mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-07-07 06:18:53 +02:00
completed get_fs_edit_option_p_and_e_state
This commit is contained in:
parent
e693af302c
commit
1d00232341
@ -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)
|
-- (state is the second offered option in both preconditions and effects list)
|
||||||
if(data.what and data.what == 2 and id_prefix ~= "a_") then
|
if(data.what and data.what == 2 and id_prefix ~= "a_") then
|
||||||
return yl_speak_up.get_fs_edit_option_p_and_e_state(
|
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
|
-- "a block somewhere", -- 3
|
||||||
-- (block is the third offered option in both preconditions and effects list)
|
-- (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
|
-- begin of formspecs for types of preconditions, actions and effects
|
||||||
|
|
||||||
-- TODO: text_variable, text_select_operator, values_operator, get_sorted_player_var_list_function
|
-- "an internal state (i.e. of a quest)", -- 2
|
||||||
yl_speak_up.get_fs_edit_option_p_and_e_state = function(pname, dialog, formspec, data, id_prefix, save_button, e)
|
-- (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
|
if(e) then
|
||||||
data.operator = math.max(1,table.indexof(values_operator, e[ id_prefix.."operator" ]))
|
data.operator = math.max(1,table.indexof(values_operator, e[ id_prefix.."operator" ]))
|
||||||
data.var_cmp_value = e[ id_prefix.."var_cmp_value" ]
|
data.var_cmp_value = e[ id_prefix.."var_cmp_value" ]
|
||||||
data.variable_name = e[ id_prefix.."variable" ]
|
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)
|
data.variable = math.max(1, table.indexof(var_list, e[ id_prefix.."variable"])+1)
|
||||||
end
|
end
|
||||||
if(not(data.variable) or data.variable < 1) then
|
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 list of available variables needs to be extended with the ones
|
||||||
-- the player has read access to, and the order has to be constant
|
-- the player has read access to, and the order has to be constant
|
||||||
-- (because dropdown just returns an index)
|
-- (because dropdown just returns an index)
|
||||||
local var_list = get_sorted_player_var_list_function(pname)
|
|
||||||
local var_list_text = "- please select -"
|
local var_list_text = "- please select -"
|
||||||
for i, v in ipairs(var_list) do
|
for i, v in ipairs(var_list) do
|
||||||
local parts = string.split(v, " ")
|
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
|
end
|
||||||
var_list_text = var_list_text..","..minetest.formspec_escape(tostring(var_name))
|
var_list_text = var_list_text..","..minetest.formspec_escape(tostring(var_name))
|
||||||
end
|
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:]"..
|
"label[0.2,4.3;Name of variable:]"..
|
||||||
"dropdown[0.2,4.8;6.5,0.6;select_variable;"..
|
"dropdown[0.2,4.8;6.5,0.6;select_variable;"..
|
||||||
var_list_text..";"..
|
var_list_text..";"..
|
||||||
|
Loading…
Reference in New Issue
Block a user