2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-10-08 10:55:30 +00:00
|
|
|
/*
|
|
|
|
* Author: esteldunedain
|
|
|
|
* Adds a vanilla laser target to the tracker PFH and globaly turns it on
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* 0: TargetObject (vanilla laser) <OBJECT>
|
|
|
|
* 1: Vehicle <OBJECT>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2016-10-08 10:55:30 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [laserTarget player, player] call ace_laser_fnc_addLaserTarget;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_targetObject", "_vehicle"];
|
|
|
|
TRACE_2("params",_targetObject,_vehicle);
|
|
|
|
|
|
|
|
// Get the designator variables, or use defaults
|
2024-07-22 17:27:26 +00:00
|
|
|
private _waveLength = _vehicle getVariable [QGVAR(waveLength), ACE_DEFAULT_LASER_WAVELENGTH];
|
|
|
|
private _laserCode = _vehicle getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
|
|
|
|
private _beamSpread = _vehicle getVariable [QGVAR(beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD];
|
2016-10-08 10:55:30 +00:00
|
|
|
TRACE_3("codes",_waveLength,_laserCode,_beamSpread);
|
|
|
|
|
|
|
|
// Laser method is the method ACE_Laser will use to determine from where to where it should project the designator cone
|
|
|
|
_vehicle setVariable [QGVAR(targetObject), _targetObject, true];
|
|
|
|
|
|
|
|
private _laserMethod = QFUNC(findLaserSource);
|
|
|
|
|
|
|
|
private _vehicleSourceSelection = "";
|
2019-08-02 01:52:20 +00:00
|
|
|
if (_vehicle isKindOf "CAManBase") then {
|
2016-10-08 10:55:30 +00:00
|
|
|
_vehicleSourceSelection = "pilot";
|
|
|
|
} else {
|
|
|
|
{ // Go through turrets on vehicle and find the laser
|
|
|
|
private _turretPath = _x;
|
|
|
|
{
|
|
|
|
if ((getNumber (configFile >> "CfgWeapons" >> _x >> "laser")) > 0) exitWith {
|
|
|
|
_vehicleSourceSelection = getText (([_vehicle, _turretPath] call CBA_fnc_getTurret) >> "memoryPointGunnerOptics");
|
|
|
|
TRACE_3("",_turretPath,_x,_vehicleSourceSelection);
|
|
|
|
};
|
|
|
|
} forEach (_vehicle weaponsTurret _turretPath);
|
|
|
|
} forEach (allTurrets [_vehicle, true]);
|
|
|
|
};
|
|
|
|
|
|
|
|
private _methodArgs = [_vehicleSourceSelection];
|
|
|
|
|
|
|
|
TRACE_6("Laser on:",_vehicle,_laserMethod,_waveLength,_laserCode,_beamSpread,_methodArgs);
|
|
|
|
private _laserUuid = [_vehicle, _vehicle, _laserMethod, _waveLength, _laserCode, _beamSpread, _methodArgs] call FUNC(laserOn);
|
|
|
|
|
2016-11-17 19:28:25 +00:00
|
|
|
GVAR(trackedLaserTargets) pushBack [_targetObject, _vehicle, _laserUuid, _laserCode];
|
2016-10-08 10:55:30 +00:00
|
|
|
TRACE_1("",GVAR(trackedLaserTargets));
|
|
|
|
|
|
|
|
if (GVAR(pfehID) == -1) then {
|
|
|
|
TRACE_1("starting pfeh",count GVAR(trackedLaserTargets));
|
2024-03-28 18:57:23 +00:00
|
|
|
GVAR(pfehID) = [LINKFUNC(laserTargetPFH), 0, []] call CBA_fnc_addPerFrameHandler;
|
2016-10-08 10:55:30 +00:00
|
|
|
};
|