Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keep engine of vehicles running after getting out #6885

Merged
merged 14 commits into from
Apr 1, 2019
Merged
26 changes: 26 additions & 0 deletions addons/vehicles/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,30 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

[
"AllVehicles",
"initPost",
{(_this select 0) setVariable [QGVAR(engineState), isEngineOn (_this select 0)]}
brainslush marked this conversation as resolved.
Show resolved Hide resolved
] call CBA_fnc_addClassEventHandler;
[
"AllVehicles",
"engine",
{(_this select 0) setVariable [QGVAR(engineState), _this select 1]}
brainslush marked this conversation as resolved.
Show resolved Hide resolved
] call CBA_fnc_addClassEventHandler;
[
"AllVehicles",
"getout",
{
params ["_vehicle","_position","_unit"];
brainslush marked this conversation as resolved.
Show resolved Hide resolved
if (!GVAR(keepEngineRunning)) exitWith {};
if (_unit == ACE_player && {_position == "driver"} && {_vehicle getVariable [QGVAR(engineState), false]}) then {
brainslush marked this conversation as resolved.
Show resolved Hide resolved
[{
[QEGVAR(common,engineOn), _this, _this select 0] call CBA_fnc_targetEvent;
brainslush marked this conversation as resolved.
Show resolved Hide resolved
}, [_vehicle, true]] call CBA_fnc_execNextFrame;
};
}
] call CBA_fnc_addClassEventHandler;

ADDON = true;
10 changes: 10 additions & 0 deletions addons/vehicles/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

[
QGVAR(keepEngineRunning),
"CHECKBOX",
[LSTRING(SettingKeepEngineRunningName), LSTRING(SettingKeepEngineRunningDesc)],
localize ELSTRING(common,ACEKeybindCategoryVehicles),
false, // default value
true, // isGlobal
{[QGVAR(keepEngineRunning), _this] call EFUNC(common,cbaSettings_settingChanged)}
brainslush marked this conversation as resolved.
Show resolved Hide resolved
brainslush marked this conversation as resolved.
Show resolved Hide resolved
] call CBA_settings_fnc_init;
8 changes: 8 additions & 0 deletions addons/vehicles/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,13 @@
<Japanese>速度制限を減らす</Japanese>
<Polish>Zmniejsz ograniczenie prędkości</Polish>
</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>
</Project>