summaryrefslogtreecommitdiff
path: root/tubes.lua
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2013-01-20 17:29:11 +0100
committerNovatux <nathanael.courant@laposte.net>2013-01-20 17:29:11 +0100
commit1657f7cb7b7080cba505914c840f9d21aee84be3 (patch)
tree0ee7621e543fa7d39f7cccf5ebbd238da5b921c6 /tubes.lua
parent26414588a58ce7db6c31f11f125dbe2b770f4a7d (diff)
downloadpipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar
pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar.gz
pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar.bz2
pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar.xz
pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.zip
Added sand tubes, which take nearby items.
Diffstat (limited to 'tubes.lua')
-rw-r--r--tubes.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/tubes.lua b/tubes.lua
index 0061f5a..ee982e1 100644
--- a/tubes.lua
+++ b/tubes.lua
@@ -423,5 +423,28 @@ register_tube("pipeworks:accelerator_tube","Accelerator pneumatic tube segment",
return notvel(meseadjlist,velocity)
end}})
+register_tube("pipeworks:sand_tube","Sand pneumatic tube segment",plain_textures,noctr_textures,end_textures,
+ short_texture,inv_texture,
+ {groups={sand_tube=1},
+ tube={can_go=function(pos,node,velocity,stack)
+ return meseadjlist
+ end}})
+
+minetest.register_abm({nodenames={"group:sand_tube"},interval=1,chance=1,
+ action=function(pos, node, active_object_count, active_object_count_wider)
+ for _,object in ipairs(minetest.env: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)
+ titem:get_luaentity().start_pos = {x=pos.x,y=pos.y-1,z=pos.z}
+ titem:setvelocity({x=0,y=1,z=0})
+ titem:setacceleration({x=0, y=0, z=0})
+ end
+ object:get_luaentity().itemstring = ""
+ object:remove()
+ end
+ end
+ end})
+
modpath=minetest.get_modpath("pipeworks")
dofile(modpath.."/teleport_tube.lua") \ No newline at end of file