2016-10-08 10:55:30 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2017-09-16 19:24:43 +00:00
|
|
|
if (hasInterface) then {
|
2016-10-08 10:55:30 +00:00
|
|
|
#include "initKeybinds.sqf"
|
|
|
|
|
2017-09-16 19:24:43 +00:00
|
|
|
GVAR(pfID) = -1;
|
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2022-05-05 16:07:54 +00:00
|
|
|
// Handle Map Drawing
|
|
|
|
GVAR(mapLaserSource) = objNull;
|
|
|
|
["ACE_controlledUAV", LINKFUNC(addMapHandler)] call CBA_fnc_addEventHandler;
|
|
|
|
["turret", LINKFUNC(addMapHandler), false] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["unit", LINKFUNC(addMapHandler), true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
|
|
|
|
// Laser code display
|
2017-09-16 19:24:43 +00:00
|
|
|
["turret", LINKFUNC(showVehicleHud), false] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["vehicle", LINKFUNC(showVehicleHud), true] call CBA_fnc_addPlayerEventHandler; // only one of these needs the retro flag
|
|
|
|
|
|
|
|
// Add UAV Control Compatibility
|
|
|
|
["ACE_controlledUAV", {
|
|
|
|
params ["_UAV", "_seatAI", "_turret", "_position"];
|
|
|
|
TRACE_4("ACE_controlledUAV EH",_UAV,_seatAI,_turret,_position);
|
|
|
|
if (!isNull _seatAI) then {
|
|
|
|
[_seatAI] call FUNC(showVehicleHud);
|
2017-12-21 22:49:48 +00:00
|
|
|
} else {
|
|
|
|
[ace_player] call FUNC(showVehicleHud);
|
2017-09-16 19:24:43 +00:00
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
};
|
|
|
|
|
2016-10-08 10:55:30 +00:00
|
|
|
// Global Laser EHs
|
|
|
|
["ace_laserOn", {
|
|
|
|
params ["_uuid", "_args"];
|
|
|
|
TRACE_2("ace_laserOn eh",_uuid,_args);
|
2023-07-28 04:03:02 +00:00
|
|
|
|
2021-10-10 16:55:14 +00:00
|
|
|
GVAR(laserEmitters) set [_uuid, _args];
|
2023-07-28 04:03:02 +00:00
|
|
|
private _unit = _args select 0;
|
|
|
|
if (local _unit && {hasPilotCamera _unit}) then {
|
|
|
|
[_unit] call FUNC(laserPointTrack);
|
|
|
|
};
|
2016-10-08 10:55:30 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
["ace_laserOff", {
|
|
|
|
params ["_uuid"];
|
|
|
|
TRACE_1("ace_laserOn eh",_uuid);
|
2021-10-10 16:55:14 +00:00
|
|
|
GVAR(laserEmitters) deleteAt _uuid;
|
2016-10-08 10:55:30 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2016-11-17 19:28:25 +00:00
|
|
|
[QGVAR(updateCode), {
|
|
|
|
params ["_uuid", "_newCode"];
|
|
|
|
TRACE_2("ace_laser_updateCode eh",_uuid,_newCode);
|
2021-10-10 16:55:14 +00:00
|
|
|
if (_uuid in GVAR(laserEmitters)) then {
|
|
|
|
private _laserArray = GVAR(laserEmitters) get _uuid;
|
2016-11-17 19:28:25 +00:00
|
|
|
TRACE_2("updating",_newCode,_laserArray select 4);
|
|
|
|
_laserArray set [4, _newCode];
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2023-07-28 04:03:02 +00:00
|
|
|
["AllVehicles", "init", {
|
|
|
|
params ["_unit"];
|
|
|
|
if (hasPilotCamera _unit) then {
|
|
|
|
_unit setVariable [QGVAR(hasLaserSpotTracker), true];
|
|
|
|
_unit setVariable [QGVAR(laserSpotTrackerOn), false];
|
|
|
|
private _actionOff = ["LSTOff", localize LSTRING(LSTOff), "", {[_this select 0] call FUNC(toggleLST)}, {(_this select 0) getVariable [QGVAR(laserSpotTrackerOn), false]}] call ace_interact_menu_fnc_createAction;
|
|
|
|
[_unit, 1, ["ACE_SelfActions"], _actionOff] call ace_interact_menu_fnc_addActionToObject;
|
|
|
|
private _actionOn = ["LSTOn", localize LSTRING(LSTOn), "", {[_this select 0] call FUNC(toggleLST)}, {!((_this select 0) getVariable [QGVAR(laserSpotTrackerOn), false])}] call ace_interact_menu_fnc_createAction;
|
|
|
|
[_unit, 1, ["ACE_SelfActions"], _actionOn] call ace_interact_menu_fnc_addActionToObject;
|
|
|
|
};
|
|
|
|
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
|
|
|
|
|
|
|
|
2016-10-08 10:55:30 +00:00
|
|
|
// Shows detector and mine posistions in 3d when debug is on
|
|
|
|
#ifdef DRAW_LASER_INFO
|
|
|
|
addMissionEventHandler ["Draw3D", {_this call FUNC(dev_drawVisibleLaserTargets)}];
|
|
|
|
#endif
|