Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RT Camera OnRemove detection #3027

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lua/entities/gmod_wire_rt_camera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@
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)
Expand All @@ -112,7 +110,7 @@
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
Expand Down Expand Up @@ -174,7 +172,7 @@
local renderedCameras = 0

for _, ent in ipairs(ActiveCameras) do
if not IsValid(ent) or not ent.IsObserved then goto next_camera end

Check warning on line 175 in lua/entities/gmod_wire_rt_camera.lua

View workflow job for this annotation

GitHub Actions / lint

"Goto"

Don't use labels and gotos unless you're jumping out of multiple loops.
renderedCameras = renderedCameras + 1

render.PushRenderTarget(ent.RenderTarget)
Expand Down
Loading