From a5227bd0e7da031d0cba9a558149fdfd5f257e53 Mon Sep 17 00:00:00 2001 From: Chev Date: Mon, 6 Nov 2023 10:39:03 -0800 Subject: [PATCH] SprayMesh Extended: Add concommand spraymesh_debug_place Used to place fake player sprays for debugging purposes. Only works when spraymesh.DEBUG_MODE is enabled. --- .../lua/spraymesh/client/cl_init.lua | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/spraymesh_extended/lua/spraymesh/client/cl_init.lua b/addons/spraymesh_extended/lua/spraymesh/client/cl_init.lua index eea8221..6d2d777 100644 --- a/addons/spraymesh_extended/lua/spraymesh/client/cl_init.lua +++ b/addons/spraymesh_extended/lua/spraymesh/client/cl_init.lua @@ -995,3 +995,23 @@ concommand.Add("spraymesh_shownames", function(ply, cmd, args, argstr) print(([[%s %s]]):format(plyStr, URLStr)) end end) + +if spraymesh.DEBUG_MODE then + concommand.Add("spraymesh_debug_place", function() + local tr = LocalPlayer():GetEyeTrace() + + local sprayData = { + SteamID64 = "DEBUG_" .. util.SHA1(CurTime()), + PlayerName = "Debug Spray " .. CurTime(), + HitPos = tr.HitPos, + HitNormal = tr.HitNormal, + TraceNormal = tr.Normal, + URL = spraymesh.SPRAY_URL_DEFAULT, + CoordDistance = spraymesh.COORD_DIST_DEFAULT, + SprayTime = CurTime(), + PlaySpraySound = true + } + + spraymesh.PlaceSpray(sprayData) + end) +end