From 36d8c8b7162b3b6ba6cc0a7f98b0dc295024ecd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Tue, 28 Jul 2020 20:39:35 +0200 Subject: Add command to split off locomotive --- advtrains/trainlogic.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'advtrains/trainlogic.lua') 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 -- cgit v1.2.3