diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
| commit | 2736f498f30220b858fc6fac23e7ddc4a597df6d (patch) | |
| tree | 374ceadedb654b00e09dac321620a8320830f734 /entities/effects | |
| download | redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.gz redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.bz2 redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.zip | |
Inital commit
Diffstat (limited to 'entities/effects')
| -rw-r--r-- | entities/effects/barrel_gib/init.lua | 42 | ||||
| -rw-r--r-- | entities/effects/biohazard/init.lua | 95 | ||||
| -rw-r--r-- | entities/effects/body_gib/init.lua | 142 | ||||
| -rw-r--r-- | entities/effects/bomb_explosion/init.lua | 138 | ||||
| -rw-r--r-- | entities/effects/c4_explosion/init.lua | 176 | ||||
| -rw-r--r-- | entities/effects/energy_explosion/init.lua | 82 | ||||
| -rw-r--r-- | entities/effects/fire_explosion/init.lua | 83 | ||||
| -rw-r--r-- | entities/effects/fire_tracer/init.lua | 87 | ||||
| -rw-r--r-- | entities/effects/gore_explosion/init.lua | 129 | ||||
| -rw-r--r-- | entities/effects/head_gib/init.lua | 91 | ||||
| -rw-r--r-- | entities/effects/headshot/init.lua | 66 | ||||
| -rw-r--r-- | entities/effects/immolate/init.lua | 88 | ||||
| -rw-r--r-- | entities/effects/player_gib/init.lua | 58 | ||||
| -rw-r--r-- | entities/effects/puke_explosion/init.lua | 119 | ||||
| -rw-r--r-- | entities/effects/puke_spray/init.lua | 119 | ||||
| -rw-r--r-- | entities/effects/rad_explosion/init.lua | 55 | ||||
| -rw-r--r-- | entities/effects/radiation/init.lua | 70 | ||||
| -rw-r--r-- | entities/effects/smoke_crater/init.lua | 52 |
18 files changed, 1692 insertions, 0 deletions
diff --git a/entities/effects/barrel_gib/init.lua b/entities/effects/barrel_gib/init.lua new file mode 100644 index 0000000..f635312 --- /dev/null +++ b/entities/effects/barrel_gib/init.lua @@ -0,0 +1,42 @@ + +function EFFECT:Init( data ) + + self.Entity:SetModel( table.Random( GAMEMODE.BarrelGibs ) ) + + self.Entity:PhysicsInit( SOLID_VPHYSICS ) + //self.Entity:SetMaterial( "models/flesh" ) + + self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS ) + self.Entity:SetCollisionBounds( Vector( -128 -128, -128 ), Vector( 128, 128, 128 ) ) + self.Entity:SetAngles( Angle( math.Rand(0,360), math.Rand(0,360), math.Rand(0,360) ) ) + + local phys = self.Entity:GetPhysicsObject() + + if IsValid( phys ) then + + local vec = VectorRand() + vec.z = math.Clamp( vec.z, -0.4, 0.8 ) + + phys:Wake() + phys:SetMass( 100 ) + phys:AddAngleVelocity( VectorRand() * 500 ) + phys:SetVelocity( vec * math.Rand( 100, 200 ) ) + + end + + self.LifeTime = CurTime() + 15 + +end + +function EFFECT:Think( ) + + return self.LifeTime > CurTime() + +end + +function EFFECT:Render() + + self.Entity:DrawModel() + +end + diff --git a/entities/effects/biohazard/init.lua b/entities/effects/biohazard/init.lua new file mode 100644 index 0000000..8af6357 --- /dev/null +++ b/entities/effects/biohazard/init.lua @@ -0,0 +1,95 @@ + +EFFECT.Color = Color(100,80,0) + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = 0 + + local pos = data:GetOrigin() + Vector(0,0,10) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 10 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 250 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 ) + particle:SetGravity( Vector( 0, 0, -400 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random( 1, 2 ), pos + Vector( 0, 0, math.random( -10, 10 ) ) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "yellowblood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + +end + +function EFFECT:Think() + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + 0.5 + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/body_gib/init.lua b/entities/effects/body_gib/init.lua new file mode 100644 index 0000000..d433bce --- /dev/null +++ b/entities/effects/body_gib/init.lua @@ -0,0 +1,142 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = CurTime() + math.Rand( 0.2, 1.0 ) + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + self.Normal = data:GetNormal() + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 6.0, 8.0 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 150, 200 ) ) + particle:SetEndSize( 200 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -5 ) ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 12 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 250 + ( self.Normal * ( i * 10 ) ) ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 40, 0, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "Blood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 8 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) ) + + if i < 4 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + + if LocalPlayer():GetPos():Distance( pos ) <= 300 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 300 ) + + for i=1, math.Round( frac * 6 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + math.Rand( 0.2, 0.6 ) + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end + diff --git a/entities/effects/bomb_explosion/init.lua b/entities/effects/bomb_explosion/init.lua new file mode 100644 index 0000000..459c3bd --- /dev/null +++ b/entities/effects/bomb_explosion/init.lua @@ -0,0 +1,138 @@ + +local matRefraction = Material( "refract_ring" ) + +function EFFECT:Init( data ) + + self.Entity:SetRenderBounds( Vector() * -1024, Vector() * 1024 ) + + self.Pos = data:GetOrigin() + self.Norm = data:GetNormal() + self.Emitter = ParticleEmitter( self.Pos ) + self.DieTime = CurTime() + 5 + + for i=1, math.random(3,6) do + + local vec = self.Norm + VectorRand() * 0.7 + vec.x = math.Clamp( vec.x, -1.0, 0 ) + + local particle = self.Emitter:Add( "effects/fire_cloud2", self.Pos ) + + particle:SetVelocity( vec * math.random( 400, 600 ) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 5 ) + particle:SetEndSize( 0 ) + particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 ) + + particle:SetGravity( Vector( 0, 0, math.random( -700, -500 ) ) ) + particle:SetAirResistance( math.random( 20, 60 ) ) + particle:SetCollide( true ) + + particle:SetLifeTime( 0 ) + particle:SetThinkFunction( CloudThink ) + particle:SetNextThink( CurTime() + 0.1 ) + + end + + for i=1, 15 do + + local particle = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos ) + + particle:SetVelocity( self.Norm * math.random(50,100) + VectorRand() * math.random(50,100) ) + particle:SetDieTime( 0.7 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 20, 40 ) ) + particle:SetEndSize( math.Rand( 100, 200 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.2, 0.2 ) ) + particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 ) + + local particle = self.Emitter:Add( "particle/particle_smokegrenade", self.Pos ) + + particle:SetDieTime( math.Rand( 1.5, 2.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 20, 40 ) ) + particle:SetEndSize( math.Rand( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local vec = VectorRand() + vec.x = math.Rand( -0.1, 0.1 ) + + if i % 2 == 0 then + + particle:SetVelocity( self.Norm * math.random(100,150) + vec * math.random(40,80) ) + + else + + particle:SetVelocity( vec * math.random(100,150) ) + + end + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + particle:SetGravity( Vector(0,0,-50) ) + particle:SetCollide( true ) + + end + + local dlight = DynamicLight( self.Entity:EntIndex() ) + + if dlight then + + dlight.Pos = self.Pos + dlight.r = 250 + dlight.g = 200 + dlight.b = 50 + dlight.Brightness = math.Rand( 4, 8 ) + dlight.Decay = 2048 + dlight.size = 2048 + dlight.DieTime = CurTime() + 5 + + end + + self.Emitter:Finish() + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end + +function CloudThink( part ) + + part:SetNextThink( CurTime() + 0.05 ) + + local scale = 1 - part:GetLifeTime() + local pos = part:GetPos() + local emitter = ParticleEmitter( pos ) + local vec = VectorRand() + vec.x = math.Rand( -0.1, 0 ) + + local particle = emitter:Add( "particle/particle_smokegrenade", pos ) + + particle:SetVelocity( vec * 3 + ( WindVector * ( 2 * ( 1 - scale ) ) ) ) + particle:SetDieTime( math.Rand( 2.0, 3.0 ) + scale * 1.0 ) + particle:SetStartAlpha( math.random( 100, 150 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 1, 3 ) + scale * 20 ) + particle:SetEndSize( math.random( 1, 5 ) + scale * 30 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + emitter:Finish() + +end diff --git a/entities/effects/c4_explosion/init.lua b/entities/effects/c4_explosion/init.lua new file mode 100644 index 0000000..bb676cc --- /dev/null +++ b/entities/effects/c4_explosion/init.lua @@ -0,0 +1,176 @@ + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + + local emitter = ParticleEmitter( pos ) + + for i=1,math.random(10,15) do + + local particle = emitter:Add( "particles/smokey", pos ) + + particle:SetVelocity( Vector(math.random(-90, 90),math.random(-90, 90), math.random(-70, 70) ) ) + particle:SetDieTime( math.Rand(3,6) ) + particle:SetStartAlpha( math.Rand( 55, 115 ) ) + particle:SetStartSize( math.Rand( 20, 30 ) ) + particle:SetEndSize( math.Rand( 140, 240 ) ) + particle:SetRoll( math.Rand( -95, 95 ) ) + particle:SetRollDelta( math.Rand( -0.12, 0.12 ) ) + particle:SetColor( 10,10,10 ) + + end + + for i=1, math.random(10,15) do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos + Vector(math.random(-40,40),math.random(-40,40),math.random(-30,50))) + + particle:SetVelocity( Vector(math.random(-150,150),math.random(-150,150),math.random(100,200)) ) + particle:SetDieTime( math.Rand(1,1.5) ) + particle:SetStartAlpha( math.Rand( 200, 240 ) ) + particle:SetStartSize( 5 ) + particle:SetEndSize( math.Rand( 90, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -1, 1 ) ) + particle:SetColor( math.Rand( 150, 255 ), math.Rand( 100, 150 ), 100 ) + particle:VelocityDecay( false ) + + end + + for i=1, math.random(15,25) do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos + Vector(math.random(-40,40),math.random(-40,40),math.random(10,20))) + + particle:SetVelocity( Vector(math.random(-200,200),math.random(-200,200),math.random(0,60)) ) + particle:SetDieTime( math.Rand( 1, 2 ) ) + particle:SetStartAlpha( math.Rand( 200, 240 ) ) + particle:SetStartSize( 48 ) + particle:SetEndSize( math.Rand( 168, 190 ) ) + particle:SetRoll( math.Rand( 360,480 ) ) + particle:SetRollDelta( math.Rand( -1, 1 ) ) + particle:SetColor( math.Rand( 150, 255 ), math.Rand( 100, 150 ), 100 ) + particle:VelocityDecay( true ) + + end + + for i=0,math.random(5,9) do + + local particle = emitter:Add( "effects/fire_embers"..math.random(1,3), pos ) + particle:SetVelocity( Vector(math.random(-400,400),math.random(-400,400),math.random(300,550)) ) + particle:SetDieTime(math.Rand(2,5)) + particle:SetStartAlpha(math.random(140,220)) + particle:SetEndAlpha(50) + particle:SetStartSize(math.random(3,4)) + particle:SetEndSize(0) + particle:SetRoll(math.random(-200,200)) + particle:SetRollDelta( math.random( -1, 1 ) ) + particle:SetColor(255, 220, 100) + particle:SetGravity(Vector(0,0,-520)) //-600 is normal + particle:SetCollide(true) + particle:SetBounce(0.45) + + end + + for i=1, 5 do + + local particle = emitter:Add( "particle/particle_smokegrenade", pos ) + + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + + if i % 2 == 1 then + particle:SetVelocity( Vector( math.random(-100,100), math.random(-100,100), math.random(0,50) ) ) + particle:SetStartSize( math.Rand( 50, 100 ) ) + particle:SetEndSize( math.Rand( 250, 500 ) ) + else + particle:SetVelocity( Vector( math.random(-200,200), math.random(-200,200), 0 ) ) + particle:SetStartSize( math.Rand( 50, 100 ) ) + particle:SetEndSize( math.Rand( 200, 400 ) ) + end + + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + if math.random(1,4) != 1 then + + local vec = Vector( math.Rand(-8,8), math.Rand(-8,8), math.Rand(8,12) ) + local particle = emitter:Add( "effects/fire_cloud2", pos + vec * 10 ) + + particle:SetVelocity( vec * 80 ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 100 ) + particle:SetStartSize( 8 ) + particle:SetEndSize( 0 ) + particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 ) + + particle:SetGravity( Vector( 0, 0, math.random( -700, -500 ) ) ) + particle:SetAirResistance( math.random( 20, 60 ) ) + particle:SetCollide( true ) + + particle:SetLifeTime( 0 ) + particle:SetThinkFunction( CloudThink ) + particle:SetNextThink( CurTime() + 0.1 ) + + end + + end + + emitter:Finish() + + local dlight = DynamicLight( self.Entity:EntIndex() ) + + if dlight then + + dlight.Pos = pos + dlight.r = 250 + dlight.g = 200 + dlight.b = 50 + dlight.Brightness = math.Rand( 4, 8 ) + dlight.Decay = 1024 + dlight.size = 1024 + dlight.DieTime = CurTime() + 5 + + end + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end + +function CloudThink( part ) + + part:SetNextThink( CurTime() + 0.12 ) + + local scale = 1 - part:GetLifeTime() + local pos = part:GetPos() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "particle/particle_smokegrenade", pos ) + + particle:SetVelocity( VectorRand() * 3 + ( WindVector * ( 3 * ( 1 - scale ) ) ) ) + particle:SetDieTime( math.Rand( 2.0, 3.0 ) + scale * 1.0 ) + particle:SetStartAlpha( math.random( 100, 150 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 1, 3 ) + scale * math.random( 20, 50 ) ) + particle:SetEndSize( math.random( 1, 5 ) + scale * math.random( 30, 50 ) ) + + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + emitter:Finish() + +end diff --git a/entities/effects/energy_explosion/init.lua b/entities/effects/energy_explosion/init.lua new file mode 100644 index 0000000..d959e8a --- /dev/null +++ b/entities/effects/energy_explosion/init.lua @@ -0,0 +1,82 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + + local pos = data:GetOrigin() + local normal = data:GetNormal() + local emitter = ParticleEmitter( pos ) + + for i=1, 20 do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos ) + particle:SetVelocity( VectorRand() * 100 ) + particle:SetDieTime( math.Rand( 0.3, 0.6 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 5, 10 ) ) + particle:SetEndSize( math.Rand( 40, 80 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 100, 250 ) + + end + + for i=1, math.random(3,6) do + + local vec = normal * math.random( 150, 200 )+ VectorRand() * 50 + local normalized = vec:GetNormal():Angle() + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( normal * math.random(150,200) + VectorRand() * 50 ) + particle:SetAngles( normalized ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( 0 ) + particle:SetEndLength( 20 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 100, 200 ) + + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() * 500 + local normalized = vec:GetNormal():Angle() + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( vec ) + particle:SetAngles( normalized ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( 0 ) + particle:SetEndLength( 20 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 100, 200 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 1.0 ) + + end + + emitter:Finish() + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/fire_explosion/init.lua b/entities/effects/fire_explosion/init.lua new file mode 100644 index 0000000..d51b1c3 --- /dev/null +++ b/entities/effects/fire_explosion/init.lua @@ -0,0 +1,83 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + + local pos = data:GetOrigin() + local normal = data:GetNormal() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 1.0, 1.5 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 50, 50 ) + + for i=1, 10 do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos ) + particle:SetVelocity( VectorRand() * 50 + normal * 50 ) + particle:SetDieTime( math.Rand( 0.3, 0.6 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 5, 10 ) ) + particle:SetEndSize( math.Rand( 30, 60 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 200, 150, 100 ) + + end + + for i=1, math.random(5,10) do + + local vec = normal * math.random( 150, 200 ) + VectorRand() * 50 + local normalized = vec:GetNormal():Angle() + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( normal * math.random(150,200) + VectorRand() * 50 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 1.5, 3.5 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 4, 8 ) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 200, 100, 50 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( math.Rand( 0, 0.2 ) ) + + end + + emitter:Finish() + + local dlight = DynamicLight( self:EntIndex() ) + + if dlight then + + dlight.Pos = pos + dlight.r = 255 + dlight.g = 150 + dlight.b = 50 + dlight.Brightness = 3 + dlight.Decay = 512 + dlight.size = 256 * math.Rand( 0.5, 1.0 ) + dlight.DieTime = CurTime() + 5 + + end + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/fire_tracer/init.lua b/entities/effects/fire_tracer/init.lua new file mode 100644 index 0000000..3f8842b --- /dev/null +++ b/entities/effects/fire_tracer/init.lua @@ -0,0 +1,87 @@ + +EFFECT.Mat = Material( "trails/plasma" ) +EFFECT.Sprite = Material( "effects/yellowflare" ) + +function EFFECT:Init( data ) + + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + local dir = self.StartPos - self.EndPos + dir:Normalize() + + self.Dir = dir + + self.Entity:SetRenderBoundsWS( self.StartPos, self.EndPos ) + + self.Alpha = 100 + self.Color = Color( 250, 150, 50, self.Alpha ) + + local dlight = DynamicLight( self:EntIndex() ) + + if dlight then + + dlight.Pos = self.StartPos + dlight.r = 255 + dlight.g = 150 + dlight.b = 50 + dlight.Brightness = 3 + dlight.Decay = 256 + dlight.size = 256 * math.Rand( 0.5, 1.0 ) + dlight.DieTime = CurTime() + 5 + + end + +end + +function EFFECT:Think( ) + + self.Entity:SetRenderBoundsWS( self.StartPos, self.EndPos ) + + self.Alpha = self.Alpha - FrameTime() * 200 + self.Color = Color( 250, 150, 50, self.Alpha ) + + return self.Alpha > 0 + +end + +function EFFECT:Render( ) + + if self.Alpha < 1 then return end + + --[[self.Length = ( self.StartPos - self.EndPos ):Length() + + render.SetMaterial( self.Mat ) + render.DrawBeam( self.StartPos, self.EndPos, ( 100 / self.Alpha ) * 0.5 + 0.5, 0, 0, self.Color )]] + + if ( self.Alpha < 1 ) then return end + + self.Length = (self.StartPos - self.EndPos):Length() + + local texcoord = CurTime() * -0.2 + + for i = 1, 10 do + + render.SetMaterial( self.Mat ) + + texcoord = texcoord + i * 0.05 * texcoord + + render.DrawBeam( self.StartPos, + self.EndPos, + i * self.Alpha * 0.03, + texcoord, + texcoord + (self.Length / (128 + self.Alpha)), + self.Color ) + + render.SetMaterial( self.Sprite ) + + render.DrawSprite( self.StartPos + self.Dir * i, i * 5, i * 5, Color( self.Color.r, self.Color.g, self.Color.b, self.Alpha ) ) + render.DrawSprite( self.EndPos, i * 5, i * 5, Color( self.Color.r, self.Color.g, self.Color.b, self.Alpha ) ) + + end + +end diff --git a/entities/effects/gore_explosion/init.lua b/entities/effects/gore_explosion/init.lua new file mode 100644 index 0000000..e4406a1 --- /dev/null +++ b/entities/effects/gore_explosion/init.lua @@ -0,0 +1,129 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 150, 200 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 6.0, 8.0 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 100, 250 ) ) + particle:SetEndSize( 200 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -5 ) ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 12 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 250 + Vector(0,0,50) ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 40, 0, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "Blood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 15 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) ) + + if i < 5 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + + if LocalPlayer():GetPos():Distance( pos ) <= 300 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 300 ) + + for i=1, math.Round( frac * 12 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/head_gib/init.lua b/entities/effects/head_gib/init.lua new file mode 100644 index 0000000..8a36dd9 --- /dev/null +++ b/entities/effects/head_gib/init.lua @@ -0,0 +1,91 @@ + + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( 0.5 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 5.0, 7.0 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 40, 80 ) ) + particle:SetEndSize( 200 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -5 ) ) + + for i=1, math.random(5,10) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 2, 4 ) ) + particle:SetEndSize( math.random( 10, 20 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 6 do + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,0,75) ) + particle:SetDieTime( 0.5 ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 30, 60 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + emitter:Finish() + + for i=1, 3 do + + local ed = EffectData() + ed:SetOrigin( pos ) + ed:SetScale( 1 ) + util.Effect( "player_gib", ed, true, true ) + + end + + if LocalPlayer():GetPos():Distance( pos ) <= 100 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 100 ) + + for i=1, math.Round( frac * 6 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end + diff --git a/entities/effects/headshot/init.lua b/entities/effects/headshot/init.lua new file mode 100644 index 0000000..7aadb41 --- /dev/null +++ b/entities/effects/headshot/init.lua @@ -0,0 +1,66 @@ + + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( 0.3 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "particles/smokey", pos ) + particle:SetDieTime( math.Rand( 10, 20 ) ) + particle:SetStartAlpha( math.random( 20, 40 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( 10 ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + for i=1, math.random(2,4) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 2, 4 ) ) + particle:SetEndSize( math.random( 10, 20 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + emitter:Finish() + + if LocalPlayer():GetPos():Distance( pos ) <= 100 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 100 ) + + for i=1, math.Round( frac * 3 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end + diff --git a/entities/effects/immolate/init.lua b/entities/effects/immolate/init.lua new file mode 100644 index 0000000..e6a7cc1 --- /dev/null +++ b/entities/effects/immolate/init.lua @@ -0,0 +1,88 @@ + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 5 + self.SmokeTime = 0 + self.Ent = data:GetEntity() + + if not IsValid( self.Ent ) then self.DieTime = 0 return end + + self.Emitter = ParticleEmitter( self.Ent:GetPos() ) + + if LocalPlayer() != self.Ent then return end + + LocalPlayer():EmitSound( "ambient/fire/ignite.wav", 100, 80 ) + +end + +function EFFECT:Think() + + if IsValid( self.Ent ) then + + if self.Ent:IsPlayer() and ( !self.Ent:Alive() or self.Ent == LocalPlayer() ) then + + self.DieTime = 0 + + end + + end + + if self.DieTime < CurTime() or not IsValid( self.Ent ) then + + if self.Emitter then + + self.Emitter:Finish() + + end + + return false + + end + + local pos + + for i=1, 3 do + + pos = self.Ent:GetPos() + Vector(0,0,math.random(1,50)) + Vector(math.random(-10,10),math.random(-10,10),0) + + local particle = self.Emitter:Add( "effects/muzzleflash" .. math.random(1,4), pos ) + particle:SetVelocity( Vector(0,0,80) ) + particle:SetDieTime( math.Rand( 0.2, 0.4 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random(5,15) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.random(-180,180) ) + particle:SetColor( 255, 200, 200 ) + particle:SetGravity( Vector( 0, 0, 500 ) ) + + end + + if self.SmokeTime < CurTime() then + + self.SmokeTime = CurTime() + 0.02 + + local particle = self.Emitter:Add( "particles/smokey", pos ) + particle:SetVelocity( Vector(0,0,30) ) + particle:SetDieTime( math.Rand( 1.0, 2.5 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 25, 50 ) ) + particle:SetRoll( 0 ) + particle:SetColor( 50, 50, 50 ) + particle:SetGravity( Vector( 0, 0, 30 ) ) + + end + + return true + +end + +function EFFECT:Render() + +end + + + + diff --git a/entities/effects/player_gib/init.lua b/entities/effects/player_gib/init.lua new file mode 100644 index 0000000..2afcae0 --- /dev/null +++ b/entities/effects/player_gib/init.lua @@ -0,0 +1,58 @@ + +function EFFECT:Init( data ) + + local scale = data:GetScale() + + if scale < 2 then + self.Entity:SetModel( table.Random( GAMEMODE.SmallGibs ) ) + else + self.Entity:SetModel( table.Random( GAMEMODE.BigGibs ) ) + end + + self.Entity:PhysicsInit( SOLID_VPHYSICS ) + self.Entity:SetMaterial( "models/flesh" ) + + self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS ) + self.Entity:SetCollisionBounds( Vector( -128 -128, -128 ), Vector( 128, 128, 128 ) ) + self.Entity:SetAngles( Angle( math.Rand(0,360), math.Rand(0,360), math.Rand(0,360) ) ) + + local phys = self.Entity:GetPhysicsObject() + + if IsValid( phys ) then + + local vec = VectorRand() + vec.z = math.Clamp( vec.z, -0.4, 0.8 ) + + phys:Wake() + phys:SetMass( 100 ) + phys:AddAngleVelocity( VectorRand() * 500 ) + phys:SetMaterial( "gmod_silent" ) + + if scale < 2 then + + phys:SetVelocity( vec * math.Rand( 100, 200 ) ) + + else + + phys:SetVelocity( vec * math.Rand( 300, 600 ) ) + + end + + end + + self.LifeTime = CurTime() + 15 + +end + +function EFFECT:Think( ) + + return self.LifeTime > CurTime() + +end + +function EFFECT:Render() + + self.Entity:DrawModel() + +end + diff --git a/entities/effects/puke_explosion/init.lua b/entities/effects/puke_explosion/init.lua new file mode 100644 index 0000000..9a13226 --- /dev/null +++ b/entities/effects/puke_explosion/init.lua @@ -0,0 +1,119 @@ + +EFFECT.Color = Color(100,50,0) + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = 0 + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 10 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 300 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 ) + particle:SetGravity( Vector( 0, 0, -400 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random( 1, 2 ), pos + Vector( 0, 0, math.random( -10, 10 ) ) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "yellowblood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 10 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector( 0, 0, math.random( 0, 30 ) ) ) + + if i < 5 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + +end + +function EFFECT:Think() + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + 0.5 + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/puke_spray/init.lua b/entities/effects/puke_spray/init.lua new file mode 100644 index 0000000..b2d73ac --- /dev/null +++ b/entities/effects/puke_spray/init.lua @@ -0,0 +1,119 @@ + +EFFECT.Color = Color(100,50,0) + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = 0 + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 10 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 200 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "yellowblood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 5 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) ) + + if i < 3 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + +end + +function EFFECT:Think( ) + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + 0.5 + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/rad_explosion/init.lua b/entities/effects/rad_explosion/init.lua new file mode 100644 index 0000000..e888a2e --- /dev/null +++ b/entities/effects/rad_explosion/init.lua @@ -0,0 +1,55 @@ + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + Vector(0,0,40) + local emitter = ParticleEmitter( pos ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 20, 40 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 100, 200, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 20 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( vec * 300 ) + particle:SetDieTime( math.Rand( 2.5, 3.5 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 2, 4 ) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 100, 200, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + particle:SetCollide( true ) + particle:SetBounce( math.Rand( 0.1, 0.5 ) ) + + end + + emitter:Finish() + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/radiation/init.lua b/entities/effects/radiation/init.lua new file mode 100644 index 0000000..e9021c9 --- /dev/null +++ b/entities/effects/radiation/init.lua @@ -0,0 +1,70 @@ + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 5 + self.PartTime = 0 + self.Ent = data:GetEntity() + + if not IsValid( self.Ent ) then self.DieTime = 0 return end + + self.Emitter = ParticleEmitter( self.Ent:GetPos() ) + +end + +function EFFECT:Think() + + if IsValid( self.Ent ) then + + if self.Ent:IsPlayer() and ( !self.Ent:Alive() or self.Ent == LocalPlayer() ) then + + self.DieTime = 0 + + end + + end + + if self.DieTime < CurTime() or not IsValid( self.Ent ) then + + if self.Emitter then + + self.Emitter:Finish() + + end + + return false + + end + + if self.PartTime < CurTime() then + + self.PartTime = CurTime() + math.Rand( 0.2, 0.4 ) + + local pos = self.Ent:GetPos() + Vector(0,0,math.random(1,40)) + Vector(math.random(-10,10),math.random(-10,10),0) + + local particle = self.Emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( VectorRand() * 5 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 1, 3 ) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.random( -180, 180 ) ) + particle:SetColor( 100, 200, 0 ) + particle:SetGravity( Vector( 0, 0, -500 ) ) + + particle:SetCollide( true ) + particle:SetBounce( math.Rand( 0, 0.2 ) ) + + end + + return true + +end + +function EFFECT:Render() + +end + + + + diff --git a/entities/effects/smoke_crater/init.lua b/entities/effects/smoke_crater/init.lua new file mode 100644 index 0000000..68c713b --- /dev/null +++ b/entities/effects/smoke_crater/init.lua @@ -0,0 +1,52 @@ + + +function EFFECT:Init( data ) + + self.Pos = data:GetOrigin() + self.Magnitude = data:GetMagnitude() or 1 + + self.Emitter = ParticleEmitter( self.Pos ) + self.DieTime = CurTime() + 15 + self.Interval = 0 + +end + + +function EFFECT:Think( ) + + if self.Interval < CurTime() then + + self.Interval = CurTime() + 0.2 + + local particle = self.Emitter:Add( "particles/smokey", self.Pos + VectorRand() * 10 ) + + particle:SetVelocity( Vector( math.Rand(-3,3), math.Rand(-3,3), math.Rand(20,40) ) + WindVector ) + particle:SetDieTime( math.Rand( 10, 15 ) + self.Magnitude ) + particle:SetStartAlpha( math.random( 25, 50 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 5, 25 ) * self.Magnitude ) + particle:SetEndSize( math.Rand( 50, 200 ) * self.Magnitude ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local rand = math.random(10,50) + particle:SetColor( rand, rand, rand ) + + end + + if self.DieTime > CurTime() then + + return true + + else + + self.Emitter:Finish() + return false + + end + +end + +function EFFECT:Render() + +end |
