From f8138908bc89859f5d0495b3220e1089a76313e6 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Fri, 22 Apr 2022 21:43:34 +0200 Subject: [PATCH] check if the player is allowed to edit the npc before applying changes --- edit_mode_apply_changes.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/edit_mode_apply_changes.lua b/edit_mode_apply_changes.lua index 4bd6747..579aae6 100644 --- a/edit_mode_apply_changes.lua +++ b/edit_mode_apply_changes.lua @@ -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 ] = {}