local assets =
{
    Asset("ANIM", "anim/downvest_yellow77.zip"),  --对应在anim里面的文件 加载动画文件
	Asset("ATLAS", "inventoryimages/downvest_yellow77.xml"), --加载物品栏贴图
    Asset("IMAGE", "inventoryimages/downvest_yellow77.tex"),
}

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

local function onequip(inst, owner) --装备
	  owner.AnimState:OverrideSymbol("swap_body", "downvest_yellow77", "swap_body")
    inst:ListenForEvent("blocked", OnBlocked, owner)
    inst.Light:Enable(true)
end

local function onunequip(inst, owner)  --脱下
    owner.AnimState:ClearOverrideSymbol("swap_body")
    inst:RemoveEventCallback("blocked", OnBlocked, owner)
    inst.Light:Enable(false)
end

local function fn()
    local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("downvest_yellow77") --动画
    inst.AnimState:SetBuild("downvest_yellow77")
    inst.AnimState:PlayAnimation("anim")	--丢地上的动画
    inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    inst.Light:SetFalloff(0.6)
    inst.Light:SetIntensity(0.5)
    inst.Light:SetRadius(1)
    inst.Light:SetColour(237/255, 237/255, 209/255)
    inst.Light:Enable(true)

    inst:AddTag("wood")

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

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end



    inst:AddComponent("inspectable") --可悲检查组件

    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.atlasname = "inventoryimages/downvest_yellow77.xml"  --加载物品栏贴图 mod物品必须有

	inst:AddComponent("waterproofer")  --防雨组件  （括号里面可以直接填数字）
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_ABSOLUTE)

	inst:AddComponent("insulator") --温度隔绝组件（括号里可以直接天数字就是保温多少秒）
    inst.components.insulator:SetInsulation(240)

	inst:AddComponent("fuel")--燃料 组件
    inst.components.fuel.fuelvalue = TUNING.LARGE_FUEL

    MakeSmallBurnable(inst, TUNING.SMALL_BURNTIME) --燃烧有关
    MakeSmallPropagator(inst)

    inst:AddComponent("armor")--护甲组件
    inst.components.armor:InitCondition(1500,0.5) --耐久度和减伤（90%）
    inst.components.armor:AddWeakness("beaver", TUNING.BEAVER_WOOD_DAMAGE)

    inst:AddComponent("equippable") --装备组件
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY --装备的部位是身体
    inst.components.equippable.walkspeedmult = 1.25--這是裝備後可以加速

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

    MakeHauntableLaunch(inst)

    return inst
end

return Prefab("downvest_yellow77", fn, assets) --生成这个预设物  代码为 downvest_gray77
