diff options
Diffstat (limited to 'railcart/railcart.lua')
-rw-r--r-- | railcart/railcart.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/railcart/railcart.lua b/railcart/railcart.lua index 68174b6..655fffe 100644 --- a/railcart/railcart.lua +++ b/railcart/railcart.lua @@ -215,11 +215,12 @@ function railcart:update(cart, time, object) end end local speed = railcart:velocity_to_speed(cart.vel) - if not cart.target then + if cart.target then + cart.dir = railtrack:get_direction(cart.target, cart.pos) + else speed = 0 end if speed > RAILCART_SPEED_MIN then - cart.dir = railtrack:get_direction(cart.target, cart.pos) local d1 = railtrack:get_distance(cart.prev, cart.target) local d2 = railtrack:get_distance(cart.prev, cart.pos) local dist = d1 - d2 |