From 452de8547ae55288ec4be8e92186948f0cf01e4a Mon Sep 17 00:00:00 2001 From: edshot99 Date: Mon, 25 Mar 2024 04:10:26 -0500 Subject: [PATCH] display velocity and allow disabling nadmod overlay taken from valen :) https://github.com/Valen-Sandbox/NadmodPP/commit/0abe29e2c4587ddf1ec8f2026e18e4a55888ee3b --- lua/autorun/client/cl_nadmodpp.lua | 15 ++++++++++++--- lua/autorun/server/nadmod_pp.lua | 2 -- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lua/autorun/client/cl_nadmodpp.lua b/lua/autorun/client/cl_nadmodpp.lua index ea834e2..14e3c4e 100644 --- a/lua/autorun/client/cl_nadmodpp.lua +++ b/lua/autorun/client/cl_nadmodpp.lua @@ -69,8 +69,10 @@ function NADMOD.IsPPAdmin(ply) 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 nadmod_overlay_convar = CreateClientConVar("nadmod_overlay", 2, true, false, "0 - Disables NPP Overlay. 1 - Minimal overlay of just owner info. 2 - Includes model, entityID, class, speed", 0, 2) local font = "ChatFont" +local refreshDelay = 0.2 +local refreshTime = CurTime() + refreshDelay hook.Add("HUDPaint", "NADMOD.HUDPaint", function() local nadmod_overlay_setting = nadmod_overlay_convar:GetInt() if nadmod_overlay_setting == 0 then return end @@ -83,17 +85,24 @@ hook.Add("HUDPaint", "NADMOD.HUDPaint", function() local Width, Height = surface.GetTextSize(text) local boxWidth = Width + 25 local boxHeight = Height + 16 - if nadmod_overlay_setting > 1 then + if nadmod_overlay_setting == 2 then local text2 = "'"..string.sub(table.remove(string.Explode("/", ent:GetModel() or "?")), 1,-5).."' ["..ent:EntIndex().."]" local text3 = ent:GetClass() + local text4 = "Velocity: " + if refreshTime < CurTime() + refreshDelay then + text4 = "Velocity: " .. math.Round(ent:GetVelocity():Length()) + refreshTime = CurTime() + refreshDelay + end local w2,h2 = surface.GetTextSize(text2) local w3,h3 = surface.GetTextSize(text3) + local w4,h4 = surface.GetTextSize(text4) boxWidth = math.Max(Width,w2,w3) + 25 - boxHeight = boxHeight + h2 + h3 + boxHeight = boxHeight + h2 + h3 + h4 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) + draw.SimpleText(text4, font, ScrW() - (w4 / 2) - 20, ScrH()/2 - 200 + Height + h2 + h3, 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) diff --git a/lua/autorun/server/nadmod_pp.lua b/lua/autorun/server/nadmod_pp.lua index 5de2073..9756252 100644 --- a/lua/autorun/server/nadmod_pp.lua +++ b/lua/autorun/server/nadmod_pp.lua @@ -526,8 +526,6 @@ 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 -- --=========================================================--