include("shared.lua")

surface.CreateFont("spawnpoint_font", {font = system.IsWindows() and "Tahoma" or "Verdana", size = 50, weight = 600, blursize = 0, scanlines = 0, antialias = true})

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

local local_ply, dist
local vector_1 = Vector(0, 0, 1)
function ENT:DrawTranslucent()
	local_ply = local_ply or LocalPlayer()
	dist = local_ply:EyePos():DistToSqr(self:GetPos())
	if dist > 40000 then return end
	local text = self.PrintName
	local ang = self:GetAngles()	
	local pos = self:GetPos() + (vector_1 * (self:OBBMaxs().z + 5 + math.sin(SysTime() * 2)))
	ang:RotateAroundAxis(ang:Forward(), 90)
	ang:RotateAroundAxis(ang:Right(), -90)
	ang:RotateAroundAxis(ang:Up(), 0)
	cam.Start3D2D(pos, Angle(0, EyeAngles().y - 90, 90), 0.1)
		local protected = self:GetProtected() and " (Geschützt)" or ""
		draw.SimpleTextOutlined(text..protected, "spawnpoint_font", 0, 0, Color(160, 40, 40), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
	cam.End3D2D()
end