aboutsummaryrefslogtreecommitdiff
path: root/server/protocol/src/movement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/protocol/src/movement.rs')
-rw-r--r--server/protocol/src/movement.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/protocol/src/movement.rs b/server/protocol/src/movement.rs
index 6a07687f..14aefacb 100644
--- a/server/protocol/src/movement.rs
+++ b/server/protocol/src/movement.rs
@@ -99,18 +99,19 @@ impl MovementBase {
}
}
- pub fn collide(&mut self, other: &mut Self, dt: f32) {
+ pub fn collide(&mut self, other: &mut Self, dt: f32) -> bool {
let diff = self.position - other.position;
let d = diff.length();
if d < 0.01 {
- return;
+ return false;
}
if d > PLAYER_SIZE * 2. {
- return;
+ return false;
}
let norm = diff.normalize();
let f = 100. / (1. + d);
- self.velocity += norm * f * dt
+ self.velocity += norm * f * dt;
+ true
}
pub fn get_interact_target(&self) -> IVec2 {
(self.position + Vec2::new(self.rotation.sin(), self.rotation.cos())).as_ivec2()