From 0eb861d86c325020be2c00431ffe389ab9352937 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Thu, 17 Mar 2022 18:17:46 +0000 Subject: [PATCH] Prevent players moving too far/fast when stepping up a staircase --- .gitlab-ci.yml | 2 +- qcsrc/common/physics/movetypes/movetypes.qc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5031c66b..e8092ddbb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,7 +32,7 @@ test_sv_game: - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache - make - - EXPECT=7b55642e475a26f6fb397093e6f8fe81 + - EXPECT=c7e360b409c6ceddff9c1407ce4e2090 - HASH=$(${ENGINE} -noconfig -nohome +timestamps 1 +exec serverbench.cfg | tee /dev/stderr | sed -e 's,^\[[^]]*\] ,,' diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 1bd0eb7ae..64a31cdbf 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -179,6 +179,8 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno if(trace_fraction == 1) break; + time_left *= 1 - trace_fraction; + float my_trace_fraction = trace_fraction; vector my_trace_plane_normal = trace_plane_normal; @@ -204,6 +206,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno // step - handle it immediately vector org = this.origin; vector steppush = '0 0 1' * stepheight; + push = this.velocity * time_left; if(!_Movetype_PushEntity(this, steppush, true, false)) { @@ -250,8 +253,6 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno numplanes = 0; } - time_left *= 1 - my_trace_fraction; - // clipped to another plane if(numplanes >= MAX_CLIP_PLANES) { -- 2.39.2