Files
wnsrc/lua/effects/lvs_ar2_tracer.lua
lifestorm 9c918c46e5 Upload
2024-08-04 23:12:27 +03:00

40 lines
894 B
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/
--]]
EFFECT.MatBeam = Material( "effects/gunshiptracer" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 500 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos + dir * len, endpos - dir * len, 10, 1, 0, Color( 255, 255, 255, 255 ) )
end