Advanced Fatigue - Improve misc. code (#8800)

* add improvements from #8763

* review changes

* writing is hard

Co-authored-by: BaerMitUmlaut <BaerMitUmlaut@users.noreply.github.com>

* missing ;

Co-authored-by: BaerMitUmlaut <BaerMitUmlaut@users.noreply.github.com>
This commit is contained in:
GhostIsSpooky 2022-03-09 00:41:56 -03:00 committed by GitHub
parent 68ed19911a
commit 8d83982d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 15 deletions

View File

@ -30,7 +30,7 @@ if (!hasInterface) exitWith {};
GVAR(ppeBlackout) ppEffectCommit 0.4; GVAR(ppeBlackout) ppEffectCommit 0.4;
// - GVAR updating and initialization ----------------------------------------- // - GVAR updating and initialization -----------------------------------------
["unit", FUNC(handlePlayerChanged), true] call CBA_fnc_addPlayerEventHandler; ["unit", LINKFUNC(handlePlayerChanged), true] call CBA_fnc_addPlayerEventHandler;
["visibleMap", { ["visibleMap", {
params ["", "_visibleMap"]; // command visibleMap is updated one frame later params ["", "_visibleMap"]; // command visibleMap is updated one frame later
@ -56,7 +56,8 @@ if (!hasInterface) exitWith {};
[1, 3] select (_this getVariable [QEGVAR(dragging,isCarrying), false]); [1, 3] select (_this getVariable [QEGVAR(dragging,isCarrying), false]);
}] call FUNC(addDutyFactor); }] call FUNC(addDutyFactor);
}; };
if (["ACE_Weather"] call EFUNC(common,isModLoaded)) then { // Weather has an off switch, Dragging & Medical don't.
if (missionNamespace getVariable [QEGVAR(weather,enabled), false]) then {
[QEGVAR(weather,temperature), { // 35->1, 45->2 [QEGVAR(weather,temperature), { // 35->1, 45->2
linearConversion [35, 45, (missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25]), 1, 2, true]; linearConversion [35, 45, (missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25]), 1, 2, true];
}] call FUNC(addDutyFactor); }] call FUNC(addDutyFactor);

View File

@ -9,7 +9,7 @@ PREP_RECOMPILE_END;
#include "initSettings.sqf" #include "initSettings.sqf"
GVAR(staminaBarWidth) = 10 * (((safezoneW / safezoneH) min 1.2) / 40); GVAR(staminaBarWidth) = 10 * (((safezoneW / safezoneH) min 1.2) / 40);
GVAR(dutyList) = [[], []]; GVAR(dutyList) = createHashMap;
GVAR(setAnimExclusions) = []; GVAR(setAnimExclusions) = [];
ADDON = true; ADDON = true;

View File

@ -18,6 +18,4 @@
params [["_id", "", [""]], ["_factor", 1, [0, {}]]]; params [["_id", "", [""]], ["_factor", 1, [0, {}]]];
if (_id == "" || {_factor isEqualTo 1}) exitWith {}; if (_id == "" || {_factor isEqualTo 1}) exitWith {};
GVAR(dutyList) params ["_idList", "_factorList"]; GVAR(dutyList) set [_id, _factor];
_idList pushBack _id;
_factorList pushBack _factor,

View File

@ -30,7 +30,7 @@ private _duty = GVAR(animDuty);
} else { } else {
_duty = _duty * (_unit call _x); _duty = _duty * (_unit call _x);
}; };
} forEach (GVAR(dutyList) select 1); } forEach (values GVAR(dutyList));
if (GVAR(isSwimming)) then { if (GVAR(isSwimming)) then {
_terrainGradient = 0; _terrainGradient = 0;

View File

@ -31,6 +31,8 @@ if (GVAR(fadeStaminaBar)) then {
} else { } else {
_staminaBarContainer ctrlSetFade (0.9 * _stamina / 0.8); _staminaBarContainer ctrlSetFade (0.9 * _stamina / 0.8);
}; };
} else {
_staminaBarContainer ctrlSetFade 0;
}; };
// - Color -------------------------------------------------------------------- // - Color --------------------------------------------------------------------

View File

@ -14,7 +14,9 @@
* *
* Public: No * Public: No
*/ */
if (!alive ACE_player) exitWith { // Dead people don't breath, Will also handle null (Map intros)
// Dead people don't breathe, will also handle null (map intros)
if (!alive ACE_player) exitWith {
[FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute; [FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull]; private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1; _staminaBarContainer ctrlSetFade 1;

View File

@ -16,10 +16,4 @@
*/ */
params [["_id", "", [""]]]; params [["_id", "", [""]]];
GVAR(dutyList) params ["_idList", "_factorList"]; GVAR(dutyList) deleteAt _id;
private _index = _idList find _id;
if (_index != -1) then {
_idList deleteAt _index;
_factorList deleteAt _index;
};