added yl_speak_up.show_fs_trade_list

This commit is contained in:
Sokomine 2021-05-31 16:45:15 +02:00
parent bcf6a4062f
commit caf72721b3
3 changed files with 18 additions and 14 deletions

View File

@ -1802,8 +1802,7 @@ yl_speak_up.input_inventory = function(player, formname, fields)
yl_speak_up.save_npc_inventory(n_id)
-- show the trade list?
if(fields.inventory_show_tradelist) then
minetest.show_formspec(pname, "yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
yl_speak_up.show_fs_trade_list(player)
return
end
-- ..and go back to the normal talk formspec
@ -2255,8 +2254,7 @@ yl_speak_up.save_changes_and_switch_to_other_dialog = function(player, fields, t
-- the trade list is not really a dialog...
if(target_dialog == "trade_list") then
minetest.show_formspec(pname, "yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
yl_speak_up.show_fs_trade_list(player)
return
end
-- move on to the target dialog
@ -2981,8 +2979,7 @@ yl_speak_up.input_talk = function(player, formname, fields)
yl_speak_up.save_changes_and_switch_to_other_dialog(player, fields, "trade_list")
return
end
minetest.show_formspec(pname, "yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
yl_speak_up.show_fs_trade_list(player)
return
end

View File

@ -1,6 +1,17 @@
-- show a list of all trades
-- provides an easier call for the trade list formspec
yl_speak_up.show_fs_trade_list = function(player)
if(not(player)) then
return
end
minetest.show_formspec(player:get_player_name(),
"yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
end
-- the player is accessing the trade list
yl_speak_up.input_trade_list = function(player, formname, fields)
local pname = player:get_player_name()

View File

@ -53,8 +53,7 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields)
-- show the trade list
if(fields.back_to_trade_list) then
minetest.show_formspec(pname, "yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
yl_speak_up.show_fs_trade_list(player)
return
end
@ -103,8 +102,7 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields)
yl_speak_up.trade[pname] = nil
end
-- go back showing the trade list (since we deleted this trade)
minetest.show_formspec(pname, "yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
yl_speak_up.show_fs_trade_list(player)
return
end
@ -275,8 +273,7 @@ yl_speak_up.input_add_trade_simple = function(player, formname, fields)
-- return the items (setting up the trade was aborted)
yl_speak_up.add_trade_simple_return_items(player, trade_inv, pay, buy)
-- ..else go back to the edit options formspec
minetest.show_formspec(pname, "yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
yl_speak_up.show_fs_trade_list(player)
return
end
-- adding a new trade via the trade list?
@ -408,8 +405,7 @@ yl_speak_up.input_add_trade_simple = function(player, formname, fields)
-- we are no longer trading
yl_speak_up.speak_to[pname].trade_id = nil
-- ..else go back to the edit options formspec
minetest.show_formspec(pname, "yl_speak_up:trade_list",
yl_speak_up.get_fs_trade_list(player))
yl_speak_up.show_fs_trade_list(player)
else
-- we are no longer trading
yl_speak_up.speak_to[pname].trade_id = nil