include("shared.lua")

function ENT:Draw()
	self:DrawModel()
	if (LocalPlayer():GetPos():Distance(self:GetPos()) > 300 or LocalPlayer():GetPos():Distance(self:GetPos()) < 15) then return end
	self:DrawInfo()
end

function ENT:DrawTranslucent()
	self:Draw()
end

function ENT:DrawInfo()
	local Pos = self:GetPos() + Vector(0, 0, 60)
	local Ang = Angle(0, LocalPlayer():EyeAngles().y - 90, 90)
	local amount = math.Round(self:GetResourceAmount(), 1)
	local Text = amount .. zrmine.config.BuyerNPC_Mass

	if (amount <= 0) then
		Text = zrmine.language.Ore_Empty
	end

	local vType = self:GetResourceType()
	local rType = "nil"

	if (vType == "Coal") then
		rType = zrmine.language.Ore_Coal
	elseif (vType == "Iron") then
		rType = zrmine.language.Ore_Iron
	elseif (vType == "Bronze") then
		rType = zrmine.language.Ore_Bronze
	elseif (vType == "Silver") then
		rType = zrmine.language.Ore_Silver
	elseif (vType == "Gold") then
		rType = zrmine.language.Ore_Gold
	elseif (vType == "Random") then
		rType = zrmine.language.Ore_Random
	end

	cam.Start3D2D(Pos, Ang, 0.2)
	draw.DrawText(rType, "zrmine_mineentrance_font1", 0, -50, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
	draw.DrawText(Text, "zrmine_resource_font2", 0, 0, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
	cam.End3D2D()
end

function ENT:Initialize()
	self.InsertEffect = ParticleEmitter(self:GetPos())
end
