mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
71
gamemodes/sandbox/entities/effects/balloon_pop.lua
Normal file
71
gamemodes/sandbox/entities/effects/balloon_pop.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
--[[
|
||||
| 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 )
|
||||
|
||||
local vOffset = data:GetOrigin()
|
||||
local Color = data:GetStart()
|
||||
|
||||
sound.Play( "garrysmod/balloon_pop_cute.wav", vOffset, 90, math.random( 90, 120 ) )
|
||||
|
||||
local NumParticles = 32
|
||||
|
||||
local emitter = ParticleEmitter( vOffset, true )
|
||||
|
||||
for i = 0, NumParticles do
|
||||
|
||||
local Pos = Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), math.Rand( -1, 1 ) )
|
||||
|
||||
local particle = emitter:Add( "particles/balloon_bit", vOffset + Pos * 8 )
|
||||
if ( particle ) then
|
||||
|
||||
particle:SetVelocity( Pos * 500 )
|
||||
|
||||
particle:SetLifeTime( 0 )
|
||||
particle:SetDieTime( 10 )
|
||||
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 255 )
|
||||
|
||||
local Size = math.Rand( 1, 3 )
|
||||
particle:SetStartSize( Size )
|
||||
particle:SetEndSize( 0 )
|
||||
|
||||
particle:SetRoll( math.Rand( 0, 360 ) )
|
||||
particle:SetRollDelta( math.Rand( -2, 2 ) )
|
||||
|
||||
particle:SetAirResistance( 100 )
|
||||
particle:SetGravity( Vector( 0, 0, -300 ) )
|
||||
|
||||
local RandDarkness = math.Rand( 0.8, 1.0 )
|
||||
particle:SetColor( Color.r * RandDarkness, Color.g * RandDarkness, Color.b * RandDarkness )
|
||||
|
||||
particle:SetCollide( true )
|
||||
|
||||
particle:SetAngleVelocity( Angle( math.Rand( -160, 160 ), math.Rand( -160, 160 ), math.Rand( -160, 160 ) ) )
|
||||
|
||||
particle:SetBounce( 1 )
|
||||
particle:SetLighting( true )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
39
gamemodes/sandbox/entities/effects/camera_flash.lua
Normal file
39
gamemodes/sandbox/entities/effects/camera_flash.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
--[[
|
||||
| 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 )
|
||||
|
||||
local vOffset = data:GetOrigin()
|
||||
local ent = data:GetEntity()
|
||||
|
||||
local dlight = DynamicLight( ent:EntIndex() )
|
||||
|
||||
if ( dlight ) then
|
||||
|
||||
dlight.Pos = vOffset
|
||||
dlight.r = 255
|
||||
dlight.g = 255
|
||||
dlight.b = 255
|
||||
dlight.Brightness = 10
|
||||
dlight.Size = 512
|
||||
dlight.DieTime = CurTime() + 0.02
|
||||
dlight.Decay = 512
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
63
gamemodes/sandbox/entities/effects/entity_remove.lua
Normal file
63
gamemodes/sandbox/entities/effects/entity_remove.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
--[[
|
||||
| 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 )
|
||||
|
||||
if ( GetConVarNumber( "gmod_drawtooleffects" ) == 0 ) then return end
|
||||
|
||||
local TargetEntity = data:GetEntity()
|
||||
if ( !IsValid( TargetEntity ) ) then return end
|
||||
|
||||
local vOffset = TargetEntity:GetPos()
|
||||
local Low, High = TargetEntity:WorldSpaceAABB()
|
||||
|
||||
local NumParticles = TargetEntity:BoundingRadius()
|
||||
NumParticles = NumParticles * 4
|
||||
|
||||
NumParticles = math.Clamp( NumParticles, 32, 256 )
|
||||
|
||||
local emitter = ParticleEmitter( vOffset )
|
||||
|
||||
for i = 0, NumParticles do
|
||||
|
||||
local vPos = Vector( math.Rand( Low.x, High.x ), math.Rand( Low.y, High.y ), math.Rand( Low.z, High.z ) )
|
||||
local particle = emitter:Add( "effects/spark", vPos )
|
||||
if ( particle ) then
|
||||
|
||||
particle:SetVelocity( ( vPos - vOffset ) * 5 )
|
||||
particle:SetLifeTime( 0 )
|
||||
particle:SetDieTime( math.Rand( 0.5, 1.0 ) )
|
||||
particle:SetStartAlpha( math.Rand( 200, 255 ) )
|
||||
particle:SetEndAlpha( 0 )
|
||||
particle:SetStartSize( 2 )
|
||||
particle:SetEndSize( 0 )
|
||||
particle:SetRoll( math.Rand( 0, 360 ) )
|
||||
particle:SetRollDelta( 0 )
|
||||
|
||||
particle:SetAirResistance( 100 )
|
||||
particle:SetGravity( Vector( 0, 0, -700 ) )
|
||||
particle:SetCollide( true )
|
||||
particle:SetBounce( 0.3 )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
56
gamemodes/sandbox/entities/effects/inflator_magic.lua
Normal file
56
gamemodes/sandbox/entities/effects/inflator_magic.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
--[[
|
||||
| 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 )
|
||||
|
||||
if ( GetConVarNumber( "gmod_drawtooleffects" ) == 0 ) then return end
|
||||
|
||||
local vOffset = data:GetOrigin()
|
||||
|
||||
local NumParticles = 16
|
||||
|
||||
local emitter = ParticleEmitter( vOffset )
|
||||
|
||||
for i = 0, NumParticles do
|
||||
|
||||
local particle = emitter:Add( "effects/spark", vOffset )
|
||||
if ( particle ) then
|
||||
|
||||
particle:SetDieTime( 0.5 )
|
||||
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 0 )
|
||||
|
||||
particle:SetStartSize( 1 )
|
||||
particle:SetEndSize( 0 )
|
||||
|
||||
particle:SetRoll( math.Rand( 0, 360 ) )
|
||||
particle:SetRollDelta( math.Rand( -200, 200 ) )
|
||||
|
||||
particle:SetAirResistance( 400 )
|
||||
|
||||
particle:SetVelocity( VectorRand() * 50 )
|
||||
particle:SetGravity( Vector( 0, 0, 100 ) )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
76
gamemodes/sandbox/entities/effects/lasertracer.lua
Normal file
76
gamemodes/sandbox/entities/effects/lasertracer.lua
Normal file
@@ -0,0 +1,76 @@
|
||||
--[[
|
||||
| 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.Mat = Material( "effects/spark" )
|
||||
|
||||
function EFFECT:Init( data )
|
||||
|
||||
self.StartPos = data:GetStart()
|
||||
self.EndPos = data:GetOrigin()
|
||||
|
||||
local ent = data:GetEntity()
|
||||
local attid = data:GetAttachment()
|
||||
|
||||
if ( IsValid( ent ) && attid > 0 ) then
|
||||
if ( ent.Owner == LocalPlayer() && LocalPlayer():GetViewModel() == LocalPlayer() ) then ent = ent.Owner:GetViewModel() end
|
||||
|
||||
local att = ent:GetAttachment( attid )
|
||||
if ( att ) then
|
||||
self.StartPos = att.Pos
|
||||
end
|
||||
end
|
||||
|
||||
self.Dir = self.EndPos - self.StartPos
|
||||
|
||||
self:SetRenderBoundsWS( self.StartPos, self.EndPos )
|
||||
|
||||
self.TracerTime = math.min( 1, self.StartPos:Distance( self.EndPos ) / 10000 )
|
||||
self.Length = math.Rand( 0.1, 0.15 )
|
||||
|
||||
-- Die when it reaches its target
|
||||
self.DieTime = CurTime() + self.TracerTime
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
|
||||
if ( CurTime() > self.DieTime ) then
|
||||
|
||||
-- Awesome End Sparks
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( self.EndPos + self.Dir:GetNormalized() * -2 )
|
||||
effectdata:SetNormal( self.Dir:GetNormalized() * -3 )
|
||||
effectdata:SetMagnitude( 1 )
|
||||
effectdata:SetScale( 1 )
|
||||
effectdata:SetRadius( 6 )
|
||||
util.Effect( "Sparks", effectdata )
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
|
||||
local fDelta = ( self.DieTime - CurTime() ) / self.TracerTime
|
||||
fDelta = math.Clamp( fDelta, 0, 1 ) ^ 0.5
|
||||
|
||||
render.SetMaterial( self.Mat )
|
||||
|
||||
local sinWave = math.sin( fDelta * math.pi )
|
||||
|
||||
render.DrawBeam( self.EndPos - self.Dir * ( fDelta - sinWave * self.Length ),
|
||||
self.EndPos - self.Dir * ( fDelta + sinWave * self.Length ),
|
||||
2 + sinWave * 16, 1, 0, Color( 0, 255, 0, 255 ) )
|
||||
|
||||
end
|
||||
41
gamemodes/sandbox/entities/effects/phys_freeze.lua
Normal file
41
gamemodes/sandbox/entities/effects/phys_freeze.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| 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 effects_freeze = CreateClientConVar( "effects_freeze", "1", true, false, "Whether to display Physics Gun freeze effects?" )
|
||||
|
||||
function EFFECT:Init( data )
|
||||
|
||||
if ( effects_freeze:GetBool() == false ) then return end
|
||||
|
||||
self.Target = data:GetEntity()
|
||||
self.StartTime = CurTime()
|
||||
self.Length = 0.3
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
|
||||
if ( effects_freeze:GetBool() == false ) then return false end
|
||||
return self.StartTime + self.Length > CurTime()
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
|
||||
if ( !IsValid( self.Target ) ) then return end
|
||||
|
||||
local delta = ( ( CurTime() - self.StartTime ) / self.Length ) ^ 0.5
|
||||
local idelta = 1 - delta
|
||||
|
||||
local size = 1
|
||||
halo.Add( { self.Target }, Color( 0, 255, 0, 255 * idelta ), size, size, 1, true, false )
|
||||
|
||||
end
|
||||
41
gamemodes/sandbox/entities/effects/phys_unfreeze.lua
Normal file
41
gamemodes/sandbox/entities/effects/phys_unfreeze.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| 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 effects_unfreeze = CreateClientConVar( "effects_unfreeze", "1", true, false, "Whether to display Physics Gun unfreeze effects?" )
|
||||
|
||||
function EFFECT:Init( data )
|
||||
|
||||
if ( effects_unfreeze:GetBool() == false ) then return end
|
||||
|
||||
self.Target = data:GetEntity()
|
||||
self.StartTime = CurTime()
|
||||
self.Length = 0.3
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
|
||||
if ( effects_unfreeze:GetBool() == false ) then return false end
|
||||
return self.StartTime + self.Length > CurTime()
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
|
||||
if ( !IsValid( self.Target ) ) then return end
|
||||
|
||||
local delta = ( ( CurTime() - self.StartTime ) / self.Length ) ^ 0.5
|
||||
local idelta = 1 - delta
|
||||
|
||||
local size = 1
|
||||
halo.Add( { self.Target }, Color( 255, 0, 0, 255 * idelta ), size, size, 1, true, false )
|
||||
|
||||
end
|
||||
149
gamemodes/sandbox/entities/effects/propspawn.lua
Normal file
149
gamemodes/sandbox/entities/effects/propspawn.lua
Normal file
@@ -0,0 +1,149 @@
|
||||
--[[
|
||||
| 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 cl_drawspawneffect = CreateConVar( "cl_drawspawneffect", "1", { FCVAR_ARCHIVE }, "Whether to draw the spawn effect when spawning objects." )
|
||||
|
||||
local matRefract = Material( "models/spawn_effect" )
|
||||
|
||||
function EFFECT:Init( data )
|
||||
|
||||
if ( !cl_drawspawneffect:GetBool() ) then return end
|
||||
|
||||
-- This is how long the spawn effect
|
||||
-- takes from start to finish.
|
||||
self.Time = 0.5
|
||||
self.LifeTime = CurTime() + self.Time
|
||||
|
||||
local ent = data:GetEntity()
|
||||
|
||||
if ( !IsValid( ent ) ) then return end
|
||||
if ( !ent:GetModel() ) then return end
|
||||
|
||||
self.ParentEntity = ent
|
||||
self:SetModel( ent:GetModel() )
|
||||
self:SetPos( ent:GetPos() )
|
||||
self:SetAngles( ent:GetAngles() )
|
||||
self:SetParent( ent )
|
||||
|
||||
self.OldRenderOverride = self.ParentEntity.RenderOverride
|
||||
self.ParentEntity.SpawnEffect = self
|
||||
self.ParentEntity.RenderOverride = self.RenderParent
|
||||
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
|
||||
if ( !cl_drawspawneffect:GetBool() ) then return false end
|
||||
if ( !IsValid( self.ParentEntity ) ) then return false end
|
||||
|
||||
local PPos = self.ParentEntity:GetPos()
|
||||
self:SetPos( PPos + ( EyePos() - PPos ):GetNormal() )
|
||||
|
||||
if ( self.LifeTime > CurTime() ) then
|
||||
return true
|
||||
end
|
||||
|
||||
-- Remove the override only if our override was not overridden.
|
||||
if ( self.ParentEntity.RenderOverride == self.RenderParent ) then
|
||||
self.ParentEntity.RenderOverride = self.OldRenderOverride
|
||||
end
|
||||
self.ParentEntity.SpawnEffect = nil
|
||||
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
|
||||
function EFFECT:RenderOverlay( entity )
|
||||
|
||||
local Fraction = ( self.LifeTime - CurTime() ) / self.Time
|
||||
local ColFrac = ( Fraction - 0.5 ) * 2
|
||||
|
||||
Fraction = math.Clamp( Fraction, 0, 1 )
|
||||
ColFrac = math.Clamp( ColFrac, 0, 1 )
|
||||
|
||||
-- Change our model's alpha so the texture will fade out
|
||||
--entity:SetColor( 255, 255, 255, 1 + 254 * (ColFrac) )
|
||||
|
||||
-- Place the camera a tiny bit closer to the entity.
|
||||
-- It will draw a big bigger and we will skip any z buffer problems
|
||||
local EyeNormal = entity:GetPos() - EyePos()
|
||||
local Distance = EyeNormal:Length()
|
||||
EyeNormal:Normalize()
|
||||
|
||||
local Pos = EyePos() + EyeNormal * Distance * 0.01
|
||||
|
||||
-- Start the new 3d camera position
|
||||
local bClipping = self:StartClip( entity, 1.2 )
|
||||
cam.Start3D( Pos, EyeAngles() )
|
||||
|
||||
-- If our card is DX8 or above draw the refraction effect
|
||||
if ( render.GetDXLevel() >= 80 ) then
|
||||
|
||||
-- Update the refraction texture with whatever is drawn right now
|
||||
render.UpdateRefractTexture()
|
||||
|
||||
matRefract:SetFloat( "$refractamount", Fraction * 0.1 )
|
||||
|
||||
-- Draw model with refraction texture
|
||||
render.MaterialOverride( matRefract )
|
||||
entity:DrawModel()
|
||||
render.MaterialOverride()
|
||||
|
||||
end
|
||||
|
||||
-- Set the camera back to how it was
|
||||
cam.End3D()
|
||||
render.PopCustomClipPlane()
|
||||
render.EnableClipping( bClipping )
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:RenderParent()
|
||||
|
||||
if ( !IsValid( self ) ) then return end
|
||||
if ( !IsValid( self.SpawnEffect ) ) then self.RenderOverride = nil return end
|
||||
|
||||
local bClipping = self.SpawnEffect:StartClip( self, 1 )
|
||||
|
||||
self:DrawModel()
|
||||
|
||||
render.PopCustomClipPlane()
|
||||
render.EnableClipping( bClipping )
|
||||
|
||||
self.SpawnEffect:RenderOverlay( self )
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:StartClip( model, spd )
|
||||
|
||||
local mn, mx = model:GetRenderBounds()
|
||||
local Up = ( mx - mn ):GetNormal()
|
||||
local Bottom = model:GetPos() + mn
|
||||
local Top = model:GetPos() + mx
|
||||
|
||||
local Fraction = ( self.LifeTime - CurTime() ) / self.Time
|
||||
Fraction = math.Clamp( Fraction / spd, 0, 1 )
|
||||
|
||||
local Lerped = LerpVector( Fraction, Bottom, Top )
|
||||
|
||||
local normal = Up
|
||||
local distance = normal:Dot( Lerped )
|
||||
|
||||
local bEnabled = render.EnableClipping( true )
|
||||
render.PushCustomClipPlane( normal, distance )
|
||||
|
||||
return bEnabled
|
||||
|
||||
end
|
||||
65
gamemodes/sandbox/entities/effects/selection_indicator.lua
Normal file
65
gamemodes/sandbox/entities/effects/selection_indicator.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
--[[
|
||||
| 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.Mat = Material( "effects/select_dot" )
|
||||
|
||||
function EFFECT:Init( data )
|
||||
|
||||
local pos = data:GetOrigin()
|
||||
local att = data:GetAttachment()
|
||||
local ent = data:GetEntity()
|
||||
local nrml = data:GetNormal()
|
||||
|
||||
self:SetRenderBounds( Vector( -8, -8, -8 ), Vector( 8, 8, 8 ) )
|
||||
self:SetPos( pos )
|
||||
|
||||
-- This 0.01 is a hack.. to prevent the angle being weird and messing up when we change it back to a normal
|
||||
self:SetAngles( nrml:Angle() + Angle( 0.01, 0.01, 0.01 ) )
|
||||
|
||||
if ( IsValid( ent ) ) then
|
||||
self:SetParentPhysNum( att )
|
||||
self:SetParent( ent )
|
||||
end
|
||||
|
||||
self.Size = 4
|
||||
self.Alpha = 255
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( pos )
|
||||
effectdata:SetNormal( nrml )
|
||||
effectdata:SetEntity( ent )
|
||||
effectdata:SetAttachment( att )
|
||||
|
||||
for i = 0, 5 do
|
||||
|
||||
util.Effect( "selection_ring", effectdata )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
|
||||
self.Alpha = self.Alpha - 255 * FrameTime()
|
||||
if ( self.Alpha < 0 ) then return false end
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
|
||||
if ( self.Alpha < 1 ) then return end
|
||||
|
||||
render.SetMaterial( self.Mat )
|
||||
|
||||
render.DrawQuadEasy( self:GetPos(), self:GetAngles():Forward(), self.Size, self.Size, Color( 255, 255, 255, self.Alpha ) )
|
||||
|
||||
end
|
||||
61
gamemodes/sandbox/entities/effects/selection_ring.lua
Normal file
61
gamemodes/sandbox/entities/effects/selection_ring.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
--[[
|
||||
| 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.Mat = Material( "effects/select_ring" )
|
||||
|
||||
function EFFECT:Init( data )
|
||||
|
||||
local size = 8
|
||||
self:SetCollisionBounds( Vector( -size, -size, -size ), Vector( size, size, size ) )
|
||||
|
||||
local Pos = data:GetOrigin() + data:GetNormal() * 2
|
||||
|
||||
self:SetPos( Pos )
|
||||
|
||||
-- This 0.01 is a hack.. to prevent the angle being weird and messing up when we change it back to a normal
|
||||
self:SetAngles( data:GetNormal():Angle() + Angle( 0.01, 0.01, 0.01 ) )
|
||||
|
||||
self:SetParentPhysNum( data:GetAttachment() )
|
||||
|
||||
if ( IsValid( data:GetEntity() ) ) then
|
||||
self:SetParent( data:GetEntity() )
|
||||
end
|
||||
|
||||
self.Pos = data:GetOrigin()
|
||||
self.Normal = data:GetNormal()
|
||||
|
||||
self.Speed = math.Rand( 0.5, 1.5 )
|
||||
self.Size = 4
|
||||
self.Alpha = 255
|
||||
|
||||
self.Life = 0.5
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
|
||||
self.Alpha = self.Alpha - FrameTime() * 255 * 5 * self.Speed
|
||||
self.Size = self.Size + FrameTime() * 256 * self.Speed
|
||||
|
||||
if ( self.Alpha < 0 ) then return false end
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
|
||||
if ( self.Alpha < 1 ) then return end
|
||||
|
||||
render.SetMaterial( self.Mat )
|
||||
|
||||
render.DrawQuadEasy( self:GetPos(), self:GetAngles():Forward(), self.Size, self.Size, Color( math.Rand( 10, 150 ), math.Rand( 170, 220 ), math.Rand( 240, 255 ), self.Alpha ) )
|
||||
|
||||
end
|
||||
67
gamemodes/sandbox/entities/effects/wheel_indicator.lua
Normal file
67
gamemodes/sandbox/entities/effects/wheel_indicator.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
--[[
|
||||
| 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.Mat = Material( "effects/wheel_ring" )
|
||||
|
||||
function EFFECT:Init( data )
|
||||
|
||||
self.Wheel = data:GetEntity()
|
||||
if ( !IsValid( self.Wheel ) ) then return end
|
||||
|
||||
self.Axis = data:GetOrigin() / 100 -- see gmod_wheel.lua
|
||||
self.Direction = data:GetScale()
|
||||
|
||||
-- This 0.01 is a hack.. to prevent the angle being weird and messing up when we change it back to a normal
|
||||
-- Removed, we are never even setting the normal on effect data
|
||||
--self:SetAngles( data:GetNormal():Angle() + Angle( 0.01, 0.01, 0.01 ) )
|
||||
|
||||
self.Alpha = 1
|
||||
|
||||
self.Size = self.Wheel:BoundingRadius() + 8
|
||||
|
||||
self:SetPos( self.Wheel:LocalToWorld( self.Axis ) )
|
||||
self:SetParent( self.Wheel )
|
||||
|
||||
local size = 64
|
||||
self:SetCollisionBounds( Vector( -size, -size, -size ), Vector( size, size, size ) )
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
|
||||
if ( !IsValid( self.Wheel ) ) then return false end
|
||||
|
||||
local speed = FrameTime()
|
||||
|
||||
self.Alpha = self.Alpha - speed * 0.8
|
||||
self.Size = self.Size + speed * 5
|
||||
|
||||
if ( self.Alpha < 0 ) then return false end
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
|
||||
if ( !IsValid( self.Wheel ) ) then return end
|
||||
if ( self.Alpha < 0 ) then return end
|
||||
|
||||
render.SetMaterial( self.Mat )
|
||||
|
||||
local offset = self.Wheel:LocalToWorld( self.Axis ) - self.Wheel:GetPos()
|
||||
|
||||
render.DrawQuadEasy( self.Wheel:GetPos() + offset,
|
||||
offset:GetNormalized() * self.Direction,
|
||||
self.Size, self.Size,
|
||||
Color( 255, 255, 255, ( self.Alpha ^ 1.1 ) * 255 ),
|
||||
self.Alpha * 200 )
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user