Skip to content

Commit

Permalink
Advanced Fatigue - Fix stamina costs when not touching ground (#10297)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored Sep 11, 2024
1 parent d4d87a1 commit fdf3198
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions addons/advanced_fatigue/functions/fnc_mainLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ if (!alive ACE_player) exitWith {
private _velocity = velocity ACE_player;
private _normal = surfaceNormal (getPosWorld ACE_player);
private _movementVector = vectorNormalized _velocity;
private _sideVector = vectorNormalized (_movementVector vectorCrossProduct _normal);
private _fwdAngle = asin (_movementVector select 2);
private _sideAngle = asin (_sideVector select 2);
private _sideAngle = if ((getPosATL ACE_player) select 2 > 0.01) then {
0 // ignore terrain normal if not touching it
} else {
private _sideVector = vectorNormalized (_movementVector vectorCrossProduct _normal);
asin (_sideVector select 2);
};
if (GVAR(isSwimming)) then { // ignore when floating
_fwdAngle = 0;
_sideAngle = 0;
};


private _currentWork = REE;
private _currentSpeed = (vectorMagnitude _velocity) min 6;
Expand Down Expand Up @@ -62,7 +71,7 @@ if (isNull objectParent ACE_player && {_currentSpeed > 0.1} && {isTouchingGround
};

// Used to simulate the unevenness/roughness of the terrain
if ((getPosATL ACE_player) select 2 < 0.01) then {
if (_sideAngle != 0) then {
private _sideGradient = abs (_sideAngle / 45) min 1;

_terrainFactor = 1 + _sideGradient ^ 4;
Expand Down

0 comments on commit fdf3198

Please sign in to comment.