From 73aaa15c44d852cebceffddbc871b86e35697a78 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sun, 20 Jun 2021 00:58:08 +0200 Subject: [PATCH] show target dialog for on_failure effect --- fs_edit_general.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fs_edit_general.lua b/fs_edit_general.lua index fff3bb9..de61571 100644 --- a/fs_edit_general.lua +++ b/fs_edit_general.lua @@ -653,7 +653,6 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields, end end - -- selections in a dropdown menu (they trigger sending the formspec) -- select a general direction/type first @@ -906,6 +905,8 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result, data.action_failure_dialog = math.max(1, table.indexof(sorted_dialog_list, e[ "a_on_failure" ])) end + -- write that data back + yl_speak_up.speak_to[pname][ tmp_data_cache ] = data end local save_button = "button[5.0,9.8;1,0.7;save_element;Save]" @@ -1104,12 +1105,21 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result, else nr = table.indexof(sorted_dialog_list, data.on_failure) end + local on_failure_dialog = "" + if(dialog and dialog.n_dialogs and dialog.n_dialogs[ data.on_failure ]) then + on_failure_dialog = + "label[0.2,5.5;This will switch to dialog "..tostring(data.on_failure)..":]".. + "hypertext[1.2,6.0;19.6,2.5;d_text;".. + minetest.formspec_escape(dialog.n_dialogs[ data.on_failure ].d_text or "?").. + "\n".."]" + end formspec = formspec.. "label[0.2,3.3;If the *previous* effect failed,]".. "label[0.2,3.8;switch to the following dialog:]".. "dropdown[5.0,3.5;6.5,0.6;select_on_failure;".. table.concat(sorted_dialog_list, ",")..";".. - tostring(nr)..";]" + tostring(nr)..";]".. + on_failure_dialog -- "send a chat message to all players" -- 6 elseif(data.what and id_prefix == "r_" and data.what == 6) then