ITEM.Name = "Chinesisches Essen"
ITEM.Description = "Füllt deine gesamte Energie auf."
ITEM.Model = "models/props_junk/garbage_takeoutcarton001a.mdl"
ITEM.Stackable = false
ITEM.Base = "base_darkrp"
ITEM.UseSpeed = 1
ITEM.DropSpeed = 1

function ITEM:Use(ply)
	ply:setSelfDarkRPVar("Energy", 100)
	umsg.Start("AteFoodIcon", ply)
	umsg.End()
	ply:EmitSound("cookingmod/eating.wav", 100, 100)
	return true
end

function ITEM:SaveData(ent)
	self:SetData("Owner", ent:Getowning_ent())
end

function ITEM:CanDrop(ply)
	local foodTable = {cmd = "buyfood", max = GAMEMODE.Config.maxfooditems}
	if ply:customEntityLimitReached(foodTable) then
		DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("limit", GAMEMODE.Config.chatCommandPrefix.."buyfood"))
		return false
	end
end

function ITEM:LoadData(ent, ply)
	ent:Setowning_ent(self:GetData("Owner"))
	local foodTable = {cmd = "buyfood", max = GAMEMODE.Config.maxfooditems}
	ent.DarkRPItem = foodTable
	if IsValid(ply) then
		ent.SID = ply.SID
		ply:addCustomEntity(foodTable)
	end
end