From 5b651ff6c764a3e64f6d03fd36079e0cc33e57e7 Mon Sep 17 00:00:00 2001 From: Vitroze Date: Wed, 28 Jan 2026 13:32:34 +0100 Subject: [PATCH 1/3] Add lightbar --- lua/entities/base_glide_car/cl_init.lua | 34 ++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lua/entities/base_glide_car/cl_init.lua b/lua/entities/base_glide_car/cl_init.lua index e82776e0..32b1127b 100644 --- a/lua/entities/base_glide_car/cl_init.lua +++ b/lua/entities/base_glide_car/cl_init.lua @@ -319,7 +319,9 @@ function ENT:OnUpdateMisc() -- Set bodygroups to default for _, v in ipairs( self.SirenLights ) do if v.bodygroup then - self:SetBodygroup( v.bodygroup, 0 ) + local ent = v.target and v.target > 0 and self.lightbars and self.lightbars[v.target] or self + + ent:SetBodygroup( v.bodygroup, 0 ) end end end @@ -465,6 +467,19 @@ end DEFINE_BASECLASS( "base_glide" ) +function ENT:OnRemove() + BaseClass.OnRemove( self ) + + if self.lightbars then + for _, lightbar in ipairs(self.lightbars) do + if IsValid(lightbar) then + lightbar:Remove() + end + end + self.lightbars = nil + end +end + local Floor = math.floor local SimpleText = draw.SimpleText local RoundedBox = draw.RoundedBox @@ -553,3 +568,20 @@ function ENT:DrawVehicleHUD( screenW, screenH ) -- Current gear DrawDataBox( GEAR_LABELS[self:GetGear()] or self:GetGear(), cornerRadius, x + size * 0.5, y + size * 0.78, size * 0.2, size * 0.1 ) end + +function ENT:CreateLightbar(model, pos, ang) + local lightbar = ents.CreateClientProp(model) + if not IsValid(lightbar) then return end + + lightbar:SetModel(model) + lightbar:SetPos(self:LocalToWorld(pos)) + lightbar:SetAngles(self:LocalToWorldAngles(ang)) + lightbar:SetParent(self) + lightbar:Spawn() + lightbar:Activate() + + self.lightbars = self.lightbars or {} + table.insert(self.lightbars, lightbar) + + return lightbar +end \ No newline at end of file From dc55ebe616bfe6dba02c96182a011cebf04ef842 Mon Sep 17 00:00:00 2001 From: Vitroze Date: Wed, 28 Jan 2026 13:45:58 +0100 Subject: [PATCH 2/3] Compliance with standards --- lua/entities/base_glide_car/cl_init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/entities/base_glide_car/cl_init.lua b/lua/entities/base_glide_car/cl_init.lua index 32b1127b..4e2eede9 100644 --- a/lua/entities/base_glide_car/cl_init.lua +++ b/lua/entities/base_glide_car/cl_init.lua @@ -471,10 +471,10 @@ function ENT:OnRemove() BaseClass.OnRemove( self ) if self.lightbars then - for _, lightbar in ipairs(self.lightbars) do - if IsValid(lightbar) then - lightbar:Remove() - end + for _, lightbar in ipairs( self.lightbars ) do + if not IsValid( lightbar ) then continue end + + lightbar:Remove() end self.lightbars = nil end @@ -569,19 +569,19 @@ function ENT:DrawVehicleHUD( screenW, screenH ) DrawDataBox( GEAR_LABELS[self:GetGear()] or self:GetGear(), cornerRadius, x + size * 0.5, y + size * 0.78, size * 0.2, size * 0.1 ) end -function ENT:CreateLightbar(model, pos, ang) - local lightbar = ents.CreateClientProp(model) - if not IsValid(lightbar) then return end +function ENT:CreateLightbar( model, pos, ang ) + local lightbar = ents.CreateClientProp( model ) + if not IsValid( lightbar ) then return end - lightbar:SetModel(model) - lightbar:SetPos(self:LocalToWorld(pos)) - lightbar:SetAngles(self:LocalToWorldAngles(ang)) - lightbar:SetParent(self) + lightbar:SetModel( model ) + lightbar:SetPos( self:LocalToWorld( pos ) ) + lightbar:SetAngles( self:LocalToWorldAngles( ang ) ) + lightbar:SetParent( self ) lightbar:Spawn() lightbar:Activate() self.lightbars = self.lightbars or {} - table.insert(self.lightbars, lightbar) + table.insert( self.lightbars, lightbar ) return lightbar end \ No newline at end of file From d155af8d75386684e22ff3c0ac1b49a2ce19f1eb Mon Sep 17 00:00:00 2001 From: Vitroze Date: Wed, 28 Jan 2026 13:53:11 +0100 Subject: [PATCH 3/3] Remove space --- lua/entities/base_glide_car/cl_init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/base_glide_car/cl_init.lua b/lua/entities/base_glide_car/cl_init.lua index 4e2eede9..83c9ff05 100644 --- a/lua/entities/base_glide_car/cl_init.lua +++ b/lua/entities/base_glide_car/cl_init.lua @@ -473,7 +473,7 @@ function ENT:OnRemove() if self.lightbars then for _, lightbar in ipairs( self.lightbars ) do if not IsValid( lightbar ) then continue end - + lightbar:Remove() end self.lightbars = nil