mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
75
lua/effects/muzzleflash_ar3/init.lua
Normal file
75
lua/effects/muzzleflash_ar3/init.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local ang
|
||||
|
||||
EFFECT.ParticleName = "muzzleflash_ar3"
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
self.Attachment = data:GetAttachment()
|
||||
self.Position = self:GetTracerShootPos(data:GetOrigin(), self.WeaponEnt, self.Attachment)
|
||||
|
||||
|
||||
local att2 = self:LookupAttachment( "punch" )
|
||||
self.Position2 = self:GetTracerShootPos(data:GetOrigin(), self.WeaponEnt, att2 )
|
||||
|
||||
if IsValid(self.WeaponEnt.Owner) then
|
||||
if self.WeaponEnt.Owner == LocalPlayer() then
|
||||
if not self.WeaponEnt:IsFirstPerson() then
|
||||
ang = self.WeaponEnt.Owner:EyeAngles()
|
||||
ang:Normalize()
|
||||
--ang.p = math.max(math.min(ang.p,55),-55)
|
||||
self.Forward = ang:Forward()
|
||||
else
|
||||
self.WeaponEnt = self.WeaponEnt.Owner:GetViewModel()
|
||||
end
|
||||
--ang.p = math.max(math.min(ang.p,55),-55)
|
||||
else
|
||||
ang = self.WeaponEnt.Owner:EyeAngles()
|
||||
ang:Normalize()
|
||||
self.Forward = ang:Forward()
|
||||
end
|
||||
end
|
||||
|
||||
self.Forward = self.Forward or data:GetNormal()
|
||||
self.Angle = self.Forward:Angle()
|
||||
local dlight = DynamicLight(self.WeaponEnt:EntIndex())
|
||||
|
||||
if (dlight) then
|
||||
dlight.pos = self.Position + self.Angle:Up() * 3 + self.Angle:Right() * -2
|
||||
dlight.r = 255
|
||||
dlight.g = 192
|
||||
dlight.b = 64
|
||||
dlight.brightness = 5
|
||||
dlight.Size = math.Rand(32, 64)
|
||||
dlight.Decay = math.Rand(32, 64) / 0.05
|
||||
dlight.DieTime = CurTime() + 0.05
|
||||
end
|
||||
|
||||
local pcf = CreateParticleSystem(self.WeaponEnt, self.ParticleName, PATTACH_POINT_FOLLOW, self.Attachment)
|
||||
if IsValid(pcf) then
|
||||
pcf:StartEmission()
|
||||
end
|
||||
|
||||
timer.Simple(3.0, function()
|
||||
if IsValid(pcf) then
|
||||
pcf:StopEmissionAndDestroyImmediately()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
Reference in New Issue
Block a user