Version MFF.

This commit is contained in:
sys4-fr 2018-09-08 00:02:29 +02:00
parent ebb9647f08
commit 17540e9aeb
5 changed files with 8 additions and 9 deletions

0
README.txt Normal file → Executable file
View File

0
depends.txt Normal file → Executable file
View File

17
init.lua Normal file → Executable file
View File

@ -21,34 +21,33 @@ minetest.register_node("locked_sign:sign_wall_locked", {
legacy_wallmounted = true, legacy_wallmounted = true,
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "") meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "\"\" (owned by " .. placer:get_player_name() .. ")") meta:set_string("infotext", "\"\" (owned by " .. placer:get_player_name() .. ")")
end, end,
on_construct = function(pos) on_construct = function(pos)
--local n = minetest.env:get_node(pos) --local n = minetest.get_node(pos)
local meta = minetest.env:get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]") meta:set_string("formspec", "field[text;;${text}]")
meta:set_string("infotext", "\"\"") meta:set_string("infotext", "\"\"")
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos); local meta = minetest.get_meta(pos);
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local pname = player:get_player_name() local pname = player:get_player_name()
return pname == owner or pname == minetest.setting_get("name") return pname == owner or pname == minetest.setting_get("name")
or minetest.check_player_privs(pname, {sign_editor=true}) or minetest.check_player_privs(pname, {sign_editor=true})
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local pname = sender:get_player_name() local pname = sender:get_player_name()
if pname ~= owner and pname ~= minetest.setting_get("name") if pname ~= owner and pname ~= minetest.setting_get("name") then
and not minetest.check_player_privs(pname, {sign_editor=true}) then
return return
end end
local meta = minetest.env:get_meta(pos) local meta = minetest.get_meta(pos)
fields.text = fields.text or "" fields.text = fields.text or ""
print((sender:get_player_name() or "").." wrote \""..fields.text.. minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text..
"\" to sign at "..minetest.pos_to_string(pos)) "\" to sign at "..minetest.pos_to_string(pos))
meta:set_string("text", fields.text) meta:set_string("text", fields.text)
meta:set_string("infotext", "\"" .. fields.text .. "\" (owned by " .. sender:get_player_name() .. ")") meta:set_string("infotext", "\"" .. fields.text .. "\" (owned by " .. sender:get_player_name() .. ")")

BIN
textures/MineToon/locked_sign_sign_wall_lock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 545 B

BIN
textures/locked_sign_sign_wall_lock.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 12 KiB