mirror of
https://github.com/HaodongMo/ARC-9.git
synced 2025-03-04 03:02:58 -05:00
fixed lack of projected light for other players with allflash 1
This commit is contained in:
parent
5896bbe4e4
commit
c253f72278
@ -36,17 +36,20 @@ end)
|
||||
|
||||
timer.Create("ARC9 CSModel Garbage Collector", 5, 0, ARC9.CollectGarbage)
|
||||
|
||||
local arc9_allflash = GetConVar("arc9_allflash")
|
||||
hook.Add("PostDrawEffects", "ARC9_CleanFlashlights", function()
|
||||
local newflashlightpile = {}
|
||||
|
||||
for _, k in ipairs(ARC9.FlashlightPile) do
|
||||
if IsValid(k.Weapon) and k.Weapon == LocalPlayer():GetActiveWeapon() then
|
||||
table.insert(newflashlightpile, k)
|
||||
|
||||
continue
|
||||
if IsValid(k.Weapon) then
|
||||
local owner = k.Weapon:GetOwner()
|
||||
if IsValid(owner) and owner:IsPlayer() and owner:GetActiveWeapon() == k.Weapon and (arc9_allflash:GetBool() or owner == LocalPlayer()) then
|
||||
table.insert(newflashlightpile, k)
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
||||
if k.ProjectedTexture and k.ProjectedTexture:IsValid() then
|
||||
if IsValid(k.ProjectedTexture) then
|
||||
k.ProjectedTexture:Remove()
|
||||
end
|
||||
end
|
||||
|
@ -11,6 +11,8 @@ function SWEP:GetHasFlashlights()
|
||||
return false
|
||||
end
|
||||
|
||||
local arc9_allflash = GetConVar("arc9_allflash")
|
||||
|
||||
function SWEP:CreateFlashlights()
|
||||
self:KillFlashlights()
|
||||
self.Flashlights = {}
|
||||
@ -61,7 +63,7 @@ function SWEP:CreateFlashlights()
|
||||
end
|
||||
end
|
||||
|
||||
if total_lights > 1 then -- you are a madman
|
||||
if total_lights > 1 or (arc9_allflash:GetBool() and self:GetOwner() != LocalPlayer()) then -- you are a madman
|
||||
for i, k in ipairs(self.Flashlights) do
|
||||
if k.light:IsValid() then k.light:SetEnableShadows(false) end
|
||||
end
|
||||
@ -80,7 +82,6 @@ function SWEP:KillFlashlights()
|
||||
self.Flashlights = nil
|
||||
end
|
||||
|
||||
local arc9_allflash = GetConVar("arc9_allflash")
|
||||
local fuckingbullshit = Vector(0, 0, 0.001)
|
||||
|
||||
function SWEP:DrawFlashlightsWM()
|
||||
@ -96,31 +97,27 @@ function SWEP:DrawFlashlightsWM()
|
||||
for i, k in ipairs(self.Flashlights) do
|
||||
local model = (k.slottbl or {}).WModel
|
||||
|
||||
if !IsValid(model) then continue end
|
||||
-- if !IsValid(model) then continue end
|
||||
|
||||
local pos, ang
|
||||
|
||||
|
||||
if !model then
|
||||
if owner != lp or !IsValid(model) then
|
||||
pos = owner:EyePos()
|
||||
ang = owner:EyeAngles()
|
||||
else
|
||||
pos = model:GetPos()
|
||||
ang = model:GetAngles()
|
||||
end
|
||||
|
||||
|
||||
if k.qca then
|
||||
local a = model:GetAttachment(k.qca)
|
||||
if a then pos, ang = a.Pos, a.Ang end
|
||||
|
||||
if k.qca then
|
||||
local a = model:GetAttachment(k.qca)
|
||||
if a then pos, ang = a.Pos, a.Ang end
|
||||
ang:RotateAroundAxis(ang:Up(), 90)
|
||||
end
|
||||
end
|
||||
|
||||
self:DrawLightFlare(pos + fuckingbullshit, ang, k.col, k.br * 20, i, nil, k.nodotter)
|
||||
|
||||
if k.qca then ang:RotateAroundAxis(ang:Up(), 90) end
|
||||
|
||||
-- ang:RotateAroundAxis(ang:Up(), 90)
|
||||
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos + ang:Forward() * 16,
|
||||
@ -198,7 +195,7 @@ function SWEP:DrawFlashlightsVM()
|
||||
filter = lp,
|
||||
})
|
||||
-- push it as back as the area behind us allows
|
||||
pos = pos + -ang:Forward() * 128 * math.min(1 - tr.Fraction, tr2.Fraction)
|
||||
pos = pos + -ang:Forward() * 32 * math.min(1 - tr.Fraction, tr2.Fraction)
|
||||
end
|
||||
|
||||
k.light:SetPos(pos)
|
||||
|
Loading…
Reference in New Issue
Block a user