improved formatting of dropdown formspec entries in fs_talkdialog.lua

This commit is contained in:
Sokomine 2022-01-08 19:14:13 +01:00
parent bcdd59e004
commit 6e461b95a6

View File

@ -537,9 +537,12 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
d_id_to_dropdown_index[d] = i + 1 d_id_to_dropdown_index[d] = i + 1
end end
table.insert(formspec, "label[0.2,4.6;Dialog:]") -- "..minetest.formspec_escape(c_d_id)..":]") table.insert(formspec, "label[0.2,4.6;Dialog:]") -- "..minetest.formspec_escape(c_d_id)..":]")
table.insert(formspec, "dropdown[3.0,4.0;5,1;d_id;"..dialog_list..";"..d_id_to_dropdown_index[c_d_id]..",]") table.insert(formspec, "dropdown[3.0,4.0;5,1;d_id;"..dialog_list..";"..
table.insert(formspec, "tooltip[3.0,4.0;5,1;Select the dialog you want to edit. Currently, dialog "..c_d_id.." is beeing displayed.;#FFFFFF;#000000]") d_id_to_dropdown_index[c_d_id]..",]")
table.insert(formspec, "tooltip[3.0,4.0;5,1;"..
"Select the dialog you want to edit. Currently, dialog "..c_d_id..
" is beeing displayed.;#FFFFFF;#000000]")
yl_speak_up.add_formspec_element_with_tooltip_if(formspec, yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
"button", "13.9,4.0;1,0.9", "show_new_dialog", "button", "13.9,4.0;1,0.9", "show_new_dialog",
@ -557,9 +560,9 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
"Save this dialog.", "Save this dialog.",
true) true)
table.insert(formspec, "textarea[0.2,5;19.6,17.8;d_text;;") table.insert(formspec, "textarea[0.2,5;19.6,17.8;d_text;;"..
table.insert(formspec, minetest.formspec_escape(active_dialog.d_text)) minetest.formspec_escape(active_dialog.d_text)..
table.insert(formspec, "]") "]")
else else
if(alternate_text) then if(alternate_text) then
alternate_text = string.gsub(alternate_text, "%$TEXT%$", active_dialog.d_text) alternate_text = string.gsub(alternate_text, "%$TEXT%$", active_dialog.d_text)
@ -623,10 +626,14 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
"Go to target dialog "..minetest.formspec_escape(target_dialog).. "Go to target dialog "..minetest.formspec_escape(target_dialog)..
" that will be shown when this option ("..oid..") is selected.", " that will be shown when this option ("..oid..") is selected.",
(target_dialog)) (target_dialog))
-- allow to set a new target dialog
table.insert(formspec, "dropdown[4.4,"..h..";4.7,1;d_id_"..oid..";"..dialog_list..";"..minetest.formspec_escape(d_id_to_dropdown_index[target_dialog] or "0")..",]") -- allow to set a new target dialog
-- add a tooltip "Change target dialog" table.insert(formspec, "dropdown[4.4,"..h..";4.7,1;d_id_"..oid..";"..
table.insert(formspec, "tooltip[4.4,"..h..";4.7,1;Change target dialog for option "..oid..".;#FFFFFF;#000000]") dialog_list..";"..
minetest.formspec_escape(d_id_to_dropdown_index[target_dialog] or "0")..",]")
-- add a tooltip "Change target dialog"
table.insert(formspec, "tooltip[4.4,"..h..";4.7,1;"..
"Change target dialog for option "..oid..".;#FFFFFF;#000000]")
-- are there any prerequirements? -- are there any prerequirements?
local prereq = active_dialog.d_options[sb_v.o_id].o_prerequisites local prereq = active_dialog.d_options[sb_v.o_id].o_prerequisites