forked from Sokomine/yl_speak_up
prepared better assignment of quest steps to npc
This commit is contained in:
parent
ce067bf18e
commit
b7423b0d81
@ -621,6 +621,54 @@ yl_speak_up.get_fs_add_quest_steps = function(player, param)
|
||||
step_data, required_for_steps)
|
||||
table.insert(formspec, "label[0.2,7.5;(Click on an entry to delete it from the list above.)]")
|
||||
y_pos = 8.3
|
||||
-- add a quest step to an NPC or location
|
||||
elseif(mode == "assign_quest_step") then
|
||||
-- what are we talking about?
|
||||
local n_id = yl_speak_up.speak_to[pname].n_id
|
||||
local d_id = yl_speak_up.speak_to[pname].d_id
|
||||
local o_id = yl_speak_up.speak_to[pname].o_id
|
||||
local dialog = yl_speak_up.speak_to[pname].dialog
|
||||
local name_txt = "- ? -"
|
||||
local dialog_txt = "- ? -"
|
||||
local option_txt = "- ? -"
|
||||
if(dialog and dialog.n_dialogs and d_id and o_id
|
||||
and dialog.n_dialogs[d_id]
|
||||
and dialog.n_dialogs[d_id].d_options
|
||||
and dialog.n_dialogs[d_id].d_options[o_id]) then
|
||||
dialog_txt = dialog.n_dialogs[d_id].d_text or "- ? -"
|
||||
option_txt = dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_met or "- ? -"
|
||||
name_txt = (dialog.n_npc or "- ? -")
|
||||
if(dialog.n_description and dialog.n_description ~= "") then
|
||||
name_txt = name_txt..", "..tostring(dialog.n_description)
|
||||
end
|
||||
end
|
||||
-- are we dealing with an NPC?
|
||||
local id_label = "the block at position "
|
||||
if(n_id and string.sub(n_id, 1, 2) == "n_") then
|
||||
id_label = "NPC "
|
||||
end
|
||||
|
||||
table.insert(formspec, "label[0.2,3.3;which will be set by ")
|
||||
table.insert(formspec, id_label)
|
||||
table.insert(formspec, minetest.colorize("#AAAAFF", minetest.formspec_escape(n_id)))
|
||||
table.insert(formspec, ":]")
|
||||
table.insert(formspec, "label[1.0,3.7;")
|
||||
table.insert(formspec, minetest.colorize("#AAAAFF", minetest.formspec_escape(name_txt)))
|
||||
table.insert(formspec, "]")
|
||||
table.insert(formspec, "label[0.2,4.2;when answering to dialog ")
|
||||
table.insert(formspec, minetest.colorize("#AAAAFF", minetest.formspec_escape(d_id)))
|
||||
table.insert(formspec, ":]")
|
||||
table.insert(formspec, "textarea[1.0,4.4;16,1.8;;;")
|
||||
table.insert(formspec, minetest.formspec_escape(dialog_txt))
|
||||
table.insert(formspec, "]")
|
||||
table.insert(formspec, "label[0.2,6.5;with the following answer/option ")
|
||||
table.insert(formspec, minetest.colorize("#AAAAFF", minetest.formspec_escape(o_id)))
|
||||
table.insert(formspec, ":]")
|
||||
table.insert(formspec, "label[1.0,6.9;")
|
||||
table.insert(formspec, minetest.colorize("#AAAAFF", minetest.formspec_escape(option_txt)))
|
||||
table.insert(formspec, "]")
|
||||
y_pos = 7.8
|
||||
|
||||
-- which NPC may contribute to the quest?
|
||||
elseif(mode == "manage_quest_npcs") then
|
||||
table.insert(formspec, "container[0,3.3;18,6]")
|
||||
|
Loading…
Reference in New Issue
Block a user