2016-10-07 07:31:59 +00:00
|
|
|
-- Delete HUD and redo if already existent. This will reset the displayed values until the next update from the server
|
2018-08-03 09:22:18 +00:00
|
|
|
if D3stats.D3statsOverlay then
|
|
|
|
D3stats.D3statsOverlay:Remove()
|
|
|
|
D3stats.Overlay_Init()
|
2016-10-05 12:30:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- HUD on the left top of the screen
|
2018-08-03 09:22:18 +00:00
|
|
|
function D3stats.Overlay_Init()
|
|
|
|
D3stats.D3statsOverlay = vgui.Create("D3statsOverlay")
|
|
|
|
D3stats.D3statsOverlay:SetPos(D3stats.Overlay_X, D3stats.Overlay_Y)
|
|
|
|
D3stats.D3statsOverlay:SetSize(350, 100)
|
2016-10-05 12:30:35 +00:00
|
|
|
end
|
|
|
|
|
2016-10-07 07:31:59 +00:00
|
|
|
-- Call this function from cl_targetid.lua in the gamemode. Works for ZS, needs adjustments for other gamemodes.
|
2016-10-05 12:30:35 +00:00
|
|
|
local colTemp = Color(255, 255, 255)
|
2018-08-03 09:22:18 +00:00
|
|
|
function D3stats.DrawTargetID(ent, fade, x, y)
|
2016-10-05 12:30:35 +00:00
|
|
|
|
|
|
|
colTemp.a = fade * 255
|
|
|
|
--util.ColorCopy(COLOR_FRIENDLY, colTemp)
|
|
|
|
|
2018-08-03 09:22:18 +00:00
|
|
|
local Level = ent:GetNWInt("D3stats_Level", 0)
|
|
|
|
if Level > 0 and D3stats.Levels[Level] then
|
|
|
|
draw.SimpleTextBlur("Level " .. tostring(Level) .. " \"" .. D3stats.Levels[Level].Name .. "\"", D3stats.Font_TargetID, x, y, colTemp, TEXT_ALIGN_CENTER)
|
|
|
|
y = y + draw.GetFontHeight(D3stats.Font_TargetID) + 4
|
2016-10-05 12:30:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return x, y
|
2018-08-03 09:22:18 +00:00
|
|
|
end
|