mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03: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
|
||||
local is_new = true
|
||||
local item_component = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||
local image_inv
|
||||
if item_component and item_component ~= 0 then
|
||||
image_inv = ComponentGetValue2(item_component, "ui_sprite")
|
||||
is_new = ComponentGetValue2(item_component, "play_hover_animation")
|
||||
end
|
||||
local vx = 0
|
||||
|
@ -91,9 +93,12 @@ function inventory_helper.serialize_single_item(item)
|
|||
vx, vy = ComponentGetValue2(vel, "mVelocity")
|
||||
end
|
||||
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
|
||||
if sprite ~= nil then
|
||||
sprite = ComponentGetValue2(sprite, "image_file")
|
||||
end
|
||||
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
|
||||
item_data = {false, util.serialize_entity(item), x, y}
|
||||
end
|
||||
|
@ -116,16 +121,23 @@ function inventory_helper.deserialize_single_item(item_data)
|
|||
local is_new = item_data[6]
|
||||
local vx, vy = item_data[7][1], item_data[7][2]
|
||||
local image = item_data[8]
|
||||
local image_inv = item_data[9]
|
||||
local sprite = EntityGetFirstComponentIncludingDisabled(item, "SpriteComponent")
|
||||
if sprite ~= nil then
|
||||
ComponentSetValue2(sprite, "image_file", image)
|
||||
if item_data[9] then
|
||||
end
|
||||
if item_data[10] then
|
||||
local varp = EntityCreateNew()
|
||||
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})
|
||||
EntityAddChild(item, varp)
|
||||
end
|
||||
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
|
||||
if extra[i] ~= nil then
|
||||
ComponentSetValue2(ability, field, extra[i])
|
||||
|
@ -133,7 +145,6 @@ function inventory_helper.deserialize_single_item(item_data)
|
|||
end
|
||||
end
|
||||
if not is_new then
|
||||
local item_component = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||
ComponentSetValue2(item_component, "play_hover_animation", false)
|
||||
local phys = EntityGetFirstComponentIncludingDisabled(item, "SimplePhysicsComponent")
|
||||
EntitySetComponentIsEnabled(item, phys, true)
|
||||
|
|
|
@ -199,6 +199,12 @@ local function player_died()
|
|||
EntityAddTag(iron, "kill_on_revive")
|
||||
LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/spectate/no_tinker.xml")
|
||||
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)
|
||||
|
||||
remove_healthbar_locally()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue