forked from Sokomine/yl_speak_up
offer button back from trade to edit options
This commit is contained in:
parent
735553a937
commit
a6b7ff0d8e
@ -38,6 +38,23 @@ yl_speak_up.input_do_trade_simple = function(player, formname, fields)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local n_id = yl_speak_up.speak_to[pname].n_id
|
||||||
|
-- if in edit mode: go back to the edit options dialog
|
||||||
|
if(fields.back_to_edit_options
|
||||||
|
and yl_speak_up.edit_mode[pname] == n_id and n_id) then
|
||||||
|
local dialog = yl_speak_up.speak_to[pname].dialog
|
||||||
|
local tr = dialog.trades[ trade.trade_id ]
|
||||||
|
if(tr) then
|
||||||
|
-- done trading
|
||||||
|
yl_speak_up.speak_to[pname].target_d_id = nil
|
||||||
|
yl_speak_up.speak_to[pname].trade_id = nil
|
||||||
|
-- go to the edit options dialog
|
||||||
|
minetest.show_formspec(pname, "yl_speak_up:edit_option_dialog",
|
||||||
|
yl_speak_up.get_fs_edit_option_dialog(player, n_id, tr.d_id, tr.o_id))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- delete a trade; this can be done here only if..
|
-- delete a trade; this can be done here only if..
|
||||||
-- * it is a trade from the trade list (not an effect of a dialog option)
|
-- * it is a trade from the trade list (not an effect of a dialog option)
|
||||||
-- * the player has the necessary privs
|
-- * the player has the necessary privs
|
||||||
@ -531,11 +548,18 @@ yl_speak_up.get_fs_trade_simple = function(player, trade_id)
|
|||||||
"button[0.2,1.6;1.0,0.9;edit_trade_simple;Edit]"..
|
"button[0.2,1.6;1.0,0.9;edit_trade_simple;Edit]"..
|
||||||
"tooltip[edit_trade_simple;Edit this trade. You can do so only "..
|
"tooltip[edit_trade_simple;Edit this trade. You can do so only "..
|
||||||
"if you can edit the NPC as such (i.e. own it).]"
|
"if you can edit the NPC as such (i.e. own it).]"
|
||||||
-- TODO offer button to show the edit options dialog if suitable
|
local dialog = yl_speak_up.speak_to[pname].dialog
|
||||||
-- formspec = formspec..
|
local tr = dialog.trades[ trade_id ]
|
||||||
-- "button[0.2,0.0;2.0,0.9;back_to_trade_list;Back to list]"..
|
-- offer button to show the edit options dialog if suitable
|
||||||
-- "tooltip[back_to_trade_list;Click here once you've traded enough with this "..
|
if( tr and tr.d_id and tr.o_id) then
|
||||||
-- "NPC and want to get back to the trade list.]"
|
formspec = formspec..
|
||||||
|
"button[0.2,-0.5;4.5,0.9;back_to_edit_options;"..
|
||||||
|
minetest.formspec_escape("Back to edit dialog "..
|
||||||
|
tostring(tr.d_id).." option "..
|
||||||
|
tostring(tr.o_id)).."]"..
|
||||||
|
"tooltip[back_to_edit_options;Go back to editing the option "..
|
||||||
|
"where this trade is located.]"
|
||||||
|
end
|
||||||
|
|
||||||
-- for trades in trade list: allow delete (new trades can easily be added)
|
-- for trades in trade list: allow delete (new trades can easily be added)
|
||||||
-- allow delete for trades in trade list even if not in edit mode
|
-- allow delete for trades in trade list even if not in edit mode
|
||||||
@ -546,9 +570,6 @@ yl_speak_up.get_fs_trade_simple = function(player, trade_id)
|
|||||||
"tooltip[delete_trade_simple;Delete this trade. You can do so only "..
|
"tooltip[delete_trade_simple;Delete this trade. You can do so only "..
|
||||||
"if you can edit the NPC as such (i.e. own it).]"
|
"if you can edit the NPC as such (i.e. own it).]"
|
||||||
end
|
end
|
||||||
-- TODO: just for debugging
|
|
||||||
formspec = formspec..
|
|
||||||
"label[0.0,-0.3;"..tostring(trade_id).." trade_is_trade_list: "..tostring(trade.trade_is_trade_list).."]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local trade_possible_msg = "Status of trade: Unknown."
|
local trade_possible_msg = "Status of trade: Unknown."
|
||||||
|
Loading…
Reference in New Issue
Block a user