fixed sorting of options in dialogs according to o_sort

This commit is contained in:
Sokomine 2022-04-25 19:08:12 +02:00
parent 292c299b5c
commit 5b0338fabc

View File

@ -487,13 +487,13 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
local anz_options = 0
-- Let#s sort the options by o_sort
if active_dialog ~= nil and active_dialog.d_options ~= nil then
local sorted_buttons = {}
for _, ad_v in pairs(active_dialog.d_options) do
sorted_buttons[tonumber(ad_v.o_sort)] = ad_v
anz_options = anz_options + 1
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
anz_options = anz_options + 1
end
for _, sb_v in pairs(sorted_buttons) do
for _, s_o_id in ipairs(sorted_o_list) do
local sb_v = active_dialog.d_options[s_o_id]
local oid = minetest.formspec_escape(sb_v.o_id)
-- in edit_mode: show all options
if(edit_mode and yl_speak_up.old_fs_version_show_line(pname_for_old_fs)) then