check if the player is allowed to edit the npc before applying changes

This commit is contained in:
Sokomine 2022-04-22 21:43:34 +02:00
parent f3573e746f
commit f8138908bc

View File

@ -59,6 +59,11 @@ yl_speak_up.edit_mode_apply_changes = function(pname, fields)
local d_id = yl_speak_up.speak_to[pname].d_id
local dialog = yl_speak_up.speak_to[pname].dialog
-- check if the player is allowed to edit this NPC
if(not(yl_speak_up.may_edit_npc(minetest.get_player_by_name(pname), n_id))) then
return
end
-- this way we can store the actual changes and present them to the player for saving
if(not(yl_speak_up.npc_was_changed[ n_id ])) then
yl_speak_up.npc_was_changed[ n_id ] = {}