local assets =
{
	Asset("ANIM", "anim/item.zip"),
    Asset("ATLAS", "images/inventoryimages/crunitcr.xml"),
}


local function fn()
    local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("item")
    inst.AnimState:SetBuild("item")
    inst.AnimState:PlayAnimation("crunitcr")

    inst.entity:SetPristine()
local function onusebush(inst)
    local owner = inst.components.inventoryitem.owner
	if owner.components.sanity.current >=30 then
	owner.components.inventory:GiveItem( SpawnPrefab("crunitcr"))
	owner.components.sanity:DoDelta(-30)
	for k = 1, 5 do
	owner.components.inventory:GiveItem( SpawnPrefab("magicpower"))end
	inst:Remove()
	else 
	inst.components.talker:Say("我的精神不能继续使用它了")
	return Say
	end 
end
    if not TheWorld.ismastersim then
        return inst
    end
	inst:AddTag("molebait")
    inst:AddComponent("inspectable")
    inst:AddComponent("inventoryitem")
	inst:AddComponent("tradable")
    inst.components.inventoryitem.imagename = "crunitcr"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/crunitcr.xml"
    inst:AddComponent("selfstacker")
	inst:AddComponent("useableitem")
    inst.components.useableitem:SetOnUseFn(onusebush)
	inst:AddComponent("equippable")
	inst:AddComponent("talker")
--使用限制：

    MakeHauntableLaunchAndSmash(inst)

    return inst
end
return Prefab("crunitcr", fn, assets)