summaryrefslogtreecommitdiff
path: root/technic_chests/register.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-03-07 11:09:13 -0500
committerGitHub <noreply@github.com>2017-03-07 11:09:13 -0500
commitb4659d9356d0c303ae750f153081481e9cd89536 (patch)
treee9259f1bc9f804685d4cb472d80264c79e9a7d71 /technic_chests/register.lua
parent186f9b70ac9efef4a1672f6822e6c22d31928dc4 (diff)
parentec6354b6a5f5fcb5a974c1c687f4c4b9ba603f27 (diff)
Merge pull request #317 from Thomas--S/chest-bugfix
Update chests protection to current minetest_game
Diffstat (limited to 'technic_chests/register.lua')
-rw-r--r--technic_chests/register.lua20
1 files changed, 5 insertions, 15 deletions
diff --git a/technic_chests/register.lua b/technic_chests/register.lua
index 8e72aec..6a5b8db 100644
--- a/technic_chests/register.lua
+++ b/technic_chests/register.lua
@@ -267,7 +267,7 @@ function technic.chests:definition(name, data)
on_blast = function(pos)
local drops = {}
default.get_inventory_drops(pos, "main", drops)
- drops[#drops+1] = "default:chest"
+ drops[#drops+1] = "technic:"..name:lower()..(data.locked and "_locked" or "").."_chest"
minetest.remove_node(pos)
return drops
end,
@@ -277,20 +277,10 @@ function technic.chests:definition(name, data)
def.allow_metadata_inventory_put = self.inv_put
def.allow_metadata_inventory_take = self.inv_take
def.on_blast = function() end
- def.on_key_use = function(pos, player)
- local secret = minetest.get_meta(pos):get_string("key_lock_secret")
- local itemstack = player:get_wielded_item()
- local key_meta = minetest.parse_json(itemstack:get_metadata())
-
- if secret ~= key_meta.secret then
- return
- end
-
- minetest.show_formspec(
- player:get_player_name(),
- "default:chest_locked",
- get_locked_chest_formspec(pos)
- )
+ def.can_dig = function(pos,player)
+ local meta = minetest.get_meta(pos);
+ local inv = meta:get_inventory()
+ return inv:is_empty("main") and default.can_interact_with_node(player, pos)
end
def.on_skeleton_key_use = function(pos, player, newsecret)
local meta = minetest.get_meta(pos)