2019-12-17 16:14:45 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
|
|
|
TRACE_2("CBA_settingsInitialized",GVAR(advancedCorrections),GVAR(disableArtilleryComputer));
|
2019-12-17 16:14:45 +00:00
|
|
|
|
|
|
|
if (hasInterface) then {
|
2024-08-17 15:56:51 +00:00
|
|
|
// Add hud overlay for actual azimuth and elevation:
|
2019-12-17 16:14:45 +00:00
|
|
|
GVAR(pfID) = -1;
|
|
|
|
["turret", LINKFUNC(turretChanged), true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
|
2024-08-17 15:56:51 +00:00
|
|
|
// Handles being teleported from one vehicle to another
|
|
|
|
["vehicle", {[_this select 0, (_this select 1) unitTurret (_this select 0)] call FUNC(turretChanged)}] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
|
2019-12-17 16:14:45 +00:00
|
|
|
// Add ability to dynamically open rangetables:
|
|
|
|
["ace_interactMenuOpened", LINKFUNC(interactMenuOpened)] call CBA_fnc_addEventHandler;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(advancedCorrections)) then {
|
|
|
|
["LandVehicle", "init", {
|
|
|
|
params ["_vehicle"];
|
2021-02-18 18:58:08 +00:00
|
|
|
private _vehicleCfg = configOf _vehicle;
|
2019-12-17 16:14:45 +00:00
|
|
|
// config "ace_artillerytables_applyCorrections" [0 disabled, 1 enabled] falls back to artilleryScanner
|
|
|
|
private _applyCorrections = if (isNumber (_vehicleCfg >> QGVAR(applyCorrections))) then {
|
|
|
|
getNumber (_vehicleCfg >> QGVAR(applyCorrections))
|
|
|
|
} else {
|
|
|
|
getNumber (_vehicleCfg >> "artilleryScanner")
|
|
|
|
};
|
|
|
|
if (_applyCorrections == 1) then {
|
|
|
|
TRACE_2("adding firedEH",_vehicle,configName _vehicleCfg);
|
|
|
|
_vehicle addEventHandler ["Fired", {call FUNC(firedEH)}];
|
|
|
|
};
|
|
|
|
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2024-08-17 15:50:38 +00:00
|
|
|
addMissionEventHandler ["ExtensionCallback", {
|
|
|
|
params ["_name", "_function", "_data"];
|
|
|
|
if (_name == "ace:artillery" && {_function == "calculate_table"}) then {
|
|
|
|
(parseSimpleArray _data) params ["_line", "_data"];
|
|
|
|
if (_data isEqualType []) then {
|
|
|
|
GVAR(tableData) set [_line, _data];
|
|
|
|
};
|
|
|
|
GVAR(tableSizeReceived) = GVAR(tableSizeReceived) + 1;
|
|
|
|
if (GVAR(tableSizeReceived) == GVAR(tableSizeActual)) then {
|
|
|
|
private _dialog = uiNamespace getVariable [QGVAR(rangeTableDialog), displayNull];
|
|
|
|
private _ctrlRangeTable = _dialog displayCtrl IDC_TABLE;
|
|
|
|
if (isNull _dialog) exitWith {true};
|
|
|
|
for "_i" from 0 to GVAR(tableSizeActual) do {
|
|
|
|
private _row = GVAR(tableData) getOrDefault [_i, []];
|
|
|
|
if (count _row == 12) then {
|
|
|
|
_ctrlRangeTable lnbAddRow _row;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
private _dialog = uiNamespace getVariable [QGVAR(rangeTableDialog), displayNull];
|
|
|
|
private _ctrlRangeTable = _dialog displayCtrl IDC_TABLE;
|
|
|
|
if (isNull _dialog) exitWith {TRACE_1("dialog closed",_this);};
|
|
|
|
_ctrlRangeTable lnbAddRow ["", "", "", "", "", "", "", "", "", "", ""];
|
|
|
|
TRACE_1("table filled",_ctrlRangeTable);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}];
|
|
|
|
|
2019-12-17 16:14:45 +00:00
|
|
|
#ifdef DEBUG_MODE_FULL
|
2023-12-07 03:20:47 +00:00
|
|
|
#include "dev\showShotInfo.inc.sqf"
|
|
|
|
#include "dev\checkConfigs.inc.sqf"
|
2019-12-17 16:14:45 +00:00
|
|
|
#endif
|