completed get_fs_edit_option_precondition_trade

This commit is contained in:
Sokomine 2021-07-02 17:14:34 +02:00
parent 2fbb0384cb
commit a4a292f7b2

View File

@ -1161,7 +1161,8 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
-- (trade - only for preconditions; effects have something else here)
elseif(data.what and id_prefix == "p_" and data.what == 4) then
return yl_speak_up.get_fs_edit_option_precondition_trade(
pname, dialog, formspec, data, id_prefix, save_button, e)
pname, dialog, formspec, data, id_prefix, save_button, e,
values_trade, check_trade)
-- "the inventory of the player", -- 5
-- "the inventory of the NPC", -- 6
@ -1405,7 +1406,11 @@ yl_speak_up.get_fs_edit_option_p_and_e_block = function(
end
yl_speak_up.get_fs_edit_option_precondition_trade = function(pname, dialog, formspec, data, id_prefix, save_button, e)
-- "a trade", -- 4
-- (trade - only for preconditions; effects have something else here)
yl_speak_up.get_fs_edit_option_precondition_trade = function(
pname, dialog, formspec, data, id_prefix, save_button, e,
values_trade, check_trade)
if(e) then
data.trade = math.max(1,table.indexof(values_trade, e[ "p_value" ]))
end
@ -1414,7 +1419,8 @@ yl_speak_up.get_fs_edit_option_precondition_trade = function(pname, dialog, form
-- not enough selected yet for saving
save_button = ""
end
return "label[0.2,3.3;If the action is a trade, the following shall be true:]"..
return formspec..
"label[0.2,3.3;If the action is a trade, the following shall be true:]"..
"dropdown[4.0,3.5;16.0,0.6;select_trade;"..
table.concat(check_trade, ",")..";"..
tostring(data.trade)..";]"..