mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-11-05 09:50:26 +01:00
parent
4e439c34cb
commit
a14722eb98
|
@ -117,15 +117,17 @@ function homedecor.handle_inventory(name, def, original_def)
|
|||
local owner = meta:get_string("owner")
|
||||
local playername = player:get_player_name()
|
||||
|
||||
if (playername ~= owner) then
|
||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
||||
playername, name, owner, minetest.pos_to_string(pos)
|
||||
))
|
||||
return 0
|
||||
if playername == owner or
|
||||
minetest.check_player_privs(player, "protection_bypass") then
|
||||
return allow_move and
|
||||
allow_move(pos, from_list, from_index, to_list, to_index, count, player) or
|
||||
count
|
||||
end
|
||||
|
||||
return allow_move and allow_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
or count
|
||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
||||
playername, name, owner, minetest.pos_to_string(pos)
|
||||
))
|
||||
return 0
|
||||
end
|
||||
|
||||
local allow_put = def.allow_metadata_inventory_put
|
||||
|
@ -134,14 +136,16 @@ function homedecor.handle_inventory(name, def, original_def)
|
|||
local owner = meta:get_string("owner")
|
||||
local playername = player:get_player_name()
|
||||
|
||||
if (playername ~= owner) then
|
||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
||||
playername, name, owner, minetest.pos_to_string(pos)
|
||||
))
|
||||
return 0
|
||||
if playername == owner or
|
||||
minetest.check_player_privs(player, "protection_bypass") then
|
||||
return allow_put and allow_put(pos, listname, index, stack, player) or
|
||||
stack:get_count()
|
||||
end
|
||||
return allow_put and allow_put(pos, listname, index, stack, player)
|
||||
or stack:get_count()
|
||||
|
||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
||||
playername, name, owner, minetest.pos_to_string(pos)
|
||||
))
|
||||
return 0
|
||||
end
|
||||
|
||||
local allow_take = def.allow_metadata_inventory_take
|
||||
|
@ -150,14 +154,16 @@ function homedecor.handle_inventory(name, def, original_def)
|
|||
local owner = meta:get_string("owner")
|
||||
local playername = player:get_player_name()
|
||||
|
||||
if (playername ~= owner) then
|
||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
||||
playername, name, owner, minetest.pos_to_string(pos)
|
||||
))
|
||||
return 0
|
||||
if playername == owner or
|
||||
minetest.check_player_privs(player, "protection_bypass") then
|
||||
return allow_take and allow_take(pos, listname, index, stack, player) or
|
||||
stack:get_count()
|
||||
end
|
||||
return allow_take and allow_take(pos, listname, index, stack, player)
|
||||
or stack:get_count()
|
||||
|
||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
||||
playername, name, owner, minetest.pos_to_string(pos)
|
||||
))
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -45,7 +45,9 @@ minetest.register_node("inbox:empty", {
|
|||
local meta = minetest.get_meta(pos)
|
||||
local player = clicker:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
if owner == player then
|
||||
if owner == player or
|
||||
minetest.check_player_privs(player, "protection_bypass") and
|
||||
clicker:get_player_control().aux1 then
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
|
|
|
@ -126,7 +126,8 @@ minetest.register_node("itemframes:frame",{
|
|||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if not itemstack then return end
|
||||
local meta = minetest.get_meta(pos)
|
||||
if clicker:get_player_name() == meta:get_string("owner") then
|
||||
if clicker:get_player_name() == meta:get_string("owner") or
|
||||
minetest.check_player_privs(clicker, "protection_bypass") then
|
||||
drop_item(pos,node)
|
||||
local s = itemstack:take_item()
|
||||
meta:set_string("item",s:to_string())
|
||||
|
@ -136,14 +137,16 @@ minetest.register_node("itemframes:frame",{
|
|||
end,
|
||||
on_punch = function(pos,node,puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if puncher:get_player_name() == meta:get_string("owner") then
|
||||
if puncher:get_player_name() == meta:get_string("owner") or
|
||||
minetest.check_player_privs(puncher, "protection_bypass") then
|
||||
drop_item(pos, node)
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local name = player and player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
return name == meta:get_string("owner")
|
||||
return name == meta:get_string("owner") or
|
||||
minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -183,7 +186,8 @@ minetest.register_node("itemframes:pedestal",{
|
|||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if not itemstack then return end
|
||||
local meta = minetest.get_meta(pos)
|
||||
if clicker:get_player_name() == meta:get_string("owner") then
|
||||
if clicker:get_player_name() == meta:get_string("owner") or
|
||||
minetest.check_player_privs(clicker, "protection_bypass") then
|
||||
drop_item(pos,node)
|
||||
local s = itemstack:take_item()
|
||||
meta:set_string("item",s:to_string())
|
||||
|
@ -193,14 +197,16 @@ minetest.register_node("itemframes:pedestal",{
|
|||
end,
|
||||
on_punch = function(pos,node,puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if puncher:get_player_name() == meta:get_string("owner") then
|
||||
if puncher:get_player_name() == meta:get_string("owner") or
|
||||
minetest.check_player_privs(puncher, "protection_bypass") then
|
||||
drop_item(pos,node)
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local name = player and player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
return name == meta:get_string("owner")
|
||||
return name == meta:get_string("owner") or
|
||||
minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
|
Loading…
Reference in New Issue
Block a user