Merge pull request #3529 from acemod/tagEvents

Throw a globalEvent when a tag is created.
This commit is contained in:
jonpas 2016-04-03 11:38:24 +00:00
commit f4074e981a

View File

@ -7,6 +7,7 @@
* 1: Vector dir and up <ARRAY>
* 2: Colour of the tag (valid colours are black, red, green and blue) <STRING>
* 3: Object it should be tied too <OBJECT>
* 4: Unit that created the tag <OBJECT>
*
* Return Value:
* None
@ -19,11 +20,11 @@
#include "script_component.hpp"
params ["_tagPosASL", "_vectorDirAndUp", "_color", "_object"];
TRACE_4("createTag:", _tagPosASL, _vectorDirAndUp, _color, _object);
params ["_tagPosASL", "_vectorDirAndUp", "_color", "_object", "_unit"];
TRACE_5("createTag:", _tagPosASL, _vectorDirAndUp, _color, _object, _unit);
if !((toLower _color) in ["black", "red", "green", "blue"]) exitWith {
ACE_LOGERROR_1("%1 is not a valid tag colour.", _color);
ACE_LOGERROR_1("%1 is not a valid tag color.", _color);
};
private _tag = "UserTexture1m_F" createVehicle [0,0,0];
@ -31,6 +32,9 @@ _tag setObjectTextureGlobal [0, '\z\ace\addons\tagging\UI\tags\' + _color + '\'
_tag setPosASL _tagPosASL;
_tag setVectorDirAndUp _vectorDirAndUp;
// Throw a global event for mision makers
["tagCreated", [_tag, _color, _object, _unit]] call EFUNC(common,globalEvent);
if (isNull _object) exitWith {};
// If the tag is applied to an object, handle its destruction