2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-10-08 10:55:30 +00:00
|
|
|
/*
|
|
|
|
* Author: esteldunedain
|
|
|
|
* Maintains the tracked lasers, deleting any laser that is turned off
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* PFEH Args
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2016-10-08 10:55:30 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [[], 1]] call ace_laser_fnc_laserTargetPFH;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-08 10:55:30 +00:00
|
|
|
params ["", "_pfhuid"];
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-08 10:55:30 +00:00
|
|
|
GVAR(trackedLaserTargets) = GVAR(trackedLaserTargets) select {
|
2016-11-17 19:28:25 +00:00
|
|
|
_x params ["_targetObject", "_owner", "_laserUuid", "_laserCode"];
|
2016-10-08 10:55:30 +00:00
|
|
|
if ((isNull _targetObject) ||
|
|
|
|
{!(alive _targetObject)} ||
|
|
|
|
{isNull _owner} ||
|
|
|
|
{!(alive _owner)}) then {
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-08 10:55:30 +00:00
|
|
|
// Turn off the laser in ace_laser
|
|
|
|
[_laserUuid] call FUNC(laserOff);
|
2024-02-05 17:04:24 +00:00
|
|
|
TRACE_1("Laser off:",_laserUuid);
|
2016-10-08 10:55:30 +00:00
|
|
|
false
|
|
|
|
} else {
|
2024-07-22 17:27:26 +00:00
|
|
|
private _newCode = _owner getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
|
2016-11-17 19:28:25 +00:00
|
|
|
if (_laserCode != _newCode) then {
|
|
|
|
TRACE_2("code change",_newCode,_laserCode);
|
|
|
|
[QGVAR(updateCode), [_laserUuid, _newCode]] call CBA_fnc_globalEvent;
|
|
|
|
_x set [3, _newCode];
|
|
|
|
};
|
2016-10-08 10:55:30 +00:00
|
|
|
true
|
|
|
|
};
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
|
2016-10-08 10:55:30 +00:00
|
|
|
if (GVAR(trackedLaserTargets) isEqualTo []) then {
|
|
|
|
TRACE_1("ending pfeh",count GVAR(trackedLaserTargets));
|
|
|
|
[_pfhuid] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(pfehID) = -1;
|
|
|
|
};
|