do not count d_dynamic when counting amount of dialogs for initial setup or dialog deletion

This commit is contained in:
Sokomine 2024-02-17 04:13:09 +01:00
parent 20735916c1
commit 2329724ef2
4 changed files with 12 additions and 4 deletions

View File

@ -79,11 +79,14 @@ yl_speak_up.generate_next_dynamic_dialog = function(player, n_id, d_id, alternat
if(not(yl_speak_up.speak_to[pname])) then
return
end
local dialog = yl_speak_up.speak_to[pname].dialog
if(not(dialog.n_dialogs["d_dynamic"])) then
dialog.n_dialogs["d_dynamic"] = {}
end
-- which dialog did the player come from?
local prev_d_id = yl_speak_up.speak_to[pname].d_id
local selected_o_id = yl_speak_up.speak_to[pname].selected_o_id
-- the text the NPC shall say:
local dialog = yl_speak_up.speak_to[pname].dialog
local prev_answer = "- unknown -"
local tmp_topic = "- none -"
if(dialog.n_dialogs[prev_d_id]

View File

@ -338,7 +338,8 @@ yl_speak_up.edit_mode_apply_changes = function(pname, fields)
end
end
-- there needs to be one dialog left after deleting this one,
if(#sorted_list > 1
-- (as there is always d_dynamic we need to leave *two* dialogs)
if(#sorted_list > 2
-- this dialog isn't allowed to hold any more options/answers
and anz_options == 0
-- we really found a new dialog to show

View File

@ -85,7 +85,9 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
local count = 0
if(dialog and dialog.n_dialogs) then
for k,v in pairs(dialog.n_dialogs) do
count = count + 1
if(k and k ~= "d_dynamic") then
count = count + 1
end
end
end

View File

@ -41,7 +41,9 @@ yl_speak_up.initialize_npc_dialog_once = function(pname, dialog, n_id, npc_name,
local count = 0
if(dialog and dialog.n_dialogs) then
for k,v in pairs(dialog.n_dialogs) do
count = count + 1
if(k and k ~= "d_dynamic") then
count = count + 1
end
end
end