Merge pull request #6868 from acemod/hideEjectSetting

Aircraft - add setting to hide Eject action from action menu
This commit is contained in:
commy2 2019-05-03 19:49:41 +02:00 committed by GitHub
commit dfd7eee681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 70 additions and 38 deletions

View File

@ -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));
};
};

View File

@ -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;

View File

@ -6,4 +6,41 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
if (hasInterface) then {
["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 ["<t color='#808080'>%1</t>", _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;

View File

@ -0,0 +1,7 @@
class CfgActions {
class None;
class Eject: None {
show = QUOTE(call compile getText (configFile >> 'CfgActions' >> 'Eject' >> 'GVAR(setting)'));
GVAR(setting) = QUOTE(profileNamespace getVariable [ARR_2('GVAR(showEjectAction)',0)]);
};
};

View File

@ -21,3 +21,4 @@ class CfgPatches {
#include "CfgAmmo.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "CfgActions.hpp"

View File

@ -1,9 +1,21 @@
[
QGVAR(keepEngineRunning),
"CHECKBOX",
[LSTRING(SettingKeepEngineRunningName), LSTRING(SettingKeepEngineRunningDesc)],
localize ELSTRING(common,ACEKeybindCategoryVehicles),
ELSTRING(common,ACEKeybindCategoryVehicles),
false, // default value
true // isGlobal
] call CBA_settings_fnc_init;
] call CBA_fnc_addSetting;
[
QGVAR(hideEjectAction),
"CHECKBOX",
[LSTRING(HideEjectAction), LSTRING(HideEjectActionTooltip)],
ELSTRING(common,ACEKeybindCategoryVehicles),
true,
2, {
profileNamespace setVariable [QGVAR(showEjectAction), parseNumber !_this];
saveProfileNamespace;
},
true // needs restart
] call CBA_fnc_addSetting;

View File

@ -75,5 +75,15 @@
<English>Prevent the automatic shut-off of the engine when exiting vehicles.</English>
<German>Verhindere das automatische Abschalten des Motors beim Verlassen des Fahrzeugs.</German>
</Key>
<Key ID="STR_ACE_Vehicles_HideEjectAction">
<English>Hide Eject Action</English>
<German>Abspringen-Aktion verstecken</German>
<Polish>Ukryj akcję Wyskocz</Polish>
</Key>
<Key ID="STR_ACE_Vehicles_HideEjectActionTooltip">
<English>Hides the Eject entry from the action menu. Requires a game restart.</English>
<German>Versteckt den Abspringen-Eintrag aus dem Aktionsmenü. Benötigt Neustart des Spiels.</German>
<Polish>Usuwa akcję Wyskocz z menu akcji. Wymaga restartu gry.</Polish>
</Key>
</Package>
</Project>