diff options
author | Novatux <nathanael.courant@laposte.net> | 2013-01-20 17:29:11 +0100 |
---|---|---|
committer | Novatux <nathanael.courant@laposte.net> | 2013-01-20 17:29:11 +0100 |
commit | 1657f7cb7b7080cba505914c840f9d21aee84be3 (patch) | |
tree | 0ee7621e543fa7d39f7cccf5ebbd238da5b921c6 | |
parent | 26414588a58ce7db6c31f11f125dbe2b770f4a7d (diff) | |
download | pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar.gz pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar.bz2 pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.tar.xz pipeworks-1657f7cb7b7080cba505914c840f9d21aee84be3.zip |
Added sand tubes, which take nearby items.
-rw-r--r-- | tubes.lua | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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 |