Skip to content

Commit

Permalink
Add settings
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueTheKing committed Nov 27, 2023
1 parent ac41e97 commit 1aa5c67
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
4 changes: 3 additions & 1 deletion addons/misc/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ call FUNC(FAK_updateContents);

["baseline", {
private _activeTourniquets = GET_TOURNIQUETS(ACE_player);
((_activeTourniquets select 2) + (_activeTourniquets select 3) min 1);
if (GVAR(tourniquetEffects_Enable)) then {
((_activeTourniquets select 2) + (_activeTourniquets select 3) min 1)
} else {0};
}, QUOTE(ADDON)] call ACEFUNC(common,addSwayFactor);

["multiplier", {
Expand Down
31 changes: 29 additions & 2 deletions addons/misc/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PREP_RECOMPILE_END;
QGVAR(treatmentTimeDetachTourniquet),
"SLIDER",
[LLSTRING(SETTING_treatmentTimeDetachTourniquet)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_Tourniquet)],
[1, 60, 7, 1],
true
] call CBA_Settings_fnc_init;
Expand All @@ -41,11 +41,38 @@ PREP_RECOMPILE_END;
QGVAR(neckTourniquet),
"CHECKBOX",
[LLSTRING(neckTourniquetDescription)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_Tourniquet)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(tourniquetEffects_Enable),
"CHECKBOX",
[LLSTRING(SETTING_tourniquetEffects_Enable)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_Tourniquet)],
[true],
true
] call CBA_Settings_fnc_init;

[
QGVAR(tourniquetEffects_PositiveMultiplier),
"SLIDER",
[LLSTRING(SETTING_tourniquetEffects_PositiveMultiplier)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_Tourniquet)],
[0.1, 10, 1, 1],
true
] call CBA_Settings_fnc_init;

[
QGVAR(tourniquetEffects_NegativeMultiplier),
"SLIDER",
[LLSTRING(SETTING_tourniquetEffects_NegativeMultiplier)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_Tourniquet)],
[0.1, 10, 1, 1],
true
] call CBA_Settings_fnc_init;


//Incompatibility Warning with other addons
[
Expand Down
11 changes: 5 additions & 6 deletions addons/misc/functions/fnc_handleTourniquetEffects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

params ["_unit"];

if (_unit getVariable [QGVAR(Tourniquet_PFH), -1] != -1) exitWith {};
if (_unit getVariable [QGVAR(Tourniquet_PFH), -1] != -1 || !(GVAR(tourniquetEffects_Enable))) exitWith {};
_unit setVariable [QGVAR(Tourniquet_LegNecrosis_Threshold), 0, true];

private _handleLegEffects = {
Expand All @@ -41,27 +41,26 @@ private _tourniquetPFH = [{
private _legTourniquets = (_activeTourniquets select 4) + (_activeTourniquets select 5);

if (_armTourniquets > 1) then {
_tourniquet_ArmNecrosis = _tourniquet_ArmNecrosis + 1.6; //0.15

_tourniquet_ArmNecrosis = _tourniquet_ArmNecrosis + (0.16 * GVAR(tourniquetEffects_PositiveMultiplier));
if (_tourniquet_ArmNecrosis >= 100) then {
_tourniquet_ArmNecrosis = 100;
};
} else {
_tourniquet_ArmNecrosis = _tourniquet_ArmNecrosis - 3.2; //0.30
_tourniquet_ArmNecrosis = _tourniquet_ArmNecrosis - (0.32 * GVAR(tourniquetEffects_NegativeMultiplier));

if (_tourniquet_ArmNecrosis <= 0) then {
_tourniquet_ArmNecrosis = 0;
};
};

if (_legTourniquets > 1) then {
_tourniquet_LegNecrosis = _tourniquet_LegNecrosis + 1.6;
_tourniquet_LegNecrosis = _tourniquet_LegNecrosis + (0.16 * GVAR(tourniquetEffects_PositiveMultiplier));

if (_tourniquet_LegNecrosis >= 100) then {
_tourniquet_LegNecrosis = 100;
};
} else {
_tourniquet_LegNecrosis = _tourniquet_LegNecrosis - 3.2;
_tourniquet_LegNecrosis = _tourniquet_LegNecrosis - (0.32 * GVAR(tourniquetEffects_NegativeMultiplier));

if (_tourniquet_LegNecrosis <= 0) then {
_tourniquet_LegNecrosis = 0;
Expand Down
12 changes: 12 additions & 0 deletions addons/misc/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,18 @@
<Spanish>[ADVERTENCIA DE KAM] Addon(s) incompatibles que podrían afectar negativamente el funcionamiento del mod fueron detectados. El equipo de desarollo de KAT - Advanced Medical REWRITE recomienda fuertemente remover estos addons. %1</Spanish>
<Portuguese>[AVISO DO KAM] Detectados addons incompatíveis que podem afetar negativamente a funcionalidade correta. KAT - A equipe de desenvolvimento do Advanced Medical REWRITE recomenda fortemente a remoção destes complementos: %1</Portuguese>
</Key>
<Key ID="STR_KAT_Misc_SubCategory_Tourniquet">
<English>Tourniquet Settings</English>
</Key>
<Key ID="STR_KAT_Misc_SETTING_tourniquetEffects_Enable">
<English>Enable tourniquet effects</English>
</Key>
<Key ID="STR_KAT_Misc_SETTING_tourniquetEffects_PositiveMultiplier">
<English>Tourniquet effects positive multiplier</English>
</Key>
<Key ID="STR_KAT_Misc_SETTING_tourniquetEffects_NegativeMultiplier">
<English>Tourniquet effects negative multiplier</English>
</Key>
<Key ID="STR_KAT_Misc_SETTING_treatmentTimeDetachTourniquet">
<English>Time to take off tourniquet</English>
<Spanish>Tiempo para retirar un torniquete</Spanish>
Expand Down

0 comments on commit 1aa5c67

Please sign in to comment.