From cc15431cb29363e6d7fcc5ba20bc1c48e67d56c2 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Thu, 15 Feb 2024 21:16:22 +0100 Subject: [PATCH] added yl_speak_up.npc_is_in_conversation / npc_is_in_conversation_with --- functions.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/functions.lua b/functions.lua index 101930f..ec44389 100644 --- a/functions.lua +++ b/functions.lua @@ -502,6 +502,29 @@ yl_speak_up.check_for_disambigous_results = function(n_id, pname) end +-- returns true if someone is speaking to the NPC +yl_speak_up.npc_is_in_conversation = function(n_id) + for name, data in pairs(yl_speak_up.speak_to) do + if(data and data.n_id and data.n_id == n_id) then + return true + end + end + return false +end + + +-- returns a list of players that are in conversation with this NPC +yl_speak_up.npc_is_in_conversation_with = function(n_id) + local liste = {} + for name, data in pairs(yl_speak_up.speak_to) do + if(data and data.n_id and data.n_id == n_id) then + table.insert(liste, name) + end + end + return liste +end + + -- Make the NPC talk -- assign n_ID