show some quest steps in quest overview

This commit is contained in:
Sokomine 2023-09-25 00:19:47 +02:00
parent 314c637aae
commit 234a18efff

View File

@ -69,7 +69,8 @@ yl_speak_up.get_fs_manage_quests = function(player, param)
local index = table.indexof(quest_list, param) local index = table.indexof(quest_list, param)
yl_speak_up.speak_to[pname].tmp_index_general = index + 1 yl_speak_up.speak_to[pname].tmp_index_general = index + 1
end end
table.insert(formspec, "size[18,12]".. table.insert(formspec, "size[30,12]"..
"container[6,0;18.5,12]"..
"label[0.2,1.2;A quest is a linear sequence of quest steps. Quests can ".. "label[0.2,1.2;A quest is a linear sequence of quest steps. Quests can "..
"depend on and influence other quests.\n".. "depend on and influence other quests.\n"..
"Progress for each player is stored in a variable. The name of ".. "Progress for each player is stored in a variable. The name of "..
@ -87,6 +88,7 @@ yl_speak_up.get_fs_manage_quests = function(player, param)
"If you click here, the selected quest will be deleted.\n".. "If you click here, the selected quest will be deleted.\n"..
"This will only be possible if it's not used anywhere.") "This will only be possible if it's not used anywhere.")
if(not(selected) or selected == "") then if(not(selected) or selected == "") then
table.insert(formspec, "container_end[]")
return table.concat(formspec, "") return table.concat(formspec, "")
end end
local var_name = yl_speak_up.restore_complete_var_name(selected, pname) local var_name = yl_speak_up.restore_complete_var_name(selected, pname)
@ -124,15 +126,13 @@ yl_speak_up.get_fs_manage_quests = function(player, param)
table.insert(formspec, "button[3.5,6.5;4.0,0.8;save_changes;TODO Save changes]") table.insert(formspec, "button[3.5,6.5;4.0,0.8;save_changes;TODO Save changes]")
table.insert(formspec, "scroll_container_end[]") table.insert(formspec, "scroll_container_end[]")
table.insert(formspec, "container_end[]")
-- TODO: make the content of the fields and textareas more readable (more contrast) -- TODO: make the content of the fields and textareas more readable (more contrast)
-- TODO: actually process and store changed entries -- TODO: actually process and store changed entries
--[[ --[[
-- TODO: entries that are not yet shown: -- TODO: entries that are not yet shown:
quest.var_name = var_name -- name of the variable where progress is stored for each player quest.var_name = var_name -- name of the variable where progress is stored for each player
quest.step_data = {} -- table containing information about a quest step (=key)
-- this may also be information about WHERE a quest step shall
-- take place
quest.subquests = {} -- list of other quest_ids that contribute to this quest quest.subquests = {} -- list of other quest_ids that contribute to this quest
-- -> determined from quests.npcs and quests.locations -- -> determined from quests.npcs and quests.locations
quest.is_subquest_of = {} -- list of quest_ids this quest contributes to quest.is_subquest_of = {} -- list of quest_ids this quest contributes to
@ -149,6 +149,33 @@ yl_speak_up.get_fs_manage_quests = function(player, param)
quest.solved_by = {} -- list of names of players that solved the quest at least once quest.solved_by = {} -- list of names of players that solved the quest at least once
--]] --]]
-- left side: quest steps
-- quest.step_data = {}
-- table containing information about a quest step (=key)
-- this may also be information about WHERE a quest step shall take place
table.insert(formspec, "button[0.1,0.1;5.6,0.8;show_step_list;Show all quest steps]")
local lists = yl_speak_up.quest_step_get_start_end_unconnected_lists(quest.step_data or {})
yl_speak_up.get_fs_show_list_in_box(formspec,
"Start steps:", "select_from_start_steps", lists.start_steps,
"0.1", "1.0", "5.6", "3.5", 0, nil, "#AAFFAA",
"The quest begins with this (or one of these) steps.\n"..
"You need at least one start step.",
nil)
yl_speak_up.get_fs_show_list_in_box(formspec,
"Unconnected steps:", "select_from_unconnected_steps", lists.unconnected_steps,
"0.1", "4.5", "5.6", "3.5", 0, nil, "#FFAAAA",
"These steps are not used yet. They are not required\n"..
"by any other step and do not require steps either.\n"..
"Please decide what to do with them!",
nil)
yl_speak_up.get_fs_show_list_in_box(formspec,
"Quest ends with steps:", "select_from_end_steps", lists.end_steps,
"0.1", "8.0", "5.6", "3.5", "0.1", nil, "#AAFFAA",
"This quest ends with these steps. They are not required\n"..
"by any other steps and have no successor.\n"..
"Your quest needs at least one end step.",
nil)
-- store the quest ID so that we know what we're working at -- store the quest ID so that we know what we're working at
yl_speak_up.speak_to[pname].q_id = quest.id yl_speak_up.speak_to[pname].q_id = quest.id
return table.concat(formspec, "") return table.concat(formspec, "")