Fix crossing tube and one way tube.
authorNovatux <nathanael.courant@laposte.net>
Mon, 21 Oct 2013 09:34:10 +0000 (11:34 +0200)
committerNovatux <nathanael.courant@laposte.net>
Mon, 21 Oct 2013 09:34:10 +0000 (11:34 +0200)
item_transport.lua
tubes.lua

index 721aa198fb20be14db28996b6dd58089ecbeb282..3e7ff0a3caa560ed4bb5a7a564cd47fc001907d1 100644 (file)
@@ -394,7 +394,7 @@ minetest.register_entity("pipeworks:tubed_item", {
        
        local moved=false
        local speed=math.abs(velocity.x+velocity.y+velocity.z)
-       local vel={x=velocity.x/speed,y=velocity.y/speed,z=velocity.z/speed}
+       local vel={x=velocity.x/speed,y=velocity.y/speed,z=velocity.z/speed, speed=speed}
        
        if math.abs(vel.x)==1 then
                local next_node=math.abs(pos.x-self.start_pos.x)
index 7056c4bdaa6fddb3b9fb24918a0af5a229e459d6..7ac950e68791262911710070d50083130d2f84b4 100644 (file)
--- a/tubes.lua
+++ b/tubes.lua
@@ -477,7 +477,7 @@ if enable_crossing_tube then
        register_tube("pipeworks:crossing_tube","Crossing tube segment",accelerator_plain_textures,
                        accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
                        {tube={can_go=function(pos,node,velocity,stack)
-                               return velocity
+                               return {velocity}
                        end}
        })
 end
@@ -640,7 +640,7 @@ if enable_one_way_tube then
                        insert_object = function(pos,node,stack,direction)
                                item1=tube_item(pos,stack)
                                item1:get_luaentity().start_pos = pos
-                               item1:setvelocity(direction)
+                               item1:setvelocity({x=direction.x*direction.speed, y=direction.y*direction.speed, z=direction.z*direction.speed})
                                item1:setacceleration({x=0, y=0, z=0})
                                return ItemStack("")
                        end,