From 30518024ddcad1d9fb8d4e40f8f4d8d3b9eb2290 Mon Sep 17 00:00:00 2001 From: Redox Date: Wed, 3 Apr 2024 01:02:22 +0200 Subject: [PATCH] Fix RT Camera OnRemove detection (#3027) * Fix OnRemove detection * Fix trailing whitespace --- lua/entities/gmod_wire_rt_camera.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lua/entities/gmod_wire_rt_camera.lua b/lua/entities/gmod_wire_rt_camera.lua index e15e4cc2aa..1037d14256 100644 --- a/lua/entities/gmod_wire_rt_camera.lua +++ b/lua/entities/gmod_wire_rt_camera.lua @@ -85,12 +85,10 @@ if CLIENT then SetCameraActive(self, isActive) end - function ENT:OnRemove() - timer.Simple( 0, function() - if not IsValid(self) then - SetCameraActive(self, false) - end - end) + function ENT:OnRemove(fullUpdate) + if not fullUpdate then + SetCameraActive(self, false) + end end function ENT:SetIsObserved(isObserved) @@ -112,7 +110,7 @@ if CLIENT then local oldi = table.RemoveFastByValue(ObservedCameras, self) if oldi == nil then return end self.ObservedCamerasIndex = nil - + local shifted_cam = ObservedCameras[oldi] if IsValid(shifted_cam) then shifted_cam.ObservedCamerasIndex = oldi