made edit button in trade in dialog options work again

This commit is contained in:
Sokomine 2021-05-31 03:38:49 +02:00
parent 71d4db6219
commit f772f6aa64

View File

@ -104,7 +104,7 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields)
-- show the edit trade formspec
if(fields.edit_trade_simple) then
minetest.show_formspec(pname, "yl_speak_up:add_trade_simple",
yl_speak_up.get_fs_add_trade_simple(player))
yl_speak_up.get_fs_add_trade_simple(player, trade.trade_id))
return
end
@ -360,7 +360,9 @@ yl_speak_up.input_add_trade_simple = function(player, formname, fields)
"Dialog "..d_id..": Trade "..tostring(trade_id).." deleted from option "..
tostring(o_id)..".")
-- delete the trade type result
if(trade_id) then
dialog.trades[ trade_id ] = nil
end
-- do not return yet - the items still need to be given back!
end
@ -511,10 +513,14 @@ yl_speak_up.get_fs_trade_simple = function(player, trade_id)
trade.player_gives = dialog.trades[ trade_id ].pay[1]
trade.npc_gives = dialog.trades[ trade_id ].buy[1]
trade.trade_is_trade_list = not(dialog.trades[ trade_id ].d_id)
yl_speak_up.speak_to[pname].trade_id = trade_id
else
trade.edit_trade = true
end
yl_speak_up.trade[pname] = trade
else
trade_id = yl_speak_up.speak_to[pname].trade_id
trade.trade_id = trade_id
end
-- do we have all the necessary data?