Update has_locked_chest_privilege to current minetest_game function

This commit is contained in:
Thomas--S 2017-01-15 15:51:53 +01:00 committed by GitHub
parent d39797aad8
commit 5f1919d2bc

View File

@ -65,7 +65,31 @@ function technic.chests.on_inv_take(pos, listname, index, stack, player)
..minetest.pos_to_string(pos)) ..minetest.pos_to_string(pos))
end end
function has_locked_chest_privilege(meta, player) local function has_locked_chest_privilege(meta, player)
return player:get_player_name() == meta:get_string("owner") if player then
if minetest.check_player_privs(player, "protection_bypass") then
return true
end
else
return false
end
-- is player wielding the right key?
local item = player:get_wielded_item()
if item:get_name() == "default:key" then
local key_meta = minetest.parse_json(item:get_metadata())
local secret = meta:get_string("key_lock_secret")
if secret ~= key_meta.secret then
return false
end
return true
end
if player:get_player_name() ~= meta:get_string("owner") then
return false
end
return true
end end