diff options
author | VanessaE <vanessaezekowitz@gmail.com> | 2013-07-08 20:40:13 -0700 |
---|---|---|
committer | VanessaE <vanessaezekowitz@gmail.com> | 2013-07-08 20:40:13 -0700 |
commit | f42486f0380a9c8d31d51ab31b786e33d452cbd1 (patch) | |
tree | 26b6d53e6ebeb451c2414266162544060dc32764 /compat.lua | |
parent | 2f843fdd767a71bb51f8d31908ff03399cd97703 (diff) | |
parent | 2c89692b4ae886fcaed082e2ede0edc3d38089d7 (diff) |
Merge pull request #45 from hdastwb/lockedchest
Locked chest integration
Diffstat (limited to 'compat.lua')
-rw-r--r-- | compat.lua | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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) |