Skip to content

Commit

Permalink
Vehicle Lock - Convert to cba settings (#6133)
Browse files Browse the repository at this point in the history
Switch vehicleStartingLockState from slider to list
Close #6014
  • Loading branch information
PabstMirror authored and jonpas committed Feb 10, 2018
1 parent 2793470 commit 7e648f2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
3 changes: 2 additions & 1 deletion addons/common/functions/fnc_cbaSettings_convertHelper.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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];
};
Expand Down
20 changes: 3 additions & 17 deletions addons/vehiclelock/ACE_Settings.hpp
Original file line number Diff line number Diff line change
@@ -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;
};
};
2 changes: 2 additions & 0 deletions addons/vehiclelock/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

ADDON = true;
28 changes: 28 additions & 0 deletions addons/vehiclelock/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -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;
14 changes: 7 additions & 7 deletions addons/vehiclelock/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<Project name="ACE">
<Package name="VehicleLock">
<Key ID="STR_ACE_VehicleLock_DisplayName">
<English>Vehicle Lock</English>
<Italian>Blocco Veicolo</Italian>
<Chinese>載具上鎖</Chinese>
<Chinesesimp>载具上锁</Chinesesimp>
<Japanese>車両の施錠</Japanese>
<Korean>차량 잠금</Korean>
<German>Fahrzeugsperre</German>
<English>ACE Vehicle Lock</English>
<Italian>ACE Blocco Veicolo</Italian>
<Chinese>ACE 載具上鎖</Chinese>
<Chinesesimp>ACE 载具上锁</Chinesesimp>
<Japanese>ACE 車両の施錠</Japanese>
<Korean>ACE 차량 잠금</Korean>
<German>ACE Fahrzeugsperre</German>
</Key>
<Key ID="STR_ACE_VehicleLock_Action_UnLock">
<English>Unlock Vehicle</English>
Expand Down

0 comments on commit 7e648f2

Please sign in to comment.