aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-07-28 20:39:35 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-07-28 20:39:35 +0200
commit36d8c8b7162b3b6ba6cc0a7f98b0dc295024ecd8 (patch)
treee2c76537639fd20e2765e878e2475b855db2a4bb /advtrains
parentc7ea09ed59d54fda9a7537dba53538ef171a7ba8 (diff)
downloadadvtrains-36d8c8b7162b3b6ba6cc0a7f98b0dc295024ecd8.tar.gz
advtrains-36d8c8b7162b3b6ba6cc0a7f98b0dc295024ecd8.tar.bz2
advtrains-36d8c8b7162b3b6ba6cc0a7f98b0dc295024ecd8.zip
Add command to split off locomotive
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/trainlogic.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 2c2e247..c39cc7a 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -892,8 +892,10 @@ function advtrains.spawn_wagons(train_id)
end
end
-function advtrains.split_train_at_fc(train)
- -- splits train at first different current FC
+function advtrains.split_train_at_fc(train, count_empty)
+ -- splits train at first different current FC by convention,
+ -- locomotives have empty FC so are ignored
+ -- count_empty is used to split off locomotives
local train_id = train.id
local fc = false
local ind = 0
@@ -902,7 +904,7 @@ function advtrains.split_train_at_fc(train)
local data = advtrains.wagons[w_id]
if data then
local wfc = advtrains.get_cur_fc(data)
- if wfc ~= "" then
+ if wfc ~= "" or count_empty then
if fc then
if fc ~= wfc then
ind = i