aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-05-22 19:42:15 +0200
committerorwell96 <orwell@bleipb.de>2021-05-22 19:42:15 +0200
commite5b053c0d824543116d322634d2cf1019d6754bc (patch)
tree7d223fc26028ea9307e9fbfd0deefd38c25bd709
parente506086011ee24a30d3085c6933e8e38f2abd325 (diff)
downloadadvtrains-e5b053c0d824543116d322634d2cf1019d6754bc.tar.gz
advtrains-e5b053c0d824543116d322634d2cf1019d6754bc.tar.bz2
advtrains-e5b053c0d824543116d322634d2cf1019d6754bc.zip
Trains splitting: retain important properties (door state, line, texts etc)
-rw-r--r--advtrains/trainlogic.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index d83d89f..187e5ba 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -1106,6 +1106,17 @@ function advtrains.split_train_at_index(train, index)
local newtrain=advtrains.trains[newtrain_id]
newtrain.velocity=train.velocity
+ -- copy various properties from the old to the new train
+ newtrain.door_open = train.door_open
+ newtrain.text_outside = train.text_outside
+ newtrain.text_inside = train.text_inside
+ newtrain.line = train.line
+ newtrain.routingcode = train.routingcode
+ newtrain.speed_restriction = train.speed_restriction
+ newtrain.is_shunt = train.is_shunt
+ newtrain.points_split = advtrains.merge_tables(train.points_split)
+ newtrain.autocouple = train.autocouple
+
return newtrain_id -- return new train ID, so new train can be manipulated
end