From 92f12404a3dfa1e3fdaffc1c420d0fc2096970f0 Mon Sep 17 00:00:00 2001 From: hdastwb Date: Mon, 8 Jul 2013 11:58:27 -0400 Subject: [PATCH] added locked chests in compat.lua --- compat.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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)