summaryrefslogtreecommitdiff
path: root/railcart/railcart.lua
diff options
context:
space:
mode:
authorstujones11 <stujones111@gmail.com>2016-01-16 18:03:13 +0000
committerstujones11 <stujones111@gmail.com>2016-01-16 18:07:46 +0000
commit620ca56b952037860b750e87e930754fd1d7b002 (patch)
tree60f8180891af42cfa29375126a5aa130858c5636 /railcart/railcart.lua
parentaee5c31362ca329ab71998d8c43588dba5113e04 (diff)
Fix regression with unloaded carts
Diffstat (limited to 'railcart/railcart.lua')
-rw-r--r--railcart/railcart.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/railcart/railcart.lua b/railcart/railcart.lua
index bdd9a05..68efda5 100644
--- a/railcart/railcart.lua
+++ b/railcart/railcart.lua
@@ -200,8 +200,10 @@ function railcart:update(cart, time, object)
accel = RAILTRACK_ACCEL_UP
end
accel = cart.accel or accel
- local d = dist - RAILCART_SNAP_DISTANCE
- local dt = railcart:get_delta_time(speed, accel, d)
+ if object then
+ dist = math.max(dist - RAILCART_SNAP_DISTANCE, 0)
+ end
+ local dt = railcart:get_delta_time(speed, accel, dist)
if dt < time then
time = dt
end