From 9797ada402445fa0b3c606afe84c0bd22410c231 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sun, 15 Dec 2024 16:57:27 +0100 Subject: [PATCH] #5266 check if npc for npc_talk_privs exists --- npc_privs.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/npc_privs.lua b/npc_privs.lua index b0cdf93..d4b3fb5 100644 --- a/npc_privs.lua +++ b/npc_privs.lua @@ -114,6 +114,12 @@ yl_speak_up.command_npc_talk_privs = function(pname, param) table.concat(yl_speak_up.npc_priv_names, ", ")..".") return end + -- revoking privs of nonexistant NPC is allowed - but not granting them privs + if(command == "grant" and not(yl_speak_up.npc_list[n_id])) then + minetest.chat_send_player(pname, + "Unknown NPC \""..tostring(n_id).."\".\n") + return + end if(command == "grant" and not(yl_speak_up.npc_priv_table[n_id])) then yl_speak_up.npc_priv_table[n_id] = {} end