From 92f12404a3dfa1e3fdaffc1c420d0fc2096970f0 Mon Sep 17 00:00:00 2001 From: hdastwb Date: Mon, 8 Jul 2013 11:58:27 -0400 Subject: [PATCH 1/2] 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) From 2c89692b4ae886fcaed082e2ede0edc3d38089d7 Mon Sep 17 00:00:00 2001 From: hdastwb Date: Mon, 8 Jul 2013 20:29:53 -0400 Subject: [PATCH 2/2] added locked chests to autoplace.lua --- autoplace.lua | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/autoplace.lua b/autoplace.lua index f049665..a15d598 100644 --- a/autoplace.lua +++ b/autoplace.lua @@ -218,7 +218,50 @@ function tube_autoroute(pos) -- does not scan for the front side of the node. ---chests +--locked chests + + -- check for left/right connects + + if string.find(nxm.name, "default:chest_locked") ~= nil + and (nxm.param2 == 0 or nxm.param2 == 2) then + pxm=1 end + if string.find(nxp.name, "default:chest_locked") ~= nil + and (nxp.param2 == 0 or nxp.param2 == 2) then + pxp=1 end + + if string.find(nzm.name, "default:chest_locked") ~= nil + and (nzm.param2 == 1 or nzm.param2 == 3) then + pzm=1 end + if string.find(nzp.name, "default:chest_locked") ~= nil + and (nzp.param2 == 1 or nzp.param2 == 3) then + pzp=1 end + + -- check for backside connects + + if string.find(nxm.name, "default:chest_locked") ~= nil + and nxm.param2 == 1 then + pxm = 1 end + + if string.find(nxp.name, "default:chest_locked") ~= nil + and nxp.param2 == 3 then + pxp = 1 end + + if string.find(nzm.name, "default:chest_locked") ~= nil + and nzm.param2 == 0 then + pzm = 1 end + + if string.find(nzp.name, "default:chest_locked") ~= nil + and nzp.param2 == 2 then + pzp = 1 end + + -- check for top/bottom connections + + if string.find(nym.name, "default:chest_locked") ~= nil then pym = 1 end + if string.find(nyp.name, "default:chest_locked") ~= nil then pyp = 1 end + + -- does not scan for the front side of the node. + +--furnaces -- check for left/right connects