tube_item has to be global. confined it to pipeworks.{} table.
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Sun, 15 Dec 2013 19:41:03 +0000 (14:41 -0500)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Sun, 15 Dec 2013 19:41:03 +0000 (14:41 -0500)
item_transport.lua
node_breaker.lua
tubes.lua

index ab961d993d323bb0757297913decc90c575c8b28..6b2b49442838ac8d3cb9c44b3049ee8f0a904104 100644 (file)
@@ -29,7 +29,7 @@ local fakePlayer = {
     -- perhaps a custom metaclass that errors specially when fakePlayer.<property> is not found?
 }
 
-local function tube_item(pos, item)
+function pipeworks.tube_item(pos, item)
        -- Take item in any format
        local stack = ItemStack(item)
        local obj = minetest.add_entity(pos, "pipeworks:tubed_item")
@@ -73,7 +73,7 @@ local function grabAndFire(frominv,frominvname,frompos,fromnode,sname,tube,idef,
                         idef.on_metadata_inventory_take(frompos, "main", spos, item, fakePlayer)
                     end
                 end
-                local item1=tube_item(frompos,item)
+                local item1=pipeworks.tube_item(frompos,item)
                 item1:get_luaentity().start_pos = frompos
                 item1:setvelocity(dir)
                 item1:setacceleration({x=0, y=0, z=0})
index 8f4accb1a24f5ea0cc29d69a51703e5ef23d181d..593799f726fa08dd9f5213c462da6cbd6dada82f 100644 (file)
@@ -162,7 +162,7 @@ local function break_node (pos, facedir)
        --handle node drops
        local drops = minetest.get_node_drops(node.name, "default:pick_mese")
        for _, dropped_item in ipairs(drops) do
-               local item1 = tube_item({x=pos.x, y=pos.y, z=pos.z}, dropped_item)
+               local item1 = pipeworks.tube_item({x=pos.x, y=pos.y, z=pos.z}, dropped_item)
                item1:get_luaentity().start_pos = {x=pos.x, y=pos.y, z=pos.z}
                item1:setvelocity(vel)
                item1:setacceleration({x=0, y=0, z=0})
index 1a31971bff8c5a8124a922ea896ec24a9acd31f3..e37946bbe8e1d1a93ee40b07a34f44c550914663 100644 (file)
--- a/tubes.lua
+++ b/tubes.lua
@@ -461,7 +461,7 @@ if pipeworks.enable_sand_tube then
                        for _,object in ipairs(minetest.get_objects_inside_radius(pos, 2)) do
                                if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
                                        if object:get_luaentity().itemstring ~= "" then
-                                               local titem=tube_item(pos,object:get_luaentity().itemstring)
+                                               local titem=pipeworks.tube_item(pos,object:get_luaentity().itemstring)
                                                titem:get_luaentity().start_pos = {x=pos.x,y=pos.y-1,z=pos.z}
                                                titem:setvelocity({x=0.01,y=1,z=-0.01})
                                                titem:setacceleration({x=0, y=0, z=0})
@@ -522,7 +522,7 @@ if pipeworks.enable_mese_sand_tube then
                        for _,object in ipairs(get_objects_with_square_radius(pos, minetest.env:get_meta(pos):get_int("dist"))) do
                                if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
                                        if object:get_luaentity().itemstring ~= "" then
-                                               local titem=tube_item(pos,object:get_luaentity().itemstring)
+                                               local titem=pipeworks.tube_item(pos,object:get_luaentity().itemstring)
                                                titem:get_luaentity().start_pos = {x=pos.x,y=pos.y-1,z=pos.z}
                                                titem:setvelocity({x=0.01,y=1,z=-0.01})
                                                titem:setacceleration({x=0, y=0, z=0})
@@ -576,7 +576,7 @@ if pipeworks.enable_one_way_tube then
                                        return velocity
                                end,
                        insert_object = function(pos,node,stack,direction)
-                               item1=tube_item(pos,stack)
+                               item1=pipeworks.tube_item(pos,stack)
                                item1:get_luaentity().start_pos = pos
                                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})