fix on_receive_fieldss: check for protection and do not set meta if that field is nil, eg.g because of pressing escape

This commit is contained in:
HybridDog
2016-04-27 18:42:20 +02:00
parent e4ed8a50ee
commit 3c99c37f44
7 changed files with 40 additions and 33 deletions

View File

@ -75,10 +75,11 @@ minetest.register_node("moremesecons_sayer:sayer", {
},
groups = {dig_immediate = 2},
on_construct = function(pos)
minetest.get_meta(pos):set_string("formspec", "field[text;text;${text}]")
minetest.get_meta(pos):set_string("formspec", "field[text;text;${text}]")
end,
on_receive_fields = function(pos, _, fields)
if fields.text then
on_receive_fields = function(pos, _, fields, player)
if fields.text
and not minetest.is_protected(pos, player:get_player_name()) then
minetest.get_meta(pos):set_string("text", fields.text)
end
end,