diff options
Diffstat (limited to 'server/protocol/src')
| -rw-r--r-- | server/protocol/src/movement.rs | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/server/protocol/src/movement.rs b/server/protocol/src/movement.rs index ab4eb818..76a243e2 100644 --- a/server/protocol/src/movement.rs +++ b/server/protocol/src/movement.rs @@ -67,11 +67,11 @@ impl MovementBase {          } else {              dt / BOOST_RESTORE          }; -        self.stamina = self.stamina.max(0.).min(1.); +        self.stamina = self.stamina.clamp(0., 1.);          let speed = PLAYER_SPEED * if self.boosting { BOOST_FACTOR } else { 1. };          self.velocity += direction * dt * speed;          self.position += self.velocity * dt; -        self.velocity = self.velocity * (-dt * PLAYER_FRICTION).exp(); +        self.velocity *= (-dt * PLAYER_FRICTION).exp();          collide_player_tiles(self, map);          PacketS::Movement { @@ -84,7 +84,10 @@ impl MovementBase {      pub fn collide(&mut self, other: &mut Self, dt: f32) {          let diff = self.position - other.position;          let d = diff.length(); -        if d < 0.01 || d > PLAYER_SIZE * 2. { +        if d < 0.01 { +            return; +        } +        if d > PLAYER_SIZE * 2. {              return;          }          let norm = diff.normalize(); | 
