forked from your-land-mirror/yl_speak_up
reformatted fs_talkdialog.lua
This commit is contained in:
parent
aec252c323
commit
1d06c2a825
@ -28,6 +28,7 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
||||
return
|
||||
end
|
||||
|
||||
-- mobs_redo based NPC may follow their owner, stand or wander around
|
||||
local new_move_order = ""
|
||||
if(fields.order_stand) then
|
||||
new_move_order = "stand"
|
||||
@ -191,11 +192,9 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
||||
-- only split into 2 parts at max
|
||||
local s = string.split(k, "_", false, 2)
|
||||
|
||||
if
|
||||
s[1] == "button" and s[2] ~= nil and s[2] ~= "" and s[2] ~= "exit" and s[2] ~= "back" and s[3] ~= nil and
|
||||
s[2] ~= "up" and
|
||||
s[2] ~= "down"
|
||||
then
|
||||
if(s[1] == "button"
|
||||
and s[2] ~= nil and s[2] ~= "" and s[2] ~= "exit" and s[2] ~= "back" and s[3] ~= nil
|
||||
and s[2] ~= "up" and s[2] ~= "down") then
|
||||
o = s[2] .. "_" .. s[3]
|
||||
end
|
||||
end
|
||||
@ -236,8 +235,8 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
||||
return
|
||||
end
|
||||
|
||||
-- if(edit_mode) (the other case has been dealt with above)
|
||||
-- all three buttons (pre(C)onditions, (Ef)fects, edit option) lead to the same new formspec
|
||||
if( edit_mode ) then
|
||||
local n_dialog = dialog.n_dialogs[d_id]
|
||||
|
||||
if(n_dialog and n_dialog.d_options) then
|
||||
@ -290,7 +289,6 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
||||
yl_speak_up.show_fs(player, "talk", {n_id = n_id, d_id = show_dialog})
|
||||
-- no option was selected - so we need to end this here
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -519,7 +517,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
||||
|
||||
-- allow to delete entries that have no options later on
|
||||
local anz_options = 0
|
||||
-- Let#s sort the options by o_sort
|
||||
-- Let's sort the options by o_sort
|
||||
if active_dialog ~= nil and active_dialog.d_options ~= nil then
|
||||
local sorted_o_list = yl_speak_up.get_sorted_options(active_dialog.d_options, "o_sort")
|
||||
for _, sb_v in ipairs(sorted_o_list) do
|
||||
@ -565,7 +563,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
||||
-- add a button "-> d_<nr>" that leads to the target dialog (if one is set)
|
||||
-- selecting an option this way MUST NOT execute the pre(C)onditions or (Ef)fects!
|
||||
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
|
||||
"button", tostring(9.0+offset).."," .. h .. ";1,0.9", "button_" .. oid,
|
||||
"button", tostring(9.0+offset)..","..h..";1,0.9", "button_" .. oid,
|
||||
"->",
|
||||
"Go to target dialog "..minetest.formspec_escape(target_dialog or "")..
|
||||
" that will be shown when this option ("..oid..") is selected.",
|
||||
@ -583,13 +581,13 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
||||
-- are there any prerequirements?
|
||||
local prereq = active_dialog.d_options[sb_v.o_id].o_prerequisites
|
||||
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
|
||||
"button", tostring(0.5+offset).."," .. h .. ";0.5,0.9", "conditions_"..oid,
|
||||
"button", tostring(0.5+offset)..","..h..";0.5,0.9", "conditions_"..oid,
|
||||
"C",
|
||||
"There are pre(C)onditions required for showing this option. Display them.",
|
||||
(prereq and next(prereq)))
|
||||
|
||||
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
|
||||
"button", tostring(1.6+offset).."," .. h .. ";0.6,0.9", "effects_"..oid,
|
||||
"button", tostring(1.6+offset)..","..h..";0.6,0.9", "effects_"..oid,
|
||||
"Ef",
|
||||
"There are further (Ef)fects (apart from switching\n"..
|
||||
"to a new dialog) set for this option. Display them.",
|
||||
@ -598,7 +596,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
||||
-- are there any actions defined?
|
||||
local actions = active_dialog.d_options[sb_v.o_id].actions
|
||||
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
|
||||
"button", tostring(1.1+offset).."," .. h .. ";0.5,0.9", "actions_"..oid,
|
||||
"button", tostring(1.1+offset)..","..h..";0.5,0.9", "actions_"..oid,
|
||||
"A",
|
||||
"There is an (A)ction (i.e. a trade) that will happen\n"..
|
||||
"when switching to a new dialog. Display actions and\n"..
|
||||
@ -607,7 +605,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
||||
|
||||
-- show the actual text for the option
|
||||
yl_speak_up.add_formspec_element_with_tooltip_if(formspec,
|
||||
"field", tostring(9.9+offset).."," .. h .. ";"..
|
||||
"field", tostring(9.9+offset)..","..h..";"..
|
||||
tostring(field_length)..",0.9",
|
||||
"text_option_" .. oid,
|
||||
";"..minetest.formspec_escape(sb_v.o_text_when_prerequisites_met),
|
||||
|
Loading…
Reference in New Issue
Block a user