mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use waitAndExecute for fatigue loop (#4453)
* Use waitAndExecute for fatigue loop Close #4379 - Will use CBA_missionTime so it repsects pause and time accl - Possible performance improvment over using a PFEH * Rename main loop function
This commit is contained in:
parent
a7c75a3bf6
commit
0b3d38a72f
@ -5,6 +5,6 @@ PREP(getMetabolicCosts);
|
||||
PREP(handleEffects);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handleStaminaBar);
|
||||
PREP(mainLoop);
|
||||
PREP(moduleSettings);
|
||||
PREP(pfhMain);
|
||||
PREP(removeDutyFactor);
|
||||
|
@ -37,8 +37,8 @@ if (!hasInterface) exitWith {};
|
||||
}] call FUNC(addDutyFactor);
|
||||
};
|
||||
|
||||
// - Add main PFH -------------------------------------------------------------
|
||||
[FUNC(pfhMain), 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
// - Add main loop at 1 second interval -------------------------------------------------------------
|
||||
[FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
["ace_settingChanged", {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Main perFrameHandler that updates fatigue values.
|
||||
* Main looping function that updates fatigue values.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
@ -9,7 +9,9 @@
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
if (!alive ACE_player) exitWith {}; // Dead people don't breath, Will also handle null (Map intros)
|
||||
if (!alive ACE_player) exitWith { // Dead people don't breath, Will also handle null (Map intros)
|
||||
[FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
|
||||
};
|
||||
|
||||
private _currentWork = REE;
|
||||
private _currentSpeed = (vectorMagnitude (velocity ACE_player)) min 6;
|
||||
@ -61,3 +63,5 @@ private _perceivedFatigue = 1 - (_anReservePercentage min _aeReservePercentage);
|
||||
if (GVAR(enableStaminaBar)) then {
|
||||
[GVAR(anReserve) / AN_MAXRESERVE] call FUNC(handleStaminaBar);
|
||||
};
|
||||
|
||||
[FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
|
Loading…
Reference in New Issue
Block a user