
local function onequip(inst, owner) 
    --owner.AnimState:OverrideSymbol("swap_body", "zgsabber_armor", "swap_body")
	owner.AnimState:ClearOverrideSymbol("swap_body")
end

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
end

local function fn()
    local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("zgsabber_armor")
    inst.AnimState:SetBuild("zgsabber_armor")
    inst.AnimState:PlayAnimation("idle")
	
    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.atlasname = "images/zgsabber_armor.xml"
	inst.components.inventoryitem.imagename = "zgsabber_armor"

    inst:AddComponent("armor")
    inst.components.armor:InitCondition(750, .8)

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

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

return Prefab("zgsabber_armor", fn)
