local assets=
{
	Asset("ANIM", "anim/baronsuit.zip"),
	Asset("ANIM", "anim/baronsuit2.zip"),
	Asset("ANIM", "anim/torso_defitems.zip"),
}


local function onequip(inst, owner)
	if owner then
    owner.AnimState:OverrideSymbol("swap_body", "baronsuit", "swap_body")
	inst.components.fueled:StartConsuming()
	end
end

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

local function suitbaron()
	local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("torso_hawaiian")--"torso_defitems")--"baronsuit_bank")
    inst.AnimState:SetBuild("baronsuit2")
    inst.AnimState:PlayAnimation("anim")

	if TheSim:GetGameID()=="DST" then
		inst.entity:AddNetwork()

		if not TheWorld.ismastersim then
			return inst
		end

		inst.entity:SetPristine()

	    MakeHauntableLaunch(inst)
	end

	inst:AddComponent("inspectable")

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

	inst:AddComponent("fueled")
	if TheSim:GetGameID()=="DST" then --Don't ask -M
		inst.components.fueled.fueltype = FUELTYPE.USAGE
	else
		inst.components.fueled.fueltype = "USAGE"
	end
    inst.components.fueled:InitializeFuelLevel(TUNING.SWEATERVEST_PERISHTIME)
	inst.components.fueled:SetDepletedFn(inst.Remove)

    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY
	inst.components.equippable.dapperness = TUNING.DAPPERNESS_LARGE
	inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)

	inst:AddComponent("insulator")
    inst.components.insulator.insulation =  TUNING.INSULATION_TINY --TODO crashes base

    return inst
end


return Prefab( "common/inventory/baronsuit", suitbaron, assets)
