show Q alongside C, A and Pr in edit menu

This commit is contained in:
Sokomine 2023-08-06 02:31:13 +02:00
parent 86f36dc26b
commit 312531e8c1

View File

@ -253,6 +253,7 @@ yl_speak_up.input_talk = function(player, formname, fields)
if( fields["edit_option_"..o_id]
or fields["conditions_"..o_id]
or fields["actions_"..o_id]
or fields["quests_"..o_id]
or fields["effects_"..o_id]) then
-- store which option we want to edit
yl_speak_up.speak_to[pname].o_id = o_id
@ -524,15 +525,15 @@ yl_speak_up.get_fs_talkdialog_line_in_edit_mode = function(
dialog, active_dialog, dialog_list, d_id_to_dropdown_index,
current_index, anz_options)
local offset = 0.0
local field_length = 44.4
local field_length = 43.8
if(pname_for_old_fs) then
offset = 0.7
field_length = 42.4
field_length = 41.8
end
h = h + 1
-- add a button "o_<nr>:" that leads to an edit formspec for this option
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
"button", tostring(2.3+offset).."," .. h .. ";2,0.9", "edit_option_" .. oid,
"button", tostring(2.9+offset).."," .. h .. ";2,0.9", "edit_option_" .. oid,
oid,
"Edit target dialog, pre(C)onditions and (Ef)fects for option "..oid..".",
true)
@ -558,19 +559,19 @@ yl_speak_up.get_fs_talkdialog_line_in_edit_mode = function(
-- add a button "-> d_<nr>" that leads to the target dialog (if one is set)
-- selecting an option this way MUST NOT execute the pre(C)onditions or (Ef)fects!
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
"button", tostring(9.0+offset)..","..h..";1,0.9", "button_" .. oid,
"button", tostring(9.6+offset)..","..h..";1,0.9", "button_" .. oid,
"->",
"Go to target dialog "..minetest.formspec_escape(target_dialog or "")..
" that will be shown when this option ("..oid..") is selected.",
(target_dialog))
-- allow to set a new target dialog
table.insert(formspec, "dropdown["..tostring(4.4+offset)..","..h..";4.7,1;d_id_"..
table.insert(formspec, "dropdown["..tostring(5.0+offset)..","..h..";4.7,1;d_id_"..
oid..";"..
dialog_list..";"..
(d_id_to_dropdown_index[(target_dialog or "?")] or "0")..",]")
-- add a tooltip "Change target dialog"
table.insert(formspec, "tooltip[4.4,"..h..";4.7,1;"..
table.insert(formspec, "tooltip[5.0,"..h..";4.7,1;"..
"Change target dialog for option "..oid..".;#FFFFFF;#000000]")
-- are there any prerequirements?
@ -588,10 +589,19 @@ yl_speak_up.get_fs_talkdialog_line_in_edit_mode = function(
"to a new dialog) set for this option. Display them.",
(has_other_results))
local d_option = active_dialog.d_options[sb_v.o_id]
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
"button", tostring(2.25+offset)..","..h..";0.6,0.9", "quests_"..oid,
"Q",
"This option sets a (Q)est step if possible.\n"..
"A special precondition is evaluated automaticly\n"..
"to check if the quest step can be set.",
(d_option and d_option.quest_id and d_option.quest_step))
-- are there any actions defined?
local actions = active_dialog.d_options[sb_v.o_id].actions
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
"button", tostring(1.1+offset)..","..h..";0.5,0.9", "actions_"..oid,
"button", tostring(1.05+offset)..","..h..";0.5,0.9", "actions_"..oid,
"A",
"There is an (A)ction (i.e. a trade) that will happen\n"..
"when switching to a new dialog. Display actions and\n"..
@ -600,18 +610,18 @@ yl_speak_up.get_fs_talkdialog_line_in_edit_mode = function(
if(sb_v.o_autoanswer) then
table.insert(formspec,
"label["..tostring(9.9+offset+0.2)..","..tostring(h+0.5)..";"..
"label["..tostring(10.5+offset+0.2)..","..tostring(h+0.5)..";"..
minetest.formspec_escape("[Automaticly selected if preconditions are met]")..
"]")
elseif(active_dialog.o_random) then
table.insert(formspec,
"label["..tostring(9.9+offset+0.2)..","..tostring(h+0.5)..";"..
"label["..tostring(10.5+offset+0.2)..","..tostring(h+0.5)..";"..
minetest.formspec_escape("[One of these options is randomly selected]")..
"]")
else
-- show the actual text for the option
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
"field", tostring(9.9+offset)..","..h..";"..
"field", tostring(10.5+offset)..","..h..";"..
tostring(field_length-2.3)..",0.9",
"text_option_" .. oid,
";"..minetest.formspec_escape(sb_v.o_text_when_prerequisites_met),
@ -619,7 +629,7 @@ yl_speak_up.get_fs_talkdialog_line_in_edit_mode = function(
true)
end
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
"button", tostring(9.9+offset+field_length-2.2)..","..h..";1.0,0.9", "delete_option_"..oid,
"button", tostring(10.5+offset+field_length-2.2)..","..h..";1.0,0.9", "delete_option_"..oid,
"Del",
"Delete this option/answer.",
true)
@ -627,7 +637,7 @@ yl_speak_up.get_fs_talkdialog_line_in_edit_mode = function(
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
-- "image_button", tostring(9.9+offset+field_length-0.5)..","..h..";0.5,0.9"..
-- ";gui_furnace_arrow_bg.png^[transformR180",
"button", tostring(9.9+offset+field_length-1.1)..","..h..";0.5,0.9",
"button", tostring(10.5+offset+field_length-1.1)..","..h..";0.5,0.9",
"option_move_down_"..oid,
"v",
"Move this option/answer one down.",
@ -635,7 +645,7 @@ yl_speak_up.get_fs_talkdialog_line_in_edit_mode = function(
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
-- "image_button", tostring(9.9+offset+field_length-1.0)..","..h..";0.5,0.9"..
-- ";gui_furnace_arrow_bg.png",
"button", tostring(9.9+offset+field_length-0.5)..","..h..";0.5,0.9",
"button", tostring(10.5+offset+field_length-0.5)..","..h..";0.5,0.9",
"option_move_up_"..oid,
"^",
"Move this option/answer one up.",