Vehicle Lock - Convert to cba settings (#6133)

Switch vehicleStartingLockState from slider to list
Close #6014
This commit is contained in:
PabstMirror 2018-02-09 20:32:14 -06:00 committed by jonpas
parent 2b89b3102b
commit c864a6d569
5 changed files with 42 additions and 25 deletions

View File

@ -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];
};

View File

@ -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;
};
};

View File

@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
ADDON = true;

View File

@ -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;

View File

@ -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>