completed get_fs_edit_option_p_and_e_block

This commit is contained in:
Sokomine 2021-07-02 17:08:51 +02:00
parent 1d00232341
commit 2fbb0384cb

View File

@ -1063,10 +1063,6 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
end
end
-- did the player get here through punching a block in the meantime?
local block_pos = yl_speak_up.speak_to[pname].block_punched
yl_speak_up.speak_to[pname].block_punched = nil
local data = yl_speak_up.speak_to[pname][ tmp_data_cache ]
if(not(data) or not(data.what)) then
data = { what = 1}
@ -1158,7 +1154,8 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
-- (block is the third offered option in both preconditions and effects list)
elseif(data.what and data.what == 3 and id_prefix ~= "a_") then
return yl_speak_up.get_fs_edit_option_p_and_e_block(
pname, dialog, formspec, data, id_prefix, save_button, e)
pname, dialog, formspec, data, id_prefix, save_button, e,
text_block_position, values_block, check_block)
-- "a trade", -- 4
-- (trade - only for preconditions; effects have something else here)
@ -1249,10 +1246,10 @@ end
-- "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 )
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
@ -1318,8 +1315,15 @@ yl_speak_up.get_fs_edit_option_p_and_e_state = function(pname, dialog, formspec,
end
-- TODO: block_pos as parameter?, values_block
yl_speak_up.get_fs_edit_option_p_and_e_block = function(pname, dialog, formspec, data, id_prefix, save_button, e)
-- "a block somewhere", -- 3
-- (block is the third offered option in both preconditions and effects list)
yl_speak_up.get_fs_edit_option_p_and_e_block = function(
pname, dialog, formspec, data, id_prefix, save_button, e,
text_block_position, values_block, check_block)
-- did the player get here through punching a block in the meantime?
local block_pos = yl_speak_up.speak_to[pname].block_punched
yl_speak_up.speak_to[pname].block_punched = nil
if(e) then
data.block = math.max(1,table.indexof(values_block, e[ id_prefix.."value" ]))
data.node_data = {}
@ -1380,7 +1384,8 @@ yl_speak_up.get_fs_edit_option_p_and_e_block = function(pname, dialog, formspec,
-- not enough selected yet for saving
save_button = ""
end
return "label[0.2,3.3;"..text_block_position.."]"..
return formspec..
"label[0.2,3.3;"..text_block_position.."]"..
"dropdown[4.0,3.5;16.0,0.6;select_block;"..
table.concat(check_block, ",")..";"..
tostring(data.block)..";]"..