mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-22 16:10:18 +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 owner = meta:get_string("owner")
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
|
|
||||||
if (playername ~= owner) then
|
if playername == owner or
|
||||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
minetest.check_player_privs(player, "protection_bypass") then
|
||||||
playername, name, owner, minetest.pos_to_string(pos)
|
return allow_move and
|
||||||
))
|
allow_move(pos, from_list, from_index, to_list, to_index, count, player) or
|
||||||
return 0
|
count
|
||||||
end
|
end
|
||||||
|
|
||||||
return allow_move and allow_move(pos, from_list, from_index, to_list, to_index, count, player)
|
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
||||||
or count
|
playername, name, owner, minetest.pos_to_string(pos)
|
||||||
|
))
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local allow_put = def.allow_metadata_inventory_put
|
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 owner = meta:get_string("owner")
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
|
|
||||||
if (playername ~= owner) then
|
if playername == owner or
|
||||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
minetest.check_player_privs(player, "protection_bypass") then
|
||||||
playername, name, owner, minetest.pos_to_string(pos)
|
return allow_put and allow_put(pos, listname, index, stack, player) or
|
||||||
))
|
stack:get_count()
|
||||||
return 0
|
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
local allow_take = def.allow_metadata_inventory_take
|
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 owner = meta:get_string("owner")
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
|
|
||||||
if (playername ~= owner) then
|
if playername == owner or
|
||||||
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
|
minetest.check_player_privs(player, "protection_bypass") then
|
||||||
playername, name, owner, minetest.pos_to_string(pos)
|
return allow_take and allow_take(pos, listname, index, stack, player) or
|
||||||
))
|
stack:get_count()
|
||||||
return 0
|
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,7 +45,9 @@ minetest.register_node("inbox:empty", {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local player = clicker:get_player_name()
|
local player = clicker:get_player_name()
|
||||||
local owner = meta:get_string("owner")
|
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(
|
minetest.show_formspec(
|
||||||
clicker:get_player_name(),
|
clicker:get_player_name(),
|
||||||
"default:chest_locked",
|
"default:chest_locked",
|
||||||
|
@ -126,7 +126,8 @@ minetest.register_node("itemframes:frame",{
|
|||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if not itemstack then return end
|
if not itemstack then return end
|
||||||
local meta = minetest.get_meta(pos)
|
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)
|
drop_item(pos,node)
|
||||||
local s = itemstack:take_item()
|
local s = itemstack:take_item()
|
||||||
meta:set_string("item",s:to_string())
|
meta:set_string("item",s:to_string())
|
||||||
@ -136,14 +137,16 @@ minetest.register_node("itemframes:frame",{
|
|||||||
end,
|
end,
|
||||||
on_punch = function(pos,node,puncher)
|
on_punch = function(pos,node,puncher)
|
||||||
local meta = minetest.get_meta(pos)
|
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)
|
drop_item(pos, node)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
local name = player and player:get_player_name()
|
local name = player and player:get_player_name()
|
||||||
local meta = minetest.get_meta(pos)
|
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,
|
end,
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -183,7 +186,8 @@ minetest.register_node("itemframes:pedestal",{
|
|||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if not itemstack then return end
|
if not itemstack then return end
|
||||||
local meta = minetest.get_meta(pos)
|
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)
|
drop_item(pos,node)
|
||||||
local s = itemstack:take_item()
|
local s = itemstack:take_item()
|
||||||
meta:set_string("item",s:to_string())
|
meta:set_string("item",s:to_string())
|
||||||
@ -193,14 +197,16 @@ minetest.register_node("itemframes:pedestal",{
|
|||||||
end,
|
end,
|
||||||
on_punch = function(pos,node,puncher)
|
on_punch = function(pos,node,puncher)
|
||||||
local meta = minetest.get_meta(pos)
|
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)
|
drop_item(pos,node)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
local name = player and player:get_player_name()
|
local name = player and player:get_player_name()
|
||||||
local meta = minetest.get_meta(pos)
|
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,
|
end,
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user