mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
fix special wands skins in inventory, maybe fix notplayer holding 2 wands sometimes
This commit is contained in:
parent
e355a41fe0
commit
a37b281838
2 changed files with 23 additions and 6 deletions
|
@ -81,7 +81,9 @@ function inventory_helper.serialize_single_item(item)
|
||||||
end
|
end
|
||||||
local is_new = true
|
local is_new = true
|
||||||
local item_component = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
local item_component = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||||
|
local image_inv
|
||||||
if item_component and item_component ~= 0 then
|
if item_component and item_component ~= 0 then
|
||||||
|
image_inv = ComponentGetValue2(item_component, "ui_sprite")
|
||||||
is_new = ComponentGetValue2(item_component, "play_hover_animation")
|
is_new = ComponentGetValue2(item_component, "play_hover_animation")
|
||||||
end
|
end
|
||||||
local vx = 0
|
local vx = 0
|
||||||
|
@ -91,9 +93,12 @@ function inventory_helper.serialize_single_item(item)
|
||||||
vx, vy = ComponentGetValue2(vel, "mVelocity")
|
vx, vy = ComponentGetValue2(vel, "mVelocity")
|
||||||
end
|
end
|
||||||
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
|
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
|
||||||
|
if sprite ~= nil then
|
||||||
sprite = ComponentGetValue2(sprite, "image_file")
|
sprite = ComponentGetValue2(sprite, "image_file")
|
||||||
|
end
|
||||||
local varp = EntityGetFilename(item) == "data/entities/items/wand_varpuluuta.xml"
|
local varp = EntityGetFilename(item) == "data/entities/items/wand_varpuluuta.xml"
|
||||||
item_data = {true, wand:Serialize(true, true), x, y, extra, is_new, {vx, vy}, sprite, varp}
|
GamePrint(tostring(image_inv))
|
||||||
|
item_data = {true, wand:Serialize(true, true), x, y, extra, is_new, {vx, vy}, sprite, image_inv, varp}
|
||||||
else
|
else
|
||||||
item_data = {false, util.serialize_entity(item), x, y}
|
item_data = {false, util.serialize_entity(item), x, y}
|
||||||
end
|
end
|
||||||
|
@ -116,16 +121,23 @@ function inventory_helper.deserialize_single_item(item_data)
|
||||||
local is_new = item_data[6]
|
local is_new = item_data[6]
|
||||||
local vx, vy = item_data[7][1], item_data[7][2]
|
local vx, vy = item_data[7][1], item_data[7][2]
|
||||||
local image = item_data[8]
|
local image = item_data[8]
|
||||||
|
local image_inv = item_data[9]
|
||||||
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
|
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
|
||||||
|
if sprite ~= nil then
|
||||||
ComponentSetValue2(sprite, "image_file", image)
|
ComponentSetValue2(sprite, "image_file", image)
|
||||||
if item_data[9] then
|
end
|
||||||
|
if item_data[10] then
|
||||||
local varp = EntityCreateNew()
|
local varp = EntityCreateNew()
|
||||||
EntityAddComponent2(varp, "InheritTransformComponent", {_tags="enabled_in_world,enabled_in_hand", only_position=true, parent_hotspot_tag="shoot_pos"})
|
EntityAddComponent2(varp, "InheritTransformComponent", {_tags="enabled_in_world,enabled_in_hand", only_position=true, parent_hotspot_tag="shoot_pos"})
|
||||||
EntityAddComponent2(varp, "CellEaterComponent", {_tags="enabled_in_world,enabled_in_hand", radius=20, eat_probability=10, only_stain=true})
|
EntityAddComponent2(varp, "CellEaterComponent", {_tags="enabled_in_world,enabled_in_hand", radius=20, eat_probability=10, only_stain=true})
|
||||||
EntityAddChild(item, varp)
|
EntityAddChild(item, varp)
|
||||||
end
|
end
|
||||||
local ability = EntityGetFirstComponentIncludingDisabled(item, "AbilityComponent")
|
local ability = EntityGetFirstComponentIncludingDisabled(item, "AbilityComponent")
|
||||||
if extra ~= nil and ability ~= nil then
|
local item_component = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||||
|
if item_component ~= nil then
|
||||||
|
ComponentSetValue2(item_component, "ui_sprite", image_inv)
|
||||||
|
end
|
||||||
|
if ability ~= nil and extra ~= nil then
|
||||||
for i, field in ipairs(ability_component_extra_fields) do
|
for i, field in ipairs(ability_component_extra_fields) do
|
||||||
if extra[i] ~= nil then
|
if extra[i] ~= nil then
|
||||||
ComponentSetValue2(ability, field, extra[i])
|
ComponentSetValue2(ability, field, extra[i])
|
||||||
|
@ -133,7 +145,6 @@ function inventory_helper.deserialize_single_item(item_data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not is_new then
|
if not is_new then
|
||||||
local item_component = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
|
||||||
ComponentSetValue2(item_component, "play_hover_animation", false)
|
ComponentSetValue2(item_component, "play_hover_animation", false)
|
||||||
local phys = EntityGetFirstComponentIncludingDisabled(item, "SimplePhysicsComponent")
|
local phys = EntityGetFirstComponentIncludingDisabled(item, "SimplePhysicsComponent")
|
||||||
EntitySetComponentIsEnabled(item, phys, true)
|
EntitySetComponentIsEnabled(item, phys, true)
|
||||||
|
|
|
@ -199,6 +199,12 @@ local function player_died()
|
||||||
EntityAddTag(iron, "kill_on_revive")
|
EntityAddTag(iron, "kill_on_revive")
|
||||||
LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/spectate/no_tinker.xml")
|
LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/spectate/no_tinker.xml")
|
||||||
set_cosmetics_locally(ctx.my_id)
|
set_cosmetics_locally(ctx.my_id)
|
||||||
|
|
||||||
|
local inv = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "Inventory2Component")
|
||||||
|
ComponentSetValue2(inv, "mItemHolstered", false)
|
||||||
|
ComponentSetValue2(inv, "mActualActiveItem", 0)
|
||||||
|
ComponentSetValue2(inv, "mActiveItem", 0)
|
||||||
|
|
||||||
polymorph.switch_entity(ent + 1)
|
polymorph.switch_entity(ent + 1)
|
||||||
|
|
||||||
remove_healthbar_locally()
|
remove_healthbar_locally()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue