forked from Nebual/NadmodPP
Add nadmod_overlay convar
This commit is contained in:
parent
03f088ff55
commit
2197a93cbd
@ -23,25 +23,35 @@ net.Receive("nadmod_propowners",function(len)
|
||||
end
|
||||
end)
|
||||
|
||||
local nadmod_overlay_convar = CreateConVar("nadmod_overlay", 2, {FCVAR_NOTIFY, FCVAR_ARCHIVE, FCVAR_REPLICATED}, "0 - Disables NPP Overlay. 1 - Minimal overlay of just owner info. 2 - Includes model, entityID, class")
|
||||
local font = "ChatFont"
|
||||
hook.Add("HUDPaint", "NADMOD.HUDPaint", function()
|
||||
local nadmod_overlay_setting = nadmod_overlay_convar:GetInt()
|
||||
if nadmod_overlay_setting == 0 then return end
|
||||
local tr = LocalPlayer():GetEyeTrace()
|
||||
if !tr.HitNonWorld then return end
|
||||
local ent = tr.Entity
|
||||
if ent:IsValid() && !ent:IsPlayer() then
|
||||
local text = "Owner: " .. (Props[ent:EntIndex()] or "N/A")
|
||||
local text2 = "'"..string.sub(table.remove(string.Explode("/", ent:GetModel() or "?")), 1,-5).."' ["..ent:EntIndex().."]"
|
||||
local text3 = ent:GetClass()
|
||||
surface.SetFont(font)
|
||||
local Width, Height = surface.GetTextSize(text)
|
||||
local boxWidth = Width + 25
|
||||
local boxHeight = Height + 16
|
||||
if nadmod_overlay_setting > 1 then
|
||||
local text2 = "'"..string.sub(table.remove(string.Explode("/", ent:GetModel() or "?")), 1,-5).."' ["..ent:EntIndex().."]"
|
||||
local text3 = ent:GetClass()
|
||||
local w2,h2 = surface.GetTextSize(text2)
|
||||
local w3,h3 = surface.GetTextSize(text3)
|
||||
local boxHeight = Height + h2 + h3 + 16
|
||||
local boxWidth = math.Max(Width,w2,w3) + 25
|
||||
boxWidth = math.Max(Width,w2,w3) + 25
|
||||
boxHeight = boxHeight + h2 + h3
|
||||
draw.RoundedBox(4, ScrW() - (boxWidth + 4), (ScrH()/2 - 200) - 16, boxWidth, boxHeight, Color(0, 0, 0, 150))
|
||||
draw.SimpleText(text, font, ScrW() - (Width / 2) - 20, ScrH()/2 - 200, Color(255, 255, 255, 255), 1, 1)
|
||||
draw.SimpleText(text2, font, ScrW() - (w2 / 2) - 20, ScrH()/2 - 200 + Height, Color(255, 255, 255, 255), 1, 1)
|
||||
draw.SimpleText(text3, font, ScrW() - (w3 / 2) - 20, ScrH()/2 - 200 + Height + h2, Color(255, 255, 255, 255), 1, 1)
|
||||
else
|
||||
draw.RoundedBox(4, ScrW() - (boxWidth + 4), (ScrH()/2 - 200) - 16, boxWidth, boxHeight, Color(0, 0, 0, 150))
|
||||
draw.SimpleText(text, font, ScrW() - (Width / 2) - 20, ScrH()/2 - 200, Color(255, 255, 255, 255), 1, 1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -488,6 +488,7 @@ function NADMOD.DebugTotals(ply,cmd,args)
|
||||
end
|
||||
concommand.Add("nadmod_totals", NADMOD.DebugTotals)
|
||||
|
||||
CreateConVar("nadmod_overlay", 2, {FCVAR_NOTIFY, FCVAR_ARCHIVE, FCVAR_REPLICATED}, "0 - Disables NPP Overlay. 1 - Minimal overlay of just owner info. 2 - Includes model, entityID, class")
|
||||
|
||||
--=========================================================--
|
||||
-- Clientside Callbacks for the Friends/Options panels --
|
||||
|
Loading…
Reference in New Issue
Block a user