aboutsummaryrefslogtreecommitdiff
path: root/trainlogic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'trainlogic.lua')
-rw-r--r--trainlogic.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/trainlogic.lua b/trainlogic.lua
index 633024d..5e3936f 100644
--- a/trainlogic.lua
+++ b/trainlogic.lua
@@ -675,17 +675,18 @@ function advtrains.try_connect_trains(id1, id2)
if not frontpos1 or not frontpos2 or not backpos1 or not backpos2 then return end
+ local couple_spawnradius=0.7
--case 1 (first train is front)
- if vector.distance(frontpos2, backpos1)<0.5 then
+ if vector.distance(frontpos2, backpos1)<couple_spawnradius then
advtrains.spawn_couple_if_neccessary(backpos1, frontpos2, id1, id2, true, false)
--case 2 (second train is front)
- elseif vector.distance(frontpos1, backpos2)<0.5 then
+ elseif vector.distance(frontpos1, backpos2)<couple_spawnradius then
advtrains.spawn_couple_if_neccessary(backpos2, frontpos1, id2, id1, true, false)
--case 3
- elseif vector.distance(backpos2, backpos1)<0.5 then
+ elseif vector.distance(backpos2, backpos1)<couple_spawnradius then
advtrains.spawn_couple_if_neccessary(backpos1, backpos2, id1, id2, true, true)
--case 4
- elseif vector.distance(frontpos2, frontpos1)<0.5 then
+ elseif vector.distance(frontpos2, frontpos1)<couple_spawnradius then
advtrains.spawn_couple_if_neccessary(frontpos1, frontpos2, id1, id2, false, false)
end
end