diff options
Diffstat (limited to 'server/src/customer')
| -rw-r--r-- | server/src/customer/movement.rs | 2 | ||||
| -rw-r--r-- | server/src/customer/pathfinding.rs | 6 | 
2 files changed, 6 insertions, 2 deletions
| diff --git a/server/src/customer/movement.rs b/server/src/customer/movement.rs index b45c7931..6a70a44f 100644 --- a/server/src/customer/movement.rs +++ b/server/src/customer/movement.rs @@ -13,7 +13,7 @@ pub struct MovementBase {  impl MovementBase {      pub fn update(&mut self, map: &HashSet<IVec2>, direction: Vec2, dt: f32) -> PacketS { -        let direction = direction.normalize_or_zero(); +        let direction = direction.clamp_length_max(1.);          if direction.length() > 0.1 {              self.facing = direction + (self.facing - direction) * (-dt * 10.).exp();          } diff --git a/server/src/customer/pathfinding.rs b/server/src/customer/pathfinding.rs index d25c6913..26de9c51 100644 --- a/server/src/customer/pathfinding.rs +++ b/server/src/customer/pathfinding.rs @@ -21,7 +21,11 @@ impl Path {              if next.distance(customer.position) < if self.0.len() == 1 { 0.1 } else { 0.6 } {                  self.0.pop();              } -            customer.update(&walkable, next - customer.position, dt) +            customer.update( +                &walkable, +                (next - customer.position).normalize_or_zero() * 0.5, +                dt, +            )          } else {              customer.update(&walkable, Vec2::ZERO, dt)          } |