local assets =
{
	Asset("ANIM", "anim/armor_rock.zip"),
}

local function OnBlocked(owner)
    owner.SoundEmitter:PlaySound("dontstarve/wilson/hit_armour")
end

local function onequip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_body", "armor_rock", "swap_body")
    inst:ListenForEvent("blocked", OnBlocked, owner)
end

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

local function fn()
	local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("armor_rock")
    inst.AnimState:SetBuild("armor_rock")
    inst.AnimState:PlayAnimation("idle")

--	inst:AddTag("ruins")
--	inst:AddTag("metal")

	inst.foleysound = "dontstarve/movement/foley/metalarmour"

	inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("inspectable")

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

	inst:AddComponent("tradable")

    inst:AddComponent("armor")
    inst.components.armor:InitCondition(1500, .85)

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

    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.ARMOR_ROCK 								= "Rock Suit"
STRINGS.RECIPE_DESC.ARMOR_ROCK 							= "For sturdy bodies."

STRINGS.CHARACTERS.GENERIC.DESCRIBE.ARMOR_ROCK 			= "It weighs a ton."
STRINGS.CHARACTERS.WILLOW.DESCRIBE.ARMOR_ROCK 			= "Can I now look like a rock?"
STRINGS.CHARACTERS.WOLFGANG.DESCRIBE.ARMOR_ROCK 		= "Rocks cannot bind Wolfgangs might!"
STRINGS.CHARACTERS.WENDY.DESCRIBE.ARMOR_ROCK 			= "It makes me feel contained."
STRINGS.CHARACTERS.WX78.DESCRIBE.ARMOR_ROCK 			= "A SECOND HARD LAYER OF SKIN"
STRINGS.CHARACTERS.WICKERBOTTOM.DESCRIBE.ARMOR_ROCK 	= "A crude hollow suit made of rocks."
STRINGS.CHARACTERS.WOODIE.DESCRIBE.ARMOR_ROCK 			= "Rocks now made wearable."
STRINGS.CHARACTERS.WAXWELL.DESCRIBE.ARMOR_ROCK 			= "A very uncomfortable pile of rocks."
STRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.ARMOR_ROCK 		= "I feel like I possess the power of a stone golem!"
STRINGS.CHARACTERS.WEBBER.DESCRIBE.ARMOR_ROCK 			= "Our body can fit in it."

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