mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix potion mimics breaking game if you pick them up, dont allow you to pickup player potion mimics(literally 1984)
This commit is contained in:
parent
9ee8b15c90
commit
f6411bce23
2 changed files with 26 additions and 2 deletions
|
@ -168,7 +168,6 @@ local function get_sync_entities(return_all)
|
||||||
return not EntityHasTag(ent, "ew_no_enemy_sync") and not EntityHasTag(ent, "wand_ghost")
|
return not EntityHasTag(ent, "ew_no_enemy_sync") and not EntityHasTag(ent, "wand_ghost")
|
||||||
end)
|
end)
|
||||||
table_extend(entities, EntityGetWithTag("ew_enemy_sync_extra"))
|
table_extend(entities, EntityGetWithTag("ew_enemy_sync_extra"))
|
||||||
table_extend(entities, EntityGetWithTag("mimic_potion"))
|
|
||||||
table_extend(entities, EntityGetWithTag("plague_rat"))
|
table_extend(entities, EntityGetWithTag("plague_rat"))
|
||||||
table_extend(entities, EntityGetWithTag("perk_fungus_tiny"))
|
table_extend(entities, EntityGetWithTag("perk_fungus_tiny"))
|
||||||
table_extend(entities, EntityGetWithTag("helpless_animal"))
|
table_extend(entities, EntityGetWithTag("helpless_animal"))
|
||||||
|
|
|
@ -252,6 +252,19 @@ local function is_safe_to_remove()
|
||||||
return not ctx.is_wand_pickup
|
return not ctx.is_wand_pickup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rpc.opts_everywhere()
|
||||||
|
function rpc.mimic_potion(ent, gid)
|
||||||
|
ent = ctx.entity_by_remote_id[ent] or ent
|
||||||
|
if not EntityHasTag(ent, "ew_global_item") then
|
||||||
|
item_sync.ensure_notify_component(ent)
|
||||||
|
EntityAddTag(ent, "ew_global_item")
|
||||||
|
EntityAddComponent2(ent, "VariableStorageComponent", {
|
||||||
|
_tags = "enabled_in_world,enabled_in_hand,enabled_in_inventory,ew_global_item_id",
|
||||||
|
value_string = gid,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function item_sync.on_world_update()
|
function item_sync.on_world_update()
|
||||||
-- TODO check that we not removing item we are going to pick now, instead of checking if picker gui is open.
|
-- TODO check that we not removing item we are going to pick now, instead of checking if picker gui is open.
|
||||||
if is_safe_to_remove() then
|
if is_safe_to_remove() then
|
||||||
|
@ -263,6 +276,18 @@ function item_sync.on_world_update()
|
||||||
if GameGetFrameNum() % 60 == 31 then
|
if GameGetFrameNum() % 60 == 31 then
|
||||||
send_item_positions()
|
send_item_positions()
|
||||||
end
|
end
|
||||||
|
if GameGetFrameNum() % 5 == 2 then
|
||||||
|
for _, ent in ipairs(EntityGetWithTag("mimic_potion")) do
|
||||||
|
if ctx.is_host then
|
||||||
|
if not EntityHasTag(ent, "ew_global_item") then
|
||||||
|
item_sync.make_item_global(ent)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if EntityHasTag(ent, "polymorphed_player") then
|
||||||
|
EntityRemoveComponent(ent, EntityGetFirstComponentIncludingDisabled(ent, "ItemComponent"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function item_sync.on_should_send_updates()
|
function item_sync.on_should_send_updates()
|
||||||
|
@ -272,7 +297,7 @@ function item_sync.on_should_send_updates()
|
||||||
local global_items = EntityGetWithTag("ew_global_item")
|
local global_items = EntityGetWithTag("ew_global_item")
|
||||||
local item_list = {}
|
local item_list = {}
|
||||||
for _, item in ipairs(global_items) do
|
for _, item in ipairs(global_items) do
|
||||||
if is_item_on_ground(item) then
|
if is_item_on_ground(item) and not EntityHasTag(item, "mimic_potion") then
|
||||||
local item_data = inventory_helper.serialize_single_item(item)
|
local item_data = inventory_helper.serialize_single_item(item)
|
||||||
local gid = item_sync.get_global_item_id(item)
|
local gid = item_sync.get_global_item_id(item)
|
||||||
item_data.gid = gid
|
item_data.gid = gid
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue