mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed clamping of insane moves
This commit is contained in:
parent
6285917917
commit
fdc4889768
|
@ -784,6 +784,12 @@ extern "C" void modc_predict()
|
|||
if(!world.players[c])
|
||||
continue;
|
||||
|
||||
|
||||
// TODO: this should be moved into the g_game
|
||||
// but not done to preserve the nethash
|
||||
if(length(world.players[c]->vel) > 150.0f)
|
||||
world.players[c]->vel = normalize(world.players[c]->vel) * 150.0f;
|
||||
|
||||
world.players[c]->move();
|
||||
world.players[c]->quantize();
|
||||
}
|
||||
|
|
|
@ -1069,8 +1069,15 @@ void player::tick_defered()
|
|||
vec2 start_pos = core.pos;
|
||||
vec2 start_vel = core.vel;
|
||||
bool stuck_before = test_box(core.pos, vec2(28.0f, 28.0f));
|
||||
if(length(core.vel) > 100.0f)
|
||||
dbg_msg("server", "insane move! (%f,%f) %f", core.vel.x, core.vel.y, length(core.vel));
|
||||
|
||||
// TODO: this should be moved into the g_game
|
||||
// but not done to preserve the nethash
|
||||
if(length(core.vel) > 150.0f)
|
||||
{
|
||||
dbg_msg("server", "insane move! clamping (%f,%f) %f", core.vel.x, core.vel.y, length(core.vel));
|
||||
core.vel = normalize(core.vel) * 150.0f;
|
||||
}
|
||||
|
||||
core.move();
|
||||
bool stuck_after_move = test_box(core.pos, vec2(28.0f, 28.0f));
|
||||
core.quantize();
|
||||
|
|
Loading…
Reference in a new issue