Jump to content

Armor ground image visible behind player while wearing armor


Recommended Posts

Basically I'm trying to make a custom armor but whenever it's equipped and the player is facing forward, the image for when it's on the ground is visible, attached to the player's behind.

Here's the code for the armor piece. As far as I can tell, there's no reason it should be doing this.

Spoiler

local assets =
{
    Asset("ANIM", "anim/vaultsuit.zip"),
    Asset("ATLAS", "images/inventoryimages/vaultsuit.xml"),
    Asset("IMAGE", "images/inventoryimages/vaultsuit.tex"),
}


local function onequip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_body", "vaultsuit", "swap_body")
    owner:AddTag("radresistant")
    inst.components.fueled:StartConsuming()
end

local function onunequip(inst, owner)
    owner.AnimState:ClearOverrideSymbol("swap_body")
    owner:RemoveTag("radresistant")
    inst.components.fueled:StopConsuming()
end

local function onperish(inst)
    inst:Remove()
end

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("vaultsuit_ground")
    inst.AnimState:SetBuild("vaultsuit")
    inst.AnimState:PlayAnimation("anim")

    inst:AddTag("vaultsuit")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/vaultsuit.xml"
    
    inst:AddComponent("fueled")
    inst.components.fueled.fueltype = "USAGE"
    inst.components.fueled:InitializeFuelLevel(6*60)
    inst.components.fueled:SetDepletedFn(onperish)

    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY

    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
    
    

    MakeHauntableLaunch(inst)

    return inst
end

return Prefab("vaultsuit", fn, assets)


 

 

Edited by Eusong
Link to comment
Share on other sites

On 9/15/2017 at 8:05 AM, Ryuushu said:

@Eusong

I ran into that problem a few days ago, eventually started using it as a feature. Move swap_body-13 outside the swap folder and rename it vaultsuit or something else before using it in an anim.

Oooh, okay. Thanks! Hopefully this should fix it. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...