aboutsummaryrefslogtreecommitdiff
path: root/trainlogic.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-06-01 11:03:50 +0200
committerorwell96 <mono96.mml@gmail.com>2016-06-01 11:03:50 +0200
commit8954740dd756dc7e442aca3dfd25bf25faafe006 (patch)
treebce26a43b7ffb92d61f29201d8418f5e99ccbe3d /trainlogic.lua
parent04e48bab20c0f812b82adeb3099918b1ad4b91cb (diff)
downloadadvtrains-8954740dd756dc7e442aca3dfd25bf25faafe006.tar.gz
advtrains-8954740dd756dc7e442aca3dfd25bf25faafe006.tar.bz2
advtrains-8954740dd756dc7e442aca3dfd25bf25faafe006.zip
added discouple entity
Diffstat (limited to 'trainlogic.lua')
-rw-r--r--trainlogic.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/trainlogic.lua b/trainlogic.lua
index e226eab..1ac5dea 100644
--- a/trainlogic.lua
+++ b/trainlogic.lua
@@ -473,8 +473,8 @@ end
function advtrains.split_train_at_wagon(wagon)
--get train
local train=advtrains.trains[wagon.train_id]
- local pos_for_new_train=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train-0.5)]
- local pos_for_new_train_prev=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train-1.5)]
+ local pos_for_new_train=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train+wagon.wagon_span)]
+ local pos_for_new_train_prev=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train-1+wagon.wagon_span)]
--before doing anything, check if both are rails. else do not allow
if not pos_for_new_train then