diff --git a/fs_edit_general.lua b/fs_edit_general.lua index 4a843f6..31a70c8 100644 --- a/fs_edit_general.lua +++ b/fs_edit_general.lua @@ -1150,7 +1150,9 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result, -- (state is the second offered option in both preconditions and effects list) if(data.what and data.what == 2 and id_prefix ~= "a_") then return yl_speak_up.get_fs_edit_option_p_and_e_state( - pname, dialog, formspec, data, id_prefix, save_button, e) + pname, dialog, formspec, data, id_prefix, save_button, e, + text_variable, text_select_value, text_select_operator, + values_operator, check_operator, get_sorted_player_var_list_function ) -- "a block somewhere", -- 3 -- (block is the third offered option in both preconditions and effects list) @@ -1245,13 +1247,18 @@ end ---------------------------------------------------------------------------- -- begin of formspecs for types of preconditions, actions and effects --- TODO: text_variable, text_select_operator, values_operator, get_sorted_player_var_list_function -yl_speak_up.get_fs_edit_option_p_and_e_state = function(pname, dialog, formspec, data, id_prefix, save_button, e) +-- "an internal state (i.e. of a quest)", -- 2 +-- (state is the second offered option in both preconditions and effects list) +yl_speak_up.get_fs_edit_option_p_and_e_state = function(pname, dialog, formspec, data, id_prefix, + save_button, e, + text_variable, text_select_value, text_select_operator, + values_operator, check_operator, get_sorted_player_var_list_function ) + + local var_list = get_sorted_player_var_list_function(pname) if(e) then data.operator = math.max(1,table.indexof(values_operator, e[ id_prefix.."operator" ])) data.var_cmp_value = e[ id_prefix.."var_cmp_value" ] data.variable_name = e[ id_prefix.."variable" ] - local var_list = get_sorted_player_var_list_function(pname) data.variable = math.max(1, table.indexof(var_list, e[ id_prefix.."variable"])+1) end if(not(data.variable) or data.variable < 1) then @@ -1275,7 +1282,6 @@ yl_speak_up.get_fs_edit_option_p_and_e_state = function(pname, dialog, formspec, -- the list of available variables needs to be extended with the ones -- the player has read access to, and the order has to be constant -- (because dropdown just returns an index) - local var_list = get_sorted_player_var_list_function(pname) local var_list_text = "- please select -" for i, v in ipairs(var_list) do local parts = string.split(v, " ") @@ -1286,7 +1292,8 @@ yl_speak_up.get_fs_edit_option_p_and_e_state = function(pname, dialog, formspec, end var_list_text = var_list_text..","..minetest.formspec_escape(tostring(var_name)) end - return "label[0.2,3.3;"..text_variable.."]".. + return formspec.. + "label[0.2,3.3;"..text_variable.."]".. "label[0.2,4.3;Name of variable:]".. "dropdown[0.2,4.8;6.5,0.6;select_variable;".. var_list_text..";"..