include("shared.lua")

surface.CreateFont("EconomyBank_Font", {font = "BebasNeue", size = 80, antialias = true, weight = 600})

local Config = EconomyConfig
local local_ply, distance
function ENT:Draw()
	self:DrawModel()
end

function ENT:DrawTranslucent()
	local_ply = local_ply or LocalPlayer()
	distance = local_ply:EyePos():DistToSqr(self:GetPos())
	if distance <= 62500 then
		local ang = self:GetAngles()
		local pos = self:GetPos() + Vector(0, 0, 100)
		pos = pos + ang:Up() * math.sin(CurTime() * 1.75) * 2
		ang:RotateAroundAxis(ang:Forward(), 90)
		ang:RotateAroundAxis(ang:Right(), 90)
	 	cam.Start3D2D(pos, Angle(0, EyeAngles().y - 90, 90), 0.1)
			surface.SetDrawColor(255, 255, 255)
			draw.SimpleTextOutlined("Staatskasse", "EconomyBank_Font", 0, -80, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, color_black)
			draw.SimpleTextOutlined("__________", "EconomyBank_Font", 0, -70, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, color_black)
			draw.SimpleTextOutlined("Eingelagertes Geld: $"..string.Comma(Config.EconomyBank), "EconomyBank_Font", 0, 0, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, color_black)
			draw.SimpleTextOutlined("Raub möglich: "..(self:GetAvailable() and "Ja" or "Nein"), "EconomyBank_Font", 0, 60, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, color_black)
			if local_ply:isCP() then
				draw.SimpleTextOutlined("Geiselkasse: $"..string.Comma(Config.HostageMoney or 0), "EconomyBank_Font", 0, 120, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, color_black)
			end
		cam.End3D2D()
	end
end