make more use of yl_speak_up.quest_step_show_table_decorated

This commit is contained in:
Sokomine 2023-09-23 23:14:43 +02:00
parent 5e8e31876c
commit e2ed6263ac

View File

@ -271,7 +271,8 @@ end
yl_speak_up.quest_step_show_table_decorated = function(formspec, yl_speak_up.quest_step_show_table_decorated = function(formspec,
label, field_name, liste, start_x, start_y, width, height, tooltip_text, add_lines) label, field_name, liste, start_x, start_y, width, height, label_ident,
tooltip_text, add_lines)
local dim_str = tostring(width)..","..tostring(height) local dim_str = tostring(width)..","..tostring(height)
table.insert(formspec, "container[") table.insert(formspec, "container[")
table.insert(formspec, tostring(start_x)..","..tostring(start_y)..";") table.insert(formspec, tostring(start_x)..","..tostring(start_y)..";")
@ -281,12 +282,18 @@ yl_speak_up.quest_step_show_table_decorated = function(formspec,
table.insert(formspec, dim_str) table.insert(formspec, dim_str)
table.insert(formspec, ";#666666") table.insert(formspec, ";#666666")
table.insert(formspec, "]") table.insert(formspec, "]")
table.insert(formspec, "label[0.1,0.5;") -- add buttons etc. first so that the label remains visible on top
if(add_lines) then
table.insert(formspec, add_lines)
end
table.insert(formspec, "label[")
table.insert(formspec, tostring(0.1 + label_ident))
table.insert(formspec, ",0.5;")
table.insert(formspec, label) table.insert(formspec, label)
table.insert(formspec, "]") table.insert(formspec, "]")
yl_speak_up.quest_step_show_table(formspec, yl_speak_up.quest_step_show_table(formspec,
"0.1,0.7;"..tostring(width-0.2)..","..tostring(height-0.8)..";"..tostring(field_name)..";", "0.1,0.7;"..tostring(width-0.2)..","..tostring(height-0.8)..";"..tostring(field_name)..";",
liste) liste or {})
if(tooltip_text and tooltip_text ~= "") then if(tooltip_text and tooltip_text ~= "") then
table.insert(formspec, "tooltip[") table.insert(formspec, "tooltip[")
table.insert(formspec, field_name) table.insert(formspec, field_name)
@ -295,9 +302,6 @@ yl_speak_up.quest_step_show_table_decorated = function(formspec,
table.insert(formspec, "\n\nClick on an element to select it.") table.insert(formspec, "\n\nClick on an element to select it.")
table.insert(formspec, "]") table.insert(formspec, "]")
end end
if(add_lines) then
table.insert(formspec, add_lines)
end
table.insert(formspec, "container_end[]") table.insert(formspec, "container_end[]")
end end
@ -351,20 +355,20 @@ yl_speak_up.get_fs_manage_quest_steps = function(player, param)
local lists = yl_speak_up.quest_step_get_start_end_unconnected_lists(step_data) local lists = yl_speak_up.quest_step_get_start_end_unconnected_lists(step_data)
yl_speak_up.quest_step_show_table_decorated(formspec, yl_speak_up.quest_step_show_table_decorated(formspec,
"Start steps:", "TODO_select_from_start_steps", lists.start_steps, "Start steps:", "TODO_select_from_start_steps", lists.start_steps,
"0.1", "2.7", "5.6", "3.5", "0.1", "2.7", "5.6", "4.3", 0,
"The quest begins with this (or one of these) steps.\n".. "The quest begins with this (or one of these) steps.\n"..
"You need at least one start step.", "You need at least one start step.",
nil) nil)
yl_speak_up.quest_step_show_table_decorated(formspec, yl_speak_up.quest_step_show_table_decorated(formspec,
"Unconnected steps:", "TODO_select_from_unconnected_steps", lists.unconnected_steps, "Unconnected steps:", "TODO_select_from_unconnected_steps", lists.unconnected_steps,
"0.1", "6.2", "5.6", "3.5", "0.1", "7.0", "5.6", "4.3", 0,
"These steps are not used yet. They are not required\n".. "These steps are not used yet. They are not required\n"..
"by any other steps and do not require steps either.\n".. "by any other steps and do not require steps either.\n"..
"Please decide what to do with them!", "Please decide what to do with them!",
nil) nil)
yl_speak_up.quest_step_show_table_decorated(formspec, yl_speak_up.quest_step_show_table_decorated(formspec,
"Quest ends with steps:", "TODO_select_from_end_steps", lists.end_steps, "Quest ends with steps:", "TODO_select_from_end_steps", lists.end_steps,
"23.8", "2.7", "5.6", "7.0", "24", "2.7", "5.6", "8.5", "0.1",
"This quest ends with these steps. They are not required\n".. "This quest ends with these steps. They are not required\n"..
"by any other steps and have no successor.\n".. "by any other steps and have no successor.\n"..
"Your quest needs at least one end step.", "Your quest needs at least one end step.",
@ -389,38 +393,34 @@ yl_speak_up.get_fs_manage_quest_steps = function(player, param)
"label[0.2,2.0;"..em("Required previous").."]".. "label[0.2,2.0;"..em("Required previous").."]"..
"label[0.2,2.4;quest step(s):]".. "label[0.2,2.4;quest step(s):]"..
"style[insert_before_next_step,insert_after_prev_step,".. "style[insert_before_next_step,insert_after_prev_step,"..
"add_to_one_needed,add_to_all_needed;bgcolor=blue;textcolor=yellow]".. "add_to_one_needed,add_to_all_needed;bgcolor=blue;textcolor=yellow]")
"container[0.1,2.7;5.6,10.8]".. yl_speak_up.quest_step_show_table_decorated(formspec,
"box[0,0;5.6,8.5;#666666]".. em("One of").." these quest steps:", "one_step_required",
"button[4.6,0.0;0.94,0.7;add_to_one_needed;Edit]".. step_data[selected].one_step_required,
"tooltip[add_to_one_needed;Add or remove a quest step to this list.]".. "0.1", "2.7", "5.6", "4.3", 0,
"label[0.1,0.5;"..em("One of").." these quest steps:]") "At least "..em("one of").." these previous quest steps listed here has to be\n"..
yl_speak_up.quest_step_show_table(formspec, "0.1,0.7;5.4,2.7;one_step_required;",
step_data[selected].one_step_required or {})
table.insert(formspec, "tooltip[one_step_required;"..
"At least "..em("one of").." these previous quest steps listed ".. "here has to be\n"..
"achieved by the player who is trying to solve this quest.\n".. "achieved by the player who is trying to solve this quest.\n"..
"Only then can the player try to achieve this current quest\n".. "Only then can the player try to achieve this current quest\n"..
"step that you are editing here.\n".. "step that you are editing here.\n"..
"If this is empty, then it's usually the/a first step of the quest.\n".. "If this is empty, then it's usually the/a first step of the quest.\n"..
"If there is one entry, then that entry is the previous quest step.\n".. "If there is one entry, then that entry is the previous quest step.\n"..
"If there are multiple entries, then players have alternate ways\n".. "If there are multiple entries, then players have alternate ways\n"..
"to achieve this current quest step here.]") "to achieve this current quest step here.",
"button[4.6,0.0;0.94,0.7;add_to_one_needed;Edit]"..
table.insert(formspec, "label[0.1,4.0;"..em("All of").." these quest steps:]".. "tooltip[add_to_one_needed;Add or remove a quest step to this list.]")
"button[4.6,3.5;0.94,0.7;add_to_all_needed;Edit]".. yl_speak_up.quest_step_show_table_decorated(formspec,
"tooltip[add_to_all_needed;Add or remove a quest step to this list.]") em("All of").." these quest steps:", "all_steps_required",
yl_speak_up.quest_step_show_table(formspec, "0.1,4.2;5.4,4.0;all_steps_required;", step_data[selected].all_steps_required,
step_data[selected].all_steps_required or {}) "0.1", "7.0", "5.6", "4.3", 0,
table.insert(formspec, "tooltip[all_steps_required;"..
"Sometimes there may not be a particular order in which\n".. "Sometimes there may not be a particular order in which\n"..
"quest steps ought to be solved. Imagine for example getting\n".. "quest steps ought to be solved. Imagine for example getting\n"..
"indigrents for a cake and delivering them to an NPC.\n".. "indigrents for a cake and delivering them to an NPC.\n"..
"The quest steps listed here can be done in "..em("any order")..".\n".. "The quest steps listed here can be done in "..em("any order")..".\n"..
"They have "..em("all").." to be achieved first in order for this current\n".. "They have "..em("all").." to be achieved first in order for this current\n"..
"quest step to become available.\n".. "quest step to become available.\n"..
"Usually this list is empty.]".. "Usually this list is empty.",
"container_end[]") "button[4.6,0.0;0.94,0.7;add_to_all_needed;Edit]"..
"tooltip[add_to_all_needed;Add or remove a quest step to this list.]")
if( #step_data[selected].one_step_required > 0 if( #step_data[selected].one_step_required > 0
or #step_data[selected].all_steps_required > 0) then or #step_data[selected].all_steps_required > 0) then
if( #step_data[selected].one_step_required if( #step_data[selected].one_step_required
@ -454,20 +454,18 @@ yl_speak_up.get_fs_manage_quest_steps = function(player, param)
-- right side (next quest step) -- right side (next quest step)
table.insert(formspec, "container[23.8,0;5.8,13.5]".. table.insert(formspec, "container[23.8,0;5.8,13.5]"..
"label[0.6,2.0;Achieving this quest step]".. "label[0.6,2.0;Achieving this quest step]"..
"label[0.6,2.4;"..em("helps").." the quester to:]".. "label[0.6,2.4;"..em("helps").." the quester to:]")
"container[0.4,2.7;5.6,10.8]".. yl_speak_up.quest_step_show_table_decorated(formspec,
"box[0,0;5.6,8.5;#666666]".. "get these quest step(s) "..em("next")..":", "next_steps_show",
"label[0.2,0.5;get these quest step(s) "..em("next")..":]") required_for,
yl_speak_up.quest_step_show_table(formspec, "0.1,0.7;5.4,7.7;next_steps_show;", -- the label needs to be moved slightly to the right to make room for the > button
required_for or {}) "0.4", "2.7", "5.6", "8.5", "0.1",
table.insert(formspec, "tooltip[next_steps_show;"..
"Once the current quest step has been achieved by the\n".. "Once the current quest step has been achieved by the\n"..
"player, the player can strive to achieve these next\n".. "player, the player can strive to achieve these next\n"..
"quest step(s).\n".. "quest step(s).\n"..
"If this is empty, then it's either the/a last step (quest\n".. "If this is empty, then it's either the/a last step (quest\n"..
"solved!) - or the quest is not properly set up.]") "solved!) - or the quest is not properly set up.",
table.insert(formspec, "container_end[]") nil)
if(required_for and #required_for > 0) then if(required_for and #required_for > 0) then
if(#required_for > 1) then if(#required_for > 1) then