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

local function fn()

	local function onequip(inst, owner)
--		owner.AnimState:OverrideSymbol("swap_hat", "hat_rock_swap", "swap_hat")
		owner.AnimState:OverrideSymbol("swap_hat", "hat_rock", "swap_hat")
		owner.AnimState:Show("HAT")
		owner.AnimState:Show("HAT_HAIR")
		owner.AnimState:Hide("HAIR_NOHAT")
		owner.AnimState:Hide("HAIR")
	
		if owner:HasTag("player") then
			owner.AnimState:Hide("HEAD")
			owner.AnimState:Show("HEAD_HAT")
		end
	end

	local function onunequip(inst, owner)
		owner.AnimState:Hide("HAT")
		owner.AnimState:Hide("HAT_HAIR")
		owner.AnimState:Show("HAIR_NOHAT")
		owner.AnimState:Show("HAIR")
	
        if owner:HasTag("player") then
            owner.AnimState:Show("HEAD")
            owner.AnimState:Hide("HEAD_HAT")
        end
	end
	
	local inst = CreateEntity()
	
	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddNetwork()
	
	MakeInventoryPhysics(inst)

	inst.AnimState:SetBank("hat_rock")
    inst.AnimState:SetBuild("hat_rock")
	inst.AnimState:PlayAnimation("idle") 
	
	inst:AddTag("hat")
	
	inst.entity:SetPristine()
	
	if not TheWorld.ismastersim then
		return inst
	end 
	
	inst:AddComponent("inspectable")
	
	inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_rock.xml"
	inst.components.inventoryitem.imagename = "hat_rock"
	
	inst:AddComponent("tradable")
	
	inst:AddComponent("armor")
	inst.components.armor:InitCondition(TUNING.ARMOR_SLURTLEHAT, .85)
	
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
	inst.components.equippable.walkspeedmult = 0.9
	
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
	
    inst:AddComponent("insulator")
    inst.components.insulator:SetInsulation(TUNING.INSULATION_SMALL)
    inst.components.insulator:SetSummer()

	MakeHauntableLaunch(inst)
	
    return inst
end

STRINGS.NAMES.HAT_ROCK 									= "Rock Helmet"
STRINGS.RECIPE_DESC.HAT_ROCK 							= "For sturdy heads."

STRINGS.CHARACTERS.GENERIC.DESCRIBE.HAT_ROCK 			= "Hard as a rock."
STRINGS.CHARACTERS.WILLOW.DESCRIBE.HAT_ROCK 			= "I prefer wood to be honest."
STRINGS.CHARACTERS.WOLFGANG.DESCRIBE.HAT_ROCK 			= "Is suited for fighting."
STRINGS.CHARACTERS.WENDY.DESCRIBE.HAT_ROCK 				= "It makes me feel the weight of the world."
STRINGS.CHARACTERS.WX78.DESCRIBE.HAT_ROCK 				= "PRIMATIVE CRANIUM DEFENSE DEVICE"
STRINGS.CHARACTERS.WICKERBOTTOM.DESCRIBE.HAT_ROCK 		= "A concave piece of rock that can be worn."
STRINGS.CHARACTERS.WOODIE.DESCRIBE.HAT_ROCK 			= "A rock made for my head!"
STRINGS.CHARACTERS.WAXWELL.DESCRIBE.HAT_ROCK 			= "It does the job."
STRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.HAT_ROCK 		= "The handwork of warriors from the past!"
STRINGS.CHARACTERS.WEBBER.DESCRIBE.HAT_ROCK 			= "It feels like living under a rock."

return Prefab( "common/inventory/hat_rock", fn, assets ) 
