added buttons to options edit menu; added color to table of preconditions/effects

This commit is contained in:
Sokomine 2021-05-03 18:21:06 +02:00
parent cb90aab7f2
commit af9edde36d

View File

@ -864,7 +864,6 @@ local function get_fs_optiondialog(player, n_id, d_id, o_id, p_id, r_id)
end
-- TODO: add buttons for options: [delete] [add] [back to dialog] [prev] [next]
-- TODO: display and allow to edit sort order (o_sort)
-- TODO: actually add functionality for this formspec
-- TODO: make sure the formspec doesn't get closed when there are unsaved modifications
@ -883,7 +882,7 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
if(prereq) then
for k, v in pairs(prereq) do
list_of_preconditions = list_of_preconditions..
minetest.formspec_escape(v.p_id)..","..
minetest.formspec_escape(v.p_id)..",#FFFF00,"..
minetest.formspec_escape(v.p_type)..","..
minetest.formspec_escape(v.p_value)..","
end
@ -901,7 +900,7 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
target_dialog = v.r_value
elseif v.r_type ~= "dialog" then
list_of_effects = list_of_effects..
minetest.formspec_escape(v.r_id)..","..
minetest.formspec_escape(v.r_id)..",#FFFF00,"..
minetest.formspec_escape(v.r_type)..","..
minetest.formspec_escape(v.r_value)..","
end
@ -941,7 +940,7 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
-- build up the formspec
local formspec = ""..
"formspec_version[3]"..
"size[21,20]"..
"size[21,18]"..
"bgcolor[#00000000;false]"..
-- button back to the current dialog (of which this is an option)
"button[15.8,0.2;5.0,0.9;show_current_dialog;Back to dialog "..
@ -956,7 +955,7 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
-- list the preconditions
"label[0.2,4.2;If all of the following pre(C)onditions are fulfilled:]"..
-- TODO: perhaps add tooltip for the type of the conditions
"tablecolumns[text;text;text]"..
"tablecolumns[text;color,span=1;text;text]"..
"table[1.2,4.5;19.6,2.0;table_of_preconditions;"..
list_of_preconditions..";0]"..
-- answer of the player (the actual option)
@ -982,7 +981,7 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
-- list of effects
"label[0.2,10.6;When this answer has been selected, apply the following (Ef)fects:]"..
-- TODO: perhaps add tooltip for the type of the conditions
"tablecolumns[text;text;text]"..
"tablecolumns[text;color,span=1;text;text]"..
"table[1.2,11.0;19.6,2.0;table_of_effect;"..
list_of_effects..";0]"..
-- ..and what the NPC will reply to that answer
@ -995,7 +994,23 @@ local function get_fs_edit_option_dialog(player, n_id, d_id, o_id)
"dropdown[14.8,13.2;5,0.9;target_dialog;"..dialog_list..";"..dialog_selected..",]"..
"tooltip[14.8,13.2;5,0.9;Select the target dialog with which the NPC shall react "..
"to this answer. Currently, dialog "..minetest.formspec_escape(target_dialog)..
" is beeing displayed.;#FFFFFF;#000000]"
" is beeing displayed.;#FFFFFF;#000000]"..
-- button: delete
"button[0.2,17;2.0,0.9;edit_option_delete;Delete]"..
"tooltip[edit_option_delete;Delete this option/answer.]"..
-- button: add new
"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]"..
"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]"..
"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.]"
return formspec
end