diff options
Diffstat (limited to 'entities')
128 files changed, 2653 insertions, 2721 deletions
diff --git a/entities/effects/barrel_gib/init.lua b/entities/effects/barrel_gib/init.lua index f635312..1c2008f 100644 --- a/entities/effects/barrel_gib/init.lua +++ b/entities/effects/barrel_gib/init.lua @@ -5,33 +5,33 @@ function EFFECT:Init( data ) 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() @@ -39,4 +39,3 @@ function EFFECT:Render() self.Entity:DrawModel() end - diff --git a/entities/effects/biohazard/init.lua b/entities/effects/biohazard/init.lua index 8af6357..ca80b2d 100644 --- a/entities/effects/biohazard/init.lua +++ b/entities/effects/biohazard/init.lua @@ -5,14 +5,14 @@ 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 ) @@ -23,14 +23,14 @@ function EFFECT:Init( data ) 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 ) ) @@ -41,14 +41,14 @@ function EFFECT:Init( data ) 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 ) @@ -59,37 +59,37 @@ function EFFECT:Init( data ) 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 index d433bce..586927e 100644 --- a/entities/effects/body_gib/init.lua +++ b/entities/effects/body_gib/init.lua @@ -4,13 +4,13 @@ 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 ) @@ -19,7 +19,7 @@ function EFFECT:Init( data ) 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 ) @@ -29,9 +29,9 @@ function EFFECT:Init( data ) 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 ) @@ -42,14 +42,14 @@ function EFFECT:Init( data ) 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 ) ) @@ -60,14 +60,14 @@ function EFFECT:Init( data ) 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 ) @@ -78,65 +78,64 @@ function EFFECT:Init( data ) 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 +end diff --git a/entities/effects/bomb_explosion/init.lua b/entities/effects/bomb_explosion/init.lua index 459c3bd..9078921 100644 --- a/entities/effects/bomb_explosion/init.lua +++ b/entities/effects/bomb_explosion/init.lua @@ -4,19 +4,19 @@ 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 ) @@ -24,19 +24,19 @@ function EFFECT:Init( data ) 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) ) @@ -48,9 +48,9 @@ function EFFECT:Init( data ) 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 ) @@ -58,32 +58,32 @@ function EFFECT:Init( data ) 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 @@ -92,17 +92,17 @@ function EFFECT:Init( data ) dlight.Decay = 2048 dlight.size = 2048 dlight.DieTime = CurTime() + 5 - + end - + self.Emitter:Finish() - + end function EFFECT:Think( ) - return self.DieTime > CurTime() - + return self.DieTime > CurTime() + end function EFFECT:Render() @@ -118,9 +118,9 @@ function CloudThink( part ) 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 ) ) @@ -129,10 +129,10 @@ function CloudThink( part ) 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 index bb676cc..55fe627 100644 --- a/entities/effects/c4_explosion/init.lua +++ b/entities/effects/c4_explosion/init.lua @@ -1,12 +1,12 @@ 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) ) ) @@ -17,11 +17,11 @@ function EFFECT:Init( data ) 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)) ) @@ -33,11 +33,11 @@ function EFFECT:Init( data ) 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)) ) @@ -48,12 +48,12 @@ function EFFECT:Init( data ) 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 ) - + 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)) @@ -66,18 +66,18 @@ function EFFECT:Init( data ) particle:SetColor(255, 220, 100) particle:SetGravity(Vector(0,0,-520)) //-600 is normal particle:SetCollide(true) - particle:SetBounce(0.45) - + 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 ) ) @@ -87,15 +87,15 @@ function EFFECT:Init( data ) 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 ) @@ -106,7 +106,7 @@ function EFFECT:Init( data ) 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 ) @@ -114,17 +114,17 @@ function EFFECT:Init( data ) 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 @@ -133,19 +133,19 @@ function EFFECT:Init( data ) 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 ) @@ -155,22 +155,22 @@ function CloudThink( part ) 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 index d959e8a..8077791 100644 --- a/entities/effects/energy_explosion/init.lua +++ b/entities/effects/energy_explosion/init.lua @@ -3,13 +3,13 @@ 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 ) ) @@ -19,14 +19,14 @@ function EFFECT:Init( data ) 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 ) @@ -39,16 +39,16 @@ function EFFECT:Init( data ) 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 ) @@ -60,23 +60,23 @@ function EFFECT:Init( data ) 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 index d51b1c3..f4fe339 100644 --- a/entities/effects/fire_explosion/init.lua +++ b/entities/effects/fire_explosion/init.lua @@ -3,11 +3,11 @@ 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 ) @@ -16,9 +16,9 @@ function EFFECT:Init( data ) 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 ) ) @@ -28,14 +28,14 @@ function EFFECT:Init( data ) 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 ) @@ -46,19 +46,19 @@ function EFFECT:Init( data ) 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 @@ -67,17 +67,17 @@ function EFFECT:Init( data ) 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 index 3f8842b..eef727a 100644 --- a/entities/effects/fire_tracer/init.lua +++ b/entities/effects/fire_tracer/init.lua @@ -7,24 +7,24 @@ 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 @@ -33,7 +33,7 @@ function EFFECT:Init( data ) dlight.Decay = 256 dlight.size = 256 * math.Rand( 0.5, 1.0 ) dlight.DieTime = CurTime() + 5 - + end end @@ -44,7 +44,7 @@ function EFFECT:Think( ) self.Alpha = self.Alpha - FrameTime() * 200 self.Color = Color( 250, 150, 50, self.Alpha ) - + return self.Alpha > 0 end @@ -52,36 +52,36 @@ 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)), + + 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 index e4406a1..66a8641 100644 --- a/entities/effects/gore_explosion/init.lua +++ b/entities/effects/gore_explosion/init.lua @@ -3,10 +3,10 @@ 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 ) @@ -15,7 +15,7 @@ function EFFECT:Init( data ) 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 ) @@ -25,9 +25,9 @@ function EFFECT:Init( data ) 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 ) @@ -38,14 +38,14 @@ function EFFECT:Init( data ) 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 ) ) @@ -56,14 +56,14 @@ function EFFECT:Init( data ) 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 ) @@ -74,56 +74,56 @@ function EFFECT:Init( data ) 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 index 8a36dd9..6258735 100644 --- a/entities/effects/head_gib/init.lua +++ b/entities/effects/head_gib/init.lua @@ -1,10 +1,10 @@ function EFFECT:Init( data ) - - local pos = data:GetOrigin() + + local pos = data:GetOrigin() local emitter = ParticleEmitter( pos ) - + local particle = emitter:Add( "effects/blood_core", pos ) particle:SetDieTime( 0.5 ) particle:SetStartAlpha( 255 ) @@ -13,7 +13,7 @@ function EFFECT:Init( data ) 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 ) @@ -23,9 +23,9 @@ function EFFECT:Init( data ) 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 ) @@ -36,11 +36,11 @@ function EFFECT:Init( data ) 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 ) @@ -51,41 +51,40 @@ function EFFECT:Init( data ) 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 +end diff --git a/entities/effects/headshot/init.lua b/entities/effects/headshot/init.lua index 7aadb41..1bc08c1 100644 --- a/entities/effects/headshot/init.lua +++ b/entities/effects/headshot/init.lua @@ -1,10 +1,10 @@ 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 ) @@ -13,7 +13,7 @@ function EFFECT:Init( data ) 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 ) ) @@ -22,9 +22,9 @@ function EFFECT:Init( data ) 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 ) @@ -35,32 +35,31 @@ function EFFECT:Init( data ) 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 +end diff --git a/entities/effects/immolate/init.lua b/entities/effects/immolate/init.lua index e6a7cc1..c562638 100644 --- a/entities/effects/immolate/init.lua +++ b/entities/effects/immolate/init.lua @@ -4,47 +4,47 @@ 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 ) ) @@ -55,13 +55,13 @@ function EFFECT:Think() 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 ) ) @@ -72,17 +72,13 @@ function EFFECT:Think() particle:SetRoll( 0 ) particle:SetColor( 50, 50, 50 ) particle:SetGravity( Vector( 0, 0, 30 ) ) - + end return true - -end -function EFFECT:Render() - end +function EFFECT:Render() - - +end diff --git a/entities/effects/player_gib/init.lua b/entities/effects/player_gib/init.lua index 2afcae0..62b5916 100644 --- a/entities/effects/player_gib/init.lua +++ b/entities/effects/player_gib/init.lua @@ -6,48 +6,48 @@ function EFFECT:Init( data ) if scale < 2 then self.Entity:SetModel( table.Random( GAMEMODE.SmallGibs ) ) else - self.Entity:SetModel( table.Random( GAMEMODE.BigGibs ) ) + 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() @@ -55,4 +55,3 @@ function EFFECT:Render() self.Entity:DrawModel() end - diff --git a/entities/effects/puke_explosion/init.lua b/entities/effects/puke_explosion/init.lua index 9a13226..afc00f6 100644 --- a/entities/effects/puke_explosion/init.lua +++ b/entities/effects/puke_explosion/init.lua @@ -5,12 +5,12 @@ 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 ) @@ -19,9 +19,9 @@ function EFFECT:Init( data ) 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 ) @@ -32,14 +32,14 @@ function EFFECT:Init( data ) 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 ) ) @@ -50,14 +50,14 @@ function EFFECT:Init( data ) 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 ) @@ -68,52 +68,52 @@ function EFFECT:Init( data ) 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 index b2d73ac..f7bb955 100644 --- a/entities/effects/puke_spray/init.lua +++ b/entities/effects/puke_spray/init.lua @@ -5,12 +5,12 @@ 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 ) @@ -19,9 +19,9 @@ function EFFECT:Init( data ) 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 ) @@ -32,14 +32,14 @@ function EFFECT:Init( data ) 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 ) ) @@ -50,14 +50,14 @@ function EFFECT:Init( data ) 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 ) @@ -68,52 +68,52 @@ function EFFECT:Init( data ) 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 index e888a2e..75e7ec5 100644 --- a/entities/effects/rad_explosion/init.lua +++ b/entities/effects/rad_explosion/init.lua @@ -1,11 +1,11 @@ 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 ) @@ -16,14 +16,14 @@ function EFFECT:Init( data ) 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 ) ) @@ -34,22 +34,22 @@ function EFFECT:Init( data ) 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 index e9021c9..5a4281e 100644 --- a/entities/effects/radiation/init.lua +++ b/entities/effects/radiation/init.lua @@ -4,43 +4,43 @@ 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 ) ) @@ -51,20 +51,16 @@ function EFFECT:Think() 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 +function EFFECT:Render() - - +end diff --git a/entities/effects/smoke_crater/init.lua b/entities/effects/smoke_crater/init.lua index 68c713b..e16d873 100644 --- a/entities/effects/smoke_crater/init.lua +++ b/entities/effects/smoke_crater/init.lua @@ -4,7 +4,7 @@ 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 @@ -15,9 +15,9 @@ 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 ) @@ -28,25 +28,25 @@ function EFFECT:Think( ) 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 ) + 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 diff --git a/entities/entities/info_npcspawn/init.lua b/entities/entities/info_npcspawn/init.lua index c7e915b..87746e9 100644 --- a/entities/entities/info_npcspawn/init.lua +++ b/entities/entities/info_npcspawn/init.lua @@ -8,7 +8,7 @@ function ENT:Initialize() self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:DrawShadow( false ) end diff --git a/entities/entities/npc_nb_common/shared.lua b/entities/entities/npc_nb_common/shared.lua index 8890529..2590783 100644 --- a/entities/entities/npc_nb_common/shared.lua +++ b/entities/entities/npc_nb_common/shared.lua @@ -16,8 +16,8 @@ ENT.BaseHealth = 90 ENT.MoveSpeed = 175 ENT.MoveAnim = ACT_RUN -ENT.Models = { Model( "models/zed/malezed_04.mdl" ), -Model( "models/zed/malezed_06.mdl" ), +ENT.Models = { Model( "models/zed/malezed_04.mdl" ), +Model( "models/zed/malezed_06.mdl" ), Model( "models/zed/malezed_08.mdl" ) } ENT.VoiceSounds = {} @@ -66,7 +66,7 @@ Sound( "nuke/redead/attack_8.wav" ), Sound( "nuke/redead/attack_9.wav" ), Sound( "nuke/redead/attack_10.wav" ) } -function ENT:OnDeath( dmginfo ) +function ENT:OnDeath( dmginfo ) end @@ -75,9 +75,9 @@ function ENT:OnHitEnemy( enemy ) enemy:TakeDamage( self.Damage, self.Entity ) enemy:SetInfected( true ) enemy:ViewBounce( 10 ) - + umsg.Start( "Drunk", enemy ) umsg.Short( 1 ) umsg.End() -end
\ No newline at end of file +end diff --git a/entities/entities/npc_nb_contagion/shared.lua b/entities/entities/npc_nb_contagion/shared.lua index 14d1503..5018518 100644 --- a/entities/entities/npc_nb_contagion/shared.lua +++ b/entities/entities/npc_nb_contagion/shared.lua @@ -16,7 +16,7 @@ ENT.MoveSpeed = 50 ENT.MoveAnim = ACT_WALK ENT.Models = nil -ENT.Model = Model( "models/zombie/classic.mdl" ) +ENT.Model = Model( "models/zombie/classic.mdl" ) ENT.VoiceSounds = {} @@ -55,34 +55,34 @@ Sound( "npc/zombie/zo_attack2.wav" ) } ENT.Torso = Model( "models/zombie/classic_torso.mdl" ) function ENT:OnDeath( dmginfo ) - + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do - + if v:GetPos():Distance( self.Entity:GetPos() ) < 150 then - + v:TakeDamage( 40, self.Entity ) v:SetInfected( true ) - + umsg.Start( "Drunk", v ) umsg.Short( 2 ) umsg.End() - + end - + end - + local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "puke_spray", ed, true, true ) - + if dmginfo:IsExplosionDamage() then - + local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "gore_explosion", ed, true, true ) - + end - + self.Entity:SpawnRagdoll( dmginfo, self.Torso, self.Entity:GetPos() + Vector(0,0,50), true ) self.Entity:SetModel( self.Legs ) @@ -97,4 +97,4 @@ function ENT:OnHitEnemy( enemy ) umsg.Short( 3 ) umsg.End() -end
\ No newline at end of file +end diff --git a/entities/entities/npc_nb_leaper/shared.lua b/entities/entities/npc_nb_leaper/shared.lua index 174fa0f..7d46821 100644 --- a/entities/entities/npc_nb_leaper/shared.lua +++ b/entities/entities/npc_nb_leaper/shared.lua @@ -17,7 +17,7 @@ ENT.JumpHeight = 300 ENT.MoveAnim = ACT_RUN ENT.Models = nil -ENT.Model = Model( "models/zombie/fast.mdl" ) +ENT.Model = Model( "models/zombie/fast.mdl" ) ENT.Legs = Model( "models/gibs/fast_zombie_legs.mdl" ) ENT.VoiceSounds = {} @@ -43,7 +43,7 @@ Sound( "npc/fast_zombie/leap1.wav" ) } ENT.Leap = Sound( "npc/fast_zombie/fz_scream1.wav" ) -function ENT:OnDeath( dmginfo ) +function ENT:OnDeath( dmginfo ) end @@ -52,7 +52,7 @@ function ENT:OnHitEnemy( enemy ) enemy:TakeDamage( self.Damage, self.Entity ) enemy:SetBleeding( true ) enemy:ViewBounce( 15 ) - + umsg.Start( "Drunk", enemy ) umsg.Short( 1 ) umsg.End() @@ -62,18 +62,18 @@ end function ENT:OnStuck() local ent = self.Entity:GetBreakable() - + if IsValid( ent ) then - + self.Obstructed = true - + else - + self.Obstructed = false self.Entity:DownTrace() - + end - + self.loco:ClearStuck() end @@ -81,16 +81,16 @@ end function ENT:DownTrace() local trace = {} - trace.start = self.Entity:GetPos() + trace.start = self.Entity:GetPos() trace.endpos = trace.start + Vector(0,0,-1000) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) - + if tr.Hit then - + self.Entity:SetPos( tr.HitPos + tr.HitNormal * 5 ) - + end end @@ -98,54 +98,54 @@ end function ENT:RunBehaviour() while true do - - self.Entity:StartActivity( self.MoveAnim ) + + self.Entity:StartActivity( self.MoveAnim ) self.loco:SetDesiredSpeed( self.MoveSpeed ) - + local enemy = self.Entity:FindEnemy() - + if not IsValid( enemy ) then - + self.Entity:MoveToPos( self.Entity:GetPos() + Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 0 ) * 500 ) - self.Entity:StartActivity( ACT_IDLE ) - + self.Entity:StartActivity( ACT_IDLE ) + else - + if self.Obstructed then - + self.Entity:BreakableRoutine() - + coroutine.yield() - + end - + local age = math.Clamp( math.min( enemy:GetPos():Distance( self.Entity:GetPos() ), 1000 ) / 1000, 0.2, 1 ) local opts = { draw = self.ShouldDrawPath, maxage = 3 * age, tolerance = self.MeleeDistance } - + if math.random(1,20) == 1 then - + self.loco:SetDesiredSpeed( math.random( 350, 700 ) ) self.loco:SetJumpHeight( math.random( 150, self.JumpHeight ) ) self.loco:Jump() - + self.Entity:SetVelocity( self.Entity:GetForward() * math.random( 350, 700 ) + Vector(0,0,200) ) self.Entity:EmitSound( self.Leap, 100, math.random(90,110) ) - + end - - self.Entity:MoveToPos( enemy:GetPos(), opts ) - - self.Entity:StartActivity( ACT_IDLE ) - + + self.Entity:MoveToPos( enemy:GetPos(), opts ) + + self.Entity:StartActivity( ACT_IDLE ) + self.Entity:BreakableRoutine() self.Entity:EnemyRoutine() - - self.Entity:StartActivity( ACT_IDLE ) - + + self.Entity:StartActivity( ACT_IDLE ) + end - + coroutine.yield() - + end - -end
\ No newline at end of file + +end diff --git a/entities/entities/npc_nb_poison/shared.lua b/entities/entities/npc_nb_poison/shared.lua index c4c67b3..10a4953 100644 --- a/entities/entities/npc_nb_poison/shared.lua +++ b/entities/entities/npc_nb_poison/shared.lua @@ -46,52 +46,52 @@ ENT.VoiceSounds.Attack = { Sound( "npc/zombie_poison/pz_throw2.wav" ), Sound( "npc/zombie_poison/pz_throw3.wav" ), Sound( "npc/zombie_poison/pz_alert2.wav" ) } -function ENT:OnDeath( dmginfo ) +function ENT:OnDeath( dmginfo ) end function ENT:OnThink() if self.EffectTime < CurTime() then - + self.EffectTime = CurTime() + 5 - + local ed = EffectData() ed:SetEntity( self.Entity ) util.Effect( "radiation", ed, true, true ) - + end for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do - + local dist = v:GetPos():Distance( self.Entity:GetPos() ) - + if dist < self.SoundRadius then - + if dist < self.Radius then - + if ( v.RadAddTime or 0 ) < CurTime() then - + v.RadAddTime = CurTime() + 8 v:AddRadiation( 1 ) - + end - + end - + if ( v.NextRadSound or 0 ) < CurTime() then - + local scale = math.Clamp( ( self.SoundRadius - dist ) / ( self.SoundRadius - self.Radius ), 0.1, 1.0 ) - - v.NextRadSound = CurTime() + 1 - scale + + v.NextRadSound = CurTime() + 1 - scale v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random( 80, 90 ) + scale * 20 ) v:NoticeOnce( "A radioactive zombie is nearby", GAMEMODE.Colors.Blue ) v:NoticeOnce( "Radioactive zombies will poison nearby people", GAMEMODE.Colors.Blue, 3, 2 ) - + end - + end - + end end @@ -101,21 +101,21 @@ function ENT:OnHitEnemy( enemy ) enemy:TakeDamage( self.Damage, self.Entity ) enemy:AddRadiation( 2 ) enemy:ViewBounce( 35 ) - + umsg.Start( "Drunk", enemy ) umsg.Short( 3 ) umsg.End() end -function ENT:OnDeath( dmginfo ) +function ENT:OnDeath( dmginfo ) - local ent = ents.Create( "sent_radiation" ) + local ent = ents.Create( "sent_radiation" ) ent:SetPos( self.Entity:GetPos() ) ent:Spawn() - + local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "rad_explosion", ed, true, true ) -end
\ No newline at end of file +end diff --git a/entities/entities/point_evac/cl_init.lua b/entities/entities/point_evac/cl_init.lua index c069cf8..a60aed9 100644 --- a/entities/entities/point_evac/cl_init.lua +++ b/entities/entities/point_evac/cl_init.lua @@ -14,6 +14,5 @@ function ENT:OnRemove() end function ENT:Draw() - -end +end diff --git a/entities/entities/point_evac/init.lua b/entities/entities/point_evac/init.lua index 040bf87..c413c9c 100644 --- a/entities/entities/point_evac/init.lua +++ b/entities/entities/point_evac/init.lua @@ -8,67 +8,67 @@ ENT.Heli = Sound( "ambient/machines/heli_pass2.wav" ) ENT.EvacDist = 400 function ENT:Initialize() - + self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_NONE ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER ) self.Entity:SetTrigger( true ) self.Entity:SetNotSolid( true ) - self.Entity:DrawShadow( false ) - + self.Entity:DrawShadow( false ) + self.Entity:SetCollisionBounds( Vector( -150, -150, -150 ), Vector( 150, 150, 150 ) ) self.Entity:PhysicsInitBox( Vector( -150, -150, -150 ), Vector( 150, 150, 150 ) ) - + self.DieTime = CurTime() + 44 self.SoundTime = CurTime() + 43 - + self.Players = {} - + local flare = ents.Create( "sent_heliflare" ) flare:SetPos( self.Entity:GetPos() ) flare:Spawn() - + self.Entity:EmitSound( self.Heli, 150 ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,10) trace.endpos = trace.start + Vector(0,0,800) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) - + if tr.HitPos:Distance( self.Entity:GetPos() ) < 400 then return end - + local heli = ents.Create( "prop_dynamic" ) heli:SetModel( "models/combine_helicopter.mdl" ) heli:SetPos( tr.HitPos + Vector(0,0,-150) ) heli:Spawn() heli:Fire( "SetAnimation", "idle", 1 ) - + end function ENT:Think() if self.SoundTime and self.SoundTime < CurTime() then - + self.Entity:EmitSound( self.Heli, 150 ) - + self.SoundTime = nil - + end if self.DieTime < CurTime() then - + self.Entity:Evac() self.Entity:Remove() - + for k,v in pairs( team.GetPlayers( TEAM_ZOMBIES ) ) do - + v:Notice( "The chopper has left the evac zone", GAMEMODE.Colors.White, 5 ) - + end - + end end @@ -76,42 +76,42 @@ end function ENT:Evac() for k,v in pairs( self.Players ) do - + if IsValid( v ) and v:Alive() and v:Team() == TEAM_ARMY and v:GetPos():Distance( self.Entity:GetPos() ) < self.EvacDist then - + v:Evac() - + end - + end end -function ENT:Touch( ent ) +function ENT:Touch( ent ) if not ent:IsPlayer() then return end - + if ent:Team() != TEAM_ARMY then return end - + if table.HasValue( self.Players, ent ) then return end - + table.insert( self.Players, ent ) - + if not self.FirstEvac then - + self.FirstEvac = true - + ent:AddStat( "Evac" ) - + end - + ent:Notice( "You made it to the evac zone", GAMEMODE.Colors.Green, 5 ) ent:Notice( "The helicopter will take off shortly", GAMEMODE.Colors.Blue, 5, 2 ) - -end + +end function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS + return TRANSMIT_ALWAYS end diff --git a/entities/entities/point_evac/shared.lua b/entities/entities/point_evac/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/point_evac/shared.lua +++ b/entities/entities/point_evac/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/point_radiation/init.lua b/entities/entities/point_radiation/init.lua index 7821c2d..e2b3f16 100644 --- a/entities/entities/point_radiation/init.lua +++ b/entities/entities/point_radiation/init.lua @@ -3,12 +3,12 @@ ENT.Type = "point" ENT.Base = "base_point" function ENT:Initialize() - + self.Active = true self.Radius = 400 self.SoundRadius = 800 self.Pos = self.Entity:GetPos() - + end function ENT:SetArtifact( ent ) @@ -38,15 +38,15 @@ end function ENT:KeyValue( key, value ) if key == "radius" then - + self.Radius = math.Clamp( tonumber( value ), 100, 5000 ) self.SoundRadius = self.Radius * 1.4 - + elseif key == "randomradius" then - + self.Radius = math.random( 100, math.Clamp( tonumber( value ), 500, 5000 ) ) self.SoundRadius = self.Radius * 1.4 - + end end @@ -60,35 +60,35 @@ end function ENT:Think() if not self.Active then return end - + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do - + local dist = v:GetPos():Distance( self.Pos ) - + if dist < self.SoundRadius then - + if dist < self.Radius then - + if ( v.RadAddTime or 0 ) < CurTime() then - + v.RadAddTime = CurTime() + 10 v:AddRadiation( 1 ) - + end - + end - + if ( v.NextRadSound or 0 ) < CurTime() then - + local scale = math.Clamp( ( self.SoundRadius - dist ) / ( self.SoundRadius - self.Radius ), 0.1, 1.0 ) - - v.NextRadSound = CurTime() + 1 - scale + + v.NextRadSound = CurTime() + 1 - scale v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random( 80, 90 ) + scale * 20 ) - + end - + end - + end - + end diff --git a/entities/entities/point_stash/cl_init.lua b/entities/entities/point_stash/cl_init.lua index e978063..b82b4fa 100644 --- a/entities/entities/point_stash/cl_init.lua +++ b/entities/entities/point_stash/cl_init.lua @@ -6,6 +6,5 @@ function ENT:Initialize() end function ENT:Draw() - -end +end diff --git a/entities/entities/point_stash/init.lua b/entities/entities/point_stash/init.lua index 94fcc43..99e7c6f 100644 --- a/entities/entities/point_stash/init.lua +++ b/entities/entities/point_stash/init.lua @@ -6,35 +6,35 @@ include( 'shared.lua' ) function ENT:Initialize() self.Entity:SetModel( "models/Roller.mdl" ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + self.Entity:DrawShadow( false ) - + self.Cash = 0 self.LastUse = 0 self.LastThink = 0 self.Items = {} - + self.ItemTbl = { ITEM_FOOD, ITEM_FOOD, ITEM_FOOD, ITEM_FOOD, ITEM_FOOD, ITEM_SUPPLY, ITEM_SUPPLY, ITEM_MISC, ITEM_MISC, ITEM_LOOT, ITEM_LOOT, ITEM_AMMO, ITEM_AMMO, ITEM_EXODUS, ITEM_WPN_COMMON } - + for i=1, math.random(2,5) do - + local rand = item.RandomItem( table.Random( self.ItemTbl ) ) - + self.Entity:AddItem( rand.ID ) - + end end function ENT:SetCash( amt ) - self.Cash = math.Clamp( amt, 0, 32000 ) + self.Cash = math.Clamp( amt, 0, 32000 ) end @@ -44,59 +44,59 @@ function ENT:GetCash() end -function ENT:Think() - +function ENT:Think() + if not IsValid( self.Entity:GetUser() ) then return end - + if not self.Entity:GetUser():Alive() then - + self.Entity:SetUser() - + end - + if self.LastThink < CurTime() then - + self.LastThink = CurTime() + ( 10 * 60 ) - + if #self.Entity:GetItems() < 1 then - + for i=1, math.random(2,5) do - + local rand = item.RandomItem( table.Random( self.ItemTbl ) ) - + self.Entity:AddItem( rand.ID ) - + end - + end - + end - -end + +end function ENT:GetUser() return self.User - + end function ENT:SetUser( ply ) self.User = ply - + end function ENT:OnExit( ply ) if ( self.LastUse or 0 ) > CurTime() then return end - + self.LastUse = CurTime() + 1.0 - + if IsValid( self.Entity:GetUser() ) then - + self.Entity:SetUser() ply:ToggleStashMenu( self.Entity, false, "StashMenu" ) - + end end @@ -104,18 +104,18 @@ end function ENT:OnUsed( ply ) if ( self.LastUse or 0 ) > CurTime() then return end - + self.LastUse = CurTime() + 1.0 if IsValid( self.Entity:GetUser() ) and self.Entity:GetUser() != ply then return end - + if not IsValid( self.Entity:GetUser() ) then - + ply:SynchCash( self.Cash ) - + self.Entity:SetUser( ply ) ply:ToggleStashMenu( self.Entity, true, "StashMenu" ) - + end end @@ -127,7 +127,7 @@ end function ENT:GetItems() return self.Items - + end function ENT:AddItem( id ) @@ -135,7 +135,7 @@ function ENT:AddItem( id ) self.Items = self.Items or {} table.insert( self.Items, id ) - + self.Entity:Synch() end @@ -143,17 +143,17 @@ end function ENT:RemoveItem( id ) for k,v in pairs( self.Items ) do - + if v == id then - + self.Entity:Synch() - + table.remove( self.Items, k ) - + return - + end - + end end @@ -161,10 +161,9 @@ end function ENT:Synch() if IsValid( self.Entity:GetUser() ) then - + self.Entity:GetUser():SynchStash( self.Entity ) - + end end - diff --git a/entities/entities/point_stash/shared.lua b/entities/entities/point_stash/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/point_stash/shared.lua +++ b/entities/entities/point_stash/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_antidote/cl_init.lua b/entities/entities/sent_antidote/cl_init.lua index 88a116a..7d6f889 100644 --- a/entities/entities/sent_antidote/cl_init.lua +++ b/entities/entities/sent_antidote/cl_init.lua @@ -8,7 +8,7 @@ function ENT:Initialize() end function ENT:Think() - + end local matLight = Material( "toxsin/allyvision" ) @@ -16,29 +16,29 @@ local matLight = Material( "toxsin/allyvision" ) function ENT:Draw() self.Entity:DrawModel() - + end - + --[[local scale = ( math.Clamp( self.Entity:GetPos():Distance( LocalPlayer():GetPos() ), 500, 3000 ) - 500 ) / 2500 - + local eyenorm = self.Entity:GetPos() - EyePos() local dist = eyenorm:Length() eyenorm:Normalize() - + local pos = EyePos() + eyenorm * dist * 0.01 - + cam.Start3D( pos, EyeAngles() ) - + render.SetColorModulation( 0, 1.0, 0.5 ) render.SetBlend( scale ) render.MaterialOverride( matLight ) - + self.Entity:DrawModel() - + render.SetColorModulation( 1, 1, 1 ) render.SetBlend( 1 ) render.MaterialOverride( 0 ) - + cam.End3D() - -end]]
\ No newline at end of file + +end]] diff --git a/entities/entities/sent_antidote/init.lua b/entities/entities/sent_antidote/init.lua index 8fc742d..62ba1ad 100644 --- a/entities/entities/sent_antidote/init.lua +++ b/entities/entities/sent_antidote/init.lua @@ -7,32 +7,32 @@ ENT.Cure = Sound( "ItemBattery.Touch" ) ENT.Model = Model( "models/Items/item_item_crate.mdl" ) function ENT:Initialize() - + self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() end - + self.Entity:SetColor( Color( 150, 255, 200, 255 ) ) - + self.CureCount = math.max( team.NumPlayers( TEAM_ARMY ) / 2, 1 ) end -function ENT:Think() - -end +function ENT:Think() + +end function ENT:SetOverride() @@ -57,30 +57,30 @@ function ENT:Use( ply, caller ) if self.Removing then return end if ply:IsInfected() then - + ply:SetInfected( false ) ply:AddStamina( 20 ) ply:EmitSound( self.Cure ) ply:Notice( "Your infection has been cured", GAMEMODE.Colors.Green ) if not self.Override then - + self.CureCount = self.CureCount - 1 - + end - + end - + if self.CureCount < 1 then - + self.Entity:Remove() - + end end function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS + return TRANSMIT_ALWAYS end diff --git a/entities/entities/sent_antidote/shared.lua b/entities/entities/sent_antidote/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_antidote/shared.lua +++ b/entities/entities/sent_antidote/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_barrel_biohazard/cl_init.lua b/entities/entities/sent_barrel_biohazard/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_barrel_biohazard/cl_init.lua +++ b/entities/entities/sent_barrel_biohazard/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_barrel_biohazard/init.lua b/entities/entities/sent_barrel_biohazard/init.lua index b776619..f7bcf1a 100644 --- a/entities/entities/sent_barrel_biohazard/init.lua +++ b/entities/entities/sent_barrel_biohazard/init.lua @@ -16,21 +16,21 @@ function ENT:Initialize() self.Entity:SetModel( self.Model ) self.Entity:SetSkin( skin ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + //self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() - + end - + end function ENT:SetSpeed( num ) @@ -46,66 +46,66 @@ end function ENT:Explode() if self.Exploded then return end - + self.Exploded = true local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true ) - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do - + if v:GetPos():Distance( self.Entity:GetPos() ) < 200 and not v:IsInfected() and v:Alive() then - + v:SetInfected( true ) - + end - + end - + for i=1, math.random( 2, 4 ) do - + local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "barrel_gib", ed, true, true ) - + end - + local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "biohazard", ed, true, true ) - + self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) ) self.Entity:Remove() end function ENT:Use( ply, caller ) - + ply:AddToInventory( self.Entity ) end @@ -117,21 +117,20 @@ end function ENT:OnTakeDamage( dmginfo ) if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then - + self.Entity:SetOwner( dmginfo:GetAttacker() ) self.Entity:Explode() - + end - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound ) - + end - -end +end diff --git a/entities/entities/sent_barrel_biohazard/shared.lua b/entities/entities/sent_barrel_biohazard/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_barrel_biohazard/shared.lua +++ b/entities/entities/sent_barrel_biohazard/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_barrel_radioactive/cl_init.lua b/entities/entities/sent_barrel_radioactive/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_barrel_radioactive/cl_init.lua +++ b/entities/entities/sent_barrel_radioactive/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_barrel_radioactive/init.lua b/entities/entities/sent_barrel_radioactive/init.lua index ef2fcd0..ba55d36 100644 --- a/entities/entities/sent_barrel_radioactive/init.lua +++ b/entities/entities/sent_barrel_radioactive/init.lua @@ -16,21 +16,21 @@ function ENT:Initialize() self.Entity:SetModel( self.Model ) self.Entity:SetSkin( skin ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + //self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() - + end - + end function ENT:SetSpeed( num ) @@ -46,60 +46,60 @@ end function ENT:Explode() if self.Exploded then return end - + self.Exploded = true local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true ) - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + for i=1, math.random( 2, 4 ) do - + local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "barrel_gib", ed, true, true ) - + end - + local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "rad_explosion", ed, true, true ) - - local ent = ents.Create( "sent_radiation" ) + + local ent = ents.Create( "sent_radiation" ) ent:SetPos( self.Entity:GetPos() ) ent:Spawn() - + self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) ) self.Entity:Remove() end function ENT:Use( ply, caller ) - + ply:AddToInventory( self.Entity ) end @@ -111,21 +111,20 @@ end function ENT:OnTakeDamage( dmginfo ) if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then - + self.Entity:SetOwner( dmginfo:GetAttacker() ) self.Entity:Explode() - + end - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound ) - + end - -end +end diff --git a/entities/entities/sent_barrel_radioactive/shared.lua b/entities/entities/sent_barrel_radioactive/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_barrel_radioactive/shared.lua +++ b/entities/entities/sent_barrel_radioactive/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_bonuscrate/cl_init.lua b/entities/entities/sent_bonuscrate/cl_init.lua index f1cad0f..fa2c2a9 100644 --- a/entities/entities/sent_bonuscrate/cl_init.lua +++ b/entities/entities/sent_bonuscrate/cl_init.lua @@ -8,6 +8,5 @@ end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_bonuscrate/init.lua b/entities/entities/sent_bonuscrate/init.lua index 3817a61..fd61688 100644 --- a/entities/entities/sent_bonuscrate/init.lua +++ b/entities/entities/sent_bonuscrate/init.lua @@ -8,19 +8,19 @@ ENT.Open = Sound( "Wood.Strain" ) ENT.Model = Model( "models/items/ammocrate_smg1.mdl" ) function ENT:Initialize() - + self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() phys:SetDamping( 0, 200 ) @@ -29,33 +29,33 @@ function ENT:Initialize() self.Removing = false self.Contents = { 1 } self.Users = {} - self.Uses = math.random( 1, 5 ) + self.Uses = math.random( 1, 5 ) end -function ENT:Think() - -end +function ENT:Think() + +end function ENT:GenerateContents() self.Contents = {} - + local tbl = { ITEM_WPN_COMMON, ITEM_AMMO, ITEM_AMMO } - + if math.random( 1, 50 ) == 1 then - + tbl = { ITEM_WPN_SPECIAL, ITEM_AMMO, ITEM_AMMO } - + end for k,v in pairs( tbl ) do - + local tbl = item.RandomItem( v ) local id = tbl.ID - + table.insert( self.Contents, id ) - + end end @@ -72,15 +72,15 @@ function ENT:Use( ply, caller ) self.Entity:EmitSound( self.Open ) self.Entity:GenerateContents() - + ply:AddMultipleToInventory( self.Contents ) - + table.insert( self.Users, ply ) - - if table.Count( self.Users ) == self.Uses then + + if table.Count( self.Users ) == self.Uses then self.Entity:Remove() - + end end @@ -88,10 +88,9 @@ end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.Bang ) - + end - -end +end diff --git a/entities/entities/sent_bonuscrate/shared.lua b/entities/entities/sent_bonuscrate/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_bonuscrate/shared.lua +++ b/entities/entities/sent_bonuscrate/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_c4/cl_init.lua b/entities/entities/sent_c4/cl_init.lua index 1821218..daa3d14 100644 --- a/entities/entities/sent_c4/cl_init.lua +++ b/entities/entities/sent_c4/cl_init.lua @@ -4,7 +4,7 @@ function ENT:Initialize() self.Light = Material( "sprites/light_glow02_add" ) self.Beep = CurTime() + 1 - + end function ENT:OnRemove() @@ -14,23 +14,22 @@ end function ENT:Think() if self.Beep < CurTime() then - + self.Beep = CurTime() + 1 - + end - + end function ENT:Draw() self.Entity:DrawModel() - + if self.Beep <= ( CurTime() + 0.1 ) then - + render.SetMaterial( self.Light ) render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * -5, 6, 6, Color( 255, 0, 0 ) ) - + end - -end +end diff --git a/entities/entities/sent_c4/init.lua b/entities/entities/sent_c4/init.lua index 3410fca..56d6548 100644 --- a/entities/entities/sent_c4/init.lua +++ b/entities/entities/sent_c4/init.lua @@ -13,25 +13,25 @@ ENT.Radius = 600 function ENT:Initialize() self.Entity:SetModel( Model( "models/weapons/w_c4.mdl" ) ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) self.Entity:DrawShadow( false ) - + self.Delay = CurTime() + 10 self.Beep = CurTime() + 1 - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() - + end - + end function ENT:SetSpeed( num ) @@ -43,19 +43,19 @@ end function ENT:Think() if self.Delay < CurTime() then - + self.Entity:Explode() - + end if self.Beep < CurTime() then - + self.Beep = CurTime() + 1 - + self.Entity:EmitSound( self.BeepSound, 100, 120 ) - + end - + end function ENT:Explode() @@ -67,41 +67,41 @@ function ENT:Explode() local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "c4_explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 1.2 ) util.Effect( "smoke_crater", ed, true, true ) - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end - + if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + for k,v in pairs( player.GetAll() ) do - + if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then - + v:SetBleeding( true ) - + end - + end - + self.Entity:Remove() end @@ -111,10 +111,9 @@ function ENT:OnRemove() end function ENT:OnTakeDamage( dmginfo ) - + end function ENT:PhysicsCollide( data, phys ) - -end +end diff --git a/entities/entities/sent_c4/shared.lua b/entities/entities/sent_c4/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_c4/shared.lua +++ b/entities/entities/sent_c4/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_cash/cl_init.lua b/entities/entities/sent_cash/cl_init.lua index d0fb196..ccd47eb 100644 --- a/entities/entities/sent_cash/cl_init.lua +++ b/entities/entities/sent_cash/cl_init.lua @@ -6,13 +6,12 @@ function ENT:Initialize() end function ENT:Think() - + end function ENT:Draw() //self.Entity:SetModelScale( Vector(1,1,1) + Vector(1,1,1) * math.sin( CurTime() * 3 ) * 0.1 ) self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_cash/init.lua b/entities/entities/sent_cash/init.lua index 1adb29e..eeb88fc 100644 --- a/entities/entities/sent_cash/init.lua +++ b/entities/entities/sent_cash/init.lua @@ -4,69 +4,69 @@ AddCSLuaFile( "shared.lua" ) include( 'shared.lua' ) function ENT:Initialize() - + self.Entity:SetModel( Model( "models/props/cs_assault/money.mdl" ) ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() end - + self.Cash = 0 self.NPCThink = 0 self.RemoveTime = CurTime() + 10 * 60 end -function ENT:Think() +function ENT:Think() if self.NPCThink < CurTime() then - + self.NPCThink = CurTime() + 10 - + for k,v in pairs( ents.FindByClass( "npc_trader*" ) ) do - + if v:GetPos():Distance( self.Entity:GetPos() ) < 50 then - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:ApplyForceCenter( ( self.Entity:GetPos() - v:GetPos() ):Normalize() * phys:GetMass() * 100 ) - + return - + end - + end - + end - + if self.RemoveTime < CurTime() then - + self.Entity:Remove() - + end - + end - -end + +end function ENT:SetCash( amt ) self.Cash = amt - + self.Entity:SetNWInt( "Cash", amt ) - + end function ENT:GetCash() @@ -76,9 +76,9 @@ function ENT:GetCash() end function ENT:Use( ply, caller ) - + ply:AddCash( self.Cash ) - + self.Entity:Remove() end diff --git a/entities/entities/sent_cash/shared.lua b/entities/entities/sent_cash/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_cash/shared.lua +++ b/entities/entities/sent_cash/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_dropflare/cl_init.lua b/entities/entities/sent_dropflare/cl_init.lua index 3ff2828..0ed93cc 100644 --- a/entities/entities/sent_dropflare/cl_init.lua +++ b/entities/entities/sent_dropflare/cl_init.lua @@ -2,17 +2,17 @@ include('shared.lua') function ENT:Initialize() - self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) self.Smoke = 0 - + end function ENT:OnRemove() if self.Emitter then - + self.Emitter:Finish() - + end end @@ -20,11 +20,11 @@ end function ENT:Think() if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end - + if self.Smoke < CurTime() then - + self.Smoke = CurTime() + 0.2 - + local particle = self.Emitter:Add( "particles/smokey", self.Entity:GetPos() + self.Entity:GetRight() * 5 ) particle:SetVelocity( VectorRand() * 5 + WindVector + Vector(0,0,10) ) particle:SetDieTime( math.Rand( 2.5, 5.0 ) ) @@ -33,16 +33,16 @@ function ENT:Think() particle:SetStartSize( math.random( 3, 6 ) ) particle:SetEndSize( math.random( 25, 50 ) ) particle:SetGravity( Vector( 0, 0, 10 ) ) - + local col = math.random( 100, 150 ) particle:SetColor( col, col + 50, col ) - + end - + local dlight = DynamicLight( self.Entity:EntIndex() ) - + if dlight then - + dlight.Pos = self.Entity:GetPos() dlight.r = 50 dlight.g = 255 @@ -51,9 +51,9 @@ function ENT:Think() dlight.Decay = 2048 dlight.size = 256 * math.Rand( 0.5, 1.0 ) dlight.DieTime = CurTime() + 1 - + end - + end local matFlare = Material( "effects/blueflare1" ) @@ -63,11 +63,10 @@ function ENT:Draw() self.Entity:DrawModel() if self.Entity:GetNWFloat( "BurnDelay", CurTime() + 1 ) > CurTime() then return end - + local size = math.Rand( 5, 25 ) - + render.SetMaterial( matFlare ) - render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 50, 255, 50, 255 ) ) - -end + render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 50, 255, 50, 255 ) ) +end diff --git a/entities/entities/sent_dropflare/init.lua b/entities/entities/sent_dropflare/init.lua index b806886..a9ff1a2 100644 --- a/entities/entities/sent_dropflare/init.lua +++ b/entities/entities/sent_dropflare/init.lua @@ -9,29 +9,29 @@ ENT.Explode = Sound( "weapons/flashbang/flashbang_explode1.wav" ) function ENT:Initialize() self.Entity:SetModel( Model( "models/props_c17/trappropeller_lever.mdl" ) ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) self.Entity:DrawShadow( false ) - + self.Entity:SetNWFloat( "BurnDelay", CurTime() + 3 ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() phys:SetDamping( 0, 10 ) - + end - + self.DieTime = CurTime() + 15 - + self.Entity:EmitSound( "Weapon_SMG1.Special1", 100, 80 ) - + end function ENT:SetDieTime( t ) @@ -43,21 +43,21 @@ end function ENT:Think() if self.Entity:GetNWFloat( "BurnDelay", 0 ) < CurTime() then - + if not self.Burning then - + self.Burning = true self.Entity:EmitSound( self.Burn ) self.Entity:EmitSound( self.Explode, 100, math.random(90,110) ) - + end - + end - + if self.DieTime < CurTime() then - + self.Entity:Remove() - + end end @@ -69,16 +69,15 @@ function ENT:OnRemove() end function ENT:OnTakeDamage( dmginfo ) - + end function ENT:PhysicsCollide( data, phys ) - + end function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS + return TRANSMIT_ALWAYS end - diff --git a/entities/entities/sent_dropflare/shared.lua b/entities/entities/sent_dropflare/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_dropflare/shared.lua +++ b/entities/entities/sent_dropflare/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_droppedgun/cl_init.lua b/entities/entities/sent_droppedgun/cl_init.lua index f1cad0f..fa2c2a9 100644 --- a/entities/entities/sent_droppedgun/cl_init.lua +++ b/entities/entities/sent_droppedgun/cl_init.lua @@ -8,6 +8,5 @@ end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_droppedgun/init.lua b/entities/entities/sent_droppedgun/init.lua index 20d6571..9d8a1ec 100644 --- a/entities/entities/sent_droppedgun/init.lua +++ b/entities/entities/sent_droppedgun/init.lua @@ -4,46 +4,46 @@ AddCSLuaFile( "shared.lua" ) include( 'shared.lua' ) function ENT:Initialize() - + if string.find( self.Entity:GetModel(), "hammer" ) or string.find( self.Entity:GetModel(), "axe" ) then local model = self.Entity:GetModel() - + self.Entity:SetModel( "models/props_canal/mattpipe.mdl" ) self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetModel( model ) - + //self.Entity:PhysicsInitBox( Vector(-5,-5,-5), Vector(5,5,5) ) else - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) - + end - + self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() end end -function ENT:Think() - -end +function ENT:Think() + +end function ENT:Use( ply, caller ) if ply:Team() != TEAM_ARMY then return end - + ply:AddToInventory( self.Entity ) end diff --git a/entities/entities/sent_droppedgun/shared.lua b/entities/entities/sent_droppedgun/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_droppedgun/shared.lua +++ b/entities/entities/sent_droppedgun/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_fire/cl_init.lua b/entities/entities/sent_fire/cl_init.lua index fb83991..a99621b 100644 --- a/entities/entities/sent_fire/cl_init.lua +++ b/entities/entities/sent_fire/cl_init.lua @@ -4,10 +4,10 @@ include('shared.lua') function ENT:Initialize() self.Emitter = ParticleEmitter( self.Entity:GetPos() ) - + self.SmokeTime = 0 self.LightTime = 0 - + self.Entity:DoTraces() end @@ -15,28 +15,28 @@ end function ENT:DoTraces() if self.Entity:GetPos() == Vector(0,0,0) then return end - + self.PosTbl = {} for i=-30,30 do - + for j=-30,30 do - + local trace = {} trace.start = self.Entity:GetPos() + Vector( i * 2, j * 2, 10 ) trace.endpos = trace.start + Vector(0,0,200) - + local tr = util.TraceLine( trace ) - + trace.start = tr.HitPos trace.endpos = trace.start + Vector( 0, 0, -2000 ) - + local tr2 = util.TraceLine( trace ) - + table.insert( self.PosTbl, { Pos = tr2.HitPos, Scale = ( ( 30 - math.abs( i ) ) + ( 30 - math.abs( j ) ) ) / 60 } ) - + end - + end end @@ -44,15 +44,15 @@ end function ENT:Think() if not self.PosTbl then - + self.Entity:DoTraces() - + if not self.PosTbl then return end - + end local tbl = table.Random( self.PosTbl ) - + local particle = self.Emitter:Add( "effects/muzzleflash" .. math.random(1,4), tbl.Pos + ( VectorRand() * 2 ) ) particle:SetVelocity( Vector(0,0,80) ) particle:SetDieTime( math.Rand( 0.2, 0.4 ) + math.Rand( 0.3, 0.6 ) * tbl.Scale ) @@ -63,11 +63,11 @@ function ENT:Think() particle:SetRoll( math.random(-180,180) ) particle:SetColor( 255, 200, 200 ) particle:SetGravity( Vector( 0, 0, 400 + ( tbl.Scale * 100 ) ) ) - + if self.SmokeTime < CurTime() then - + self.SmokeTime = CurTime() + 0.02 - + local particle = self.Emitter:Add( "particles/smokey", tbl.Pos + ( VectorRand() * 2 ) + Vector(0,0,50) ) particle:SetVelocity( Vector( 0, 0, 30 + tbl.Scale * 10 ) ) particle:SetDieTime( math.Rand( 0.5, 1.0 ) + ( tbl.Scale * math.Rand( 2.5, 3.5 ) ) ) @@ -78,17 +78,17 @@ function ENT:Think() particle:SetRoll( 0 ) particle:SetColor( 10, 10, 10 ) particle:SetGravity( Vector( 0, 0, 30 ) ) - + end - + if self.LightTime < CurTime() then - + self.LightTime = CurTime() + 0.05 - + local dlight = DynamicLight( self.Entity:EntIndex() ) - + if dlight then - + dlight.Pos = self.Entity:GetPos() dlight.r = 255 dlight.g = 120 @@ -97,9 +97,9 @@ function ENT:Think() dlight.Decay = 2048 dlight.size = 256 * math.Rand( 0.8, 1.2 ) dlight.DieTime = CurTime() + 1 - + end - + end end @@ -107,14 +107,13 @@ end function ENT:OnRemove() if self.Emitter then - + self.Emitter:Finish() - + end end function ENT:Draw() - -end +end diff --git a/entities/entities/sent_fire/init.lua b/entities/entities/sent_fire/init.lua index d643ada..2be7870 100644 --- a/entities/entities/sent_fire/init.lua +++ b/entities/entities/sent_fire/init.lua @@ -8,22 +8,22 @@ ENT.LifeTime = 10 ENT.Explosives = { "sent_oxygen", "sent_propane_canister", "sent_propane_tank", "sent_fuel_diesel", "sent_fuel_gas" } function ENT:Initialize() - + self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_NONE ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER ) self.Entity:SetTrigger( true ) self.Entity:SetNotSolid( true ) - self.Entity:DrawShadow( false ) - + self.Entity:DrawShadow( false ) + self.Entity:SetCollisionBounds( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) ) self.Entity:PhysicsInitBox( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) ) - + self.DieTime = CurTime() + self.LifeTime - + self.Entity:EmitSound( self.BurnSound ) - + end function ENT:SetLifeTime( num ) @@ -41,34 +41,34 @@ end function ENT:Think() if self.DieTime < CurTime() then - + self.Entity:Remove() - + end end -function ENT:Touch( ent ) +function ENT:Touch( ent ) if not IsValid( self.Entity:GetOwner() ) then return end - + //if ent:IsPlayer() and ent:Team() == self.Entity:GetOwner():Team() then return end - + if table.HasValue( self.Explosives, ent:GetClass() ) then - + ent:SetOwner( self.Entity:GetOwner() ) ent:Explode() - + end - + if not ent.NextBot and not ent:IsPlayer() then return end - + ent:DoIgnite( self.Entity:GetOwner() ) - -end + +end function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS + return TRANSMIT_ALWAYS end diff --git a/entities/entities/sent_fire/shared.lua b/entities/entities/sent_fire/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_fire/shared.lua +++ b/entities/entities/sent_fire/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_flare/cl_init.lua b/entities/entities/sent_flare/cl_init.lua index d6bf3a4..44a985c 100644 --- a/entities/entities/sent_flare/cl_init.lua +++ b/entities/entities/sent_flare/cl_init.lua @@ -2,17 +2,17 @@ include('shared.lua') function ENT:Initialize() - self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) self.Smoke = 0 - + end function ENT:OnRemove() if self.Emitter then - + self.Emitter:Finish() - + end end @@ -20,11 +20,11 @@ end function ENT:Think() if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end - + if self.Smoke < CurTime() then - + self.Smoke = CurTime() + 0.2 - + local particle = self.Emitter:Add( "particles/smokey", self.Entity:GetPos() + self.Entity:GetRight() * 5 ) particle:SetVelocity( VectorRand() * 5 + WindVector ) particle:SetDieTime( math.Rand( 2.5, 4.5 ) ) @@ -33,16 +33,16 @@ function ENT:Think() particle:SetStartSize( math.random( 2, 4 ) ) particle:SetEndSize( math.random( 15, 30 ) ) particle:SetGravity( Vector( 0, 0, 10 ) ) - + local col = math.random( 100, 150 ) particle:SetColor( col + 50, col, col ) - + end - + local dlight = DynamicLight( self.Entity:EntIndex() ) - + if dlight then - + dlight.Pos = self.Entity:GetPos() dlight.r = 255 dlight.g = 50 @@ -51,22 +51,22 @@ function ENT:Think() dlight.Decay = 2048 dlight.size = 512 * math.Rand( 1.50, 1.75 ) dlight.DieTime = CurTime() + 1 - + end - + if not LocalPlayer():Alive() then return end - + local dist = LocalPlayer():GetPos():Distance( self.Entity:GetPos() ) - + if dist < 300 then - + local scale = math.Clamp( 1 - ( math.Clamp( dist, 1, 300 ) / 300 ), 0, 1 ) - + Sharpen = scale * 5 ColorModify[ "$pp_colour_contrast" ] = 1 + ( scale * 0.6 ) - + end - + end local matFlare = Material( "effects/blueflare1" ) @@ -76,11 +76,10 @@ function ENT:Draw() self.Entity:DrawModel() if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end - + local size = math.Rand( 5, 25 ) - + render.SetMaterial( matFlare ) - render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 255, 50, 50, 255 ) ) - -end + render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 255, 50, 50, 255 ) ) +end diff --git a/entities/entities/sent_flare/init.lua b/entities/entities/sent_flare/init.lua index 7e36159..8f54afe 100644 --- a/entities/entities/sent_flare/init.lua +++ b/entities/entities/sent_flare/init.lua @@ -9,49 +9,49 @@ ENT.Explode = Sound( "weapons/flashbang/flashbang_explode1.wav" ) function ENT:Initialize() self.Entity:SetModel( Model( "models/props_c17/trappropeller_lever.mdl" ) ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) self.Entity:DrawShadow( false ) - + self.Entity:SetNWFloat( "BurnDelay", CurTime() + 3 ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() phys:SetDamping( 0, 10 ) - + end - + self.DieTime = CurTime() + 60 * 5 - + self.Entity:EmitSound( "Weapon_SMG1.Special1", 100, 80 ) - + end function ENT:Think() if self.Entity:GetNWFloat( "BurnDelay", 0 ) < CurTime() then - + if not self.Burning then - + self.Burning = true self.Entity:EmitSound( self.Burn ) self.Entity:EmitSound( self.Explode, 100, math.random(90,110) ) - + end - + end - + if self.DieTime < CurTime() then - + self.Entity:Remove() - + end end @@ -63,16 +63,15 @@ function ENT:OnRemove() end function ENT:OnTakeDamage( dmginfo ) - + end function ENT:PhysicsCollide( data, phys ) - + end function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS + return TRANSMIT_ALWAYS end - diff --git a/entities/entities/sent_flare/shared.lua b/entities/entities/sent_flare/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_flare/shared.lua +++ b/entities/entities/sent_flare/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_fuel_diesel/cl_init.lua b/entities/entities/sent_fuel_diesel/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_fuel_diesel/cl_init.lua +++ b/entities/entities/sent_fuel_diesel/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_fuel_diesel/init.lua b/entities/entities/sent_fuel_diesel/init.lua index 9340505..d9c07ba 100644 --- a/entities/entities/sent_fuel_diesel/init.lua +++ b/entities/entities/sent_fuel_diesel/init.lua @@ -12,21 +12,21 @@ ENT.Radius = 350 function ENT:Initialize() self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + //self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() - + end - + end function ENT:SetSpeed( num ) @@ -42,50 +42,50 @@ end function ENT:Explode() if self.Exploded then return end - + self.Exploded = true local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + --[[local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true )]] - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + local fire = ents.Create( "sent_fire" ) fire:SetPos( self.Entity:GetPos() ) fire:SetOwner( self.Entity:GetOwner() ) fire:SetLifeTime( 10 ) fire:Spawn() - + self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) ) self.Entity:Remove() end function ENT:Use( ply, caller ) - + ply:AddToInventory( self.Entity ) end @@ -97,21 +97,20 @@ end function ENT:OnTakeDamage( dmginfo ) if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then - + self.Entity:SetOwner( dmginfo:GetAttacker() ) self.Entity:Explode() - + end - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound ) - + end - -end +end diff --git a/entities/entities/sent_fuel_diesel/shared.lua b/entities/entities/sent_fuel_diesel/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_fuel_diesel/shared.lua +++ b/entities/entities/sent_fuel_diesel/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_fuel_gas/cl_init.lua b/entities/entities/sent_fuel_gas/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_fuel_gas/cl_init.lua +++ b/entities/entities/sent_fuel_gas/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_fuel_gas/init.lua b/entities/entities/sent_fuel_gas/init.lua index 6672661..537c2bd 100644 --- a/entities/entities/sent_fuel_gas/init.lua +++ b/entities/entities/sent_fuel_gas/init.lua @@ -12,21 +12,21 @@ ENT.Radius = 350 function ENT:Initialize() self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + //self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() - + end - + end function ENT:SetSpeed( num ) @@ -42,50 +42,50 @@ end function ENT:Explode() if self.Exploded then return end - + self.Exploded = true local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + --[[local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true )]] - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + local fire = ents.Create( "sent_fire" ) fire:SetPos( self.Entity:GetPos() ) fire:SetOwner( self.Entity:GetOwner() ) fire:SetLifeTime( 12 ) fire:Spawn() - + self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) ) self.Entity:Remove() end function ENT:Use( ply, caller ) - + ply:AddToInventory( self.Entity ) end @@ -97,21 +97,20 @@ end function ENT:OnTakeDamage( dmginfo ) if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then - + self.Entity:SetOwner( dmginfo:GetAttacker() ) self.Entity:Explode() - + end - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound ) - + end - -end +end diff --git a/entities/entities/sent_fuel_gas/shared.lua b/entities/entities/sent_fuel_gas/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_fuel_gas/shared.lua +++ b/entities/entities/sent_fuel_gas/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_grenade/cl_init.lua b/entities/entities/sent_grenade/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_grenade/cl_init.lua +++ b/entities/entities/sent_grenade/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_grenade/init.lua b/entities/entities/sent_grenade/init.lua index 3973d4f..07f3901 100644 --- a/entities/entities/sent_grenade/init.lua +++ b/entities/entities/sent_grenade/init.lua @@ -11,26 +11,26 @@ ENT.Speed = 3500 function ENT:Initialize() self.Entity:SetModel( Model( "models/weapons/w_eq_fraggrenade_thrown.mdl") ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) self.Entity:DrawShadow( false ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() phys:SetDamping( 0, 5 ) phys:ApplyForceCenter( self.Entity:GetAngles():Forward() * self.Speed ) - + end - + self.Delay = CurTime() + 3.5 - + end function ENT:SetSpeed( num ) @@ -42,9 +42,9 @@ end function ENT:Think() if self.Delay < CurTime() then - + self.Entity:Explode() - + end end @@ -54,41 +54,41 @@ function ENT:Explode() local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true ) - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) and self.Entity:GetOwner():Team() == TEAM_ARMY then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + --[[for k,v in pairs( player.GetAll() ) do - + if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then - + v:SetBleeding( true ) - + end - + end]] - + self.Entity:Remove() end @@ -98,16 +98,15 @@ function ENT:OnRemove() end function ENT:OnTakeDamage( dmginfo ) - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound, 50, math.random(90,110) ) - + end - -end +end diff --git a/entities/entities/sent_grenade/shared.lua b/entities/entities/sent_grenade/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_grenade/shared.lua +++ b/entities/entities/sent_grenade/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_grenade_incendiary/cl_init.lua b/entities/entities/sent_grenade_incendiary/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_grenade_incendiary/cl_init.lua +++ b/entities/entities/sent_grenade_incendiary/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_grenade_incendiary/init.lua b/entities/entities/sent_grenade_incendiary/init.lua index 906fe1f..a6fb1fa 100644 --- a/entities/entities/sent_grenade_incendiary/init.lua +++ b/entities/entities/sent_grenade_incendiary/init.lua @@ -12,26 +12,26 @@ ENT.Speed = 3500 function ENT:Initialize() self.Entity:SetModel( Model( "models/weapons/w_eq_flashbang.mdl" ) ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) self.Entity:DrawShadow( false ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() phys:SetDamping( 0, 5 ) phys:ApplyForceCenter( self.Entity:GetAngles():Forward() * self.Speed ) - + end - + self.Delay = CurTime() + 3.5 - + end function ENT:SetSpeed( num ) @@ -43,9 +43,9 @@ end function ENT:Think() if self.Delay < CurTime() then - + self.Entity:Explode() - + end end @@ -55,42 +55,42 @@ function ENT:Explode() local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) and self.Entity:GetOwner():Team() == TEAM_ARMY then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + local fire = ents.Create( "sent_fire" ) fire:SetPos( self.Entity:GetPos() ) fire:SetOwner( self.Entity:GetOwner() ) fire:SetLifeTime( 8 ) fire:Spawn() - + --[[for k,v in pairs( player.GetAll() ) do - + if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then - + v:SetBleeding( true ) - + end - + end]] - + self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) ) self.Entity:Remove() @@ -101,16 +101,15 @@ function ENT:OnRemove() end function ENT:OnTakeDamage( dmginfo ) - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound, 50, math.random(120,140) ) - + end - -end +end diff --git a/entities/entities/sent_grenade_incendiary/shared.lua b/entities/entities/sent_grenade_incendiary/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_grenade_incendiary/shared.lua +++ b/entities/entities/sent_grenade_incendiary/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_heliflare/cl_init.lua b/entities/entities/sent_heliflare/cl_init.lua index 30e76c6..5c2884e 100644 --- a/entities/entities/sent_heliflare/cl_init.lua +++ b/entities/entities/sent_heliflare/cl_init.lua @@ -2,17 +2,17 @@ include('shared.lua') function ENT:Initialize() - self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) self.Smoke = 0 - + end function ENT:OnRemove() if self.Emitter then - + self.Emitter:Finish() - + end end @@ -20,11 +20,11 @@ end function ENT:Think() if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end - + if self.Smoke < CurTime() then - + self.Smoke = CurTime() + 0.2 - + local particle = self.Emitter:Add( "particles/smokey", self.Entity:GetPos() + self.Entity:GetRight() * 5 ) particle:SetVelocity( VectorRand() * 8 + WindVector ) particle:SetDieTime( math.Rand( 4.0, 8.0 ) ) @@ -33,16 +33,16 @@ function ENT:Think() particle:SetStartSize( 1 ) particle:SetEndSize( math.random( 50, 150 ) ) particle:SetGravity( Vector( 0, 0, 25 ) + WindVector * 1.5 ) - + local col = math.random( 50, 100 ) particle:SetColor( col + 150, col, col ) - + end - + local dlight = DynamicLight( self.Entity:EntIndex() ) - + if dlight then - + dlight.Pos = self.Entity:GetPos() dlight.r = 255 dlight.g = 50 @@ -51,22 +51,22 @@ function ENT:Think() dlight.Decay = 0 dlight.size = 256 dlight.DieTime = CurTime() + 0.1 - + end - + if not LocalPlayer():Alive() then return end - + local dist = LocalPlayer():GetPos():Distance( self.Entity:GetPos() ) - + if dist < 300 then - + local scale = math.Clamp( 1 - ( math.Clamp( dist, 1, 300 ) / 300 ), 0, 1 ) - + Sharpen = scale * 5 ColorModify[ "$pp_colour_contrast" ] = 1 + ( scale * 0.6 ) - + end - + end local matFlare = Material( "sprites/flareglow" ) @@ -76,9 +76,8 @@ function ENT:Draw() self.Entity:DrawModel() if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end - + render.SetMaterial( matFlare ) - render.DrawSprite( self.Entity:GetPos(), 170, 170, Color( 255, 50, 50, 255 ) ) - -end + render.DrawSprite( self.Entity:GetPos(), 170, 170, Color( 255, 50, 50, 255 ) ) +end diff --git a/entities/entities/sent_heliflare/init.lua b/entities/entities/sent_heliflare/init.lua index 914b5c1..0f306b7 100644 --- a/entities/entities/sent_heliflare/init.lua +++ b/entities/entities/sent_heliflare/init.lua @@ -9,47 +9,47 @@ ENT.Explode = Sound( "weapons/flashbang/flashbang_explode1.wav" ) function ENT:Initialize() self.Entity:SetModel( Model( "models/props_c17/trappropeller_lever.mdl" ) ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) self.Entity:DrawShadow( false ) - + self.Entity:SetNWFloat( "BurnDelay", CurTime() + 3 ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() phys:SetDamping( 0, 10 ) - + end - + self.DieTime = CurTime() + 45 - + end function ENT:Think() if self.Entity:GetNWFloat( "BurnDelay", 0 ) < CurTime() then - + if not self.Burning then - + self.Burning = true self.Entity:EmitSound( self.Rotor ) self.Entity:EmitSound( self.Explode, 100, math.random(90,110) ) - + end - + end - + if self.DieTime < CurTime() then - + self.Entity:Remove() - + end end @@ -61,16 +61,15 @@ function ENT:OnRemove() end function ENT:OnTakeDamage( dmginfo ) - + end function ENT:PhysicsCollide( data, phys ) - + end function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS + return TRANSMIT_ALWAYS end - diff --git a/entities/entities/sent_heliflare/shared.lua b/entities/entities/sent_heliflare/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_heliflare/shared.lua +++ b/entities/entities/sent_heliflare/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_lootbag/cl_init.lua b/entities/entities/sent_lootbag/cl_init.lua index 5af3dc2..49ad7f9 100644 --- a/entities/entities/sent_lootbag/cl_init.lua +++ b/entities/entities/sent_lootbag/cl_init.lua @@ -10,6 +10,5 @@ function ENT:Draw() if IsValid( self.Entity:GetNWEntity( "QuestOwner", nil ) ) and self.Entity:GetNWEntity( "QuestOwner", nil ) != LocalPlayer() then return end self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_lootbag/init.lua b/entities/entities/sent_lootbag/init.lua index 7a93b0a..bc9d64a 100644 --- a/entities/entities/sent_lootbag/init.lua +++ b/entities/entities/sent_lootbag/init.lua @@ -4,31 +4,31 @@ AddCSLuaFile( "shared.lua" ) include( 'shared.lua' ) function ENT:Initialize() - + self.Entity:SetModel( "models/props_junk/garbage_bag001a.mdl" ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() end self.LastUse = CurTime() + 1 self.Cash = 0 - + end function ENT:SetCash( amt ) - self.Cash = math.Clamp( amt, 0, 32000 ) + self.Cash = math.Clamp( amt, 0, 32000 ) end @@ -38,18 +38,18 @@ function ENT:GetCash() end -function ENT:Think() +function ENT:Think() if ( table.Count( self.Entity:GetItems() ) < 1 and self:GetCash() < 1 ) or ( self.DieTime and self.DieTime < CurTime() ) then - + self.Entity:Remove() - + end - -end + +end function ENT:SetRemoval( num ) - + self.DieTime = CurTime() + num end @@ -58,14 +58,14 @@ end if ( self.LastUse or 0 ) > CurTime() then return end if IsValid( self.Entity:GetNWEntity( "QuestOwner", nil ) ) and self.Entity:GetNWEntity( "QuestOwner", nil ) != ply then return end - + self.LastUse = CurTime() + 1.0 if IsValid( self.Entity:GetUser() ) then - + self.Entity:SetUser() ply:ToggleStashMenu( self.Entity, false, "StashMenu" ) - + end end @@ -74,26 +74,26 @@ function ENT:OnUsed( ply ) if ( self.LastUse or 0 ) > CurTime() then return end if IsValid( self.Entity:GetNWEntity( "QuestOwner", nil ) ) and self.Entity:GetNWEntity( "QuestOwner", nil ) != ply then return end - + self.LastUse = CurTime() + 1.0 if not IsValid( self.Entity:GetUser() ) then - + ply:SynchCash( self.Cash ) - + self.Entity:SetUser( ply ) ply:ToggleStashMenu( self.Entity, true, "StashMenu" ) - + end end]] function ENT:Use( ply, caller ) - + if ply:Team() != TEAM_ARMY then return end if self.Removing then return end - + self.Removing = true ply:AddMultipleToInventory( self.Items ) @@ -106,7 +106,7 @@ end function ENT:GetItems() return self.Items or {} - + end function ENT:AddItem( id ) @@ -114,7 +114,7 @@ function ENT:AddItem( id ) self.Items = self.Items or {} table.insert( self.Items, id ) - + //self.Entity:Synch() end @@ -122,17 +122,17 @@ end function ENT:RemoveItem( id ) for k,v in pairs( self.Items ) do - + if v == id then - + //self.Entity:Synch() - + table.remove( self.Items, k ) - + return - + end - + end end @@ -140,10 +140,9 @@ end function ENT:Synch() --[[if IsValid( self.Entity:GetUser() ) then - + self.Entity:GetUser():SynchStash( self.Entity ) - + end]] end - diff --git a/entities/entities/sent_lootbag/shared.lua b/entities/entities/sent_lootbag/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_lootbag/shared.lua +++ b/entities/entities/sent_lootbag/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_oxygen/cl_init.lua b/entities/entities/sent_oxygen/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_oxygen/cl_init.lua +++ b/entities/entities/sent_oxygen/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_oxygen/init.lua b/entities/entities/sent_oxygen/init.lua index 550be32..c2ef088 100644 --- a/entities/entities/sent_oxygen/init.lua +++ b/entities/entities/sent_oxygen/init.lua @@ -12,22 +12,22 @@ ENT.Speed = 3500 function ENT:Initialize() self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() phys:ApplyForceCenter( self.Entity:GetAngles():Forward() * self.Speed ) - + end - + end function ENT:SetSpeed( num ) @@ -45,47 +45,47 @@ function ENT:Explode() local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true ) - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + for k,v in pairs( player.GetAll() ) do - + if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then - + v:SetBleeding( true ) - + end - + end - + self.Entity:Remove() end function ENT:Use( ply, caller ) - + ply:AddToInventory( self.Entity ) end @@ -97,21 +97,20 @@ end function ENT:OnTakeDamage( dmginfo ) if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then - + self.Entity:SetOwner( dmginfo:GetAttacker() ) self.Entity:Explode() - + end - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound, 100, 120 ) - + end - -end +end diff --git a/entities/entities/sent_oxygen/shared.lua b/entities/entities/sent_oxygen/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_oxygen/shared.lua +++ b/entities/entities/sent_oxygen/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_propane_canister/cl_init.lua b/entities/entities/sent_propane_canister/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_propane_canister/cl_init.lua +++ b/entities/entities/sent_propane_canister/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_propane_canister/init.lua b/entities/entities/sent_propane_canister/init.lua index b36368f..a0894cb 100644 --- a/entities/entities/sent_propane_canister/init.lua +++ b/entities/entities/sent_propane_canister/init.lua @@ -12,21 +12,21 @@ ENT.Radius = 350 function ENT:Initialize() self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + //self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() - + end - + end function ENT:SetSpeed( num ) @@ -42,44 +42,44 @@ end function ENT:Explode() if self.Exploded then return end - + self.Exploded = true local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true ) - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) ) self.Entity:Remove() end function ENT:Use( ply, caller ) - + ply:AddToInventory( self.Entity ) end @@ -91,21 +91,20 @@ end function ENT:OnTakeDamage( dmginfo ) if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then - + self.Entity:SetOwner( dmginfo:GetAttacker() ) self.Entity:Explode() - + end - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound ) - + end - -end +end diff --git a/entities/entities/sent_propane_canister/shared.lua b/entities/entities/sent_propane_canister/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_propane_canister/shared.lua +++ b/entities/entities/sent_propane_canister/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_propane_tank/cl_init.lua b/entities/entities/sent_propane_tank/cl_init.lua index 514bad0..6eb79fa 100644 --- a/entities/entities/sent_propane_tank/cl_init.lua +++ b/entities/entities/sent_propane_tank/cl_init.lua @@ -1,7 +1,7 @@ include('shared.lua') function ENT:Initialize() - + end function ENT:OnRemove() @@ -9,12 +9,11 @@ function ENT:OnRemove() end function ENT:Think() - + end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_propane_tank/init.lua b/entities/entities/sent_propane_tank/init.lua index caadbf5..8cc24f3 100644 --- a/entities/entities/sent_propane_tank/init.lua +++ b/entities/entities/sent_propane_tank/init.lua @@ -12,21 +12,21 @@ ENT.Radius = 350 function ENT:Initialize() self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + //self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() - + end - + end function ENT:SetSpeed( num ) @@ -42,44 +42,44 @@ end function ENT:Explode() if self.Exploded then return end - + self.Exploded = true local ed = EffectData() ed:SetOrigin( self.Entity:GetPos() ) util.Effect( "Explosion", ed, true, true ) - + local trace = {} trace.start = self.Entity:GetPos() + Vector(0,0,20) trace.endpos = trace.start + Vector( 0, 0, -200 ) trace.filter = self.Entity - + local tr = util.TraceLine( trace ) if tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.8 ) util.Effect( "smoke_crater", ed, true, true ) - + util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) - + end if IsValid( self.Entity:GetOwner() ) then - + util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage ) - + end - + self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) ) self.Entity:Remove() end function ENT:Use( ply, caller ) - + ply:AddToInventory( self.Entity ) end @@ -91,21 +91,20 @@ end function ENT:OnTakeDamage( dmginfo ) if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then - + self.Entity:SetOwner( dmginfo:GetAttacker() ) self.Entity:Explode() - + end - + end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.HitSound ) - + end - -end +end diff --git a/entities/entities/sent_propane_tank/shared.lua b/entities/entities/sent_propane_tank/shared.lua index 8b0a8a2..1036ddc 100644 --- a/entities/entities/sent_propane_tank/shared.lua +++ b/entities/entities/sent_propane_tank/shared.lua @@ -1,2 +1,2 @@ ENT.Type = "anim" -ENT.Base = "base_anim"
\ No newline at end of file +ENT.Base = "base_anim" diff --git a/entities/entities/sent_radiation/cl_init.lua b/entities/entities/sent_radiation/cl_init.lua index e07f410..44beb90 100644 --- a/entities/entities/sent_radiation/cl_init.lua +++ b/entities/entities/sent_radiation/cl_init.lua @@ -12,26 +12,26 @@ end function ENT:Think() self.Scale = ( self.DieTime - CurTime() ) / 30 - + if self.LightTime < CurTime() then - + self.LightTime = CurTime() + 0.1 - + local dlight = DynamicLight( self.Entity:EntIndex() ) - + if dlight then - + dlight.Pos = self.Entity:GetPos() dlight.r = 150 dlight.g = 255 dlight.b = 50 dlight.Brightness = 2 dlight.Decay = 0 - dlight.size = self.Scale * self.Entity:GetNWInt( "Distance", 300 ) + dlight.size = self.Scale * self.Entity:GetNWInt( "Distance", 300 ) dlight.DieTime = CurTime() + 1 - + end - + end end @@ -39,14 +39,13 @@ end function ENT:OnRemove() if self.Emitter then - + self.Emitter:Finish() - + end end function ENT:Draw() - -end +end diff --git a/entities/entities/sent_radiation/init.lua b/entities/entities/sent_radiation/init.lua index 52eabb4..3c3f6a2 100644 --- a/entities/entities/sent_radiation/init.lua +++ b/entities/entities/sent_radiation/init.lua @@ -7,21 +7,21 @@ ENT.Scale = 1 ENT.Distance = 300 function ENT:Initialize() - + self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_NONE ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER ) self.Entity:SetNotSolid( true ) - self.Entity:DrawShadow( false ) - + self.Entity:DrawShadow( false ) + self.Entity:SetCollisionBounds( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) ) self.Entity:PhysicsInitBox( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) ) - + self.Entity:SetNWInt( "Distance", self.Distance ) - + self.DieTime = CurTime() + 30 - + end function ENT:SetDistance( num ) @@ -43,48 +43,48 @@ end function ENT:Think() if self.DieTime < CurTime() then - + self.Entity:Remove() - + end - + self.Scale = ( self.DieTime - CurTime() ) / 30 - + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do - + local dist = v:GetPos():Distance( self.Entity:GetPos() ) - + if dist < ( self.Distance * self.Scale ) + 100 then - + if dist < ( self.Distance * self.Scale ) then - + if ( v.RadAddTime or 0 ) < CurTime() then - + v.RadAddTime = CurTime() + 8 v:AddRadiation( 1 ) - + end - + end - + if ( v.NextRadSound or 0 ) < CurTime() then - + local scale = math.Clamp( ( ( self.Distance * self.Scale ) + 100 - dist ) / ( ( self.Distance * self.Scale ) ), 0.1, 1.0 ) - - v.NextRadSound = CurTime() + 1 - scale + + v.NextRadSound = CurTime() + 1 - scale v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random( 80, 90 ) + scale * 20 ) v:NoticeOnce( "A radioactive deposit is nearby", GAMEMODE.Colors.Blue ) - + end - + end - + end end function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS + return TRANSMIT_ALWAYS end diff --git a/entities/entities/sent_radiation/shared.lua b/entities/entities/sent_radiation/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_radiation/shared.lua +++ b/entities/entities/sent_radiation/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/entities/sent_supplycrate/cl_init.lua b/entities/entities/sent_supplycrate/cl_init.lua index f1cad0f..fa2c2a9 100644 --- a/entities/entities/sent_supplycrate/cl_init.lua +++ b/entities/entities/sent_supplycrate/cl_init.lua @@ -8,6 +8,5 @@ end function ENT:Draw() self.Entity:DrawModel() - -end +end diff --git a/entities/entities/sent_supplycrate/init.lua b/entities/entities/sent_supplycrate/init.lua index 932ca4e..07d3389 100644 --- a/entities/entities/sent_supplycrate/init.lua +++ b/entities/entities/sent_supplycrate/init.lua @@ -8,23 +8,23 @@ ENT.Open = Sound( "Wood.Strain" ) ENT.Model = Model( "models/Items/item_item_crate.mdl" ) function ENT:Initialize() - + self.Entity:SetModel( self.Model ) - + self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) - + self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) - + local phys = self.Entity:GetPhysicsObject() - + if IsValid( phys ) then - + phys:Wake() end - + self.Entity:SetColor( Color( 255, 200, 150, 255 ) ) self.Removing = false @@ -32,13 +32,13 @@ function ENT:Initialize() end -function ENT:Think() - +function ENT:Think() + if IsValid( self.User ) and self.User:Alive() and self.User:Team() == TEAM_ARMY then return end - + self.Entity:SetColor( Color( 255, 255, 150, 255 ) ) - -end + +end function ENT:SetContents( tbl ) @@ -55,7 +55,7 @@ end function ENT:Use( ply, caller ) if IsValid( self.User ) and self.User:Alive() and self.User:Team() == TEAM_ARMY and ply != self.User then return end - + if ply:Team() != TEAM_ARMY then return end if self.Removing then return end @@ -70,10 +70,9 @@ end function ENT:PhysicsCollide( data, phys ) if data.Speed > 50 and data.DeltaTime > 0.15 then - + self.Entity:EmitSound( self.Bang ) - + end - -end +end diff --git a/entities/entities/sent_supplycrate/shared.lua b/entities/entities/sent_supplycrate/shared.lua index 8e216e2..1036ddc 100644 --- a/entities/entities/sent_supplycrate/shared.lua +++ b/entities/entities/sent_supplycrate/shared.lua @@ -1,3 +1,2 @@ ENT.Type = "anim" ENT.Base = "base_anim" - diff --git a/entities/weapons/rad_ak47/shared.lua b/entities/weapons/rad_ak47/shared.lua index 36d2799..a0001df 100644 --- a/entities/weapons/rad_ak47/shared.lua +++ b/entities/weapons/rad_ak47/shared.lua @@ -1,16 +1,16 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then - + SWEP.PrintName = "AK-47" SWEP.IconLetter = "b" SWEP.Slot = 4 SWEP.Slotpos = 2 - + end SWEP.HoldType = "ar2" diff --git a/entities/weapons/rad_awp/shared.lua b/entities/weapons/rad_awp/shared.lua index f20fd07..64a656b 100644 --- a/entities/weapons/rad_awp/shared.lua +++ b/entities/weapons/rad_awp/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "AWP" SWEP.IconLetter = "r" SWEP.Slot = 2 SWEP.Slotpos = 2 - + end SWEP.HoldType = "ar2" diff --git a/entities/weapons/rad_base/shared.lua b/entities/weapons/rad_base/shared.lua index 63ef374..684572f 100644 --- a/entities/weapons/rad_base/shared.lua +++ b/entities/weapons/rad_base/shared.lua @@ -1,11 +1,11 @@ if SERVER then AddCSLuaFile( "shared.lua" ) - + SWEP.Weight = 1 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false - + end if CLIENT then @@ -16,18 +16,18 @@ if CLIENT then SWEP.ViewModelFOV = 75 SWEP.ViewModelFlip = true - + SWEP.PrintName = "BASE WEAPON" SWEP.IconLetter = "c" SWEP.Slot = 0 SWEP.Slotpos = 0 - + SWEP.IconFont = "CSSelectIcons" - + function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) //draw.SimpleText( self.IconLetter, self.IconFont, x + wide/2, y + tall/2.5, Color( 15, 20, 200, 255 ), TEXT_ALIGN_CENTER ) end - + end SWEP.HoldType = "pistol" @@ -84,7 +84,7 @@ SWEP.FalloffDistances[ "Buckshot" ] = { Range = 300, Falloff = 500 } SWEP.UseShellSounds = true SWEP.ShellSounds = { "player/pl_shell1.wav", "player/pl_shell2.wav", "player/pl_shell3.wav" } -SWEP.BuckshotShellSounds = { "weapons/fx/tink/shotgun_shell1.wav", "weapons/fx/tink/shotgun_shell2.wav", "weapons/fx/tink/shotgun_shell3.wav" } +SWEP.BuckshotShellSounds = { "weapons/fx/tink/shotgun_shell1.wav", "weapons/fx/tink/shotgun_shell2.wav", "weapons/fx/tink/shotgun_shell3.wav" } SWEP.Pitches = {} SWEP.Pitches[ "Pistol" ] = 100 @@ -169,19 +169,19 @@ end function SWEP:GetMoveScale( movetime, duration, mul ) mul = 1 - + if CurTime() - movetime < duration then - + mul = math.Clamp( ( CurTime() - duration ) / movetime, 0, 1 ) - + end - + if self.Weapon:GetNWBool( "ReverseAnim", false ) then - + return -( mul - 1 ) ^ 3 - + end - + return ( mul - 1 ) ^ 3 + 1 end @@ -193,23 +193,23 @@ function SWEP:AngApproach( newang, ang, mul ) ang:RotateAroundAxis( ang:Right(), newang.x * mul ) ang:RotateAroundAxis( ang:Up(), newang.y * mul ) ang:RotateAroundAxis( ang:Forward(), newang.z * mul ) - + return ang end -function SWEP:PosApproach( newpos, pos, ang, mul ) +function SWEP:PosApproach( newpos, pos, ang, mul ) local right = ang:Right() local up = ang:Up() local forward = ang:Forward() - + if not newpos then return pos end pos = pos + newpos.x * right * mul pos = pos + newpos.y * forward * mul pos = pos + newpos.z * up * mul - + return pos end @@ -218,7 +218,7 @@ function SWEP:MoveViewModelTo( newpos, newang, pos, ang, mul ) ang = self:AngApproach( newang, ang, mul ) pos = self:PosApproach( newpos, pos, ang, mul ) - + return pos, ang end @@ -226,40 +226,40 @@ end function SWEP:Initialize() self.Weapon:SetWeaponHoldType( self.HoldType ) - + end function SWEP:Deploy() if SERVER then - + self.Weapon:SetZoomMode( 1 ) self.Owner:DrawViewModel( true ) - - end + + end self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + return true - -end + +end function SWEP:Holster() - + return true end -function SWEP:Think() +function SWEP:Think() self.Weapon:ReloadThink() if self.Owner:GetVelocity():Length() > 0 and self.Owner:KeyDown( IN_SPEED ) then - + self.LastRunFrame = CurTime() + 0.3 - + self.Weapon:UnZoom() - + end end @@ -267,19 +267,19 @@ end function SWEP:SetZoomMode( num ) if num > #self.ZoomModes then - + num = 1 self.Weapon:UnZoom() - + end - + self.Weapon:SetNWInt( "Mode", num ) - + if self.Owner:GetFOV() != self.ZoomModes[num] then - + self.Owner:SetFOV( self.ZoomModes[num], self.ZoomSpeeds[num] ) - + end end @@ -287,7 +287,7 @@ end function SWEP:GetZoomMode() return self.Weapon:GetNWInt( "Mode", 1 ) - + end function SWEP:UnZoom() @@ -296,67 +296,67 @@ function SWEP:UnZoom() self.Weapon:SetZoomMode( 1 ) self.Weapon:SetNWBool( "ReverseAnim", true ) - + self.Owner:DrawViewModel( true ) - + end function SWEP:Reload() if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end - - if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then - + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then + self.Weapon:SetClip1( self.Primary.ClipSize ) - + return - + end if self.Weapon:GetZoomMode() != 1 then - + self.Weapon:UnZoom() - - end + + end self.Weapon:DoReload() - + end function SWEP:StartWeaponAnim( anim ) - + if IsValid( self.Owner ) then - + local vm = self.Owner:GetViewModel() - + local idealSequence = self:SelectWeightedSequence( anim ) local nextSequence = self:FindTransitionSequence( self.Weapon:GetSequence(), idealSequence ) - + //vm:RemoveEffects( EF_NODRAW ) //vm:SetPlaybackRate( pbr ) if nextSequence > 0 then - + vm:SendViewModelMatchingSequence( nextSequence ) - + else - + vm:SendViewModelMatchingSequence( idealSequence ) - + end return vm:SequenceDuration( vm:GetSequence() ) - - end - + + end + end function SWEP:DoReload() local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD ) - + self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.080 ) - + self.ReloadTime = CurTime() + time end @@ -364,10 +364,10 @@ end function SWEP:ReloadThink() if self.ReloadTime and self.ReloadTime <= CurTime() then - + self.ReloadTime = nil self.Weapon:SetClip1( self.Primary.ClipSize ) - + end end @@ -377,120 +377,120 @@ function SWEP:CanSecondaryAttack() if self.HolsterMode or self.Owner:KeyDown( IN_SPEED ) or self.LastRunFrame > CurTime() then return false end if self.Weapon:Clip1() <= 0 and self.IsSniper then - + if self.Weapon:GetZoomMode() != 1 then - + self.Weapon:UnZoom() - + end - + return false - + end - + return true - + end function SWEP:CanPrimaryAttack() if self.HolsterMode or self.ReloadTime or self.LastRunFrame > CurTime() then return false end - - if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then - + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then + self.Weapon:EmitSound( self.Primary.Empty ) - - return false - + + return false + end if self.Weapon:Clip1() <= 0 then - + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) self.Weapon:DoReload() - + if self.Weapon:GetZoomMode() != 1 then - + self.Weapon:UnZoom() - - end - + + end + return false - + end - + return true - + end -function SWEP:ShootEffects() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - - end - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - - self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) - + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + if CLIENT then return end - + if self.UseShellSounds then - + local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 ) local tbl = self.ShellSounds local pos = self.Owner:GetPos() - + if self.AmmoType == "Buckshot" then - + tbl = self.BuckshotShellSounds - + end - + timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end ) - + end - + end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) - - return - + + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) self.Weapon:SetClip1( self.Weapon:Clip1() - self.Primary.NumShots ) self.Weapon:ShootEffects() - + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) - + else - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) - + end - + if self.Weapon:GetZoomMode() > 1 then - + self.Weapon:UnZoom() - + end - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, self.Primary.NumShots * -1 ) - + end end @@ -498,31 +498,31 @@ end function SWEP:SecondaryAttack() if not self.Weapon:CanSecondaryAttack() then return end - + self.Weapon:SetNextSecondaryFire( CurTime() + 0.25 ) - + if not self.IsSniper then - + self.Weapon:ToggleLaser() - + return - + end - + if SERVER then - + if self.Weapon:GetZoomMode() == 1 then - + self.Owner:DrawViewModel( false ) - + end - + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) - + end - + self.Weapon:EmitSound( self.Secondary.Sound ) - + end function SWEP:ToggleLaser() @@ -536,101 +536,101 @@ function SWEP:AdjustMouseSensitivity() local num = self.Weapon:GetNWInt( "Mode", 1 ) local scale = ( self.ZoomModes[ num ] or 0 ) / 100 - + if scale == 0 then - + return nil - + end return scale - -end -function SWEP:GetDamageFalloffScale( distance ) +end + +function SWEP:GetDamageFalloffScale( distance ) + + local scale = 1 - local scale = 1 + if distance > self.FalloffDistances[ self.AmmoType ].Range then - if distance > self.FalloffDistances[ self.AmmoType ].Range then + scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) ) - scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) ) + end - end - return math.Clamp( scale, 0.1, 1.0 ) - + end function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) if SERVER then - + self.Owner:AddStat( "Bullets", numbullets ) - + end local scale = aimcone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = aimcone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( aimcone / 1.75, 0, 10 ) - + end - + local bullet = {} bullet.Num = numbullets - bullet.Src = self.Owner:GetShootPos() - bullet.Dir = self.Owner:GetAimVector() - bullet.Spread = Vector( scale, scale, 0 ) + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) bullet.Tracer = 0 - bullet.Force = damage * 2 + bullet.Force = damage * 2 bullet.Damage = damage bullet.AmmoType = "Pistol" - + //if self.IsSniper and self.AmmoType == "Sniper" then - + //bullet.TracerName = "sniper_tracer" - + //end - + bullet.Callback = function( attacker, tr, dmginfo ) - + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) - + if tr.Entity.NextBot then - + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) - + end if ( IsValid( tr.Entity ) and tr.Entity:IsPlayer() ) or math.random(1,5) != 1 then return end - + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) - + end - + self.Owner:LagCompensation( true ) - + self.Owner:FireBullets( bullet ) - + self.Owner:LagCompensation( false ) - + end function SWEP:GetPenetrationDistance( mat_type ) if ( mat_type == MAT_PLASTIC || mat_type == MAT_WOOD || mat_type == MAT_ALIENFLESH || mat_type == MAT_FLESH || mat_type == MAT_GLASS ) then - + return 64 - + end - + return 32 - + end function SWEP:GetPenetrationDamageLoss( mat_type, distance, damage ) @@ -642,168 +642,168 @@ function SWEP:GetPenetrationDamageLoss( mat_type, distance, damage ) elseif( mat_type == MAT_TILE || mat_type == MAT_SAND || mat_type == MAT_DIRT ) then return damage - ( distance * 1.2 ) end - + return damage - ( distance * 1.8 ) - + end --[[function SWEP:BulletPenetration( attacker, tr, dmginfo, bounce ) if ( !self or !IsValid( self.Weapon ) ) then return end - - if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then - - local effectdata = EffectData() - effectdata:SetOrigin( tr.HitPos ) - util.Effect( "BloodImpact", effectdata ) - - end - + + if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then + + local effectdata = EffectData() + effectdata:SetOrigin( tr.HitPos ) + util.Effect( "BloodImpact", effectdata ) + + end + // Don't go through more than 3 times if ( bounce > 3 ) then return false end - + // Direction (and length) that we are gonna penetrate local PeneDir = tr.Normal * self:GetPenetrationDistance( tr.MatType ) - + local PeneTrace = {} PeneTrace.endpos = tr.HitPos PeneTrace.start = tr.HitPos + PeneDir PeneTrace.mask = MASK_SHOT PeneTrace.filter = { self.Owner } - - local PeneTrace = util.TraceLine( PeneTrace ) - + + local PeneTrace = util.TraceLine( PeneTrace ) + // Bullet didn't penetrate. if ( PeneTrace.StartSolid or PeneTrace.Fraction >= 1.0 or tr.Fraction <= 0.0 ) then return false end - + local distance = ( PeneTrace.HitPos - tr.HitPos ):Length() local new_damage = self:GetPenetrationDamageLoss( tr.MatType, distance, dmginfo:GetDamage() ) - + if new_damage > 0 then - - local bullet = - { + + local bullet = + { Num = 1, Src = PeneTrace.HitPos, - Dir = tr.Normal, + Dir = tr.Normal, Spread = Vector( 0, 0, 0 ), Tracer = 0, Force = 5, Damage = new_damage, AmmoType = "Pistol", } - + bullet.Callback = function ( attacker, tr, dmginfo ) - + if IsValid( self ) and IsValid( self.Weapon ) then - + self.Weapon:BulletPenetration( attacker, tr, dmginfo, bounce + 1 ) - + end - + end - + local effectdata = EffectData() effectdata:SetOrigin( PeneTrace.HitPos ) effectdata:SetNormal( PeneTrace.Normal ) - util.Effect( "Impact", effectdata ) - + util.Effect( "Impact", effectdata ) + local func = function( attacker, bullet ) - + if IsValid( attacker ) then - + attacker.FireBullets( attacker, bullet, true ) - + end - + end - + timer.Simple( 0.05, function() func( attacker, bullet ) end ) - + if SERVER and tr.MatType != MAT_FLESH then - + sound.Play( table.Random( GAMEMODE.Ricochet ), tr.HitPos, 100, math.random(90,120) ) - + end - + end - + end]] function SWEP:BulletPenetration( attacker, tr, dmginfo, bounce ) if ( !self or not IsValid( self.Weapon ) ) then return end - - if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then - - local effectdata = EffectData() - effectdata:SetOrigin( tr.HitPos ) - util.Effect( "BloodImpact", effectdata ) - - end - + + if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then + + local effectdata = EffectData() + effectdata:SetOrigin( tr.HitPos ) + util.Effect( "BloodImpact", effectdata ) + + end + if ( bounce > 3 ) then return false end - + local PeneDir = tr.Normal * self:GetPenetrationDistance( tr.MatType ) - + local PeneTrace = {} PeneTrace.endpos = tr.HitPos PeneTrace.start = tr.HitPos + PeneDir PeneTrace.mask = MASK_SHOT PeneTrace.filter = { self.Owner } - - local PeneTrace = util.TraceLine( PeneTrace ) - + + local PeneTrace = util.TraceLine( PeneTrace ) + if ( PeneTrace.StartSolid || PeneTrace.Fraction >= 1.0 || tr.Fraction <= 0.0 ) then return false end - + local distance = ( PeneTrace.HitPos - tr.HitPos ):Length() local new_damage = self:GetPenetrationDamageLoss( tr.MatType, distance, dmginfo:GetDamage() ) - + if new_damage > 0 then - - local bullet = - { + + local bullet = + { Num = 1, Src = PeneTrace.HitPos, - Dir = tr.Normal, + Dir = tr.Normal, Spread = Vector( 0, 0, 0 ), Tracer = 0, Force = 5, Damage = new_damage, AmmoType = "Pistol", } - - bullet.Callback = function( a, b, c ) - + + bullet.Callback = function( a, b, c ) + if IsValid( self ) and IsValid( self.Weapon ) then - + self.Weapon:BulletPenetration( attacker, tr, dmginfo, bounce + 1 ) - - end - + + end + end - + local effectdata = EffectData() effectdata:SetOrigin( PeneTrace.HitPos ); effectdata:SetNormal( PeneTrace.Normal ); - util.Effect( "Impact", effectdata ) - + util.Effect( "Impact", effectdata ) + timer.Simple( 0.01, function() attacker:FireBullets( bullet, true ) end ) - + if SERVER and tr.MatType != MAT_FLESH and bounce == 0 then - + sound.Play( table.Random( GAMEMODE.Ricochet ), tr.HitPos, 100, math.random(90,120) ) - + end - + end - + end function SWEP:ShouldNotDraw() return self.Weapon:GetNWBool( "Laser", false ) - + end if CLIENT then @@ -813,7 +813,7 @@ if CLIENT then SWEP.CrossBlue = CreateClientConVar( "cl_redead_crosshair_b", 255, true, false ) SWEP.CrossAlpha = CreateClientConVar( "cl_redead_crosshair_a", 255, true, false ) SWEP.CrossLength = CreateClientConVar( "cl_redead_crosshair_length", 10, true, false ) - + SWEP.DotMat = Material( "Sprites/light_glow02_add_noz" ) SWEP.LasMat = Material( "sprites/bluelaser1" ) @@ -824,120 +824,120 @@ SWEP.CrosshairScale = 1 function SWEP:LaserDraw() local vm = self.Owner:GetViewModel() - + if IsValid( vm ) then - + local idx = vm:LookupAttachment( "1" ) - + if idx == 0 then idx = vm:LookupAttachment( "muzzle" ) end - + local trace = util.GetPlayerTrace( ply ) local tr = util.TraceLine( trace ) local tbl = vm:GetAttachment( idx ) - + local pos = tr.HitPos - + if vm:GetSequence() != ACT_VM_IDLE then - + self.AngDiff = ( tbl.Ang - self.LastGoodAng ):Forward() - + trace = {} trace.start = tbl.Pos or Vector(0,0,0) trace.endpos = trace.start + ( ( EyeAngles() + self.AngDiff ):Forward() * 99999 ) trace.filter = { self.Owner, self.Weapon } - + local tr2 = util.TraceLine( trace ) - + pos = tr2.HitPos - + else - + self.LastGoodAng = tbl.Ang - + end - + cam.Start3D( EyePos(), EyeAngles() ) - + local dir = ( tbl.Ang ):Forward() local start = tbl.Pos - + render.SetMaterial( self.LasMat ) - + for i=0,254 do - + render.DrawBeam( start, start + dir * 5, 2, 0, 12, Color( 255, 0, 0, 255 - i ) ) - + start = start + dir * 5 - + end - + local dist = tr.HitPos:Distance( EyePos() ) local size = math.Rand( 6, 7 ) local dotsize = dist / size ^ 2 - + render.SetMaterial( self.DotMat ) render.DrawQuadEasy( pos, ( EyePos() - tr.HitPos ):GetNormal(), dotsize, dotsize, Color( 255, 0, 0, 255 ), 0 ) - + cam.End3D() - - end + + end end function SWEP:DrawHUD() if self.Weapon:ShouldNotDraw() then return end - + if self.Weapon:GetNWBool( "Laser", false ) then return end - + local mode = self.Weapon:GetZoomMode() if not self.IsSniper or mode == 1 then - + local cone = self.Primary.Cone local scale = cone - + if self.IsSniper then - + cone = self.Primary.SniperCone scale = cone - + end - + local x = ScrW() * 0.5 local y = ScrH() * 0.5 local scalebywidth = ( ScrW() / 1024 ) * 10 - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = cone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( cone / 1.75, 0, 10 ) - + end - + scale = scale * scalebywidth - + local dist = math.abs( self.CrosshairScale - scale ) self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) - + local gap = 40 * self.CrosshairScale local length = gap + self.CrossLength:GetInt() //20 * self.CrosshairScale - + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) - + return - + end - + if mode != 1 then - + local w = ScrW() local h = ScrH() local wr = ( h / 3 ) * 4 @@ -945,14 +945,13 @@ function SWEP:DrawHUD() surface.SetTexture( surface.GetTextureID( "gmod/scope" ) ) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawTexturedRect( ( w / 2 ) - wr / 2, 0, wr, h ) - + surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawRect( 0, 0, ( w / 2 ) - wr / 2, h ) surface.DrawRect( ( w / 2 ) + wr / 2, 0, w - ( ( w / 2 ) + wr / 2 ), h ) surface.DrawLine( 0, h * 0.50, w, h * 0.50 ) surface.DrawLine( w * 0.50, 0, w * 0.50, h ) - + end - -end +end diff --git a/entities/weapons/rad_berettas/shared.lua b/entities/weapons/rad_berettas/shared.lua index 4ffeebd..ff48da6 100644 --- a/entities/weapons/rad_berettas/shared.lua +++ b/entities/weapons/rad_berettas/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = false - + SWEP.PrintName = "Dual Berettas" SWEP.IconLetter = "s" SWEP.Slot = 2 SWEP.Slotpos = 0 - + end SWEP.HoldType = "duel" @@ -44,36 +44,36 @@ SWEP.Primary.Delay = 0.180 SWEP.Primary.ClipSize = 30 SWEP.Primary.Automatic = false -function SWEP:ShootEffects() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - + end - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + self.Weapon:SendWeaponAnim( self.Anims[ self.AnimPos ] ) self.AnimPos = self.AnimPos + 1 - + if self.AnimPos > 2 then - + self.AnimPos = 1 - + end - + end --[[function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - return - + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) @@ -81,11 +81,11 @@ end self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) self.Weapon:TakePrimaryAmmo( 1 ) self.Weapon:ShootEffects() - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end end]] diff --git a/entities/weapons/rad_deagle/shared.lua b/entities/weapons/rad_deagle/shared.lua index 1bc4118..5298747 100644 --- a/entities/weapons/rad_deagle/shared.lua +++ b/entities/weapons/rad_deagle/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "Desert Eagle" SWEP.IconLetter = "f" SWEP.Slot = 2 SWEP.Slotpos = 1 - + end SWEP.HoldType = "revolver" @@ -36,4 +36,4 @@ SWEP.Primary.Cone = 0.030 SWEP.Primary.Delay = 0.380 SWEP.Primary.ClipSize = 7 -SWEP.Primary.Automatic = false
\ No newline at end of file +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_experimental/shared.lua b/entities/weapons/rad_experimental/shared.lua index f8da7b8..4c2d1b8 100644 --- a/entities/weapons/rad_experimental/shared.lua +++ b/entities/weapons/rad_experimental/shared.lua @@ -1,20 +1,20 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then - + SWEP.ViewModelFlip = false - + SWEP.ViewModelFOV = 60 - + SWEP.PrintName = "PPW-952" SWEP.IconLetter = "m" SWEP.Slot = 4 SWEP.Slotpos = 2 - + end SWEP.HoldType = "ar2" @@ -51,28 +51,28 @@ SWEP.Primary.Delay = 1.400 SWEP.Primary.ClipSize = 3 SWEP.Primary.Automatic = true -function SWEP:ShootEffects() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - + end - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - - self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) - + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - return - + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) @@ -81,11 +81,11 @@ function SWEP:PrimaryAttack() self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) self.Weapon:TakePrimaryAmmo( 1 ) self.Weapon:ShootEffects() - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end end @@ -93,62 +93,62 @@ end function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) if SERVER then - + self.Owner:AddStat( "Bullets", numbullets ) - + end local scale = aimcone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = aimcone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( aimcone / 1.75, 0, 10 ) - + end - + local bullet = {} bullet.Num = numbullets - bullet.Src = self.Owner:GetShootPos() - bullet.Dir = self.Owner:GetAimVector() - bullet.Spread = Vector( scale, scale, 0 ) + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) bullet.Tracer = 1 - bullet.Force = damage * 2 + bullet.Force = damage * 2 bullet.Damage = 1 bullet.AmmoType = "Pistol" bullet.TracerName = "AirboatGunHeavyTracer" - + bullet.Callback = function ( attacker, tr, dmginfo ) if IsValid( tr.Entity ) and IsValid( self ) and IsValid( self.Owner ) and SERVER then - + if tr.Entity:IsPlayer() and tr.Entity:Team() == TEAM_ZOMBIES then - + tr.Entity:SetModel( table.Random( GAMEMODE.Corpses ) ) - + end - + local dmg = DamageInfo() dmg:SetDamage( 500 ) dmg:SetDamageType( DMG_BLAST ) dmg:SetAttacker( self.Owner ) dmg:SetInflictor( self.Weapon ) - + tr.Entity:EmitSound( self.Gore, 100, math.random(90,110) ) tr.Entity:TakeDamageInfo( dmg ) - + end - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetNormal( tr.HitNormal ) util.Effect( "energy_explosion", ed, true, true ) end - + self.Owner:FireBullets( bullet ) - + end diff --git a/entities/weapons/rad_famas/shared.lua b/entities/weapons/rad_famas/shared.lua index b7966f4..7b8682b 100644 --- a/entities/weapons/rad_famas/shared.lua +++ b/entities/weapons/rad_famas/shared.lua @@ -1,13 +1,13 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = false - + SWEP.PrintName = "FAMAS" SWEP.IconLetter = "v" SWEP.Slot = 4 diff --git a/entities/weapons/rad_firegun/shared.lua b/entities/weapons/rad_firegun/shared.lua index a8e3ae8..5e83dc9 100644 --- a/entities/weapons/rad_firegun/shared.lua +++ b/entities/weapons/rad_firegun/shared.lua @@ -1,20 +1,20 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then - + SWEP.ViewModelFlip = false - + SWEP.ViewModelFOV = 60 - + SWEP.PrintName = "HEAT Cannon" SWEP.IconLetter = "m" SWEP.Slot = 4 SWEP.Slotpos = 2 - + end SWEP.HoldType = "physgun" @@ -52,28 +52,28 @@ SWEP.Primary.Delay = 1.700 SWEP.Primary.ClipSize = 1 SWEP.Primary.Automatic = true -function SWEP:ShootEffects() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - + end - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - - self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK ) - + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK ) + end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - return - + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) @@ -82,14 +82,14 @@ function SWEP:PrimaryAttack() self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) self.Weapon:TakePrimaryAmmo( 1 ) self.Weapon:ShootEffects() - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) self.Owner:EmitSound( self.Primary.Sound2 ) - + end - + self.ReloadTime = CurTime() + self.Primary.Delay end @@ -97,16 +97,16 @@ end function SWEP:ReloadThink() if self.ReloadTime and self.ReloadTime <= CurTime() then - + self.ReloadTime = nil self.Weapon:SetClip1( self.Primary.ClipSize ) - + end end function SWEP:Reload() - + end SWEP.Decals = { "Scorch", "SmallScorch" } @@ -114,77 +114,77 @@ SWEP.Decals = { "Scorch", "SmallScorch" } function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) if SERVER then - + self.Owner:AddStat( "Bullets", numbullets ) - + end local scale = aimcone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = aimcone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( aimcone / 1.75, 0, 10 ) - + end - + local bullet = {} bullet.Num = numbullets - bullet.Src = self.Owner:GetShootPos() - bullet.Dir = self.Owner:GetAimVector() - bullet.Spread = Vector( scale, scale, 0 ) + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) bullet.Tracer = 1 - bullet.Force = damage * 2 + bullet.Force = damage * 2 bullet.Damage = 1 bullet.AmmoType = "Pistol" bullet.TracerName = "fire_tracer" - + bullet.Callback = function ( attacker, tr, dmginfo ) if IsValid( tr.Entity ) and IsValid( self ) and IsValid( self.Owner ) and SERVER then - + if tr.Entity:IsPlayer() then - + tr.Entity:TakeDamage( self.Primary.Damage, self.Owner ) - + else - + tr.Entity:TakeDamage( math.Clamp( math.min( 20, tr.Entity:Health() - 5 ), 1, 20 ), self.Owner ) - + end - + if tr.Entity.NextBot or ( tr.Entity:IsPlayer() and tr.Entity:Team() != TEAM_ARMY ) then - + tr.Entity:DoIgnite( self.Owner ) tr.Entity:EmitSound( self.Burn, 100, math.random(90,110) ) - + end - + end - + sound.Play( self.Burn2, tr.HitPos ) - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetNormal( tr.HitNormal ) util.Effect( "fire_explosion", ed, true, true ) - + if tr.HitNormal.z > 0.5 and tr.HitWorld then - + local ed = EffectData() ed:SetOrigin( tr.HitPos ) ed:SetMagnitude( 0.5 ) util.Effect( "smoke_crater", ed, true, true ) - + end - + util.Decal( table.Random( self.Decals ), tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) end - + self.Owner:FireBullets( bullet ) - + end diff --git a/entities/weapons/rad_fiveseven/shared.lua b/entities/weapons/rad_fiveseven/shared.lua index 28ce60e..3634c0e 100644 --- a/entities/weapons/rad_fiveseven/shared.lua +++ b/entities/weapons/rad_fiveseven/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "FN Five-Seven" SWEP.IconLetter = "y" SWEP.Slot = 2 SWEP.Slotpos = 2 - + end SWEP.HoldType = "pistol" diff --git a/entities/weapons/rad_g3/shared.lua b/entities/weapons/rad_g3/shared.lua index 8e9d8b7..d55b732 100644 --- a/entities/weapons/rad_g3/shared.lua +++ b/entities/weapons/rad_g3/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "G3 SG1" SWEP.IconLetter = "i" SWEP.Slot = 4 SWEP.Slotpos = 3 - + end SWEP.HoldType = "ar2" @@ -44,33 +44,33 @@ SWEP.Primary.Automatic = true function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) - - return - + + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) self.Weapon:ShootEffects() - + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) - + else - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) - + end - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end -end
\ No newline at end of file +end diff --git a/entities/weapons/rad_galil/shared.lua b/entities/weapons/rad_galil/shared.lua index 246ab86..e92a431 100644 --- a/entities/weapons/rad_galil/shared.lua +++ b/entities/weapons/rad_galil/shared.lua @@ -1,13 +1,13 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = false - + SWEP.PrintName = "IMI Galil" SWEP.IconLetter = "v" SWEP.Slot = 4 diff --git a/entities/weapons/rad_glock/shared.lua b/entities/weapons/rad_glock/shared.lua index fd00c73..67c8f87 100644 --- a/entities/weapons/rad_glock/shared.lua +++ b/entities/weapons/rad_glock/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "Glock 19" SWEP.IconLetter = "c" SWEP.Slot = 2 SWEP.Slotpos = 2 - + end SWEP.HoldType = "pistol" diff --git a/entities/weapons/rad_grenade/shared.lua b/entities/weapons/rad_grenade/shared.lua index 516f491..fe05c4a 100644 --- a/entities/weapons/rad_grenade/shared.lua +++ b/entities/weapons/rad_grenade/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "HE Grenade" SWEP.IconLetter = "h" SWEP.Slot = 3 SWEP.Slotpos = 3 - + end SWEP.HoldType = "grenade" @@ -39,70 +39,70 @@ SWEP.Primary.Delay = 2.300 SWEP.Primary.ClipSize = 1 SWEP.Primary.Automatic = false -function SWEP:Think() +function SWEP:Think() if self.Owner:GetVelocity():Length() > 0 then - + if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then - + self.LastRunFrame = CurTime() + 0.3 - + end - + end - + if self.ThrowTime then - + if self.ThrowTime - 0.3 < CurTime() and not self.ThrowAnim then - - self.ThrowAnim = true - + + self.ThrowAnim = true + if self.ThrowPower > 1000 then - + self.Weapon:SendWeaponAnim( ACT_VM_THROW ) - + end - + end - + if self.ThrowTime < CurTime() then - + self.ThrowTime = nil self.ReloadTime = CurTime() + 0.75 - + if CLIENT then return end - + local tbl = item.GetByModel( "models/weapons/w_eq_fraggrenade_thrown.mdl" ) - - if self.Owner:HasItem( tbl.ID ) then - + + if self.Owner:HasItem( tbl.ID ) then + self.Owner:RemoveFromInventory( tbl.ID ) - + end - + local ent = ents.Create( "sent_grenade" ) ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetRight() * 5 + self.Owner:GetUp() * -5 ) ent:SetOwner( self.Owner ) ent:SetAngles( self.Owner:GetAimVector():Angle() ) ent:SetSpeed( self.ThrowPower ) ent:Spawn() - + if not self.Owner:HasItem( tbl.ID ) then - + self.Owner:StripWeapon( "rad_grenade" ) - + end - + end - + end - + if self.ReloadTime and self.ReloadTime < CurTime() then - + self.ReloadTime = nil - + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + end end @@ -113,7 +113,7 @@ function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:ShootEffects() - + self.ThrowTime = CurTime() + 1.25 self.ThrowAnim = false self.ThrowPower = 800 @@ -126,26 +126,25 @@ function SWEP:PrimaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:ShootEffects() - + self.ThrowTime = CurTime() + 1.25 self.ThrowAnim = false self.ThrowPower = 3000 - + end -function SWEP:ShootEffects() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - - self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + end - - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + end function SWEP:DrawHUD() end - diff --git a/entities/weapons/rad_incendiarygrenade/shared.lua b/entities/weapons/rad_incendiarygrenade/shared.lua index 3dda5dc..42e2723 100644 --- a/entities/weapons/rad_incendiarygrenade/shared.lua +++ b/entities/weapons/rad_incendiarygrenade/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "Incendiary Grenade" SWEP.IconLetter = "h" SWEP.Slot = 3 SWEP.Slotpos = 3 - + end SWEP.HoldType = "grenade" @@ -39,70 +39,70 @@ SWEP.Primary.Delay = 2.300 SWEP.Primary.ClipSize = 1 SWEP.Primary.Automatic = false -function SWEP:Think() +function SWEP:Think() if self.Owner:GetVelocity():Length() > 0 then - + if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then - + self.LastRunFrame = CurTime() + 0.3 - + end - + end - + if self.ThrowTime then - + if self.ThrowTime - 0.3 < CurTime() and not self.ThrowAnim then - - self.ThrowAnim = true - + + self.ThrowAnim = true + if self.ThrowPower > 1000 then - + self.Weapon:SendWeaponAnim( ACT_VM_THROW ) - + end - + end - + if self.ThrowTime < CurTime() then - + self.ThrowTime = nil self.ReloadTime = CurTime() + 0.75 - + if CLIENT then return end - + local tbl = item.GetByModel( "models/weapons/w_eq_flashbang.mdl" ) - - if self.Owner:HasItem( tbl.ID ) then - + + if self.Owner:HasItem( tbl.ID ) then + self.Owner:RemoveFromInventory( tbl.ID ) - + end - + local ent = ents.Create( "sent_grenade_incendiary" ) ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetRight() * 5 + self.Owner:GetUp() * -5 ) ent:SetOwner( self.Owner ) ent:SetAngles( self.Owner:GetAimVector():Angle() ) ent:SetSpeed( self.ThrowPower ) ent:Spawn() - + if not self.Owner:HasItem( tbl.ID ) then - + self.Owner:StripWeapon( "rad_incendiarygrenade" ) - + end - + end - + end - + if self.ReloadTime and self.ReloadTime < CurTime() then - + self.ReloadTime = nil - + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + end end @@ -113,7 +113,7 @@ function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:ShootEffects() - + self.ThrowTime = CurTime() + 1.25 self.ThrowAnim = false self.ThrowPower = 800 @@ -126,26 +126,25 @@ function SWEP:PrimaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:ShootEffects() - + self.ThrowTime = CurTime() + 1.25 self.ThrowAnim = false self.ThrowPower = 3000 - + end -function SWEP:ShootEffects() +function SWEP:ShootEffects() if SERVER then - - self.Owner:ViewBounce( self.Primary.Recoil ) - + + self.Owner:ViewBounce( self.Primary.Recoil ) + end - - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + end function SWEP:DrawHUD() end - diff --git a/entities/weapons/rad_inv/shared.lua b/entities/weapons/rad_inv/shared.lua index 50e7691..15510d4 100644 --- a/entities/weapons/rad_inv/shared.lua +++ b/entities/weapons/rad_inv/shared.lua @@ -1,19 +1,19 @@ if SERVER then AddCSLuaFile( "shared.lua" ) - + end if CLIENT then SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Quick Inventory" SWEP.IconLetter = "H" SWEP.Slot = 0 SWEP.Slotpos = 1 - + end SWEP.HoldType = "normal" @@ -39,13 +39,13 @@ SWEP.PanelSize = 80 function SWEP:Holster() if SERVER then return true end - + if self.Deployed then - + self.Deployed = false - + self.Weapon:RemovePanels() - + end return true @@ -54,33 +54,33 @@ end function SWEP:Deploy() - if SERVER then - + if SERVER then + self.Weapon:SetNWInt( "InvPos", 1 ) self.Weapon:SetNWBool( "Synch", false ) self.Weapon:SetNWBool( "UseMode", false ) - + self.Owner:SynchInventory() - - self.Owner:NoticeOnce( "Right click to scroll through your inventory", GAMEMODE.Colors.Blue, 5, 2 ) - self.Owner:NoticeOnce( "Left click to select an item and use it", GAMEMODE.Colors.Blue, 5, 4 ) - - return true - + + self.Owner:NoticeOnce( "Right click to scroll through your inventory", GAMEMODE.Colors.Blue, 5, 2 ) + self.Owner:NoticeOnce( "Left click to select an item and use it", GAMEMODE.Colors.Blue, 5, 4 ) + + return true + end - + if not self.Deployed then - + self.Deployed = true self.LastInv = Inv_Size() self.InvPos = 1 - + self.Weapon:GeneratePanels() - + end - - return true - + + return true + end function SWEP:GeneratePanels() @@ -88,42 +88,42 @@ function SWEP:GeneratePanels() self.InvPanels = {} self.YPosTbl = {} self.InvItems = Inv_UniqueItems() - + if Inv_Size() == 0 then return end - + for i=1, math.min( self.NumPanels, #self.InvItems ) do - + local id = self.Weapon:GetNWInt( "InvPos", 1 ) + i - 1 - + if id > #self.InvItems then - + id = math.Clamp( id - #self.InvItems, 1, #self.InvItems ) - + end - + local panel = vgui.Create( "ItemPanel" ) panel:SetItemTable( item.GetByID( self.InvItems[id] ) ) - + if i == 1 then - + panel:SetPos( -self.PanelSize, self.YPos ) panel:SetSize( self.PanelSize * 1.5, self.PanelSize * 1.5 ) panel:SetSizeOverride( self.PanelSize * 1.5 ) panel.YPos = self.YPos - + else - + panel:SetPos( -self.PanelSize, self.YPos + ( self.PanelSize * ( i - 1 ) ) + ( self.PanelSize * 1.5 ) + ( 5 * i ) ) panel:SetSize( self.PanelSize, self.PanelSize ) panel:SetSizeOverride( self.PanelSize ) panel.YPos = self.YPos + ( self.PanelSize * ( i - 2 ) ) + ( self.PanelSize * 1.5 ) + ( 5 * i ) - + end - + self.YPosTbl[i] = panel.YPos - + table.insert( self.InvPanels, panel ) - + end end @@ -132,35 +132,35 @@ function SWEP:AddPanel() // call after removing a panel local id = self.Weapon:GetNWInt( "InvPos", 1 ) - 1 local inv = Inv_UniqueItems() - + if id < 1 then - + id = #inv - + end local i = #self.InvPanels local tbl = item.GetByID( inv[id] ) - + local panel = vgui.Create( "ItemPanel" ) panel:SetItemTable( tbl ) panel:SetPos( -self.PanelSize, self.YPosTbl[ i + 1 ] ) panel:SetSize( self.PanelSize, self.PanelSize ) panel:SetSizeOverride( self.PanelSize ) panel.YPos = self.YPosTbl[ i + 1 ] - + table.insert( self.InvPanels, panel ) - + end function SWEP:RemovePanels() for k,v in pairs( self.InvPanels ) do - + v:Remove() - + end - + self.InvPanels = {} self.InvItems = {} self.YPosTbl = {} @@ -170,7 +170,7 @@ end function SWEP:RemovePanel() if not self.InvPanels[1] then return end - + self.InvPanels[1].Removal = true end @@ -178,9 +178,9 @@ end function SWEP:RemoveAllPanels() for k,v in pairs( self.InvPanels ) do - + v.Removal = true - + end end @@ -188,50 +188,50 @@ end function SWEP:SecondaryAttack() if CLIENT then return end - + self.Weapon:SetNextSecondaryFire( CurTime() + 0.3 ) - + if self.Weapon:GetNWBool( "UseMode", false ) then - + local inv = self.Owner:GetUniqueInventory() local pos = self.Weapon:GetNWInt( "InvPos", 1 ) local tbl = item.GetByID( inv[pos] ) - + self.Weapon:SetNWInt( "FuncPos", self.Weapon:GetNWInt( "FuncPos", 1 ) + 1 ) - + if tbl.Weapon then - + if self.Weapon:GetNWInt( "FuncPos", 1 ) > 2 then - + self.Weapon:SetNWInt( "FuncPos", 1 ) - + end - + return - + end - + if self.Weapon:GetNWInt( "FuncPos", 1 ) > ( #self.Functions + 2 ) then - + self.Weapon:SetNWInt( "FuncPos", 1 ) - + end - + else - + local size = #self.Owner:GetUniqueInventory() local pos = self.Weapon:GetNWInt( "InvPos", 1 ) + 1 - + if pos > size then - + pos = 1 - + end - + self.Weapon:SetNWInt( "InvPos", pos ) - + end - + self.Owner:ClientSound( self.Scroll ) end @@ -239,152 +239,152 @@ end function SWEP:PrimaryAttack() if CLIENT then return end - + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - + local inv = self.Owner:GetUniqueInventory() - local pos = self.Weapon:GetNWInt( "InvPos", 1 ) + local pos = self.Weapon:GetNWInt( "InvPos", 1 ) local tbl = item.GetByID( inv[pos] ) - + if not tbl then return end - + if self.Weapon:GetNWBool( "UseMode", false ) then local fpos = self.Weapon:GetNWInt( "FuncPos", 1 ) - + if tbl.Weapon then - + if fpos == 1 then - + self.Owner:ClientSound( self.Cancel ) - + else - + self.Functions[1]( self.Owner, tbl.ID ) - + end - + self.Weapon:SetNWBool( "UseMode", false ) self.Weapon:SetNWInt( "FuncPos", 1 ) self.Weapon:SetNWInt( "InvPos", 1 ) self.Weapon:Synch() - + return - + end - + if fpos == 1 then - + self.Owner:ClientSound( self.Cancel ) - + elseif fpos == 2 then - + self.Weapon:DropItem( tbl.ID, 1 ) - + else - + self.Functions[ fpos - 2 ]( self.Owner, tbl.ID ) - + end - + self.Weapon:SetNWBool( "UseMode", false ) self.Weapon:SetNWInt( "FuncPos", 1 ) self.Weapon:SetNWInt( "InvPos", 1 ) self.Weapon:Synch() - + else - + self.Weapon:SetNWBool( "UseMode", !self.Weapon:SetNWBool( "UseMode", false ) ) - + self.Functions = tbl.Functions - + self.Owner:ClientSound( self.Selection ) - + end - + end function SWEP:DropItem( id, count ) - + if not self.Owner:HasItem( id ) then return end - + local tbl = item.GetByID( id ) - + if count == 1 then - + if self.Owner:HasItem( id ) then - + local makeprop = true - + if tbl.DropFunction then - + makeprop = tbl.DropFunction( self.Owner, id, true ) - + end - + if makeprop then - + local prop = ents.Create( "prop_physics" ) prop:SetPos( self.Owner:GetItemDropPos() ) prop:SetAngles( self.Owner:GetAimVector():Angle() ) - prop:SetModel( tbl.Model ) + prop:SetModel( tbl.Model ) prop:SetCollisionGroup( COLLISION_GROUP_WEAPON ) prop:Spawn() prop.IsItem = true prop.Removal = CurTime() + 5 * 60 - + end - + self.Owner:RemoveFromInventory( id, true ) self.Owner:EmitSound( Sound( "items/ammopickup.wav" ) ) - + end - + return - + end - + local items = {} - + for i=1, count do - + if self.Owner:HasItem( id ) then - + table.insert( items, id ) - + end - + end - + local loot = ents.Create( "sent_lootbag" ) - + for k,v in pairs( items ) do - + loot:AddItem( v ) - + end - + loot:SetAngles( self.Owner:GetAimVector():Angle() ) loot:SetPos( self.Owner:GetItemDropPos() ) loot:SetRemoval( 60 * 5 ) loot:Spawn() - + self.Owner:EmitSound( Sound( "items/ammopickup.wav" ) ) self.Owner:RemoveMultipleFromInventory( items ) - + if tbl.DropFunction then - + tbl.DropFunction( self.Owner, id ) - + end end function SWEP:Synch() - umsg.Start( "InvSWEP", self.Owner ) + umsg.Start( "InvSWEP", self.Owner ) umsg.End() - + end function RecvSynch() @@ -394,68 +394,68 @@ function RecvSynch() end usermessage.Hook( "InvSWEP", RecvSynch ) -function SWEP:Think() +function SWEP:Think() if SERVER then return end - + if not self.Deployed then return end - + local removing = false - + if InvSWEPSynch or self.LastInv != Inv_Size() then - + removing = true InvSWEPSynch = false - + self.Weapon:RemoveAllPanels() - + end - + self.LastInv = Inv_Size() - + if #self.InvPanels < 1 then - + self.Weapon:GeneratePanels() - + end - + if removing then return end - + if self.Shuffle and #self.InvPanels < 5 then - + for k,v in pairs( self.InvPanels ) do - + v.YPos = self.YPosTbl[k] - + end - + self.Weapon:AddPanel() - + self.Shuffle = false - + end - + if self.InvPos != self.Weapon:GetNWInt( "InvPos", 1 ) then - + self.InvPos = self.Weapon:GetNWInt( "InvPos", 1 ) - + self.Weapon:RemovePanel() - + end - + end function SWEP:DrawOption( i, name ) surface.SetFont( "InventoryFont" ) - + local w,h = surface.GetTextSize( name ) local col = Color( 255, 255, 255 ) - + if i == self.Weapon:GetNWInt( "FuncPos", 1 ) then - + col = Color( 50, 255, 50 ) - + end draw.RoundedBox( 4, self.PanelSize * 1.5 + 20, 12 + ( i - 1 ) * 25, w + 8, h, Color( 0, 0, 0, 200 ) ) @@ -466,97 +466,97 @@ end function SWEP:DrawHUD() if self.Weapon:GetNWBool( "UseMode", false ) then - + local inv = Inv_UniqueItems() local tbl = item.GetByID( inv[ self.Weapon:GetNWInt( "InvPos", 1 ) ] ) - + if not tbl then return end - + if tbl.Weapon then - + self.Weapon:DrawOption( 1, "cancel" ) self.Weapon:DrawOption( 2, "drop" ) - + return - + end - + for i=1, #tbl.Functions + 2 do - + if i == 1 then - + self.Weapon:DrawOption( i, "cancel" ) - + elseif i == 2 then - + self.Weapon:DrawOption( i, "drop" ) - + else - + self.Weapon:DrawOption( i, string.lower( tbl.Functions[ i - 2 ]( 0, 0, true ) ) ) - + end - + end - + end - + for k,v in pairs( self.InvPanels or {} ) do - + v.LastX = math.Clamp( math.max( ( v.LastX or self.PanelSize + self.XPos ) - ( FrameTime() * 700 ), 1 ), 0, self.PanelSize + self.XPos ) v.LastY = math.Clamp( math.max( ( v.LastY or self.YPos ) - ( FrameTime() * 700 ), 1 ), 0, self.PanelSize + self.YPos ) - + if v.LastX != 0 or v.LastY != 0 then // automatically bring the panel into the screen - + v:SetPos( self.XPos - v.LastX, v.YPos - v.LastY ) - + if v.YPos == self.YPosTbl[1] then - + v:SetSize( self.PanelSize * 1.5, self.PanelSize * 1.5 ) v:SetSizeOverride( self.PanelSize * 1.5 ) - + end - + end - + if v.Removal then - + v.RemoveX = math.Clamp( ( v.RemoveX or self.XPos ) - ( FrameTime() * 700 ), -1 * ( self.PanelSize * 2 ), self.PanelSize + self.XPos ) - + if v.RemoveX != -1 * ( self.PanelSize * 2 ) then - + v:SetPos( v.RemoveX, v.YPos ) - + else - + v:Remove() - + table.remove( self.InvPanels, k ) - + local all = true - + for c,d in pairs( self.InvPanels ) do - + if not d.Removal then - + all = false - + end - + end - + if not all then - + self.Shuffle = true - + end - + break - + end - + end - + end - + end diff --git a/entities/weapons/rad_itemplacer/shared.lua b/entities/weapons/rad_itemplacer/shared.lua index 12dad13..6ae189d 100644 --- a/entities/weapons/rad_itemplacer/shared.lua +++ b/entities/weapons/rad_itemplacer/shared.lua @@ -1,11 +1,11 @@ if SERVER then AddCSLuaFile( "shared.lua" ) - + SWEP.Weight = 1 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false - + end if CLIENT then @@ -19,15 +19,15 @@ if CLIENT then SWEP.ViewModelFOV = 74 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Item Placement Tool" SWEP.Slot = 5 SWEP.Slotpos = 5 - + function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) - + end - + end SWEP.HoldType = "pistol" @@ -71,35 +71,35 @@ SWEP.SharedItems = {} function SWEP:Initialize() if SERVER then - + self.Weapon:SetWeaponHoldType( self.HoldType ) - + end - + end function SWEP:Synch() for k,v in pairs( self.ServersideItems ) do - + local ents = ents.FindByClass( v ) local postbl = {} - + for c,d in pairs( ents ) do - + table.insert( postbl, d:GetPos() ) - + end - + net.Start( "ItemPlacerSynch" ) net.WriteString( v ) net.WriteTable( postbl ) net.Send( self.Owner ) - + //local tbl = { Name = v, Ents = postbl } - + //datastream.StreamToClients( { self.Owner }, "ItemPlacerSynch", tbl ) - + end end @@ -120,51 +120,51 @@ datastream.Hook( "ItemPlacerSynch", PlacerSynch )]] function SWEP:Deploy() if SERVER then - + self.Weapon:Synch() - + end self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + return true - -end -function SWEP:Think() +end + +function SWEP:Think() if CLIENT then return end if self.Owner:KeyDown( IN_USE ) and ( ( self.NextDel or 0 ) < CurTime() ) then - + self.NextDel = CurTime() + 1 - + local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) ) - + local closest local dist = 1000 - + for k,v in pairs( ents.FindByClass( self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] ) ) do - + if v:GetPos():Distance( tr.HitPos ) < dist then - + dist = v:GetPos():Distance( tr.HitPos ) closest = v - + end - + end - + if IsValid( closest ) then - + closest:Remove() - + self.Owner:EmitSound( self.Primary.Delete1 ) - + self.Weapon:Synch() - + end - + end end @@ -172,17 +172,17 @@ end function SWEP:Reload() if CLIENT then return end - + for k,v in pairs( ents.FindByClass( self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] ) ) do - + v:Remove() - + end - + self.Weapon:Synch() - + self.Owner:EmitSound( self.Primary.Delete ) - + end function SWEP:Holster() @@ -191,21 +191,21 @@ function SWEP:Holster() end -function SWEP:ShootEffects() - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - - self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) - +function SWEP:ShootEffects() + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + end function SWEP:PlaceItem() local itemtype = self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] - + local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) ) - + local ent = ents.Create( itemtype ) ent:SetPos( tr.HitPos + tr.HitNormal * 5 ) ent:Spawn() @@ -218,13 +218,13 @@ function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire( CurTime() + 1 ) self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) self.Weapon:ShootEffects() - + if SERVER then - + self.Weapon:PlaceItem() - + self.Weapon:Synch() - + end end @@ -232,64 +232,62 @@ end function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + 0.5 ) - + self.Weapon:EmitSound( self.Primary.Swap ) - + if SERVER then - + self.Weapon:SetNWInt( "ItemType", self.Weapon:GetNWInt( "ItemType", 1 ) + 1 ) - + if self.Weapon:GetNWInt( "ItemType", 1 ) > #self.ItemTypes then - + self.Weapon:SetNWInt( "ItemType", 1 ) - + end - + end - + end function SWEP:DrawHUD() draw.SimpleText( "PRIMARY FIRE: Place Item SECONDARY FIRE: Change Item Type +USE: Delete Nearest Item Of Current Type RELOAD: Remove All Of Current Item Type", "AmmoFontSmall", ScrW() * 0.5, ScrH() - 120, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( "CURRENT ITEM TYPE: "..self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ], "AmmoFontSmall", ScrW() * 0.5, ScrH() - 100, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) - + for k,v in pairs( self.SharedItems ) do for c,d in pairs( ents.FindByClass( v ) ) do - + local pos = d:GetPos():ToScreen() - + if pos.visible then - + draw.SimpleText( v, "AmmoFontSmall", pos.x, pos.y - 15, Color(80,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.RoundedBox( 0, pos.x - 2, pos.y - 2, 4, 4, Color(255,255,255) ) - + end - + end - + end - + for k,v in pairs( ClientItemPlacerTbl ) do - + for c,d in pairs( v ) do - + local vec = Vector( d[1], d[2], d[3] ) - + local pos = vec:ToScreen() - + if pos.visible then - + draw.SimpleText( k, "AmmoFontSmall", pos.x, pos.y - 15, Color(80,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.RoundedBox( 0, pos.x - 2, pos.y - 2, 4, 4, Color(255,255,255) ) - + end - + end - - end - -end + end +end diff --git a/entities/weapons/rad_m1014/shared.lua b/entities/weapons/rad_m1014/shared.lua index 9d4ca65..2b176a5 100644 --- a/entities/weapons/rad_m1014/shared.lua +++ b/entities/weapons/rad_m1014/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "M1014 Shotgun" SWEP.IconLetter = "B" SWEP.Slot = 3 SWEP.Slotpos = 3 - + end SWEP.HoldType = "shotgun" @@ -45,64 +45,64 @@ function SWEP:Deploy() self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) if SERVER then - + self.Weapon:SetZoomMode( 1 ) - - end - + + end + self.InIron = false self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + return true - -end + +end function SWEP:CanPrimaryAttack() if self.HolsterMode or self.LastRunFrame > CurTime() then return false end - - if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then - + + if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then + self.Weapon:EmitSound( self.Primary.Empty ) - return false - + return false + end - + if self.Weapon:GetNWBool( "Reloading", false ) then - + self.Weapon:SetNWBool( "Reloading", false ) self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) - + return false - + end if self.Weapon:Clip1() <= 0 then - + self.Weapon:SetNWBool( "Reloading", true ) self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + return false - + end - + return true - + end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - return - + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) @@ -110,17 +110,17 @@ function SWEP:PrimaryAttack() self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) self.Weapon:TakePrimaryAmmo( 1 ) self.Weapon:ShootEffects() - + if self.Weapon:GetZoomMode() > 1 then - + self.Weapon:UnZoom() - + end - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end end @@ -128,73 +128,73 @@ end function SWEP:Reload() if self.HolsterMode or self.Weapon:Clip1() == self.Primary.ClipSize then return end - + if self.Weapon:Clip1() < self.Primary.ClipSize and not self.Weapon:GetNWBool( "Reloading", false ) then - + self.Weapon:SetNWBool( "Reloading", true ) self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + end - + end function SWEP:Think() if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then - + self.HolsterTime = CurTime() + 2 --[[self.HolsterMode = !self.HolsterMode - + if self.HolsterMode then - + self.Owner:SetLuaAnimation( self.HoldType ) - + else - + self.Owner:StopAllLuaAnimations( 0.5 ) - + end]] - + end if self.Weapon:GetNWBool( "Reloading", false ) then - + if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then - + // Finsished reload if self.Weapon:Clip1() >= self.Primary.ClipSize then - + self.Weapon:SetNWBool( "Reloading", false ) self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) - + return - + end - + // Next cycle self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) - + // Add ammo self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + end - + end if self.Owner:GetVelocity():Length() > 0 then - + if self.Owner:KeyDown( IN_SPEED ) then - + self.LastRunFrame = CurTime() + 0.3 - + end - + end end @@ -202,61 +202,61 @@ end function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) if SERVER then - + self.Owner:AddStat( "Bullets", 1 ) - + end local scale = aimcone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = aimcone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( aimcone / 1.25, 0, 10 ) - + end - + local tracer = 1 - + if ( zoommode or 1 ) > 1 then - + tracer = 0 - + end - + local bullet = {} bullet.Num = numbullets - bullet.Src = self.Owner:GetShootPos() - bullet.Dir = self.Owner:GetAimVector() - bullet.Spread = Vector( scale, scale, 0 ) + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) bullet.Tracer = 0 - bullet.Force = damage * 2 - bullet.Damage = damage + bullet.Force = damage * 2 + bullet.Damage = damage bullet.AmmoType = "Pistol" bullet.TracerName = tracername bullet.Callback = function ( attacker, tr, dmginfo ) - + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) - + if tr.Entity.NextBot then - + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) - + end - + if math.random(1,6) == 1 then - + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) - + end end - + self.Owner:FireBullets( bullet ) - + end function SWEP:DrawHUD() @@ -264,36 +264,36 @@ function SWEP:DrawHUD() if self.Weapon:ShouldNotDraw() then return end if not self.IsSniper and not self.Owner:GetNWBool( "InIron", false ) then - + local x = ScrW() * 0.5 local y = ScrH() * 0.5 local scalebywidth = ( ScrW() / 1024 ) * 10 local scale = self.Primary.Cone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = self.Primary.Cone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 ) - + end - + scale = scale * scalebywidth - + local dist = math.abs( self.CrosshairScale - scale ) self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) - + local gap = 40 * self.CrosshairScale local length = gap + self.CrossLength:GetInt() - + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) - + end - + end diff --git a/entities/weapons/rad_m249/shared.lua b/entities/weapons/rad_m249/shared.lua index 7e72cd2..96a4830 100644 --- a/entities/weapons/rad_m249/shared.lua +++ b/entities/weapons/rad_m249/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = false - + SWEP.PrintName = "M249 SAW" SWEP.IconLetter = "z" SWEP.Slot = 4 SWEP.Slotpos = 2 - + end SWEP.HoldType = "ar2" @@ -37,4 +37,3 @@ SWEP.Primary.Delay = 0.090 SWEP.Primary.ClipSize = 100 SWEP.Primary.Automatic = true - diff --git a/entities/weapons/rad_mac10/shared.lua b/entities/weapons/rad_mac10/shared.lua index 3e95b6e..b69d53b 100644 --- a/entities/weapons/rad_mac10/shared.lua +++ b/entities/weapons/rad_mac10/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "MAC 10" SWEP.IconLetter = "l" SWEP.Slot = 3 SWEP.Slotpos = 2 - + end SWEP.HoldType = "revolver" diff --git a/entities/weapons/rad_mp5/shared.lua b/entities/weapons/rad_mp5/shared.lua index e41ef49..b5e3025 100644 --- a/entities/weapons/rad_mp5/shared.lua +++ b/entities/weapons/rad_mp5/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "HK MP5" SWEP.IconLetter = "x" SWEP.Slot = 3 SWEP.Slotpos = 2 - + end SWEP.HoldType = "smg" diff --git a/entities/weapons/rad_p228/shared.lua b/entities/weapons/rad_p228/shared.lua index 56c1415..9a21f5b 100644 --- a/entities/weapons/rad_p228/shared.lua +++ b/entities/weapons/rad_p228/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "P228 Compact" SWEP.IconLetter = "y" SWEP.Slot = 2 SWEP.Slotpos = 2 - + end SWEP.HoldType = "pistol" diff --git a/entities/weapons/rad_p90/shared.lua b/entities/weapons/rad_p90/shared.lua index 2055466..7525436 100644 --- a/entities/weapons/rad_p90/shared.lua +++ b/entities/weapons/rad_p90/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "FN P90" SWEP.IconLetter = "l" SWEP.Slot = 3 SWEP.Slotpos = 2 - + end SWEP.HoldType = "rpg" diff --git a/entities/weapons/rad_revolver/shared.lua b/entities/weapons/rad_revolver/shared.lua index 2b34184..d6bcce5 100644 --- a/entities/weapons/rad_revolver/shared.lua +++ b/entities/weapons/rad_revolver/shared.lua @@ -1,19 +1,19 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Colt Python" SWEP.IconLetter = "f" SWEP.Slot = 2 SWEP.Slotpos = 1 - + end SWEP.HoldType = "revolver" @@ -41,31 +41,31 @@ SWEP.Primary.Delay = 0.850 SWEP.Primary.ClipSize = 6 SWEP.Primary.Automatic = false -function SWEP:ShootEffects() +function SWEP:ShootEffects() if SERVER then - - self.Owner:ViewBounce( self.Primary.Recoil ) - + + self.Owner:ViewBounce( self.Primary.Recoil ) + end - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - - self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) - + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + if CLIENT then return end - local tbl = self.ShellSounds[ ( self.Primary.ShellType or 1 ) ] + local tbl = self.ShellSounds[ ( self.Primary.ShellType or 1 ) ] local pos = self.Owner:GetPos() - + //timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl.Wavs ), pos, 75, tbl.Pitch ) end ) - + --[[local ed = EffectData() ed:SetOrigin( self.Owner:GetShootPos() ) ed:SetEntity( self.Weapon ) ed:SetAttachment( self.Weapon:LookupAttachment( "2" ) ) ed:SetScale( ( self.Primary.ShellType or SHELL_9MM ) ) util.Effect( "weapon_shell", ed, true, true )]] - -end
\ No newline at end of file + +end diff --git a/entities/weapons/rad_scout/shared.lua b/entities/weapons/rad_scout/shared.lua index d7fa4d0..6fafaca 100644 --- a/entities/weapons/rad_scout/shared.lua +++ b/entities/weapons/rad_scout/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "Steyr Scout" SWEP.IconLetter = "n" SWEP.Slot = 2 SWEP.Slotpos = 2 - + end SWEP.HoldType = "ar2" diff --git a/entities/weapons/rad_sg552/shared.lua b/entities/weapons/rad_sg552/shared.lua index 9d22ef2..393ab68 100644 --- a/entities/weapons/rad_sg552/shared.lua +++ b/entities/weapons/rad_sg552/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "SG 552" SWEP.IconLetter = "A" SWEP.Slot = 4 SWEP.Slotpos = 2 - + end SWEP.HoldType = "ar2" @@ -45,13 +45,13 @@ SWEP.Primary.Automatic = true function SWEP:SetZoomMode( num ) if num > 2 then - + num = 1 self.Weapon:UnZoom() - + end - + self.Weapon:SetNWInt( "Mode", num ) self.Owner:SetFOV( self.ZoomModes[num], self.ZoomSpeeds[num] ) @@ -59,39 +59,39 @@ end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) - - return - + + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) self.Weapon:ShootEffects() - + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) - + else - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) - + end - + --[[if self.Weapon:GetZoomMode() > 1 then - + self.Weapon:UnZoom() - + end]] - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end end @@ -99,49 +99,49 @@ end function SWEP:DrawHUD() if self.Weapon:ShouldNotDraw() then return end - + local mode = self.Weapon:GetZoomMode() local cone = self.Primary.Cone local scale = cone - + if mode == 1 then - + cone = self.Primary.SniperCone scale = cone - + end local x = ScrW() * 0.5 local y = ScrH() * 0.5 local scalebywidth = ( ScrW() / 1024 ) * 10 - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = cone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( cone / 1.75, 0, 10 ) - + end - + scale = scale * scalebywidth - + local dist = math.abs( self.CrosshairScale - scale ) self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) - + local gap = 40 * self.CrosshairScale local length = gap + self.CrossLength:GetInt() //20 * self.CrosshairScale - + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) - + if mode != 1 then - + local w = ScrW() local h = ScrH() local wr = ( h / 3 ) * 4 @@ -149,11 +149,11 @@ function SWEP:DrawHUD() surface.SetTexture( surface.GetTextureID( "gmod/scope" ) ) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawTexturedRect( ( w / 2 ) - wr / 2, 0, wr, h ) - + surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawRect( 0, 0, ( w / 2 ) - wr / 2, h ) surface.DrawRect( ( w / 2 ) + wr / 2, 0, w - ( ( w / 2 ) + wr / 2 ), h ) - + end - -end
\ No newline at end of file + +end diff --git a/entities/weapons/rad_shotgun/shared.lua b/entities/weapons/rad_shotgun/shared.lua index d754462..6b424dd 100644 --- a/entities/weapons/rad_shotgun/shared.lua +++ b/entities/weapons/rad_shotgun/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "Winchester 1887" SWEP.IconLetter = "k" SWEP.Slot = 3 SWEP.Slotpos = 3 - + end SWEP.HoldType = "shotgun" @@ -47,85 +47,85 @@ function SWEP:Deploy() self.Weapon:SetNWBool( "Reloading", false ) self.Weapon:SetVar( "PumpTime", 0 ) self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) - + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + return true - -end + +end function SWEP:CanPrimaryAttack() if self.HolsterMode or self.LastRunFrame > CurTime() then return false end - - if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then - + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then + self.Weapon:EmitSound( self.Primary.Empty ) - return false - + return false + end - + if self.Weapon:GetNWBool( "Reloading", false ) then - + self.Weapon:SetNWBool( "Reloading", false ) self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) - + return false - + end if self.Weapon:Clip1() <= 0 then - + self.Weapon:SetNWBool( "Reloading", true ) self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + return false - + end - + return true - + end -function SWEP:ShootEffects() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - + end - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - - self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) - + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + if self.UseShellSounds then - + local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 ) local tbl = self.BuckshotShellSounds local pos = self.Owner:GetPos() - + timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end ) - + end - + end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - return - + return + end - + self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) @@ -133,11 +133,11 @@ function SWEP:PrimaryAttack() self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) self.Weapon:TakePrimaryAmmo( 1 ) self.Weapon:ShootEffects() - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end end @@ -145,17 +145,17 @@ end function SWEP:Reload() if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end - + if self.Weapon:Clip1() < self.Primary.ClipSize then - + self.Weapon:SetNWBool( "Reloading", true ) self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + end - + end function SWEP:PumpIt() @@ -164,70 +164,70 @@ function SWEP:PumpIt() self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP ) self.Weapon:EmitSound( self.Primary.Pump ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) - + end function SWEP:Think() if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then - + self.HolsterTime = CurTime() + 2 self.HolsterMode = !self.HolsterMode - + if self.HolsterMode then - + self.Owner:SetLuaAnimation( self.HoldType ) - + else - + self.Owner:StopAllLuaAnimations( 0.5 ) - + end - + end if self.Weapon:GetVar( "PumpTime", 0 ) != 0 and self.Weapon:GetVar( "PumpTime", 0 ) < CurTime() then - + self.Weapon:SetVar( "PumpTime", 0 ) self.Weapon:PumpIt() - + end if self.Weapon:GetNWBool( "Reloading", false ) then - + if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then - + // Finsished reload if self.Weapon:Clip1() >= self.Primary.ClipSize then - + self.Weapon:SetNWBool( "Reloading", false ) self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) - + return - + end - + // Next cycle self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) - + // Add ammo self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + end - + end if self.Owner:GetVelocity():Length() > 0 then - + if self.Owner:KeyDown( IN_SPEED ) then - + self.LastRunFrame = CurTime() + 0.3 - + end - + end end @@ -235,53 +235,53 @@ end function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) if SERVER then - + self.Owner:AddStat( "Bullets", 1 ) - + end local scale = aimcone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = aimcone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( aimcone / 1.25, 0, 10 ) - + end - + local bullet = {} bullet.Num = numbullets - bullet.Src = self.Owner:GetShootPos() - bullet.Dir = self.Owner:GetAimVector() - bullet.Spread = Vector( scale, scale, 0 ) + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) bullet.Tracer = 0 - bullet.Force = damage * 2 - bullet.Damage = damage + bullet.Force = damage * 2 + bullet.Damage = damage bullet.AmmoType = "Pistol" bullet.TracerName = tracername bullet.Callback = function ( attacker, tr, dmginfo ) - + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) - + if tr.Entity.NextBot then - + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) - + end - + if math.random(1,6) == 1 then - + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) - + end end - + self.Owner:FireBullets( bullet ) - + end function SWEP:DrawHUD() @@ -292,29 +292,29 @@ function SWEP:DrawHUD() local y = ScrH() * 0.5 local scalebywidth = ( ScrW() / 1024 ) * 10 local scale = self.Primary.Cone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = self.Primary.Cone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 ) - + end - + scale = scale * scalebywidth - + local dist = math.abs( self.CrosshairScale - scale ) self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) - + local gap = 40 * self.CrosshairScale local length = gap + self.CrossLength:GetInt() - + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) - + end diff --git a/entities/weapons/rad_spas12/shared.lua b/entities/weapons/rad_spas12/shared.lua index c3bcfb7..432ed09 100644 --- a/entities/weapons/rad_spas12/shared.lua +++ b/entities/weapons/rad_spas12/shared.lua @@ -1,19 +1,19 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFOV = 55 SWEP.ViewModelFlip = false - + SWEP.PrintName = "SPAS-12" SWEP.IconLetter = "k" SWEP.Slot = 3 SWEP.Slotpos = 3 - + end SWEP.HoldType = "shotgun" @@ -53,89 +53,89 @@ function SWEP:Deploy() self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) if SERVER then - + self.Weapon:SetZoomMode( 1 ) - + end self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + return true - -end + +end function SWEP:CanPrimaryAttack() if self.HolsterMode or self.LastRunFrame > CurTime() then return false end - - if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then - + + if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then + self.Weapon:EmitSound( self.Primary.Empty ) - return false - + return false + end - + if self.Weapon:GetNWBool( "Reloading", false ) then - + self.Weapon:SetNWBool( "Reloading", false ) self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) - + return false - + end if self.Weapon:Clip1() <= 0 and not self.Weapon:GetNWBool( "Reloading", false ) then - + self.Weapon:SetNWBool( "Reloading", true ) self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + return false - + end - + return true - + end -function SWEP:ShootEffects() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - + end - - self.Owner:MuzzleFlash() - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - - self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) - + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + if self.UseShellSounds then - + local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 ) local tbl = self.BuckshotShellSounds local pos = self.Owner:GetPos() - + timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end ) - + end - + end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - return - + return + end - + self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) @@ -143,11 +143,11 @@ function SWEP:PrimaryAttack() self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) self.Weapon:TakePrimaryAmmo( 1 ) self.Weapon:ShootEffects() - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end end @@ -155,18 +155,18 @@ end function SWEP:Reload() if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end - + if self.Weapon:Clip1() < self.Primary.ClipSize then - + self.Weapon:SetNWBool( "Reloading", true ) self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) - + //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + end - + end function SWEP:PumpIt() @@ -175,73 +175,73 @@ function SWEP:PumpIt() self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP ) self.Weapon:EmitSound( self.Primary.Pump ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) - + end function SWEP:Think() if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then - + self.HolsterTime = CurTime() + 2 self.HolsterMode = !self.HolsterMode - + --[[if self.HolsterMode then - + self.Owner:SetLuaAnimation( self.HoldType ) - + else - + self.Owner:StopAllLuaAnimations( 0.5 ) - + end]] - + end if self.Weapon:GetVar( "PumpTime", 0 ) != 0 and self.Weapon:GetVar( "PumpTime", 0 ) < CurTime() then - + self.Weapon:SetVar( "PumpTime", 0 ) self.Weapon:PumpIt() - + end if self.Weapon:GetNWBool( "Reloading", false ) then - + if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then - + // Finsished reload if self.Weapon:Clip1() >= self.Primary.ClipSize then - + self.Weapon:SetNWBool( "Reloading", false ) self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) - + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) - + return - + end - + // Next cycle self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) - + // Add ammo self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) - + // Sound self.Weapon:EmitSound( self.Primary.ReloadSound, 100, math.random(90,110) ) - + end - + end if self.Owner:GetVelocity():Length() > 0 then - + if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then - + self.LastRunFrame = CurTime() + 0.3 - + end - + end end @@ -249,61 +249,61 @@ end function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) if SERVER then - + self.Owner:AddStat( "Bullets", 1 ) - + end local scale = aimcone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = aimcone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( aimcone / 1.25, 0, 10 ) - + end - + local tracer = 1 - + if ( zoommode or 1 ) > 1 then - + tracer = 0 - + end - + local bullet = {} bullet.Num = numbullets - bullet.Src = self.Owner:GetShootPos() - bullet.Dir = self.Owner:GetAimVector() - bullet.Spread = Vector( scale, scale, 0 ) + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) bullet.Tracer = 0 - bullet.Force = damage * 2 - bullet.Damage = damage + bullet.Force = damage * 2 + bullet.Damage = damage bullet.AmmoType = "Pistol" bullet.TracerName = tracername bullet.Callback = function ( attacker, tr, dmginfo ) - + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) - + if tr.Entity.NextBot then - + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) - + end - + if math.random(1,6) == 1 then - + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) - + end end - + self.Owner:FireBullets( bullet ) - + end function SWEP:DrawHUD() @@ -314,29 +314,29 @@ function SWEP:DrawHUD() local y = ScrH() * 0.5 local scalebywidth = ( ScrW() / 1024 ) * 10 local scale = self.Primary.Cone - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = self.Primary.Cone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 ) - + end - + scale = scale * scalebywidth - + local dist = math.abs( self.CrosshairScale - scale ) self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) - + local gap = 40 * self.CrosshairScale local length = gap + self.CrossLength:GetInt() - + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) - + end diff --git a/entities/weapons/rad_tmp/shared.lua b/entities/weapons/rad_tmp/shared.lua index f0a794a..0653b17 100644 --- a/entities/weapons/rad_tmp/shared.lua +++ b/entities/weapons/rad_tmp/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "TMP" SWEP.IconLetter = "x" SWEP.Slot = 3 SWEP.Slotpos = 2 - + end SWEP.HoldType = "rpg" diff --git a/entities/weapons/rad_ump45/shared.lua b/entities/weapons/rad_ump45/shared.lua index b8191ca..6f232d1 100644 --- a/entities/weapons/rad_ump45/shared.lua +++ b/entities/weapons/rad_ump45/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "HK UMP45" SWEP.IconLetter = "q" SWEP.Slot = 3 SWEP.Slotpos = 2 - + end SWEP.HoldType = "smg" diff --git a/entities/weapons/rad_usp/shared.lua b/entities/weapons/rad_usp/shared.lua index 91db700..ea321a3 100644 --- a/entities/weapons/rad_usp/shared.lua +++ b/entities/weapons/rad_usp/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "USP Compact" SWEP.IconLetter = "a" SWEP.Slot = 2 SWEP.Slotpos = 2 - + end SWEP.HoldType = "pistol" diff --git a/entities/weapons/rad_z_banshee/shared.lua b/entities/weapons/rad_z_banshee/shared.lua index 00e881a..eae8fd9 100644 --- a/entities/weapons/rad_z_banshee/shared.lua +++ b/entities/weapons/rad_z_banshee/shared.lua @@ -1,21 +1,21 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Claws" SWEP.IconLetter = "C" SWEP.Slot = 0 SWEP.Slotpos = 0 - + killicon.AddFont( "rad_z_banshee", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) - + end SWEP.Base = "rad_z_base" @@ -49,11 +49,11 @@ end function SWEP:Holster() if SERVER then - + self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(40,60) ) - + end - + return true end @@ -61,57 +61,57 @@ end function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + 8 ) - + if SERVER then - + self.Owner:VoiceSound( self.Taunt, 100, math.random( 90, 100 ) ) - + local hit = false - + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do - + local dist = v:GetPos():Distance( self.Owner:GetPos() ) - + if dist <= 350 then - + local scale = 1 - ( dist / 350 ) local count = math.Round( scale * 4 ) - + umsg.Start( "Drunk", v ) umsg.Short( count ) umsg.End() umsg.Start( "ScreamHit", v ) umsg.End() - + v:TakeDamage( scale * 20, self.Owner, self.Weapon ) v:SetDSP( 34, false ) - + self.Owner:AddZedDamage( 5 ) - + hit = true - + end - + end - + if hit then - + self.Owner:Notice( "You disoriented a human", GAMEMODE.Colors.Green ) - + end - + end end function SWEP:PrimaryAttack() - + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(130,150) ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) - + self.ThinkTime = CurTime() + ( self.Primary.Delay * 0.3 ) - + end function SWEP:OnHitHuman( ent, dmg ) @@ -119,13 +119,13 @@ function SWEP:OnHitHuman( ent, dmg ) if ent:GetRadiation() != 5 then ent:AddRadiation( 1 ) - + self.Owner:AddZedDamage( 10 ) - + end - + self.Owner:AddZedDamage( dmg ) self.Owner:DrawBlood( 4 ) self.Owner:Notice( "You irradiated a human", GAMEMODE.Colors.Green ) -end
\ No newline at end of file +end diff --git a/entities/weapons/rad_z_base/shared.lua b/entities/weapons/rad_z_base/shared.lua index 0748b8d..3ccbcf0 100644 --- a/entities/weapons/rad_z_base/shared.lua +++ b/entities/weapons/rad_z_base/shared.lua @@ -1,21 +1,21 @@ if SERVER then AddCSLuaFile( "shared.lua" ) - + end if CLIENT then SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Claws" SWEP.IconLetter = "C" SWEP.Slot = 0 SWEP.Slotpos = 0 - + killicon.AddFont( "rad_z_common", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ); - + end SWEP.HoldType = "slam" @@ -44,7 +44,7 @@ SWEP.Primary.Automatic = true function SWEP:GetViewModelPosition( pos, ang ) return pos, ang - + end function SWEP:NoobHelp() @@ -56,13 +56,13 @@ end function SWEP:Deploy() self.Owner:DrawWorldModel( false ) - + if SERVER then - + self.Weapon:NoobHelp() - + end - + return true end @@ -70,11 +70,11 @@ end function SWEP:Holster() if SERVER then - - self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) ) - + + self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) ) + end - + return true end @@ -82,32 +82,32 @@ end function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + 2.5 ) - + if SERVER then - + self.Owner:VoiceSound( table.Random( self.Taunt ), 100, math.random( 90, 100 ) ) - + end end function SWEP:PrimaryAttack() - + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(90,110) ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) - + self.ThinkTime = CurTime() + ( self.Primary.Delay * 0.3 ) - + end -function SWEP:Think() +function SWEP:Think() if self.ThinkTime != 0 and self.ThinkTime < CurTime() then - + self.Weapon:MeleeTrace( self.Primary.Damage ) - + self.ThinkTime = 0 - + end end @@ -115,40 +115,40 @@ end function SWEP:OnHitHuman( ent, dmg ) if not ent:IsInfected() then - + ent:SetInfected( true ) - + self.Owner:Notice( "You infected a human", GAMEMODE.Colors.Green ) self.Owner:AddZedDamage( 15 ) - + end - + self.Owner:AddZedDamage( dmg ) self.Owner:DrawBlood( 3 ) - + end function SWEP:MeleeTrace( dmg ) - + self.Owner:SetAnimation( PLAYER_ATTACK1 ) - + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) - + if CLIENT then return end - + self.Weapon:SetNWString( "CurrentAnim", "zattack" .. math.random(1,3) ) self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) - + local pos = self.Owner:GetShootPos() local aim = self.Owner:GetAimVector() * 80 - + local line = {} line.start = pos line.endpos = pos + aim line.filter = self.Owner - + local linetr = util.TraceLine( line ) - + local tr = {} tr.start = pos + self.Owner:GetAimVector() * -5 tr.endpos = pos + aim @@ -160,54 +160,54 @@ function SWEP:MeleeTrace( dmg ) local trace = util.TraceHull( tr ) local ent = trace.Entity local ent2 = linetr.Entity - + if not IsValid( ent ) and IsValid( ent2 ) then - + ent = ent2 - + end - if not IsValid( ent ) then - + if not IsValid( ent ) then + self.Owner:EmitSound( self.Primary.Miss, 100, math.random(90,110) ) - - return - + + return + elseif not ent:IsWorld() then - + if ent:IsPlayer() and ent:Team() == TEAM_ARMY then - + ent:TakeDamage( dmg, self.Owner, self.Weapon ) ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) - + self.Weapon:OnHitHuman( ent, dmg ) - + local ed = EffectData() ed:SetOrigin( trace.HitPos ) util.Effect( "BloodImpact", ed, true, true ) - + elseif string.find( ent:GetClass(), "npc" ) then - + ent:TakeDamage( 20, self.Owner, self.Weapon ) ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) - - elseif !ent:IsPlayer() then - + + elseif !ent:IsPlayer() then + if ent:GetClass() == "prop_door_rotating" then - + if not ent.Hits then - + ent.Hits = 1 ent.MaxHits = math.random(5,10) - + ent:EmitSound( Sound( "Wood_Plank.Break" ) ) - + else - + ent.Hits = ent.Hits + 1 - + if ent.Hits > ent.MaxHits then - + local prop = ents.Create( "prop_physics" ) prop:SetPos( ent:GetPos() ) prop:SetAngles( ent:GetAngles() + Angle(10,0,2) ) @@ -215,75 +215,75 @@ function SWEP:MeleeTrace( dmg ) prop:SetSkin( ent:GetSkin() ) prop:SetCollisionGroup( COLLISION_GROUP_WEAPON ) prop:Spawn() - - local dir = ent:GetPos() - self.Owner:GetShootPos() + + local dir = ent:GetPos() - self.Owner:GetShootPos() dir:Normalize() - + local phys = prop:GetPhysicsObject() - + if IsValid( phys ) then - + phys:ApplyForceCenter( dir * phys:GetMass() * 800 ) end - + ent:EmitSound( Sound( "Wood_Crate.Break" ) ) ent:Remove() - + return - + else - + ent:EmitSound( Sound( "Wood_Plank.Break" ) ) - + end - + end - + elseif string.find( ent:GetClass(), "breakable" ) then - + ent:TakeDamage( 50, self.Owner, self.Weapon ) ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) - + if ent:GetClass() == "func_breakable_surf" then - + ent:Fire( "shatter", "1 1 1", 0 ) - + return - + end - + end - + local phys = ent:GetPhysicsObject() - + if IsValid( phys ) then - + ent:SetPhysicsAttacker( self.Owner ) ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) - + if ent.IsWood then - + ent:TakeDamage( 75, self.Owner, self.Weapon ) ent:EmitSound( self.Primary.Door ) - + else - + ent:TakeDamage( 25, self.Owner, self.Weapon ) - + end - + phys:Wake() phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 400 ) - + end - + end - + end end function SWEP:DrawHUD() - + end diff --git a/entities/weapons/rad_z_contagion/shared.lua b/entities/weapons/rad_z_contagion/shared.lua index 0bfb142..ace303b 100644 --- a/entities/weapons/rad_z_contagion/shared.lua +++ b/entities/weapons/rad_z_contagion/shared.lua @@ -1,21 +1,21 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Claws" SWEP.IconLetter = "C" SWEP.Slot = 0 SWEP.Slotpos = 0 - + killicon.AddFont( "rad_z_contagion", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) - + end SWEP.Base = "rad_z_base" @@ -59,7 +59,7 @@ end function SWEP:OnHitHuman( ent, dmg ) ent:ViewBounce( 20 ) - + self.Owner:AddZedDamage( dmg ) self.Owner:DrawBlood( 5 ) diff --git a/entities/weapons/rad_z_leaper/shared.lua b/entities/weapons/rad_z_leaper/shared.lua index e123b48..ee4db39 100644 --- a/entities/weapons/rad_z_leaper/shared.lua +++ b/entities/weapons/rad_z_leaper/shared.lua @@ -1,21 +1,21 @@ if SERVER then AddCSLuaFile( "shared.lua" ) - + end if CLIENT then SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Claws" SWEP.IconLetter = "C" SWEP.Slot = 0 SWEP.Slotpos = 0 - + killicon.AddFont( "rad_z_leaper", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) - + end SWEP.Base = "rad_z_base" @@ -53,28 +53,28 @@ function SWEP:NoobHelp() end -function SWEP:Think() +function SWEP:Think() if self.ThinkTime != 0 and self.ThinkTime < CurTime() then - + self.Weapon:MeleeTrace( self.Primary.Damage ) - + self.ThinkTime = 0 - + end - + if CLIENT then return end - + if self.JumpTime < CurTime() and self.Owner:KeyDown( IN_SPEED ) then - + local vec = self.Owner:GetAimVector() vec.z = math.Clamp( vec.z, 0.40, 0.75 ) - + self.JumpTime = CurTime() + 8 - + self.Owner:SetVelocity( vec * 800 ) self.Owner:EmitSound( self.Scream, 100, math.random( 90, 110 ) ) - + end end @@ -84,13 +84,13 @@ function SWEP:OnHitHuman( ent, dmg ) if not ent:IsBleeding() then ent:SetBleeding( true ) - + self.Owner:Notice( "You made a human bleed", GAMEMODE.Colors.Green ) self.Owner:AddZedDamage( 10 ) - + end - + self.Owner:AddZedDamage( dmg ) self.Owner:DrawBlood( 5 ) - + end diff --git a/entities/weapons/rad_z_runner/shared.lua b/entities/weapons/rad_z_runner/shared.lua index feeae59..a9e766f 100644 --- a/entities/weapons/rad_z_runner/shared.lua +++ b/entities/weapons/rad_z_runner/shared.lua @@ -1,21 +1,21 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false - + SWEP.PrintName = "Claws" SWEP.IconLetter = "C" SWEP.Slot = 0 SWEP.Slotpos = 0 - + killicon.AddFont( "rad_z_runner", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ); - + end SWEP.HoldType = "slam" |
