forked from Sokomine/yl_speak_up
add text from generic dialogs to start dialogs as well
This commit is contained in:
parent
6cb44d54e0
commit
4949afcd00
@ -346,20 +346,20 @@ yl_speak_up.add_generic_dialogs = function(dialog, current_n_id, player)
|
||||
if(not(dialog.n_dialogs[start_dialog_current].d_options)) then
|
||||
dialog.n_dialogs[start_dialog_current].d_options = {}
|
||||
end
|
||||
if(not(dialog.n_dialogs[start_dialog_current].d_text)) then
|
||||
dialog.n_dialogs[start_dialog_current].d_text = ""
|
||||
end
|
||||
|
||||
-- TODO: supply npc.self directly as parameter?
|
||||
|
||||
-- which generic dialogs shall be included?
|
||||
local n_id_list = yl_speak_up.calculate_available_generic_dialogs(current_n_id, player)
|
||||
-- TODO: just debug info
|
||||
-- minetest.chat_send_player("singleplayer", "Ok, generic option will be included: "..minetest.serialize(n_id_list))
|
||||
-- actually integrate those generic parts
|
||||
for i, n_id in ipairs(n_id_list) do
|
||||
-- add the dialogs as such first
|
||||
for d_id, d in pairs(yl_speak_up.generic_dialogs[n_id]) do
|
||||
-- no need to deep copy here - this is not added in edit mode
|
||||
dialog.n_dialogs[d_id] = d
|
||||
-- minetest.chat_send_player("singleplayer","copying d_id: "..tostring(d_id))
|
||||
end
|
||||
-- add the options so that these new dialogs can be accessed
|
||||
local d = yl_speak_up.generic_dialogs[n_id]["d_generic_start_dialog"]
|
||||
@ -367,10 +367,15 @@ yl_speak_up.add_generic_dialogs = function(dialog, current_n_id, player)
|
||||
for o_id, o in pairs(d.d_options) do
|
||||
-- actually insert the new option
|
||||
dialog.n_dialogs[start_dialog_current].d_options[o.o_id] = o
|
||||
-- minetest.chat_send_player("singleplayer","injecting option "..tostring(o_id).." into "..tostring(start_dialog_current)..": "..minetest.serialize(o))
|
||||
end
|
||||
end
|
||||
-- TODO: add necessary texts
|
||||
-- add text from those new dialogs so that the player can know what the
|
||||
-- new options are actually about
|
||||
if(d and d.d_text and d.d_text ~= "") then
|
||||
dialog.n_dialogs[start_dialog_current].d_text =
|
||||
dialog.n_dialogs[start_dialog_current].d_text.."\n"..d.d_text
|
||||
end
|
||||
|
||||
end
|
||||
-- TODO: deal with d_got_item
|
||||
return dialog
|
||||
|
Loading…
Reference in New Issue
Block a user