diff --git a/addons/aircraft/CfgEventHandlers.hpp b/addons/aircraft/CfgEventHandlers.hpp index 9426fa861e..93e3311cf2 100644 --- a/addons/aircraft/CfgEventHandlers.hpp +++ b/addons/aircraft/CfgEventHandlers.hpp @@ -9,9 +9,3 @@ class Extended_PreInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; - -class Extended_PostInit_EventHandlers { - class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient)); - }; -}; diff --git a/addons/aircraft/XEH_postInitClient.sqf b/addons/aircraft/XEH_postInitClient.sqf deleted file mode 100644 index e468602dbc..0000000000 --- a/addons/aircraft/XEH_postInitClient.sqf +++ /dev/null @@ -1,29 +0,0 @@ -#include "script_component.hpp" - -if (!hasInterface) exitWith {}; - -private _cfgAction = configFile >> "CfgActions" >> "Eject"; -GVAR(ejectActionParams) = [ - [ - "", // will be set with setUserActionText - { - params ["_vehicle", "_unit"]; - private _preserveEngineOn = (_unit == driver _vehicle) && {isEngineOn _vehicle}; - moveOut _unit; - if (_preserveEngineOn) then { - // vehicle is local to last driver, no need to care - _vehicle engineOn true; - }; - }, - nil, - getNumber (_cfgAction >> "priority"), - false, - true, - getText (_cfgAction >> "shortcut"), - '[_this, _target] call DFUNC(canShowEject)' - ], - getText (_cfgAction >> "text"), - getText (_cfgAction >> "textDefault") -]; - -["Helicopter", "initPost", LINKFUNC(initEjectAction)] call CBA_fnc_addClassEventHandler; diff --git a/addons/aircraft/XEH_preInit.sqf b/addons/aircraft/XEH_preInit.sqf index b47cf6628d..d3cdb33dc4 100644 --- a/addons/aircraft/XEH_preInit.sqf +++ b/addons/aircraft/XEH_preInit.sqf @@ -6,4 +6,41 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +if (hasInterface) exitWith { + ["CBA_settingsInitialized", { + private _ejectAction = configFile >> "CfgActions" >> "Eject"; + private _hideEjectAction = missionNamespace getVariable [QEGVAR(vehicles,hideEjectAction), false]; + + private _text = getText (_ejectAction >> "text"); + if (_hideEjectAction) then { + _text = format ["%1", _text]; + }; + + GVAR(ejectActionParams) = [ + [ + "", // will be set with setUserActionText + { + params ["_vehicle", "_unit"]; + private _preserveEngineOn = (_unit == driver _vehicle) && {isEngineOn _vehicle}; + moveOut _unit; + if (_preserveEngineOn) then { + // vehicle is local to last driver, no need to care + _vehicle engineOn true; + }; + }, + nil, + [getNumber (_ejectAction >> "priority"), -999] select _hideEjectAction, + false, + true, + getText (_ejectAction >> "shortcut"), + '[_this, _target] call DFUNC(canShowEject)' + ], + _text, + getText (_ejectAction >> "textDefault") + ]; + + ["Helicopter", "InitPost", LINKFUNC(initEjectAction), nil, nil, true] call CBA_fnc_addClassEventHandler; + }] call CBA_fnc_addEventHandler; +}; + ADDON = true; diff --git a/addons/vehicles/initSettings.sqf b/addons/vehicles/initSettings.sqf index 8355be5751..926a95ea4c 100644 --- a/addons/vehicles/initSettings.sqf +++ b/addons/vehicles/initSettings.sqf @@ -1,9 +1,8 @@ - [ QGVAR(keepEngineRunning), "CHECKBOX", [LSTRING(SettingKeepEngineRunningName), LSTRING(SettingKeepEngineRunningDesc)], - localize ELSTRING(common,ACEKeybindCategoryVehicles), + ELSTRING(common,ACEKeybindCategoryVehicles), false, // default value true // isGlobal ] call CBA_fnc_addSetting;