
local function MakeFood(name,data)
	local assets=
	{
		Asset("ANIM", "anim/miaoji_food.zip"),
		Asset( "IMAGE", "images/inventoryimages/miaoji_food.tex" ),
		Asset( "ATLAS", "images/inventoryimages/miaoji_food.xml" ),
	}
	
	local prefabs = 
	{
		"spoiled_food",
	}
	
	local function fn()
		local inst = CreateEntity()
		inst.entity:AddTransform()
		inst.entity:AddAnimState()
		if TheSim:GetGameID() == "DST" then
		inst.entity:AddNetwork()
		end
		MakeInventoryPhysics(inst)
		
		inst.AnimState:SetBuild("miaoji_food")
		inst.AnimState:SetBank("miaoji_food")
		inst.AnimState:PlayAnimation("idle")
	    
	    inst:AddTag("preparedfood")
		inst:AddTag("catfood")
		if TheSim:GetGameID() == "DST" then
		inst.entity:SetPristine()

		if not TheWorld.ismastersim then
			return inst
		end
		end
		inst:AddComponent("edible")
		inst.components.edible.healthvalue = data.health
		inst.components.edible.hungervalue = data.hunger
		inst.components.edible.foodtype =  "MEAT"
		inst.components.edible.sanityvalue = data.sanity
		inst:AddComponent("inspectable")

		inst:AddComponent("inventoryitem")
		inst.components.inventoryitem.imagename = "miaoji_food"
		inst.components.inventoryitem.atlasname = "images/inventoryimages/miaoji_food.xml"
		
		inst:AddComponent("stackable")
		inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM

		inst:AddComponent("perishable")
		inst.components.perishable:SetPerishTime(data.perishtime) 
		inst.components.perishable:StartPerishing()
		inst.components.perishable.onperishreplacement = "spoiled_food"
		if TheSim:GetGameID() == "DST" then		
	    MakeHauntableLaunch(inst)  
		end		
		return inst
	end
return Prefab(name, fn, assets, prefabs)	
end
return
		MakeFood("miaoji_food",{hunger= 20,sanity=40 ,health= 45,perishtime=TUNING.PERISH_FAST}),
		MakeFood("miaoji_foodfu",{hunger= 20,sanity=40 ,health= 45,perishtime=TUNING.PERISH_FAST})