Skip to content

Commit

Permalink
do something to not error on negative sv_friction and negative sv_acc…
Browse files Browse the repository at this point in the history
…elerate
  • Loading branch information
rtldg committed Oct 9, 2024
1 parent e41ba9f commit 187bd2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/sourcemod/scripting/include/shavit/core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,13 @@ stock void TrimDisplayString(const char[] str, char[] outstr, int outstrlen, int
// TODO: surfacefriction
stock float MaxPrestrafe(float runspeed, float accelerate, float friction, float tickinterval)
{
return runspeed * SquareRoot(
if (friction < 0.0) return 9999999.0; // hello ~~mario~~ bhop_ins_mariooo
if (accelerate < 0.0) accelerate = -accelerate;
float something = runspeed * SquareRoot(
(accelerate / friction) *
((2.0 - accelerate * tickinterval) / (2.0 - friction * tickinterval))
);
return something < 0.0 ? -something : something;
}

/**
Expand Down

0 comments on commit 187bd2c

Please sign in to comment.