forked from Sokomine/yl_speak_up
don't show add button in edit options menu if already max number of options
This commit is contained in:
parent
7e3911b949
commit
f199a9d04c
@ -219,6 +219,7 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id)
|
|||||||
-- sort all options by o_sort
|
-- sort all options by o_sort
|
||||||
local sorted_list = yl_speak_up.get_sorted_options(n_dialog.d_options, "o_sort")
|
local sorted_list = yl_speak_up.get_sorted_options(n_dialog.d_options, "o_sort")
|
||||||
local o_found = o_id
|
local o_found = o_id
|
||||||
|
local anz_options = 0
|
||||||
for i, o in ipairs(sorted_list) do
|
for i, o in ipairs(sorted_list) do
|
||||||
if(o == o_id and sorted_list[ i-1 ]) then
|
if(o == o_id and sorted_list[ i-1 ]) then
|
||||||
button_prev = ""..
|
button_prev = ""..
|
||||||
@ -232,7 +233,17 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id)
|
|||||||
"tooltip[edit_option_next;Go to next option/answer "..
|
"tooltip[edit_option_next;Go to next option/answer "..
|
||||||
"(according to o_sort).]"
|
"(according to o_sort).]"
|
||||||
end
|
end
|
||||||
|
anz_options = anz_options + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- less than yl_speak_up.max_number_of_options_per_dialog options?
|
||||||
|
local button_add = ""..
|
||||||
|
"button[2.4,17;2.0,0.9;add_option;Add]"..
|
||||||
|
"tooltip[add_option;Add a new option/answer to this dialog.]"
|
||||||
|
if(anz_options >= yl_speak_up.max_number_of_options_per_dialog) then
|
||||||
|
button_add = ""
|
||||||
|
end
|
||||||
|
|
||||||
-- build up the formspec
|
-- build up the formspec
|
||||||
local formspec = ""..
|
local formspec = ""..
|
||||||
"formspec_version[3]"..
|
"formspec_version[3]"..
|
||||||
@ -297,8 +308,7 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id)
|
|||||||
"button[0.2,17;2.0,0.9;del_option;Delete]"..
|
"button[0.2,17;2.0,0.9;del_option;Delete]"..
|
||||||
"tooltip[del_option;Delete this option/answer.]"..
|
"tooltip[del_option;Delete this option/answer.]"..
|
||||||
-- button: add new
|
-- button: add new
|
||||||
"button[2.4,17;2.0,0.9;add_option;Add]"..
|
button_add..
|
||||||
"tooltip[add_option;Add a new option/answer to this dialog.]"..
|
|
||||||
-- button: prev/next
|
-- button: prev/next
|
||||||
button_prev..
|
button_prev..
|
||||||
button_next..
|
button_next..
|
||||||
|
Loading…
Reference in New Issue
Block a user