reformatted fs_talkdialog.lua

This commit is contained in:
Sokomine 2022-07-18 19:19:21 +02:00
parent aec252c323
commit 1d06c2a825

View File

@ -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
@ -291,7 +290,6 @@ yl_speak_up.input_talk = function(player, formname, fields)
-- no option was selected - so we need to end this here
return
end
end
-- helper function for
@ -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