added o_sort for options edit dialog

This commit is contained in:
Sokomine 2021-05-03 19:06:57 +02:00
parent 1b9bfa8e14
commit 9f9741cb44

View File

@ -1005,15 +1005,23 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
"button[2.4,17;2.0,0.9;edit_option_add;Add]"..
"tooltip[edit_option_add;Add a new option/answer to this dialog.]"..
-- button: prev/next
"button[8.6,17;2.0,0.9;edit_option_prev;Prev]"..
"button[7.4,17;2.0,0.9;edit_option_prev;Prev]"..
"tooltip[edit_option_prev;Go to previous option/answer (according to o_sort).]"..
"button[10.8,17;2.0,0.9;edit_option_next;Next]"..
"button[12.0,17;2.0,0.9;edit_option_next;Next]"..
"tooltip[edit_option_next;Go to next option/answer (according to o_sort).]"..
-- button: go back to dialog (repeated from top of the page)
"button[15.8,17;5.0,0.9;show_current_dialog;Back to dialog "..
minetest.formspec_escape(d_id).."]"..
"tooltip[show_current_dialog;Go back to dialog "..
minetest.formspec_escape(d_id).." and continue editing that dialog.]"
minetest.formspec_escape(d_id).." and continue editing that dialog.]"..
-- allow to enter o_sort
"label[9.6,17.5;Sort:]"..
"field[10.6,17;1.0,0.9;edit_option_o_sort;;"..
minetest.formspec_escape(d_option.o_sort).."]"..
"tooltip[edit_option_o_sort;o_sort: The lower the number, the higher up in the "..
"list this option goes\nNegative values are ignored;#FFFFFF;#000000]"..
-- hidden field containing the value of o_id
"field[40,40;0.1,0.1;o_id;;"..minetest.formspec_escape(o_id).."]"
return formspec
end
@ -2102,7 +2110,12 @@ minetest.register_on_player_receive_fields(
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, n_id, d_id))
return
end
--minetest.chat_send_player(pname, "Fields: "..minetest.serialize(fields))
-- if ESC is pressed or anything else unpredicted happens: go back to the main dialog edit window
-- reason: don't loose any unsaved changes to the dialog
minetest.show_formspec(pname, "yl_speak_up:talk", get_fs_talkdialog(player, n_id, d_id))
end
)