mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-06-26 09:08:03 +02:00
fixed bug with data.what used before data
This commit is contained in:
parent
412ae94c1b
commit
ad063f2e0a
@ -301,7 +301,7 @@ yl_speak_up.save_element_p_or_a_or_e = function(
|
|||||||
-- "the inventory of the player", -- 5
|
-- "the inventory of the player", -- 5
|
||||||
-- "the inventory of the NPC", -- 6
|
-- "the inventory of the NPC", -- 6
|
||||||
-- (only for preconditions; not for effects)
|
-- (only for preconditions; not for effects)
|
||||||
elseif((what_type == "player_inv" or what_type == "npc_inv") and id_prefix == "p_") then
|
elseif((what_type == "player_inv" or what_type == "npc_inv" or what_type == "block_inv") and id_prefix == "p_") then
|
||||||
v.p_value = values_inv[ data.inv ]
|
v.p_value = values_inv[ data.inv ]
|
||||||
if(v.p_value and v.p_value ~= "inv_is_empty") then
|
if(v.p_value and v.p_value ~= "inv_is_empty") then
|
||||||
if(not(data.inv_stack_name) or data.inv_stack_name == "") then
|
if(not(data.inv_stack_name) or data.inv_stack_name == "") then
|
||||||
@ -732,19 +732,19 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields,
|
|||||||
|
|
||||||
-- field inputs: those do not trigger a sending of the formspec on their own
|
-- field inputs: those do not trigger a sending of the formspec on their own
|
||||||
|
|
||||||
|
local was_changed = false
|
||||||
|
-- are we talking about an inventory?
|
||||||
|
-- (inventory only applies to preconditions; not effects)
|
||||||
|
local data = yl_speak_up.speak_to[pname][ tmp_data_cache ]
|
||||||
local what_type = ""
|
local what_type = ""
|
||||||
if(data and data.what and values_what[ data.what ]) then
|
if(data and data.what and values_what[ data.what ]) then
|
||||||
what_type = values_what[ data.what ]
|
what_type = values_what[ data.what ]
|
||||||
end
|
end
|
||||||
|
|
||||||
local was_changed = false
|
|
||||||
-- are we talking about an inventory?
|
|
||||||
-- (inventory only applies to preconditions; not effects)
|
|
||||||
local data = yl_speak_up.speak_to[pname][ tmp_data_cache ]
|
|
||||||
if(((fields.inv_stack_name and fields.inv_stack_name ~= "")
|
if(((fields.inv_stack_name and fields.inv_stack_name ~= "")
|
||||||
or (fields.store_item_name and fields.store_item_name ~= ""))
|
or (fields.store_item_name and fields.store_item_name ~= ""))
|
||||||
and data and data.what
|
and data and data.what
|
||||||
and ((id_prefix == "p_" and (what_type == "player_inv" or what_type == "npc_inv"))
|
and ((id_prefix == "p_" and (what_type == "player_inv" or what_type == "npc_inv" or what_type == "block_inv"))
|
||||||
-- "give item (created out of thin air) to player (requires npc_master priv)", -- 7
|
-- "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
|
-- "take item from player and destroy it (requires npc_master priv)", -- 8
|
||||||
or (id_prefix == "r_" and (what_type == "give_item" or what_type == "take_item")))) then
|
or (id_prefix == "r_" and (what_type == "give_item" or what_type == "take_item")))) then
|
||||||
@ -1273,7 +1273,7 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
|
|||||||
-- "the inventory of the player", -- 5
|
-- "the inventory of the player", -- 5
|
||||||
-- "the inventory of the NPC", -- 6
|
-- "the inventory of the NPC", -- 6
|
||||||
-- (inventory - only for preconditions; effects have something else here)
|
-- (inventory - only for preconditions; effects have something else here)
|
||||||
elseif(data.what and id_prefix == "p_" and (what_type == "player_inv" or what_type == "npc_inv")) then
|
elseif(data.what and id_prefix == "p_" and (what_type == "player_inv" or what_type == "npc_inv" or what_type == "block_inv")) then
|
||||||
return yl_speak_up.get_fs_edit_option_precondition_inv(
|
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)
|
values_inv, check_inv)
|
||||||
|
Loading…
Reference in New Issue
Block a user