From 03d5541c7c43a7efceab1bc5dd68e11a8b12bed2 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 8 Jun 2021 12:48:29 +1000 Subject: [PATCH] Partially re-implement the .teleport_time field in player physics to prevent getting stuck in some maps, workaround for #2596 --- qcsrc/common/physics/player.qc | 1 + qcsrc/ecs/systems/physics.qc | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 1c55d3d14..24967d1c8 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -450,6 +450,7 @@ void CheckWaterJump(entity this) { // open at eye level this.velocity_z = 225; this.flags |= FL_WATERJUMP; + this.teleport_time = time + 2; // safety net SET_JUMP_HELD(this); } } diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index 38d35d4b3..c7fc88dc9 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -90,8 +90,9 @@ void sys_phys_update(entity this, float dt) if (this.flags & FL_WATERJUMP) { this.velocity_x = this.movedir.x; this.velocity_y = this.movedir.y; - if (this.waterlevel == WATERLEVEL_NONE) { + if (time > this.teleport_time || this.waterlevel == WATERLEVEL_NONE) { this.flags &= ~FL_WATERJUMP; + this.teleport_time = 0; } } else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod, dt)) { // handled -- 2.39.2