added yl_speak_up.quest_step_show_table_decorated

This commit is contained in:
Sokomine 2023-09-23 22:28:33 +02:00
parent 1347fb1bdb
commit 5e8e31876c

View File

@ -270,6 +270,38 @@ yl_speak_up.quest_step_show_table = function(formspec, table_specs, liste)
end
yl_speak_up.quest_step_show_table_decorated = function(formspec,
label, field_name, liste, start_x, start_y, width, height, tooltip_text, add_lines)
local dim_str = tostring(width)..","..tostring(height)
table.insert(formspec, "container[")
table.insert(formspec, tostring(start_x)..","..tostring(start_y)..";")
table.insert(formspec, dim_str)
table.insert(formspec, "]")
table.insert(formspec, "box[0,0;")
table.insert(formspec, dim_str)
table.insert(formspec, ";#666666")
table.insert(formspec, "]")
table.insert(formspec, "label[0.1,0.5;")
table.insert(formspec, label)
table.insert(formspec, "]")
yl_speak_up.quest_step_show_table(formspec,
"0.1,0.7;"..tostring(width-0.2)..","..tostring(height-0.8)..";"..tostring(field_name)..";",
liste)
if(tooltip_text and tooltip_text ~= "") then
table.insert(formspec, "tooltip[")
table.insert(formspec, field_name)
table.insert(formspec, ";")
table.insert(formspec, tooltip_text)
table.insert(formspec, "\n\nClick on an element to select it.")
table.insert(formspec, "]")
end
if(add_lines) then
table.insert(formspec, add_lines)
end
table.insert(formspec, "container_end[]")
end
yl_speak_up.get_fs_manage_quest_steps = function(player, param)
-- small helper function
local em = function(text)
@ -317,21 +349,26 @@ yl_speak_up.get_fs_manage_quest_steps = function(player, param)
table.insert(formspec, yl_speak_up.get_fs_add_quest_steps(player, nil))
table.insert(formspec, "container_end[]")
local lists = yl_speak_up.quest_step_get_start_end_unconnected_lists(step_data)
table.insert(formspec, "container[0.1,2.7;5.6,10.8]"..
"box[0,0;5.6,8.5;#666666]"..
"label[0.1,0.5;Start steps:]"..
"label[0.1,4.0;Unconnected steps:]")
yl_speak_up.quest_step_show_table(formspec, "0.1,0.7;5.4,2.7;TODO_one_step_required;",
lists.start_steps)
yl_speak_up.quest_step_show_table(formspec, "0.1,4.2;5.4,4.0;TODO_all_steps_required;",
lists.unconnected_steps)
table.insert(formspec, "container_end[]")
table.insert(formspec, "container[23.8,2.7;5.6,10.8]"..
"box[0,0;5.6,8.5;#666666]"..
"label[0.2,0.5;Quest ends with steps:]")
yl_speak_up.quest_step_show_table(formspec, "0.1,0.7;5.4,7.7;TODO_next_steps_show;",
lists.end_steps)
table.insert(formspec, "container_end[]")
yl_speak_up.quest_step_show_table_decorated(formspec,
"Start steps:", "TODO_select_from_start_steps", lists.start_steps,
"0.1", "2.7", "5.6", "3.5",
"The quest begins with this (or one of these) steps.\n"..
"You need at least one start step.",
nil)
yl_speak_up.quest_step_show_table_decorated(formspec,
"Unconnected steps:", "TODO_select_from_unconnected_steps", lists.unconnected_steps,
"0.1", "6.2", "5.6", "3.5",
"These steps are not used yet. They are not required\n"..
"by any other steps and do not require steps either.\n"..
"Please decide what to do with them!",
nil)
yl_speak_up.quest_step_show_table_decorated(formspec,
"Quest ends with steps:", "TODO_select_from_end_steps", lists.end_steps,
"23.8", "2.7", "5.6", "7.0",
"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)
return table.concat(formspec, "")
end
-- find out the next quest step