Allow custom texture for tagging (only direct function call)

This commit is contained in:
jonpas 2016-03-28 18:44:30 +02:00
parent 4e3b342a7f
commit dc1af390cd
5 changed files with 22 additions and 16 deletions

View File

@ -98,4 +98,4 @@ class CfgVehicles {
MACRO_ADDITEM(ACE_SpraypaintGreen,5);
};
};
};
};

View File

@ -5,7 +5,7 @@
* Arguments:
* 0: Position ASL <ARRAY>
* 1: Vector dir and up <ARRAY>
* 2: Colour of the tag (valid colours are black, red, green and blue) <STRING>
* 2: Colour of the tag (valid colours are black, red, green and blue or full path to custom texture) <STRING>
* 3: Object it should be tied too <OBJECT>
*
* Return Value:
@ -19,15 +19,21 @@
#include "script_component.hpp"
params ["_tagPosASL", "_vectorDirAndUp", "_color", "_object"];
TRACE_4("createTag:", _tagPosASL, _vectorDirAndUp, _color, _object);
params ["_tagPosASL", "_vectorDirAndUp", "_colorTexture", "_object"];
TRACE_4("createTag:",_tagPosASL,_vectorDirAndUp,_colorTexture,_object);
if !((toLower _color) in ["black", "red", "green", "blue"]) exitWith {
ACE_LOGERROR_1("%1 is not a valid tag colour.", _color);
private _customTexture = [true, false] select (_colorTexture find ".paa" == -1);
if (!_customTexture && {!((toLower _colorTexture) in ["black", "red", "green", "blue"])}) exitWith {
ACE_LOGERROR_1("%1 is not a valid tag colour.",_colorTexture);
};
private _tag = "UserTexture1m_F" createVehicle [0,0,0];
_tag setObjectTextureGlobal [0, '\z\ace\addons\tagging\UI\tags\' + _color + '\' + str (floor (random 3)) + '.paa'];
if (!_customTexture) then {
_tag setObjectTextureGlobal [0, "\z\ace\addons\tagging\UI\tags\" + _colorTexture + "\" + str (floor (random 3)) + ".paa"];
} else {
_tag setObjectTextureGlobal [0, _colorTexture];
};
_tag setPosASL _tagPosASL;
_tag setVectorDirAndUp _vectorDirAndUp;

View File

@ -6,7 +6,7 @@
* 0: Unit
* 1: Start position ASL <ARRAY>
* 2: End position ASL <ARRAY>
* 3: The colour of the tag (valid colours are black, red, green and blue) <STRING>
* 3: The colour of the tag (valid colours are black, red, green and blue or full path to custom texture) <STRING>
*
* Return Value:
* Sucess <BOOLEAN>
@ -19,7 +19,7 @@
#include "script_component.hpp"
params ["_unit", "_startPosASL", "_endPosASL", "_color"];
params ["_unit", "_startPosASL", "_endPosASL", "_colorTexture"];
// Check for intersections below the unit
private _intersections = lineIntersectsSurfaces [_startPosASL, _endPosASL, _unit, objNull, true, 1, "GEOM", "FIRE"];
@ -102,6 +102,6 @@ _unit playActionNow "PutDown";
// Tell the server to create the tag and handle its destruction
["createTag", _this] call EFUNC(common,serverEvent);
}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _color, _object, _unit], 0.6] call EFUNC(common,waitAndExecute);
}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _colorTexture, _object, _unit], 0.6] call EFUNC(common,waitAndExecute);
true

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 1: The colour of the tag (valid colours are black, red, green and blue) <STRING>
* 1: The colour of the tag (valid colours are black, red, green and blue or full path to custom texture) <STRING>
*
* Return Value:
* None
@ -17,9 +17,9 @@
#include "script_component.hpp"
params ["_unit", "_color"];
params ["_unit", "_colorTexture"];
private _startPosASL = getPosASL _unit;
private _endPosASL = _startPosASL vectorAdd [0, 0, -2] vectorAdd eyeDirection _unit;
[_unit, _startPosASL, _endPosASL, _color] call FUNC(tagDirection);
[_unit, _startPosASL, _endPosASL, _colorTexture] call FUNC(tagDirection);

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 1: The colour of the tag (valid colours are black, red, green and blue) <STRING>
* 1: The colour of the tag (valid colours are black, red, green and blue or full path to custom texture) <STRING>
*
* Return Value:
* None
@ -17,11 +17,11 @@
#include "script_component.hpp"
params ["_unit", "_color"];
params ["_unit", "_colorTexture"];
private _startPosASL = eyePos _unit;
private _cameraPosASL = AGLToASL positionCameraToWorld [0, 0, 0];
private _cameraDir = (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff _cameraPosASL;
private _endPosASL = _startPosASL vectorAdd (_cameraDir vectorMultiply 2.5);
[_unit, _startPosASL, _endPosASL, _color] call FUNC(tagDirection);
[_unit, _startPosASL, _endPosASL, _colorTexture] call FUNC(tagDirection);