Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Fatigue - Solid stamina bar option #6911

Merged
merged 13 commits into from
Dec 7, 2019
10 changes: 6 additions & 4 deletions addons/advanced_fatigue/functions/fnc_handleStaminaBar.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ _posAndSize set [2, _stamina * GVAR(staminaBarWidth)];
_staminaBarContainer ctrlSetPosition _posAndSize;

// - Opacity ------------------------------------------------------------------
if (_stamina >= 0.8) then {
_staminaBarContainer ctrlSetFade (0.9 + 0.1 * (_stamina - 0.8) / 0.2);
} else {
_staminaBarContainer ctrlSetFade (0.9 * _stamina / 0.8);
if (GVAR(fadeStaminaBar)) then {
if (_stamina >= 0.8) then {
_staminaBarContainer ctrlSetFade (0.9 + 0.1 * (_stamina - 0.8) / 0.2);
} else {
_staminaBarContainer ctrlSetFade (0.9 * _stamina / 0.8);
};
};

// - Color --------------------------------------------------------------------
Expand Down
25 changes: 23 additions & 2 deletions addons/advanced_fatigue/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
[LSTRING(Enabled), LSTRING(Enabled_Description)],
LSTRING(DisplayName),
true,
true,
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true, {
if (!_this) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;
_staminaBarContainer ctrlCommit 0;
};
[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)
},
true // Needs mission restart
] call CBA_Settings_fnc_init;

Expand All @@ -24,6 +30,21 @@
}
] call CBA_Settings_fnc_init;

[
QGVAR(fadeStaminaBar),
"CHECKBOX",
[LSTRING(FadeStaminaBar), LSTRING(FadeStaminaBar_Description)],
LSTRING(DisplayName),
true,
false, {
if (!_this && GVAR(enabled) && GVAR(enableStaminaBar)) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 0;
_staminaBarContainer ctrlCommit 0;
};
}
] call CBA_Settings_fnc_init;

[
QGVAR(performanceFactor),
"SLIDER",
Expand Down
8 changes: 8 additions & 0 deletions addons/advanced_fatigue/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,13 @@
<Russian>Показывает шкалу усталости.</Russian>
<Portuguese>Exibe a barra de estamina.</Portuguese>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_FadeStaminaBar">
<English>Fade Stamina bar automatically</English>
<German>Blende Ausdauerleiste automatisch aus</German>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_FadeStaminaBar_Description">
<English>Adjusts transparency of the bar based on stamina status.</English>
<German>Passt die Transparenz der Ausdauerleiste abhängig vom Ausdauerstatus an.</German>
</Key>
</Package>
</Project>