From de2e16a86f9ad04184a9be9c8c35ed72288bba0d Mon Sep 17 00:00:00 2001 From: StyledStrike Date: Sat, 14 Dec 2024 15:52:21 -0300 Subject: [PATCH] Use PreRender hook to capture radar terrain --- lua/gminimap/client/radar.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/gminimap/client/radar.lua b/lua/gminimap/client/radar.lua index 460e3f9..8b9b2f1 100644 --- a/lua/gminimap/client/radar.lua +++ b/lua/gminimap/client/radar.lua @@ -151,8 +151,14 @@ function Radar:Draw() self.lastGridX = gridPos[1] self.lastGridY = gridPos[2] - self.lastCapturePos = gridPos - self:Capture( gridPos ) + local hookId = "GMinimap.Capture_" .. self.rtId + + hook.Add( "PreRender", hookId, function() + hook.Remove( "PreRender", hookId ) + + self.lastCapturePos = gridPos + self:Capture( gridPos ) + end ) end -- When the origin moves away from out last captured position,