ACE3/addons/medical/functions/fnc_addStateHandler.sqf

27 lines
673 B
Plaintext
Raw Normal View History

2016-09-18 17:48:49 +00:00
/*
* Author: Glowbal
* [Description]
*
* Arguments:
* 0: Argument Name <TYPE>
*
* Return Value:
* Return Name <TYPE>
*
* Example:
* ["example"] call ace_[module]_fnc_[functionName]
*
* Public: [Yes/No]
*/
#include "script_component.hpp"
2016-09-18 17:48:49 +00:00
params ["_unit", "_stateMachine"];
2016-09-18 17:48:49 +00:00
if (_unit in GVAR(monitoredUnitsList)) exitWith {}; // already monitored
private _defaultState = _stateMachine getVariable "Default";
if (!isNil "_defaultState") then {
systemChat format["Assigned default state to: %1. Total monitored: %2", _unit, GVAR(monitoredUnitsList)];
_unit setVariable[QGVAR(state), [-1, _defaultState]];
GVAR(monitoredUnitsList) pushBack _unit;
};