Fix repartition of teleport tubes not being random.
authorNovatux <nathanael.courant@laposte.net>
Sat, 13 Apr 2013 09:47:50 +0000 (11:47 +0200)
committerNovatux <nathanael.courant@laposte.net>
Sat, 13 Apr 2013 09:47:50 +0000 (11:47 +0200)
teleport_tube.lua

index ac1a613d1b025ef7106797d051802f62a8763edf..c1629528464f04f6dcd57ad6e129f6f301e451b1 100644 (file)
@@ -76,9 +76,10 @@ register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",tele
                        channel=meta:get_string("channel")
                        goto=get_tubes_in_file(pos,channel)
                        if goto[1]==nil then return {} end
-                       pos.x=goto[1].x
-                       pos.y=goto[1].y
-                       pos.z=goto[1].z
+                       d=math.random(1,#goto)
+                       pos.x=goto[d].x
+                       pos.y=goto[d].y
+                       pos.z=goto[d].z
                        return meseadjlist
                end},
                on_construct = function(pos)