Explosives - Add CBA settings for max/min/default timer values (#7916)

* Transfer to CBA settings, add timer options

* Remove wiki note

* Tweak arrays, stringtables

* moveToSQF
This commit is contained in:
Freddo 2020-10-03 19:00:06 +02:00 committed by GitHub
parent 74d74ede71
commit e27110aac3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 82 additions and 27 deletions

View File

@ -1,23 +1,11 @@
class ACE_Settings {
class GVAR(requireSpecialist) {
category = CSTRING(Menu);
displayName = CSTRING(RequireSpecialist_DisplayName);
description = CSTRING(RequireSpecialist_Description);
value = 0;
typeName = "BOOL";
movedToSQF = 1;
};
class GVAR(punishNonSpecialists) {
category = CSTRING(Menu);
displayName = CSTRING(PunishNonSpecialists_DisplayName);
description = CSTRING(PunishNonSpecialists_Description);
value = 1;
typeName = "BOOL";
movedToSQF = 1;
};
class GVAR(explodeOnDefuse) {
category = CSTRING(Menu);
displayName = CSTRING(ExplodeOnDefuse_DisplayName);
description = CSTRING(ExplodeOnDefuse_Description);
value = 1;
typeName = "BOOL";
movedToSQF = 1;
};
};

View File

@ -8,6 +8,8 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
GVAR(detonationHandlers) = [];
ADDON = true;

View File

@ -15,9 +15,6 @@
* Public: No
*/
#define TIMER_VALUE_MIN_CUSTOM (missionNamespace getVariable [QGVAR(customTimerMin), TIMER_VALUE_MIN])
#define TIMER_VALUE_MAX_CUSTOM (missionNamespace getVariable [QGVAR(customTimerMax), TIMER_VALUE_MAX])
params ["_explosive"];
TRACE_1("Opening timer UI",_explosive);
@ -26,8 +23,8 @@ private _display = uiNamespace getVariable [QGVAR(timerDisplay), displayNull];
// Update slider speed to 1s
(_display displayCtrl IDC_TIMER_SLIDER) sliderSetSpeed [1, 1];
(_display displayCtrl IDC_TIMER_SLIDER) sliderSetRange [TIMER_VALUE_MIN_CUSTOM, TIMER_VALUE_MAX_CUSTOM];
(_display displayCtrl IDC_TIMER_SLIDER) sliderSetPosition (TIMER_VALUE_DEFAULT max TIMER_VALUE_MIN_CUSTOM min TIMER_VALUE_MAX_CUSTOM);
(_display displayCtrl IDC_TIMER_SLIDER) sliderSetRange [GVAR(customTimerMin), GVAR(customTimerMax)];
(_display displayCtrl IDC_TIMER_SLIDER) sliderSetPosition (GVAR(customTimerDefault) max GVAR(customTimerMin) min GVAR(customTimerMax));
// Add confirm button action
@ -58,7 +55,7 @@ _display displayAddEventHandler ["MouseZChanged", {
if (cba_events_control) then {_change = _change * 10};
private _slider = _display displayCtrl IDC_TIMER_SLIDER;
private _value = (sliderPosition _slider + _change) max TIMER_VALUE_MIN_CUSTOM min TIMER_VALUE_MAX_CUSTOM;
private _value = (sliderPosition _slider + _change) max GVAR(customTimerMin) min GVAR(customTimerMax);
_slider sliderSetPosition _value;
}];

View File

@ -0,0 +1,56 @@
private _categoryStr = format ["ACE %1", LLSTRING(Menu)];
[
QGVAR(requireSpecialist),
"CHECKBOX",
[LLSTRING(RequireSpecialist_DisplayName),LLSTRING(RequireSpecialist_Description)],
_categoryStr,
false,
true
] call CBA_fnc_addSetting;
[
QGVAR(punishNonSpecialists),
"CHECKBOX",
[LLSTRING(PunishNonSpecialists_DisplayName),LLSTRING(PunishNonSpecialists_Description)],
_categoryStr,
true,
true
] call CBA_fnc_addSetting;
[
QGVAR(explodeOnDefuse),
"CHECKBOX",
[LLSTRING(ExplodeOnDefuse_DisplayName),LLSTRING(ExplodeOnDefuse_Description)],
_categoryStr,
true,
true
] call CBA_fnc_addSetting;
// Variable names to preserve https://github.com/acemod/ACE3/pull/6882
[
QGVAR(customTimerMin),
"TIME",
[LLSTRING(TimerMin_DisplayName), LLSTRING(TimerMin_Description)],
[_categoryStr, LLSTRING(ExplosiveTimer)],
[0, 5999, TIMER_VALUE_MIN],
true
] call CBA_fnc_addSetting;
[
QGVAR(customTimerMax),
"TIME",
[LLSTRING(TimerMax_DisplayName), LLSTRING(TimerMax_Description)],
[_categoryStr, LLSTRING(ExplosiveTimer)],
[0, 5999, TIMER_VALUE_MAX],
true
] call CBA_fnc_addSetting;
[
QGVAR(customTimerDefault),
"TIME",
[LLSTRING(TimerDefault_DisplayName), LLSTRING(TimerDefault_Description)],
[_categoryStr, LLSTRING(ExplosiveTimer)],
[0, 5999, TIMER_VALUE_DEFAULT],
false
] call CBA_fnc_addSetting;

View File

@ -1101,5 +1101,23 @@
<Polish>Kontroluje, czy jednostka jest specjalistą od materiałów wybuchowych.</Polish>
<Russian>Определяет, является ли юнит сапёром.</Russian>
</Key>
<Key ID="STR_ACE_Explosives_TimerMin_DisplayName">
<English>Minimum Time</English>
</Key>
<Key ID="STR_ACE_Explosives_TimerMax_DisplayName">
<English>Maximum Time</English>
</Key>
<Key ID="STR_ACE_Explosives_TimerDefault_DisplayName">
<English>Default Time</English>
</Key>
<Key ID="STR_ACE_Explosives_TimerMin_Description">
<English>Minimum time value (in seconds) for the explosive timer.</English>
</Key>
<Key ID="STR_ACE_Explosives_TimerMax_Description">
<English>Maximum time value (in seconds) for the explosive timer.</English>
</Key>
<Key ID="STR_ACE_Explosives_TimerDefault_Description">
<English>Default time value (in seconds) for the explosive timer.</English>
</Key>
</Package>
</Project>

View File

@ -204,9 +204,3 @@ Jammer that blocks RF triggers:
true
}] call ace_explosives_fnc_addDetonateHandler;
```
#### 5.4 Custom timer limits
`Added in 3.12.7`
Can set custom min and max time for the timer trigger, can set one or both, time in seconds
`ace_explosives_customTimerMin` / `ace_explosives_customTimerMax`