File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1414,6 +1414,12 @@ bool PlayerSAO::checkMovementCheat()
1414
1414
// until this can be verified correctly, tolerate higher jumping speeds
1415
1415
player_max_jump *= 2.0 ;
1416
1416
1417
+ // Don't divide by zero!
1418
+ if (player_max_walk < 0 .0001f )
1419
+ player_max_walk = 0 .0001f ;
1420
+ if (player_max_jump < 0 .0001f )
1421
+ player_max_jump = 0 .0001f ;
1422
+
1417
1423
v3f diff = (m_base_position - m_last_good_position);
1418
1424
float d_vert = diff.Y ;
1419
1425
diff.Y = 0 ;
@@ -1422,8 +1428,11 @@ bool PlayerSAO::checkMovementCheat()
1422
1428
1423
1429
// FIXME: Checking downwards movement is not easily possible currently,
1424
1430
// the server could calculate speed differences to examine the gravity
1425
- if (d_vert > 0 )
1426
- required_time = MYMAX (required_time, d_vert / player_max_jump);
1431
+ if (d_vert > 0 ) {
1432
+ // In certain cases (water, ladders) walking speed is applied vertically
1433
+ float s = MYMAX (player_max_jump, player_max_walk);
1434
+ required_time = MYMAX (required_time, d_vert / s);
1435
+ }
1427
1436
1428
1437
if (m_move_pool.grab (required_time)) {
1429
1438
m_last_good_position = m_base_position;
You can’t perform that action at this time.
0 commit comments