mirror of
https://codeberg.org/minenux/minetest-mod-xdecor
synced 2023-10-20 21:43:39 -07:00
Fix a few issues with itemframe #85
This commit is contained in:
parent
3c46a5ddb7
commit
6c7a75ede3
@ -69,9 +69,11 @@ end
|
|||||||
|
|
||||||
function itemframe.rightclick(pos, node, clicker, itemstack)
|
function itemframe.rightclick(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local player = clicker:get_player_name()
|
local player_name = clicker:get_player_name()
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
if player ~= owner or not itemstack then
|
local admin = minetest.check_player_privs(player_name, "protection_bypass")
|
||||||
|
|
||||||
|
if not admin and (player_name ~= owner or not itemstack) then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -85,19 +87,22 @@ end
|
|||||||
|
|
||||||
function itemframe.punch(pos, node, puncher)
|
function itemframe.punch(pos, node, puncher)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local player = puncher:get_player_name()
|
local player_name = puncher:get_player_name()
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
|
local admin = minetest.check_player_privs(player_name, "protection_bypass")
|
||||||
|
|
||||||
if player ~= owner then return end
|
if not admin and player_name ~= owner then return end
|
||||||
drop_item(pos, node)
|
drop_item(pos, node)
|
||||||
end
|
end
|
||||||
|
|
||||||
function itemframe.dig(pos, player)
|
function itemframe.dig(pos, player)
|
||||||
|
if not player then return end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local pname = player and player:get_player_name()
|
local player_name = player and player:get_player_name()
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
|
local admin = minetest.check_player_privs(player_name, "protection_bypass")
|
||||||
|
|
||||||
return pname == owner
|
return admin or player_name == owner
|
||||||
end
|
end
|
||||||
|
|
||||||
xdecor.register("itemframe", {
|
xdecor.register("itemframe", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user