forked from your-land-mirror/yl_speak_up
show trades as (A)ction in edit mode
This commit is contained in:
parent
e52d219204
commit
7e3911b949
@ -1053,7 +1053,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id)
|
||||
if edit_mode then
|
||||
h = h + 1
|
||||
-- add a button "o_<nr>:" that leads to an edit formspec for this option
|
||||
table.insert(formspec, "button[1.8," .. h .. ";2,0.9;edit_option_" .. oid .. ";"..oid..":]")
|
||||
table.insert(formspec, "button[2.3," .. h .. ";2,0.9;edit_option_" .. oid .. ";"..oid..":]")
|
||||
-- add a tooltip "Edit target dialog, pre(C)onditions and (Ef)fects for option o_<nr>"
|
||||
table.insert(formspec, "tooltip[edit_option_" .. oid .. ";Edit target dialog, pre(C)onditions and (Ef)fects for option "..oid..".]")
|
||||
|
||||
@ -1074,16 +1074,16 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id)
|
||||
end
|
||||
if(target_dialog) then
|
||||
-- add a button "-> d_<nr>" that leads to the target dialog (if one is set)
|
||||
table.insert(formspec, "button[8.5," .. h .. ";1,0.9;button_" .. oid .. ";->]")
|
||||
table.insert(formspec, "button[9.0," .. h .. ";1,0.9;button_" .. oid .. ";->]")
|
||||
-- add a tooltip "Go to target dialog d_<nr>"
|
||||
table.insert(formspec, "tooltip[button_" .. oid .. ";Go to target dialog "..minetest.formspec_escape(target_dialog).." that will be shown when this option ("..oid..") is selected.]")
|
||||
|
||||
-- selecting an option this way MUST NOT execute the pre(C)onditions or (Ef)fects!
|
||||
end
|
||||
-- allow to set a new target dialog
|
||||
table.insert(formspec, "dropdown[3.9,"..h..";4.7,1;d_id_"..oid..";"..dialog_list..";"..minetest.formspec_escape(d_id_to_dropdown_index[target_dialog] or "0")..",]")
|
||||
table.insert(formspec, "dropdown[4.4,"..h..";4.7,1;d_id_"..oid..";"..dialog_list..";"..minetest.formspec_escape(d_id_to_dropdown_index[target_dialog] or "0")..",]")
|
||||
-- add a tooltip "Change target dialog"
|
||||
table.insert(formspec, "tooltip[3.9,"..h..";4.7,1;Change target dialog for option "..oid..".;#FFFFFF;#000000]")
|
||||
table.insert(formspec, "tooltip[4.4,"..h..";4.7,1;Change target dialog for option "..oid..".;#FFFFFF;#000000]")
|
||||
|
||||
-- are there any prerequirements?
|
||||
local prereq = active_dialog.d_options[sb_v.o_id].o_prerequisites
|
||||
@ -1093,23 +1093,26 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id)
|
||||
table.insert(formspec, "tooltip[conditions_" .. oid .. ";There are pre(C)onditions required for showing this option. Display them.]")
|
||||
end
|
||||
if(has_other_results) then
|
||||
table.insert(formspec, "button[1.1," .. h .. ";0.6,0.9;effects_"..oid..";Ef]")
|
||||
table.insert(formspec, "button[1.6," .. h .. ";0.6,0.9;effects_"..oid..";Ef]")
|
||||
-- label: "There are further (Ef)fects (apart from switching to a new dialog)
|
||||
-- set for this option. Display them."
|
||||
table.insert(formspec, "tooltip[effects_" .. oid .. ";"..
|
||||
"There are further (Ef)fects (apart from switching\n"..
|
||||
"to a new dialog) set for this option. Display them.]")
|
||||
end
|
||||
-- if there are only trade effects: show that as well
|
||||
elseif(dialog and dialog.trades
|
||||
-- TODO: show this for other types of actions as well
|
||||
if(dialog and dialog.trades
|
||||
and dialog.trades[ tostring(c_d_id).." "..tostring(oid) ]) then
|
||||
table.insert(formspec, "button[1.1," .. h .. ";0.6,0.9;effects_"..oid..";Tr]")
|
||||
table.insert(formspec, "button[1.1," .. h .. ";0.5,0.9;effects_"..oid..";A]")
|
||||
table.insert(formspec, "tooltip[effects_" .. oid .. ";"..
|
||||
"There is a (Tr)ade that will happen when switching to a\n"..
|
||||
"new dialog. Display effects and trade of this option.]")
|
||||
"There is an (A)ction (i.e. a trade) that will happen\n"..
|
||||
"when switching to a new dialog. Display effects and\n"..
|
||||
"trade of this option.]")
|
||||
end
|
||||
|
||||
-- show the actual text for the option
|
||||
table.insert(formspec, "field[9.4," .. h .. ";44.9,0.9;text_option_" .. oid .. ";;"..
|
||||
table.insert(formspec, "field[9.9," .. h .. ";44.4,0.9;text_option_" .. oid .. ";;"..
|
||||
minetest.formspec_escape(sb_v.o_text_when_prerequisites_met).."]")
|
||||
-- add a tooltip "Edit the text that is displayed on button o_<nr>."
|
||||
table.insert(formspec, "tooltip[text_option_" .. oid .. ";Edit the text that is displayed on button "..oid..".]")
|
||||
|
Loading…
Reference in New Issue
Block a user