aboutsummaryrefslogtreecommitdiff
path: root/advtrains/wagons.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-11-26 15:49:36 +0100
committerorwell96 <orwell@bleipb.de>2019-11-26 15:49:36 +0100
commit4ff8e05755e7560e4c15bce170122545a468150b (patch)
treebe551580b9ff5ea4baa01d35c941fd78328a8b5a /advtrains/wagons.lua
parentca4d65050ccb6ac7f7a54c491250c632a50b6d23 (diff)
downloadadvtrains-4ff8e05755e7560e4c15bce170122545a468150b.tar.gz
advtrains-4ff8e05755e7560e4c15bce170122545a468150b.tar.bz2
advtrains-4ff8e05755e7560e4c15bce170122545a468150b.zip
Fix trains not stopping when colliding with environment H#122
Diffstat (limited to 'advtrains/wagons.lua')
-rw-r--r--advtrains/wagons.lua15
1 files changed, 4 insertions, 11 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index 8ff1d7e..4f84fc0 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -419,17 +419,10 @@ function wagon:on_step(dtime)
end
end
if collides then
- if self.collision_count and self.collision_count>10 then
- --enable collision mercy to get trains stuck in walls out of walls
- --actually do nothing except limiting the velocity to 1
- train.velocity=math.min(train.velocity, 1)
- else
- train.recently_collided_with_env=true
- train.velocity=0
- self.collision_count=(self.collision_count or 0)+1
- end
- else
- self.collision_count=nil
+ -- screw collision mercy
+ train.recently_collided_with_env=true
+ train.velocity=0
+ advtrains.atc.train_reset_command(train)
end
end