aboutsummaryrefslogtreecommitdiff
path: root/advtrains/couple.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-11-04 20:14:20 +0100
committerorwell96 <orwell@bleipb.de>2021-11-04 20:14:20 +0100
commit8a9f1389a5ee4c53b423b548bf8c7355adb7ec94 (patch)
treeae49d50bc517e01d8312b47ca5b6d29d8c3d34de /advtrains/couple.lua
parentf046cfc2d32c5cc764404c21f627695ca547b9c0 (diff)
downloadadvtrains-8a9f1389a5ee4c53b423b548bf8c7355adb7ec94.tar.gz
advtrains-8a9f1389a5ee4c53b423b548bf8c7355adb7ec94.tar.bz2
advtrains-8a9f1389a5ee4c53b423b548bf8c7355adb7ec94.zip
On-Track Collision system: Fix train teleportation when using split_at_index() from LuaATC
Issue was that train thought it would collide with the newly added back portion although it was already long past this train. Added additional check that current train index is not further than the collision point.
Diffstat (limited to 'advtrains/couple.lua')
-rw-r--r--advtrains/couple.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/advtrains/couple.lua b/advtrains/couple.lua
index c421f61..3e6c432 100644
--- a/advtrains/couple.lua
+++ b/advtrains/couple.lua
@@ -252,6 +252,8 @@ function advtrains.couple_trains(init_train, invert_init_train, stat_train, stat
init_train.index = advtrains.path_get_index_by_offset(init_train, init_train.index, stat_trainlen)
advtrains.update_trainpart_properties(init_train.id)
+ advtrains.update_train_start_and_end(init_train)
+
advtrains.couple_invalidate(init_train)
return true
end