mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 21:33:46 +03:00
55 lines
1.3 KiB
Lua
55 lines
1.3 KiB
Lua
--[[
|
|
| 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/
|
|
--]]
|
|
|
|
|
|
function EFFECT:Init(data)
|
|
self.ShotStart = data:GetStart()
|
|
self.ShotEnd = data:GetOrigin()
|
|
|
|
-- ws = worldspace
|
|
self:SetRenderBoundsWS(self.ShotStart, self.ShotEnd)
|
|
|
|
self.HitBox = data:GetMagnitude()
|
|
|
|
self.Duration = data:GetScale() or 0
|
|
self.EndTime = CurTime() + self.Duration
|
|
|
|
self.FadeTime = 3
|
|
|
|
self.FadeIn = CurTime() + self.FadeTime
|
|
self.FadeOut = self.EndTime - self.FadeTime
|
|
|
|
self.Width = 0
|
|
self.WidthMax = 5
|
|
end
|
|
|
|
function EFFECT:Think()
|
|
if self.EndTime < CurTime() then
|
|
return false
|
|
end
|
|
|
|
if self.FadeIn > CurTime() then
|
|
self.Width = self.WidthMax * (1 - ((self.FadeIn - CurTime()) / self.FadeTime))
|
|
elseif self.FadeOut < CurTime() then
|
|
self.Width = self.WidthMax * (1 - ((CurTime() - self.FadeOut) / self.FadeTime))
|
|
end
|
|
|
|
|
|
return true
|
|
end
|
|
|
|
local shot_mat = Material("cable/blue_elec")
|
|
--local clr = Color(0, 0, 100, 255)
|
|
function EFFECT:Render()
|
|
render.SetMaterial(shot_mat)
|
|
|
|
render.DrawBeam(self.ShotStart, self.ShotEnd, self.Width, 0, 0, self.Color)
|
|
end
|