From 1bff001db2914e8ee7bc331a4104592ad6e2e9a3 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 18 Jul 2024 15:52:12 +0200 Subject: clippy --- server/protocol/src/movement.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'server/protocol/src/movement.rs') 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(); -- cgit v1.2.3-70-g09d2