ACE3/addons/laser/functions/fnc_laserTargetPFH.sqf

41 lines
927 B
Plaintext
Raw Normal View History

/*
* Author: esteldunedain
* Maintains the tracked lasers, deleting any laser that is turned off
*
* Argument:
* PFEH Args
*
* Return value:
* None
*
* Example:
* [[], 1]] call ace_laser_fnc_laserTargetPFH;
*
* Public: No
*/
2016-05-30 16:37:03 +00:00
#include "script_component.hpp"
params ["", "_pfhuid"];
2016-05-30 16:37:03 +00:00
GVAR(trackedLaserTargets) = GVAR(trackedLaserTargets) select {
_x params ["_targetObject", "_owner", "_laserUuid"];
if ((isNull _targetObject) ||
{!(alive _targetObject)} ||
{isNull _owner} ||
{!(alive _owner)}) then {
2016-05-30 16:37:03 +00:00
// Turn off the laser in ace_laser
[_laserUuid] call FUNC(laserOff);
TRACE_1("Laser off:", _laserUuid);
false
} else {
true
};
2016-05-30 16:37:03 +00:00
};
if (GVAR(trackedLaserTargets) isEqualTo []) then {
TRACE_1("ending pfeh",count GVAR(trackedLaserTargets));
[_pfhuid] call CBA_fnc_removePerFrameHandler;
GVAR(pfehID) = -1;
};