Fix trains not stopping when colliding with environment H#122

h137
orwell96 2019-11-26 15:49:36 +01:00
parent ca4d65050c
commit 4ff8e05755
1 changed files with 4 additions and 11 deletions

View File

@ -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