Clarify repair while engine is running

#3348
- Show action, but exit and show warning when selected
- Optional (default off) setting to auto shut off engine to keep
compatibility with missions
This commit is contained in:
PabstMirror 2016-04-12 20:04:12 -05:00
parent fa2b6dac2d
commit 4f6b11c2a6
5 changed files with 21 additions and 2 deletions

View File

@ -146,6 +146,7 @@ if (isServer) then {
["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler);
["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler);
["engineOn", {(_this select 0) engineOn (_this select 1)}] call FUNC(addEventhandler);
["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler);
["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler);
["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler);

View File

@ -77,4 +77,9 @@ class ACE_Settings {
values[] = {"None", "ToolKit"};
_values[] = {{}, {"ToolKit"}};
};
class GVAR(autoShutOffEngineWhenStartingRepair) {
typeName = "BOOL";
value = 1;
category = ECSTRING(OptionsMenu,CategoryLogistics);
};
};

View File

@ -25,7 +25,8 @@ private ["_config", "_engineerRequired", "_items", "_return", "_condition", "_ve
_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
if !(isClass _config) exitWith {false}; // or go for a default?
if(isEngineOn _target) exitWith {false};
// if(isEngineOn _target) exitWith {false}; // Ignore here so action shows, then exit and show warning when selected #3348
_engineerRequired = if (isNumber (_config >> "requiredEngineer")) then {
getNumber (_config >> "requiredEngineer");

View File

@ -36,7 +36,14 @@ _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then {
0;
};
if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false};
if (isEngineOn _target) exitWith {false};
if ((isEngineOn _target) && {GVAR(autoShutOffEngineWhenStartingRepair)}) then {
["engineOn", _target, [_target, false]] call EFUNC(common,objectEvent);
};
if ((isEngineOn _target) && {!GVAR(autoShutOffEngineWhenStartingRepair)}) exitWith {
["displayTextStructured", [LSTRING(shutOffEngineWarning), 1.5, _caller]] call EFUNC(common,localEvent);
false
};
//Items can be an array of required items or a string to a ACE_Setting array
_items = if (isArray (_config >> "items")) then {

View File

@ -1316,5 +1316,10 @@
<Italian>Oggetti richiesti per riparare/rimuovere ruote</Italian>
<French>Items exigés pour enlever/remplacer les roues</French>
</Key>
<Key ID="STR_ACE_Repair_shutOffEngineWarning">
<English>Engine must be off to repair</English>
<German>Motor muss ausgeschaltet zu reparieren sein</German>
<Spanish>El motor necesita desactivado para la reparación</Spanish>
</Key>
</Package>
</Project>