From c864a6d56992dd20d187f1eb46b447ea01915b16 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 9 Feb 2018 20:32:14 -0600 Subject: [PATCH] Vehicle Lock - Convert to cba settings (#6133) Switch vehicleStartingLockState from slider to list Close #6014 --- .../fnc_cbaSettings_convertHelper.sqf | 3 +- addons/vehiclelock/ACE_Settings.hpp | 20 ++----------- addons/vehiclelock/XEH_preInit.sqf | 2 ++ addons/vehiclelock/initSettings.sqf | 28 +++++++++++++++++++ addons/vehiclelock/stringtable.xml | 14 +++++----- 5 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 addons/vehiclelock/initSettings.sqf diff --git a/addons/common/functions/fnc_cbaSettings_convertHelper.sqf b/addons/common/functions/fnc_cbaSettings_convertHelper.sqf index d6ecd38591..6b6416e7df 100644 --- a/addons/common/functions/fnc_cbaSettings_convertHelper.sqf +++ b/addons/common/functions/fnc_cbaSettings_convertHelper.sqf @@ -67,6 +67,7 @@ private _settings = configProperties [configFile >> "ACE_Settings", "(isClass _x _valueTitles pushBack (if ((_x select [0, 1]) == "$") then {localize (_x select [1]);} else {_x}); } forEach (getArray (_config >> "values")); _cbaValueInfo = [_values, _valueTitles, getNumber (_config >> "value")]; + _cbaValueInfoHint = "[values, titles, defaultIndex]"; } else { _cbaSettingType = "SLIDER"; // [_min, _max, _default, _trailingDecimals] _cbaValueInfo = if (isArray (_config >> "sliderSettings")) then { @@ -116,7 +117,7 @@ private _settings = configProperties [configFile >> "ACE_Settings", "(isClass _x _output pushBack format [" %1, // %2", _cbaValueInfo, _cbaValueInfoHint]; _output pushBack format [" %1, // isGlobal", _cbaIsGlobal]; if ((_varName select [0, 4]) == "ACE_") then { - _output pushBack format [" {[QGVAR(%1), _this] call EFUNC(common,cbaSettings_settingChanged)}] call CBA_settings_fnc_init;", _gvarName]; + _output pushBack format [" {[QGVAR(%1), _this] call EFUNC(common,cbaSettings_settingChanged)}", _gvarName]; } else { _output pushBack format [" {[""%1"", _this] call ace_common_fnc_cbaSettings_settingChanged}", _varName]; }; diff --git a/addons/vehiclelock/ACE_Settings.hpp b/addons/vehiclelock/ACE_Settings.hpp index 75073f4f8f..29367b707f 100644 --- a/addons/vehiclelock/ACE_Settings.hpp +++ b/addons/vehiclelock/ACE_Settings.hpp @@ -1,25 +1,11 @@ class ACE_Settings { class GVAR(defaultLockpickStrength) { - category = CSTRING(DisplayName); - displayName = CSTRING(DefaultLockpickStrength_DisplayName); - description = CSTRING(DefaultLockpickStrength_Description); - value = 10; - typeName = "SCALAR"; - sliderSettings[] = {-1, 60, 5, 1}; + movedToSQF = 1; }; class GVAR(lockVehicleInventory) { - category = CSTRING(DisplayName); - displayName = CSTRING(LockVehicleInventory_DisplayName); - description = CSTRING(LockVehicleInventory_Description); - value = 0; - typeName = "BOOL"; + movedToSQF = 1; }; class GVAR(vehicleStartingLockState) { - category = CSTRING(DisplayName); - displayName = CSTRING(VehicleStartingLockState_DisplayName); - description = CSTRING(VehicleStartingLockState_Description); - value = -1; - typeName = "SCALAR"; - sliderSettings[] = {-1, 2, -1, -1}; // ToDo: Make this a list? + movedToSQF = 1; }; }; diff --git a/addons/vehiclelock/XEH_preInit.sqf b/addons/vehiclelock/XEH_preInit.sqf index b47cf6628d..9361d05015 100644 --- a/addons/vehiclelock/XEH_preInit.sqf +++ b/addons/vehiclelock/XEH_preInit.sqf @@ -6,4 +6,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf" + ADDON = true; diff --git a/addons/vehiclelock/initSettings.sqf b/addons/vehiclelock/initSettings.sqf new file mode 100644 index 0000000000..238268a8dc --- /dev/null +++ b/addons/vehiclelock/initSettings.sqf @@ -0,0 +1,28 @@ +// CBA Settings [ADDON: ace_vehicleLock]: + +[ + QGVAR(defaultLockpickStrength), "SLIDER", + [LSTRING(DefaultLockpickStrength_DisplayName), LSTRING(DefaultLockpickStrength_Description)], + LSTRING(DisplayName), + [-1,60,10,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] + true, // isGlobal + {[QGVAR(defaultLockpickStrength), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; + +[ + QGVAR(lockVehicleInventory), "CHECKBOX", + [LSTRING(LockVehicleInventory_DisplayName), LSTRING(LockVehicleInventory_Description)], + LSTRING(DisplayName), + false, // default value + true, // isGlobal + {[QGVAR(lockVehicleInventory), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; + +[ + QGVAR(vehicleStartingLockState), "LIST", + [LSTRING(VehicleStartingLockState_DisplayName), LSTRING(VehicleStartingLockState_Description)], + LSTRING(DisplayName), + [[-1,0,1,2],["str_cfg_envsounds_default", LSTRING(VehicleStartingLockState_AsIs), LSTRING(VehicleStartingLockState_Locked), LSTRING(VehicleStartingLockState_Unlocked)], 0], // [values, titles, defaultIndex] + true, // isGlobal + {[QGVAR(vehicleStartingLockState), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; diff --git a/addons/vehiclelock/stringtable.xml b/addons/vehiclelock/stringtable.xml index b6edabfc7a..e7cd5e3b14 100644 --- a/addons/vehiclelock/stringtable.xml +++ b/addons/vehiclelock/stringtable.xml @@ -2,13 +2,13 @@ - Vehicle Lock - Blocco Veicolo - 載具上鎖 - 载具上锁 - 車両の施錠 - 차량 잠금 - Fahrzeugsperre + ACE Vehicle Lock + ACE Blocco Veicolo + ACE 載具上鎖 + ACE 载具上锁 + ACE 車両の施錠 + ACE 차량 잠금 + ACE Fahrzeugsperre Unlock Vehicle