forked from your-land-mirror/yl_speak_up
fixed bug on first click on add trade not working
This commit is contained in:
parent
cfd300ac5d
commit
a9ddfb5a51
@ -2688,8 +2688,20 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields)
|
|||||||
return
|
return
|
||||||
end
|
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 "<d_id> <o_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
|
-- 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
|
-- sort all options by o_sort
|
||||||
local sorted_list = yl_speak_up.get_sorted_options(n_dialog.d_options, "o_sort")
|
local sorted_list = yl_speak_up.get_sorted_options(n_dialog.d_options, "o_sort")
|
||||||
local o_found = o_id
|
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))
|
yl_speak_up.get_fs_edit_option_dialog(player, n_id, d_id, o_found))
|
||||||
return
|
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 "<d_id> <o_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
|
-- show the trade associated with this dialog and option
|
||||||
elseif(fields.effect_show_trade) then
|
elseif(fields.effect_show_trade) then
|
||||||
-- remember which option was selected
|
-- remember which option was selected
|
||||||
|
Loading…
Reference in New Issue
Block a user