diff --git a/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf b/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf index 36048cee049..46d03962e97 100644 --- a/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf +++ b/addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf @@ -5,22 +5,32 @@ * Calculation is done according to the Pandolf/Wojtowicz formulas. * * Arguments: - * 0: Duty of animation - * 1: Mass of unit - * 2: Terrain gradient - * 3: Terrain factor - * 4: Speed + * 0: Mass of unit + * 1: Terrain gradient + * 2: Terrain factor + * 3: Speed * * Return Value: * Metabolic cost * * Example: - * [1, 840, 20, 1, 4] call ace_advanced_fatigue_fnc_getMetabolicCosts + * [840, 20, 1, 4] call ace_advanced_fatigue_fnc_getMetabolicCosts * * Public: No */ -params ["_duty", "_gearMass", "_terrainGradient", "_terrainFactor", "_speed"]; +params ["_gearMass", "_terrainGradient", "_terrainFactor", "_speed"]; + +// Get the current duty +private _duty = GVAR(animDuty); + +{ + _duty = if (_x isEqualType 0) then { + _duty * _x + } else { + _duty * (ACE_player call _x) + }; +} forEach (values GVAR(dutyList)); // Metabolic cost for walking and running is different if (_speed > 2) then { diff --git a/addons/advanced_fatigue/functions/fnc_mainLoop.sqf b/addons/advanced_fatigue/functions/fnc_mainLoop.sqf index 2955e9d6ee0..1eac51ea04d 100644 --- a/addons/advanced_fatigue/functions/fnc_mainLoop.sqf +++ b/addons/advanced_fatigue/functions/fnc_mainLoop.sqf @@ -48,17 +48,6 @@ if (GVAR(isProne)) then { _currentSpeed = _currentSpeed min 1.5; }; -// Get the current duty -private _duty = GVAR(animDuty); - -{ - if (_x isEqualType 0) then { - _duty = _duty * _x; - } else { - _duty = _duty * (ACE_player call _x); - }; -} forEach (values GVAR(dutyList)); - private _terrainGradient = abs _fwdAngle; private _terrainFactor = 1; private _gearMass = 0 max (((ACE_player getVariable [QEGVAR(movement,totalLoad), loadAbs ACE_player]) / 22.046 - UNDERWEAR_WEIGHT) * GVAR(loadFactor)); @@ -79,7 +68,7 @@ if (isNull objectParent ACE_player && {_currentSpeed > 0.1} && {isTouchingGround }; // Add a scaling factor of 0.1 to reduce excessive stamina consumption on default settings (see #10361) - _currentWork = [_duty, _gearMass, _terrainGradient * GVAR(terrainGradientFactor) * 0.1, _terrainFactor, _currentSpeed] call FUNC(getMetabolicCosts); + _currentWork = [_gearMass, _terrainGradient * GVAR(terrainGradientFactor) * 0.1, _terrainFactor, _currentSpeed] call FUNC(getMetabolicCosts); _currentWork = _currentWork max REE; };