include("shared.lua")

local localply
local cam_Start3D2D, cam_End3D2D, draw_SimpleTextOutlined, math_Round = cam.Start3D2D, cam.End3D2D, draw.SimpleTextOutlined, math.Round

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

function ENT:DrawTranslucent()
	localply = localply or LocalPlayer()
	if localply:GetPos():DistToSqr(self:GetPos()) < 90000 and self:GetInBucket() then
		self:DrawInfo()
	end
end

function ENT:DrawInfo()
	local owner = zmlab.f.GetOwner(self)
	local pname = owner and owner:Nick() or "Niemand"
	local Pos = self:GetPos() + self:GetUp() * 1
	local Ang = self:GetAngles()
	Ang:RotateAroundAxis(Ang:Forward(), 90)
	Ang:RotateAroundAxis(Ang:Forward(), -90)

	cam_Start3D2D(Pos, Ang, 0.1)
		local text = math_Round(self:GetInBucket(), 1) .. zmlab.config.UoW
		draw_SimpleTextOutlined(pname, "mg_meth_ownersmall", 0, -80, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, color_black)
		draw_SimpleTextOutlined(text, "zmlab_font2", 0, -50, zmlab.default_colors["white01"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, color_black)
	cam_End3D2D()
end