good light flares in vm too

This commit is contained in:
Darsu 2025-01-25 22:42:20 +07:00
parent 72ff0f177e
commit 761c76eac6
2 changed files with 10 additions and 8 deletions

View File

@ -163,7 +163,7 @@ function SWEP:DrawLasers(wm, behav)
if (atttbl.LaserColorPlayer or atttbl.LaserPlayerColor) then color = colorplayer or color end
self:DrawLightFlare(a.Pos, wm and self:GetShootDir() or lasang, color, 0.075, (slottbl.Address or 0) + 69, !wm)
self:DrawLightFlare(a.Pos, lasang, color, 0.075, !wm, false, -lasang:Right())
if !wm or owner == LocalPlayer() or wm and owner:IsNPC() then
if behav then

View File

@ -184,7 +184,7 @@ function SWEP:DrawFlashlightsVM()
end
end
-- self:DrawLightFlare(pos, ang, k.col, k.br * 25, i, true, k.nodotter, ang:Forward())
self:DrawLightFlare(pos, ang, k.col, k.br / 6, true, k.nodotter, -ang:Right())
if k.qca then ang:RotateAroundAxis(ang:Up(), 90) end
@ -215,12 +215,14 @@ end
local flaremat = Material("effects/arc9_lensflare", "mips smooth")
local badcolor = Color(255, 255, 255)
function SWEP:DrawLightFlare(pos, ang, col, size, vm, nodotter) -- mostly tacrp
function SWEP:DrawLightFlare(pos, ang, col, size, vm, nodotter, dir) -- mostly tacrp
col = col or badcolor
size = size or 1
local dot = -ang:Forward():Dot(EyeAngles():Forward())
local dot2 = ang:Forward():Dot((EyePos() - pos):GetNormalized())
dir = dir or ang:Forward()
local dot = -dir:Dot(EyeAngles():Forward())
local dot2 = dir:Dot((EyePos() - pos):GetNormalized())
dot = (dot + dot2) / 2
if nodotter then dot, dot2 = 1, 1 end
@ -233,7 +235,7 @@ function SWEP:DrawLightFlare(pos, ang, col, size, vm, nodotter) -- mostly tacrp
local tr = util.QuickTrace(pos, diff, {self:GetOwner(), LocalPlayer()})
local s = math.Clamp(1 - diff:Length() / 700, 0, 1) ^ 1 * dot * 500 * math.Rand(0.95, 1.05) * size
if tr.Fraction == 1 then
if vm or tr.Fraction == 1 then
s = ScreenScale(s)
local toscreen = pos:ToScreen()
cam.Start2D()
@ -242,7 +244,7 @@ function SWEP:DrawLightFlare(pos, ang, col, size, vm, nodotter) -- mostly tacrp
surface.DrawTexturedRect(toscreen.x - s / 2, toscreen.y - s / 2, s, s)
cam.End2D()
if !vm then
if !vm and size > 0.1 then
local rad = 128 * size * dot2
col.a = 50 + size * 205