include("shared.lua")

local use_font = system.IsWindows() and "Tahoma" or "Verdana"
surface.CreateFont("mg_towfont", {font = use_font, size = 150, weight = 1000, blursize = 0, antialias = true, shadow = false})
surface.CreateFont("mg_towfont2", {font = use_font, size = 75, weight = 600, blursize = 0, antialias = true, shadow = false})

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())
	self:SetMaterial(self.StealJobs[local_ply:Team()] and "phoenix_storms/metalfloor_2-3" or "phoenix_storms/cube")
	if dist > 1500000 then return end
	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.15)
		if self:GetSelling() != 0 then
			draw.SimpleTextOutlined("Auto wird verkauft ("..string.ToMinutesSeconds(math.max(0, self:GetSelling() - CurTime() + 1))..")", "mg_towfont", 0, -800, color_1, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
			draw.SimpleTextOutlined("Zum Stoppen, Auto von Plattform fahren.", "mg_towfont2", 0, -700, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
		else
			if MG_CarStealJobs[local_ply:Team()] then
				if self:GetSelling() == 0 then
					draw.SimpleTextOutlined("↓", "mg_towfont", 0, -150, Color(120, 0, 140, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, color_black)
					draw.SimpleTextOutlined("Verkaufs-Plattform", "mg_towfont", 0, -800, Color(120, 0, 140, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, color_black)
					draw.SimpleTextOutlined("Auto hier abstellen, um Verkauf zu starten.", "mg_towfont2", 0, -700, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
				end
			else
				draw.SimpleTextOutlined("↓", "mg_towfont", 0, -150, Color(150, 150, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, color_black)
				draw.SimpleTextOutlined(self.PrintName, "mg_towfont", 0, -800, Color(150, 150, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, color_black)
				if local_ply:Team() == TEAM_REPAIR then
					draw.SimpleTextOutlined("Auto hier abstellen, um Abschleppung abzuschließen.", "mg_towfont2", 0, -700, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
				end
			end
		end
	cam.End3D2D()
end