Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Fatigue - Fix stamina costs when not touching ground #10297

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.02) 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
Loading