From a9ddfb5a51c1b0fd3ec138d635317597ebc9e608 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sun, 30 May 2021 23:57:20 +0200 Subject: [PATCH] fixed bug on first click on add trade not working --- functions.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/functions.lua b/functions.lua index f9ce302..1fe9246 100644 --- a/functions.lua +++ b/functions.lua @@ -2688,8 +2688,20 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields) return end + -- add or edit the trade associated with this dialog and option + if(fields.effect_add_trade) then + -- remember which option was selected + yl_speak_up.speak_to[pname].o_id = o_id + -- do not switch target dialog (we are in edit mode) + yl_speak_up.speak_to[pname].target_d_id = nil + -- create a new trade for this dialog and option - with ID " " + minetest.show_formspec(pname, "yl_speak_up:add_trade_simple", + yl_speak_up.get_fs_add_trade_simple(player, + tostring(d_id).." "..tostring(o_id))) + return + -- the player wants to see the previous option/answer - if(fields.edit_option_prev) then + elseif(fields.edit_option_prev) then -- sort all options by o_sort local sorted_list = yl_speak_up.get_sorted_options(n_dialog.d_options, "o_sort") local o_found = o_id @@ -2718,18 +2730,6 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields) yl_speak_up.get_fs_edit_option_dialog(player, n_id, d_id, o_found)) return - -- add or edit the trade associated with this dialog and option - elseif(fields.effect_add_trade) then - -- remember which option was selected - yl_speak_up.speak_to[pname].o_id = o_id - -- do not switch target dialog (we are in edit mode) - yl_speak_up.speak_to[pname].target_d_id = nil - -- create a new trade for this dialog and option - with ID " " - minetest.show_formspec(pname, "yl_speak_up:add_trade_simple", - yl_speak_up.get_fs_add_trade_simple(player, - tostring(d_id).." "..tostring(o_id))) - return - -- show the trade associated with this dialog and option elseif(fields.effect_show_trade) then -- remember which option was selected