From: terencehill Date: Sun, 24 May 2020 07:16:00 +0000 (+0200) Subject: Move resurfacing (when frozen) code to sys_phys_simulate X-Git-Tag: xonotic-v0.8.5~1033^2~1 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=7840c370615d4f2210b9d20fc35c586c8808a2f6 Move resurfacing (when frozen) code to sys_phys_simulate --- diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 13fcc670f3..91073a88e4 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -617,13 +617,6 @@ void PM_check_frozen(entity this) } else PHYS_CS(this).movement = '0 0 0'; - - if(this.waterlevel >= WATERLEVEL_SWIMMING) - { - this.velocity = this.velocity * 0.5; - if(this.waterlevel >= WATERLEVEL_SUBMERGED) - this.velocity.z = 160; - } } void PM_check_hitground(entity this) diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index 1155c09f27..fb0781e49e 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -217,14 +217,22 @@ void sys_phys_simulate(entity this, float dt) vector wishvel = forward * PHYS_CS(this).movement.x + right * PHYS_CS(this).movement.y + '0 0 1' * PHYS_CS(this).movement.z * (this.com_phys_vel_2d ? 0 : 1); - if (this.com_phys_water && !PHYS_FROZEN(this)) { - if (PHYS_INPUT_BUTTON_CROUCH(this)) { - wishvel.z = -PHYS_MAXSPEED(this); + if (this.com_phys_water) { + if (PHYS_FROZEN(this)) + { + if(this.waterlevel >= WATERLEVEL_SUBMERGED) + wishvel = '0 0 160'; // resurface } - if (this.viewloc) { - wishvel.z = -160; // drift anyway - } else if (wishvel == '0 0 0') { - wishvel = '0 0 -60'; // drift towards bottom + else + { + if (PHYS_INPUT_BUTTON_CROUCH(this)) { + wishvel.z = -PHYS_MAXSPEED(this); + } + if (this.viewloc) { + wishvel.z = -160; // drift anyway + } else if (wishvel == '0 0 0') { + wishvel = '0 0 -60'; // drift towards bottom + } } } if (this.com_phys_ladder) {