Add keep engine of vehicles running after getting out (#6885)

Adds a feature which leaves the vehicle engine running after getting out. So, it requires the driver to switch off the engine of the vehicle.
This commit is contained in:
brainslush 2019-04-01 11:17:18 +02:00 committed by jonpas
parent 3769679237
commit 978049eab1
3 changed files with 50 additions and 0 deletions

View File

@ -6,4 +6,37 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
PREP_RECOMPILE_END; PREP_RECOMPILE_END;
#include "initSettings.sqf"
[
"AllVehicles",
"initPost",
{
params ["_vehicle"];
_vehicle setVariable [QGVAR(engineState), isEngineOn _vehicle];
}
] call CBA_fnc_addClassEventHandler;
[
"AllVehicles",
"engine",
{
params ["_vehicle", "_state"];
_vehicle setVariable [QGVAR(engineState), _state];
}
] call CBA_fnc_addClassEventHandler;
[
"AllVehicles",
"getout",
{
params ["_vehicle", "_position", "_unit"];
if (!GVAR(keepEngineRunning)) exitWith {};
if (_unit == ACE_player && {_position == "driver" && {_vehicle getVariable [QGVAR(engineState), false]}}) then {
[{
params ["_vehicle"];
[QEGVAR(common,engineOn), _this, _vehicle] call CBA_fnc_targetEvent;
}, [_vehicle, true]] call CBA_fnc_execNextFrame;
};
}
] call CBA_fnc_addClassEventHandler;
ADDON = true; ADDON = true;

View File

@ -0,0 +1,9 @@
[
QGVAR(keepEngineRunning),
"CHECKBOX",
[LSTRING(SettingKeepEngineRunningName), LSTRING(SettingKeepEngineRunningDesc)],
localize ELSTRING(common,ACEKeybindCategoryVehicles),
false, // default value
true // isGlobal
] call CBA_settings_fnc_init;

View File

@ -67,5 +67,13 @@
<Japanese>速度制限を減らす</Japanese> <Japanese>速度制限を減らす</Japanese>
<Polish>Zmniejsz ograniczenie prędkości</Polish> <Polish>Zmniejsz ograniczenie prędkości</Polish>
</Key> </Key>
<Key ID="STR_ACE_Vehicles_SettingKeepEngineRunningName">
<English>Disable automatic engine shut-off</English>
<German>Motor nach Verlassen laufen lassen</German>
</Key>
<Key ID="STR_ACE_Vehicles_SettingKeepEngineRunningDesc">
<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>
</Package> </Package>
</Project> </Project>