Skip to content

Commit

Permalink
Add more strobe light options
Browse files Browse the repository at this point in the history
  • Loading branch information
StyledStrike committed Dec 29, 2024
1 parent 7bc017b commit d6aeb4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions lua/entities/base_glide_aircraft/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local function DrawLight( id, pos, color, size )
dl.b = color.b
dl.brightness = 5
dl.decay = 1000
dl.size = size or 70
dl.size = size
dl.dietime = CurTime() + 0.05
end
end
Expand All @@ -62,14 +62,17 @@ function ENT:OnUpdateMisc()
t = t % 1

for i, v in ipairs( self.StrobeLights ) do
on = t > v.blinkTime and t < v.blinkTime + 0.05
on = t > v.blinkTime and t < v.blinkTime + ( v.blinkDuration or 0.05 )

if on then
pos = self:LocalToWorld( v.offset )
color = self.StrobeLightColors[i]

DrawLight( self:EntIndex() + i, pos, color, 80 )
DrawLightSprite( pos, nil, 30, color )
if self.StrobeLightRadius > 0 then
DrawLight( self:EntIndex() + i, pos, color, self.StrobeLightRadius )
end

DrawLightSprite( pos, nil, self.StrobeLightSpriteSize, color )
end
end
end
5 changes: 4 additions & 1 deletion lua/entities/base_glide_aircraft/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ if CLIENT then
-- This should countain a table of tables, where each looks like this:
--
-- { offset = Vector( 0, 0, 0 ), blinkTime = 0 }, -- Blinks at the start of the cycle
-- { offset = Vector( 0, 0, 0 ), blinkTime = 0.5 }, -- Blinks in the middle of the cycle
-- { offset = Vector( 0, 0, 0 ), blinkTime = 0.5, blinkDuration = 0.5 }, -- Blinks in the middle of the cycle, for half of the cycle
--
-- Also note that the table count here should be less than or equal to
-- the color count on `ENT.StrobeLightColors`.
ENT.StrobeLights = {}

ENT.StrobeLightRadius = 80
ENT.StrobeLightSpriteSize = 30

ENT.StrobeLightColors = {
Color( 255, 255, 255 ),
Color( 255, 0, 0 ),
Expand Down

0 comments on commit d6aeb4c

Please sign in to comment.