2016-02-28 23:12:56 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Enabled the vitals loop for a unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* ReturnValue:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
params ["_unit", ["_force", false]];
|
|
|
|
|
|
|
|
if !([_unit] call FUNC(hasMedicalEnabled) || _force) exitWith {};
|
|
|
|
|
|
|
|
if !(local _unit) exitWith {
|
2016-06-03 18:57:21 +00:00
|
|
|
[QGVAR(addVitalLoop), [_unit, _force], _unit] call CBA_fnc_targetEvent;
|
2016-02-28 23:12:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Quit if the unit already has a vital loop, or is dead, unless it's forced
|
|
|
|
if ((_unit getVariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitWith{};
|
|
|
|
|
2016-02-28 23:26:05 +00:00
|
|
|
// Schedule the loop to be executed again 1 sec later
|
2016-02-28 23:12:56 +00:00
|
|
|
// @todo: should the loop be started righ away instead?
|
|
|
|
_unit setVariable [QGVAR(addedToUnitLoop), true, true];
|
2016-05-30 19:14:34 +00:00
|
|
|
[DFUNC(vitalLoop), [_unit, CBA_missionTime], 1] call CBA_fnc_waitAndExecute;
|