forked from Sokomine/yl_speak_up
added yl_speak_up.show_fs_trade_list
This commit is contained in:
parent
bcf6a4062f
commit
caf72721b3
@ -1802,8 +1802,7 @@ yl_speak_up.input_inventory = function(player, formname, fields)
|
|||||||
yl_speak_up.save_npc_inventory(n_id)
|
yl_speak_up.save_npc_inventory(n_id)
|
||||||
-- show the trade list?
|
-- show the trade list?
|
||||||
if(fields.inventory_show_tradelist) then
|
if(fields.inventory_show_tradelist) then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:trade_list",
|
yl_speak_up.show_fs_trade_list(player)
|
||||||
yl_speak_up.get_fs_trade_list(player))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- ..and go back to the normal talk formspec
|
-- ..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...
|
-- the trade list is not really a dialog...
|
||||||
if(target_dialog == "trade_list") then
|
if(target_dialog == "trade_list") then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:trade_list",
|
yl_speak_up.show_fs_trade_list(player)
|
||||||
yl_speak_up.get_fs_trade_list(player))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- move on to the target dialog
|
-- 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")
|
yl_speak_up.save_changes_and_switch_to_other_dialog(player, fields, "trade_list")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.show_formspec(pname, "yl_speak_up:trade_list",
|
yl_speak_up.show_fs_trade_list(player)
|
||||||
yl_speak_up.get_fs_trade_list(player))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
-- show a list of all trades
|
-- 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
|
-- the player is accessing the trade list
|
||||||
yl_speak_up.input_trade_list = function(player, formname, fields)
|
yl_speak_up.input_trade_list = function(player, formname, fields)
|
||||||
local pname = player:get_player_name()
|
local pname = player:get_player_name()
|
||||||
|
@ -53,8 +53,7 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields)
|
|||||||
|
|
||||||
-- show the trade list
|
-- show the trade list
|
||||||
if(fields.back_to_trade_list) then
|
if(fields.back_to_trade_list) then
|
||||||
minetest.show_formspec(pname, "yl_speak_up:trade_list",
|
yl_speak_up.show_fs_trade_list(player)
|
||||||
yl_speak_up.get_fs_trade_list(player))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -103,8 +102,7 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields)
|
|||||||
yl_speak_up.trade[pname] = nil
|
yl_speak_up.trade[pname] = nil
|
||||||
end
|
end
|
||||||
-- go back showing the trade list (since we deleted this trade)
|
-- go back showing the trade list (since we deleted this trade)
|
||||||
minetest.show_formspec(pname, "yl_speak_up:trade_list",
|
yl_speak_up.show_fs_trade_list(player)
|
||||||
yl_speak_up.get_fs_trade_list(player))
|
|
||||||
return
|
return
|
||||||
end
|
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)
|
-- return the items (setting up the trade was aborted)
|
||||||
yl_speak_up.add_trade_simple_return_items(player, trade_inv, pay, buy)
|
yl_speak_up.add_trade_simple_return_items(player, trade_inv, pay, buy)
|
||||||
-- ..else go back to the edit options formspec
|
-- ..else go back to the edit options formspec
|
||||||
minetest.show_formspec(pname, "yl_speak_up:trade_list",
|
yl_speak_up.show_fs_trade_list(player)
|
||||||
yl_speak_up.get_fs_trade_list(player))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- adding a new trade via the trade list?
|
-- 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
|
-- we are no longer trading
|
||||||
yl_speak_up.speak_to[pname].trade_id = nil
|
yl_speak_up.speak_to[pname].trade_id = nil
|
||||||
-- ..else go back to the edit options formspec
|
-- ..else go back to the edit options formspec
|
||||||
minetest.show_formspec(pname, "yl_speak_up:trade_list",
|
yl_speak_up.show_fs_trade_list(player)
|
||||||
yl_speak_up.get_fs_trade_list(player))
|
|
||||||
else
|
else
|
||||||
-- we are no longer trading
|
-- we are no longer trading
|
||||||
yl_speak_up.speak_to[pname].trade_id = nil
|
yl_speak_up.speak_to[pname].trade_id = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user