aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-12-13 19:27:38 +0100
committerorwell96 <mono96.mml@gmail.com>2016-12-13 19:27:38 +0100
commit0e185b9fb80285a4ca9f1a0ba15897b152632a67 (patch)
tree1a3971c7221f0128504753b5868be222ec180d4d
parent631636f75706659dba11afc3a9d8075d8278fe43 (diff)
downloadadvtrains-0e185b9fb80285a4ca9f1a0ba15897b152632a67.tar.gz
advtrains-0e185b9fb80285a4ca9f1a0ba15897b152632a67.tar.bz2
advtrains-0e185b9fb80285a4ca9f1a0ba15897b152632a67.zip
increase couple validity radius
-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