2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-09-04 19:33:07 +00:00
|
|
|
/*
|
2024-06-22 17:53:08 +00:00
|
|
|
* Author: BaerMitUmlaut, ulteq
|
|
|
|
* Calculates the current metabolic costs.
|
2016-09-04 19:33:07 +00:00
|
|
|
* Calculation is done according to the Pandolf/Wojtowicz formulas.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2024-06-22 17:53:08 +00:00
|
|
|
* 0: Duty of animation
|
|
|
|
* 1: Mass of unit <NUMBER>
|
|
|
|
* 2: Terrain gradient <NUMBER>
|
|
|
|
* 3: Terrain factor <NUMBER>
|
|
|
|
* 4: Speed <NUMBER>
|
2016-09-04 19:33:07 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Metabolic cost <NUMBER>
|
|
|
|
*
|
|
|
|
* Example:
|
2024-06-22 17:53:08 +00:00
|
|
|
* [1, 840, 20, 1, 4] call ace_advanced_fatigue_fnc_getMetabolicCosts
|
2016-09-04 19:33:07 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2024-06-22 17:53:08 +00:00
|
|
|
params ["_duty", "_gearMass", "_terrainGradient", "_terrainFactor", "_speed"];
|
2016-09-04 19:33:07 +00:00
|
|
|
|
2023-09-07 04:42:33 +00:00
|
|
|
// Metabolic cost for walking and running is different
|
2024-06-22 17:53:08 +00:00
|
|
|
if (_speed > 2) then {
|
2023-09-07 04:42:33 +00:00
|
|
|
// Running
|
2024-06-22 17:53:08 +00:00
|
|
|
#ifdef DEBUG_MODE_FULL
|
|
|
|
private _baseline = 2.1 * SIM_BODYMASS + 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + (SIM_BODYMASS + _gearMass) * 0.9 * (_speed ^ 2);
|
|
|
|
private _graded = 2.1 * SIM_BODYMASS + 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + _terrainFactor * (SIM_BODYMASS + _gearMass) * (0.9 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient);
|
|
|
|
private _terrainImpact = abs ((_graded / _baseline) - 1);
|
|
|
|
hintSilent format ["FwdAngle: %1 | SideAngle: %2 \n TerrainFactor: %3 | TerrainGradient: %4 \n TerrainImpact: %5 \n Speed: %6 | CarriedLoad: %7 \n Duty: %8 | Work: %9",
|
|
|
|
_fwdAngle toFixed 1,
|
|
|
|
_sideAngle toFixed 1,
|
|
|
|
_terrainFactor toFixed 2,
|
|
|
|
_terrainGradient toFixed 1,
|
|
|
|
_terrainImpact toFixed 2,
|
|
|
|
_speed toFixed 2,
|
|
|
|
_gearMass toFixed 1,
|
|
|
|
_duty toFixed 2,
|
|
|
|
round (_graded * BIOMECH_EFFICIENCY * _duty)
|
|
|
|
];
|
|
|
|
#endif
|
|
|
|
|
2016-09-04 19:33:07 +00:00
|
|
|
(
|
2024-06-22 17:53:08 +00:00
|
|
|
2.1 * SIM_BODYMASS
|
2016-09-04 19:33:07 +00:00
|
|
|
+ 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2)
|
2024-06-22 17:53:08 +00:00
|
|
|
+ _terrainFactor * (SIM_BODYMASS + _gearMass) * (0.9 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient)
|
|
|
|
) * BIOMECH_EFFICIENCY * _duty
|
2016-09-04 19:33:07 +00:00
|
|
|
} else {
|
2023-09-07 04:42:33 +00:00
|
|
|
// Walking
|
2024-06-22 17:53:08 +00:00
|
|
|
#ifdef DEBUG_MODE_FULL
|
|
|
|
private _baseline = 1.05 * SIM_BODYMASS + 2 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + (SIM_BODYMASS + _gearMass) * 1.15 * (_speed ^ 2);
|
|
|
|
private _graded = 1.05 * SIM_BODYMASS + 2 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + _terrainFactor * (SIM_BODYMASS + _gearMass) * (1.15 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient);
|
|
|
|
private _terrainImpact = abs ((_graded / _baseline) - 1);
|
|
|
|
hintSilent format ["FwdAngle: %1 | SideAngle: %2 \n TerrainFactor: %3 | TerrainGradient: %4 \n TerrainImpact: %5 \n Speed: %6 | CarriedLoad: %7 \n Duty: %8 | Work: %9",
|
|
|
|
_fwdAngle toFixed 1,
|
|
|
|
_sideAngle toFixed 1,
|
|
|
|
_terrainFactor toFixed 2,
|
|
|
|
_terrainGradient toFixed 1,
|
|
|
|
_terrainImpact toFixed 2,
|
|
|
|
_speed toFixed 2,
|
|
|
|
_gearMass toFixed 1,
|
|
|
|
_duty toFixed 2,
|
|
|
|
round (_graded * BIOMECH_EFFICIENCY * _duty)
|
|
|
|
];
|
|
|
|
#endif
|
|
|
|
|
2016-09-04 19:33:07 +00:00
|
|
|
(
|
|
|
|
1.05 * SIM_BODYMASS
|
2023-09-07 04:42:33 +00:00
|
|
|
+ 2 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2)
|
2024-06-22 17:53:08 +00:00
|
|
|
+ _terrainFactor * (SIM_BODYMASS + _gearMass) * (1.15 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient)
|
|
|
|
) * BIOMECH_EFFICIENCY * _duty
|
2016-09-04 19:33:07 +00:00
|
|
|
};
|