summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhdastwb <hdastwb@hdastwb.heliohost.org>2013-07-08 11:58:27 -0400
committerhdastwb <hdastwb@hdastwb.heliohost.org>2013-07-08 11:58:27 -0400
commit92f12404a3dfa1e3fdaffc1c420d0fc2096970f0 (patch)
treef1653ba593d496287b6d6e597c209a0cf7c11bc4
parent2f843fdd767a71bb51f8d31908ff03399cd97703 (diff)
downloadpipeworks-92f12404a3dfa1e3fdaffc1c420d0fc2096970f0.tar
pipeworks-92f12404a3dfa1e3fdaffc1c420d0fc2096970f0.tar.gz
pipeworks-92f12404a3dfa1e3fdaffc1c420d0fc2096970f0.tar.bz2
pipeworks-92f12404a3dfa1e3fdaffc1c420d0fc2096970f0.tar.xz
pipeworks-92f12404a3dfa1e3fdaffc1c420d0fc2096970f0.zip
added locked chests in compat.lua
-rw-r--r--compat.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/compat.lua b/compat.lua
index da3cac9..6113815 100644
--- a/compat.lua
+++ b/compat.lua
@@ -97,3 +97,28 @@ chest=clone_node("default:chest")
end
minetest.register_node(":default:chest",chest)
+
+
+chest_locked=clone_node("default:chest_locked")
+ chest_locked.groups.tubedevice=1
+ chest_locked.groups.tubedevice_receiver=1
+ chest_locked.tube={insert_object = function(pos,node,stack,direction)
+ local meta=minetest.env:get_meta(pos)
+ local inv=meta:get_inventory()
+ return inv:add_item("main",stack)
+ end,
+ can_insert=function(pos,node,stack,direction)
+ local meta=minetest.env:get_meta(pos)
+ local inv=meta:get_inventory()
+ return inv:room_for_item("main",stack)
+ end}
+ local old_after_place = minetest.registered_nodes["default:chest_locked"].after_place_node;
+ chest_locked.after_place_node = function(pos, placer)
+ tube_scanforobjects(pos)
+ old_after_place(pos, placer)
+ end
+ chest_locked.after_dig_node = function(pos)
+ tube_scanforobjects(pos)
+ end
+
+minetest.register_node(":default:chest_locked",chest_locked)