forked from your-land-mirror/yl_speak_up
added update_start_dialog for ink import
This commit is contained in:
parent
7ce56ca733
commit
543c767dd5
@ -230,7 +230,7 @@ yl_speak_up.get_fs_export = function(player, param)
|
|||||||
end
|
end
|
||||||
return table.concat({"size[20,20]label[4,0.5;Export of NPC ",
|
return table.concat({"size[20,20]label[4,0.5;Export of NPC ",
|
||||||
minetest.formspec_escape(n_id or "- ? -"),
|
minetest.formspec_escape(n_id or "- ? -"),
|
||||||
"dialog data in .json format]",
|
" dialog data in .json format]",
|
||||||
"button[17.8,0.2;2.0,0.9;back;Back]",
|
"button[17.8,0.2;2.0,0.9;back;Back]",
|
||||||
"button[15.4,0.2;2.0,0.9;import;Import]",
|
"button[15.4,0.2;2.0,0.9;import;Import]",
|
||||||
"tooltip[import;WARNING: This is highly experimental and requires the \"privs\" priv.\n"..
|
"tooltip[import;WARNING: This is highly experimental and requires the \"privs\" priv.\n"..
|
||||||
|
@ -264,6 +264,27 @@ yl_speak_up.update_dialog_options_completed = function(log, dialog, d_id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- make sure only one dialog has d_sort set to 0 (and is thus the start dialog)
|
||||||
|
yl_speak_up.update_start_dialog = function(log, dialog, start_dialog_name)
|
||||||
|
local start_d_id = yl_speak_up.d_name_to_d_id(dialog, start_dialog_name)
|
||||||
|
if(not(start_d_id)) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for d_id, d in pairs(dialog.n_dialogs) do
|
||||||
|
if(d_id == start_d_id) then
|
||||||
|
if(not(d.d_sort) or d.d_sort ~= 0) then
|
||||||
|
table.insert(log, "Setting start dialog to "..tostring(start_dialog_name)..".")
|
||||||
|
end
|
||||||
|
d.d_sort = 0
|
||||||
|
-- the start dialog certainly is *a* start dialog (with the buttons)
|
||||||
|
d.is_a_start_dialog = true
|
||||||
|
elseif(not(d.d_sort) or d.d_sort == 0) then
|
||||||
|
-- all other dialogs are not *the* start dialog
|
||||||
|
d.d_sort = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- add a new option/answer to dialog d_id with option_text (or default "")
|
-- add a new option/answer to dialog d_id with option_text (or default "")
|
||||||
-- option_text (optional) the text that shall be shown as option/answer
|
-- option_text (optional) the text that shall be shown as option/answer
|
||||||
|
Loading…
Reference in New Issue
Block a user