manage_variables formspec has all elements now but still lacks implementation of most functions

This commit is contained in:
Sokomine 2021-07-26 22:53:44 +02:00
parent c19e478728
commit 8e3ba06a7e

View File

@ -268,15 +268,65 @@ yl_speak_up.get_fs_manage_variables = function(player, param)
"tooltip[add_variable;Create a new varialbe with the name\n"..
"you entered in the field to the left.]"
else
local add_read_button = ""
local add_write_button = ""
if(not(yl_speak_up.speak_to[pname].tmp_index_var_read_access)
or yl_speak_up.speak_to[pname].tmp_index_var_read_access == 1) then
yl_speak_up.speak_to[pname].tmp_index_var_read_access = 1
add_read_button = "button[12.9,2.9;1.0,0.9;add_read_access;Add]"..
"tooltip[add_read_access;Grant the player whose name you entered\n"..
"you entered in the field to the left read access\n"..
"to your variable.]"
end
if(not(yl_speak_up.speak_to[pname].tmp_index_var_write_access)
or yl_speak_up.speak_to[pname].tmp_index_var_write_access == 1) then
yl_speak_up.speak_to[pname].tmp_index_var_write_access = 1
add_write_button = "button[12.9,3.9;1.0,0.9;add_write_access;Add]"..
"tooltip[add_write_access;Grant the player whose name you entered\n"..
"you entered in the field to the left *write* access\n"..
"to your variable.]"
end
additional_buttons = "button[11.4,1.9;2.5,0.9;show_var_usage;Where is it used?]"..
"tooltip[show_var_usage;Show which NPC use this variable in which context.]"
"tooltip[show_var_usage;Show which NPC use this variable in which context.]"..
-- offer a dropdown list and a text input field for new varialbe names for adding
"label[0.2,3.05;Players with read access to this variable:]"..
yl_speak_up.create_dropdown_playerlist(player, pname,
{}, yl_speak_up.speak_to[pname].tmp_index_var_read_access, -- TODO
5.5, 2.9, 0.0, "list_var_read_access", "player", "Remove player from list",
"grant_player_var_read_access",
"Enter the name of the player that shall\n"..
"have read access to this variable.",
"revoke_player_var_read_access",
"If you click here, the selected player\n"..
"will no longer be able to add new\n"..
"pre(C)onditions which read your variable."
)..add_read_button..
"label[0.2,4.05;Players with *write* access to this variable:]"..
yl_speak_up.create_dropdown_playerlist(player, pname,
{}, yl_speak_up.speak_to[pname].tmp_index_var_write_access, -- TODO
5.5, 3.9, 0.0, "list_var_write_access", "player", "Remove player from list",
"grant_player_var_write_access",
"Enter the name of the player that shall\n"..
"have *write* access to this variable.",
"revoke_player_var_write_access",
"If you click here, the selected player\n"..
"will no longer be able to *write* new\n"..
"values into this variable."
)..add_write_button..
"label[0.2,5.05;Type of variable: "..
-- TODO: show actual type
minetest.colorize("#FFFF00","String/text or numerical value, depending "..
"on how you use it")..".]"
end
return "size[14,4]"..
"label[2.0,-0.2;* Manage your variables *]"..
return "size[14,6.5]"..
"label[5.0,0.0;* Manage your variables *]"..
"label[0.2,0.8;Note: Each variable will store a diffrent value for each player who "..
"interacts with the NPC.\n"..
"You can grant read and write access to other players for your "..
"variables so that they can also use them as well.]"..
"label[0.2,2.05;Your variables:]"..
-- offer a dropdown list and a text input field for new varialbe names for adding
yl_speak_up.create_dropdown_playerlist(player, pname,
--table_of_names, yl_speak_up.speak_to[pname].tmp_index,
table_of_vars, yl_speak_up.speak_to[pname].tmp_index_variable,
2.2, 1.9, 1.0, "list_var_names", "variable", "Delete selected variable",
"add_variable_name",
@ -287,7 +337,8 @@ yl_speak_up.get_fs_manage_variables = function(player, param)
"will be deleted."
)..
additional_buttons..
"button[2.0,3.5;1.0,0.6;back;Back]"
"button[0.0,0.2;1.0,0.6;back;Back]"..
"button[6.0,6.0;1.0,0.6;back;Back]"
end