Skip to content

Commit 187bd2c

Browse files
committed
do something to not error on negative sv_friction and negative sv_accelerate
1 parent e41ba9f commit 187bd2c

File tree

1 file changed

+4
-1
lines changed
  • addons/sourcemod/scripting/include/shavit

1 file changed

+4
-1
lines changed

addons/sourcemod/scripting/include/shavit/core.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,13 @@ stock void TrimDisplayString(const char[] str, char[] outstr, int outstrlen, int
534534
// TODO: surfacefriction
535535
stock float MaxPrestrafe(float runspeed, float accelerate, float friction, float tickinterval)
536536
{
537-
return runspeed * SquareRoot(
537+
if (friction < 0.0) return 9999999.0; // hello ~~mario~~ bhop_ins_mariooo
538+
if (accelerate < 0.0) accelerate = -accelerate;
539+
float something = runspeed * SquareRoot(
538540
(accelerate / friction) *
539541
((2.0 - accelerate * tickinterval) / (2.0 - friction * tickinterval))
540542
);
543+
return something < 0.0 ? -something : something;
541544
}
542545

543546
/**

0 commit comments

Comments
 (0)