completed get_fs_edit_option_precondition_inv

This commit is contained in:
Sokomine 2021-07-02 17:17:33 +02:00
parent a4a292f7b2
commit b70f9bdafe

View File

@ -1169,7 +1169,8 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
-- (inventory - only for preconditions; effects have something else here)
elseif(data.what and id_prefix == "p_" and data.what >= 5 and data.what <= 6) then
return yl_speak_up.get_fs_edit_option_precondition_inv(
pname, dialog, formspec, data, id_prefix, save_button, e)
pname, dialog, formspec, data, id_prefix, save_button, e,
values_inv, check_inv)
-- "give item (created out of thin air) to player (requires npc_master priv)", -- 7
-- "take item from player and destroy it (requires npc_master priv)", -- 8
@ -1428,7 +1429,12 @@ yl_speak_up.get_fs_edit_option_precondition_trade = function(
end
yl_speak_up.get_fs_edit_option_precondition_inv = function(pname, dialog, formspec, data, id_prefix, save_button, e)
-- "the inventory of the player", -- 5
-- "the inventory of the NPC", -- 6
-- (inventory - only for preconditions; effects have something else here)
yl_speak_up.get_fs_edit_option_precondition_inv = function(
pname, dialog, formspec, data, id_prefix, save_button, e,
values_inv, check_inv)
if(e) then
data.inv = math.max(1,table.indexof(values_inv, e["p_value"]))
data.inv_stack_name = e[ "p_itemstack" ]
@ -1438,7 +1444,8 @@ yl_speak_up.get_fs_edit_option_precondition_inv = function(pname, dialog, formsp
-- not enough selected yet for saving
save_button = ""
end
return "label[0.2,3.0;The following shall be true about the inventory:]"..
return formspec..
"label[0.2,3.0;The following shall be true about the inventory:]"..
"dropdown[4.0,3.2;16.0,0.6;select_inv;"..
table.concat(check_inv, ",")..";"..
tostring(data.inv)..";]"..