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 updating and initialization -----------------------------------------
["unit", FUNC(handlePlayerChanged), true] call CBA_fnc_addPlayerEventHandler;
["unit", LINKFUNC(handlePlayerChanged), true] call CBA_fnc_addPlayerEventHandler;
["visibleMap", {
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]);
}] 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
linearConversion [35, 45, (missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25]), 1, 2, true];
}] call FUNC(addDutyFactor);

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,9 @@
*
* 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;
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;

View File

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