1
0
mirror of https://github.com/mt-mods/signs_lib.git synced 2024-12-25 00:30:18 +01:00

add protection and ownership checks to default metal sign

This commit is contained in:
Vanessa Dannenberg 2019-05-25 04:45:30 -04:00
parent 34a7242616
commit dfa47c2519

View File

@ -920,7 +920,6 @@ minetest.register_node(":locked_sign:sign_wall_locked", {
-- default metal sign, if defined
if minetest.registered_nodes["default:sign_wall_steel"] then
minetest.register_node(":"..default_sign_metal, {
description = S("Sign"),
inventory_image = default_sign_metal_image,
@ -944,14 +943,29 @@ if minetest.registered_nodes["default:sign_wall_steel"] then
signs_lib.destruct_sign(pos)
end,
on_receive_fields = function(pos, formname, fields, sender)
signs_lib.receive_fields(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local pname = sender:get_player_name() or ""
if pname ~= owner and pname ~= minetest.settings:get("name")
and not minetest.check_player_privs(pname, {sign_editor=true}) then
return
end
signs_lib.receive_fields(pos, formname, fields, sender, true)
end,
on_punch = function(pos, node, puncher)
signs_lib.update_sign(pos,nil,nil,node)
end,
on_rotate = signs_lib.wallmounted_rotate
})
on_rotate = function(pos, node, user, mode)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if owner == user:get_player_name() then
signs_lib.wallmounted_rotate(pos, node, user, mode)
else
return false
end
end
})
-- metal, colored signs
if enable_colored_metal_signs then