AfterShotParticle fixes

This commit is contained in:
Darsu 2025-01-07 04:25:33 +07:00
parent abd78c010f
commit 67692149a7
2 changed files with 28 additions and 25 deletions

View File

@ -5,39 +5,39 @@ function EFFECT:Init(data)
local smoke = wpn:GetProcessedValue("AfterShotParticle", true)
local att = data:GetAttachment() or 1
if smoke and isstring(smoke) then
local att = data:GetAttachment() or 1
local vm = LocalPlayer():GetViewModel()
local vm = LocalPlayer():GetViewModel()
local wm = false
local wm = false
if (LocalPlayer():ShouldDrawLocalPlayer() or wpn.Owner != LocalPlayer()) then
wm = true
att = 1
end
if (LocalPlayer():ShouldDrawLocalPlayer() or wpn.Owner != LocalPlayer()) then
wm = true
att = 1
end
local parent = wpn
local parent = wpn
if !wm then
parent = vm
else
parent = (wpn.WModel or {})[1] or wpn
end
if !wm then
parent = vm
else
parent = (wpn.WModel or {})[1] or wpn
end
local muz = wpn:GetMuzzleDevice(wm)
local muz = wpn:GetMuzzleDevice(wm)
if !IsValid(muz) then
muz = wpn
end
if !IsValid(muz) then
muz = wpn
end
if !IsValid(muz) then
self:Remove()
return
end
if !IsValid(muz) then
self:Remove()
return
end
-- if !IsValid(parent) then return end
-- if !IsValid(parent) then return end
if smoke then
if IsValid(wpn.ActiveAfterShotPCF) then
wpn.ActiveAfterShotPCF:StopEmission()
end
@ -53,6 +53,9 @@ function EFFECT:Init(data)
table.insert(wpn.PCFs, pcf)
end
end
else
self:Remove()
return
end
end

View File

@ -134,8 +134,8 @@ function SWEP:Think()
if weaponGetNextPrimaryFire(self) + delay + swepGetProcessedValue(self, "AfterShotParticleDelay") < now then
self:SetAfterShot(false)
if swepGetProcessedValue(self, "AfterShotParticle", true) then
local att = swepGetProcessedValue(self, "AfterShotQCA") or swepGetProcessedValue(self, "MuzzleEffectQCA", true)
if swepGetProcessedValue(self, "AfterShotParticle") then
local att = swepGetProcessedValue(self, "AfterShotQCA", true) or swepGetProcessedValue(self, "MuzzleEffectQCA", true)
local data = EffectData()
data:SetEntity(self)