diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
| commit | 2736f498f30220b858fc6fac23e7ddc4a597df6d (patch) | |
| tree | 374ceadedb654b00e09dac321620a8320830f734 /entities | |
| download | redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.gz redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.bz2 redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.zip | |
Inital commit
Diffstat (limited to 'entities')
141 files changed, 14092 insertions, 0 deletions
diff --git a/entities/effects/barrel_gib/init.lua b/entities/effects/barrel_gib/init.lua new file mode 100644 index 0000000..f635312 --- /dev/null +++ b/entities/effects/barrel_gib/init.lua @@ -0,0 +1,42 @@ + +function EFFECT:Init( data ) + + self.Entity:SetModel( table.Random( GAMEMODE.BarrelGibs ) ) + + self.Entity:PhysicsInit( SOLID_VPHYSICS ) + //self.Entity:SetMaterial( "models/flesh" ) + + self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS ) + self.Entity:SetCollisionBounds( Vector( -128 -128, -128 ), Vector( 128, 128, 128 ) ) + self.Entity:SetAngles( Angle( math.Rand(0,360), math.Rand(0,360), math.Rand(0,360) ) ) + + local phys = self.Entity:GetPhysicsObject() + + if IsValid( phys ) then + + local vec = VectorRand() + vec.z = math.Clamp( vec.z, -0.4, 0.8 ) + + phys:Wake() + phys:SetMass( 100 ) + phys:AddAngleVelocity( VectorRand() * 500 ) + phys:SetVelocity( vec * math.Rand( 100, 200 ) ) + + end + + self.LifeTime = CurTime() + 15 + +end + +function EFFECT:Think( ) + + return self.LifeTime > CurTime() + +end + +function EFFECT:Render() + + self.Entity:DrawModel() + +end + diff --git a/entities/effects/biohazard/init.lua b/entities/effects/biohazard/init.lua new file mode 100644 index 0000000..8af6357 --- /dev/null +++ b/entities/effects/biohazard/init.lua @@ -0,0 +1,95 @@ + +EFFECT.Color = Color(100,80,0) + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = 0 + + local pos = data:GetOrigin() + Vector(0,0,10) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 10 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 250 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 ) + particle:SetGravity( Vector( 0, 0, -400 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random( 1, 2 ), pos + Vector( 0, 0, math.random( -10, 10 ) ) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "yellowblood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + +end + +function EFFECT:Think() + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + 0.5 + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/body_gib/init.lua b/entities/effects/body_gib/init.lua new file mode 100644 index 0000000..d433bce --- /dev/null +++ b/entities/effects/body_gib/init.lua @@ -0,0 +1,142 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = CurTime() + math.Rand( 0.2, 1.0 ) + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + self.Normal = data:GetNormal() + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 6.0, 8.0 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 150, 200 ) ) + particle:SetEndSize( 200 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -5 ) ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 12 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 250 + ( self.Normal * ( i * 10 ) ) ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 40, 0, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "Blood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 8 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) ) + + if i < 4 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + + if LocalPlayer():GetPos():Distance( pos ) <= 300 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 300 ) + + for i=1, math.Round( frac * 6 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + math.Rand( 0.2, 0.6 ) + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end + diff --git a/entities/effects/bomb_explosion/init.lua b/entities/effects/bomb_explosion/init.lua new file mode 100644 index 0000000..459c3bd --- /dev/null +++ b/entities/effects/bomb_explosion/init.lua @@ -0,0 +1,138 @@ + +local matRefraction = Material( "refract_ring" ) + +function EFFECT:Init( data ) + + self.Entity:SetRenderBounds( Vector() * -1024, Vector() * 1024 ) + + self.Pos = data:GetOrigin() + self.Norm = data:GetNormal() + self.Emitter = ParticleEmitter( self.Pos ) + self.DieTime = CurTime() + 5 + + for i=1, math.random(3,6) do + + local vec = self.Norm + VectorRand() * 0.7 + vec.x = math.Clamp( vec.x, -1.0, 0 ) + + local particle = self.Emitter:Add( "effects/fire_cloud2", self.Pos ) + + particle:SetVelocity( vec * math.random( 400, 600 ) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 5 ) + particle:SetEndSize( 0 ) + particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 ) + + particle:SetGravity( Vector( 0, 0, math.random( -700, -500 ) ) ) + particle:SetAirResistance( math.random( 20, 60 ) ) + particle:SetCollide( true ) + + particle:SetLifeTime( 0 ) + particle:SetThinkFunction( CloudThink ) + particle:SetNextThink( CurTime() + 0.1 ) + + end + + for i=1, 15 do + + local particle = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos ) + + particle:SetVelocity( self.Norm * math.random(50,100) + VectorRand() * math.random(50,100) ) + particle:SetDieTime( 0.7 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 20, 40 ) ) + particle:SetEndSize( math.Rand( 100, 200 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.2, 0.2 ) ) + particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 ) + + local particle = self.Emitter:Add( "particle/particle_smokegrenade", self.Pos ) + + particle:SetDieTime( math.Rand( 1.5, 2.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 20, 40 ) ) + particle:SetEndSize( math.Rand( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local vec = VectorRand() + vec.x = math.Rand( -0.1, 0.1 ) + + if i % 2 == 0 then + + particle:SetVelocity( self.Norm * math.random(100,150) + vec * math.random(40,80) ) + + else + + particle:SetVelocity( vec * math.random(100,150) ) + + end + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + particle:SetGravity( Vector(0,0,-50) ) + particle:SetCollide( true ) + + end + + local dlight = DynamicLight( self.Entity:EntIndex() ) + + if dlight then + + dlight.Pos = self.Pos + dlight.r = 250 + dlight.g = 200 + dlight.b = 50 + dlight.Brightness = math.Rand( 4, 8 ) + dlight.Decay = 2048 + dlight.size = 2048 + dlight.DieTime = CurTime() + 5 + + end + + self.Emitter:Finish() + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end + +function CloudThink( part ) + + part:SetNextThink( CurTime() + 0.05 ) + + local scale = 1 - part:GetLifeTime() + local pos = part:GetPos() + local emitter = ParticleEmitter( pos ) + local vec = VectorRand() + vec.x = math.Rand( -0.1, 0 ) + + local particle = emitter:Add( "particle/particle_smokegrenade", pos ) + + particle:SetVelocity( vec * 3 + ( WindVector * ( 2 * ( 1 - scale ) ) ) ) + particle:SetDieTime( math.Rand( 2.0, 3.0 ) + scale * 1.0 ) + particle:SetStartAlpha( math.random( 100, 150 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 1, 3 ) + scale * 20 ) + particle:SetEndSize( math.random( 1, 5 ) + scale * 30 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + emitter:Finish() + +end diff --git a/entities/effects/c4_explosion/init.lua b/entities/effects/c4_explosion/init.lua new file mode 100644 index 0000000..bb676cc --- /dev/null +++ b/entities/effects/c4_explosion/init.lua @@ -0,0 +1,176 @@ + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + + local emitter = ParticleEmitter( pos ) + + for i=1,math.random(10,15) do + + local particle = emitter:Add( "particles/smokey", pos ) + + particle:SetVelocity( Vector(math.random(-90, 90),math.random(-90, 90), math.random(-70, 70) ) ) + particle:SetDieTime( math.Rand(3,6) ) + particle:SetStartAlpha( math.Rand( 55, 115 ) ) + particle:SetStartSize( math.Rand( 20, 30 ) ) + particle:SetEndSize( math.Rand( 140, 240 ) ) + particle:SetRoll( math.Rand( -95, 95 ) ) + particle:SetRollDelta( math.Rand( -0.12, 0.12 ) ) + particle:SetColor( 10,10,10 ) + + end + + for i=1, math.random(10,15) do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos + Vector(math.random(-40,40),math.random(-40,40),math.random(-30,50))) + + particle:SetVelocity( Vector(math.random(-150,150),math.random(-150,150),math.random(100,200)) ) + particle:SetDieTime( math.Rand(1,1.5) ) + particle:SetStartAlpha( math.Rand( 200, 240 ) ) + particle:SetStartSize( 5 ) + particle:SetEndSize( math.Rand( 90, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -1, 1 ) ) + particle:SetColor( math.Rand( 150, 255 ), math.Rand( 100, 150 ), 100 ) + particle:VelocityDecay( false ) + + end + + for i=1, math.random(15,25) do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos + Vector(math.random(-40,40),math.random(-40,40),math.random(10,20))) + + particle:SetVelocity( Vector(math.random(-200,200),math.random(-200,200),math.random(0,60)) ) + particle:SetDieTime( math.Rand( 1, 2 ) ) + particle:SetStartAlpha( math.Rand( 200, 240 ) ) + particle:SetStartSize( 48 ) + particle:SetEndSize( math.Rand( 168, 190 ) ) + particle:SetRoll( math.Rand( 360,480 ) ) + particle:SetRollDelta( math.Rand( -1, 1 ) ) + particle:SetColor( math.Rand( 150, 255 ), math.Rand( 100, 150 ), 100 ) + particle:VelocityDecay( true ) + + end + + for i=0,math.random(5,9) do + + local particle = emitter:Add( "effects/fire_embers"..math.random(1,3), pos ) + particle:SetVelocity( Vector(math.random(-400,400),math.random(-400,400),math.random(300,550)) ) + particle:SetDieTime(math.Rand(2,5)) + particle:SetStartAlpha(math.random(140,220)) + particle:SetEndAlpha(50) + particle:SetStartSize(math.random(3,4)) + particle:SetEndSize(0) + particle:SetRoll(math.random(-200,200)) + particle:SetRollDelta( math.random( -1, 1 ) ) + particle:SetColor(255, 220, 100) + particle:SetGravity(Vector(0,0,-520)) //-600 is normal + particle:SetCollide(true) + particle:SetBounce(0.45) + + end + + for i=1, 5 do + + local particle = emitter:Add( "particle/particle_smokegrenade", pos ) + + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + + if i % 2 == 1 then + particle:SetVelocity( Vector( math.random(-100,100), math.random(-100,100), math.random(0,50) ) ) + particle:SetStartSize( math.Rand( 50, 100 ) ) + particle:SetEndSize( math.Rand( 250, 500 ) ) + else + particle:SetVelocity( Vector( math.random(-200,200), math.random(-200,200), 0 ) ) + particle:SetStartSize( math.Rand( 50, 100 ) ) + particle:SetEndSize( math.Rand( 200, 400 ) ) + end + + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + if math.random(1,4) != 1 then + + local vec = Vector( math.Rand(-8,8), math.Rand(-8,8), math.Rand(8,12) ) + local particle = emitter:Add( "effects/fire_cloud2", pos + vec * 10 ) + + particle:SetVelocity( vec * 80 ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 100 ) + particle:SetStartSize( 8 ) + particle:SetEndSize( 0 ) + particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 ) + + particle:SetGravity( Vector( 0, 0, math.random( -700, -500 ) ) ) + particle:SetAirResistance( math.random( 20, 60 ) ) + particle:SetCollide( true ) + + particle:SetLifeTime( 0 ) + particle:SetThinkFunction( CloudThink ) + particle:SetNextThink( CurTime() + 0.1 ) + + end + + end + + emitter:Finish() + + local dlight = DynamicLight( self.Entity:EntIndex() ) + + if dlight then + + dlight.Pos = pos + dlight.r = 250 + dlight.g = 200 + dlight.b = 50 + dlight.Brightness = math.Rand( 4, 8 ) + dlight.Decay = 1024 + dlight.size = 1024 + dlight.DieTime = CurTime() + 5 + + end + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end + +function CloudThink( part ) + + part:SetNextThink( CurTime() + 0.12 ) + + local scale = 1 - part:GetLifeTime() + local pos = part:GetPos() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "particle/particle_smokegrenade", pos ) + + particle:SetVelocity( VectorRand() * 3 + ( WindVector * ( 3 * ( 1 - scale ) ) ) ) + particle:SetDieTime( math.Rand( 2.0, 3.0 ) + scale * 1.0 ) + particle:SetStartAlpha( math.random( 100, 150 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 1, 3 ) + scale * math.random( 20, 50 ) ) + particle:SetEndSize( math.random( 1, 5 ) + scale * math.random( 30, 50 ) ) + + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local dark = math.random( 10, 50 ) + particle:SetColor( dark, dark, dark ) + + emitter:Finish() + +end diff --git a/entities/effects/energy_explosion/init.lua b/entities/effects/energy_explosion/init.lua new file mode 100644 index 0000000..d959e8a --- /dev/null +++ b/entities/effects/energy_explosion/init.lua @@ -0,0 +1,82 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + + local pos = data:GetOrigin() + local normal = data:GetNormal() + local emitter = ParticleEmitter( pos ) + + for i=1, 20 do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos ) + particle:SetVelocity( VectorRand() * 100 ) + particle:SetDieTime( math.Rand( 0.3, 0.6 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 5, 10 ) ) + particle:SetEndSize( math.Rand( 40, 80 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 100, 250 ) + + end + + for i=1, math.random(3,6) do + + local vec = normal * math.random( 150, 200 )+ VectorRand() * 50 + local normalized = vec:GetNormal():Angle() + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( normal * math.random(150,200) + VectorRand() * 50 ) + particle:SetAngles( normalized ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( 0 ) + particle:SetEndLength( 20 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 100, 200 ) + + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() * 500 + local normalized = vec:GetNormal():Angle() + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( vec ) + particle:SetAngles( normalized ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( 0 ) + particle:SetEndLength( 20 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 100, 200 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 1.0 ) + + end + + emitter:Finish() + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/fire_explosion/init.lua b/entities/effects/fire_explosion/init.lua new file mode 100644 index 0000000..d51b1c3 --- /dev/null +++ b/entities/effects/fire_explosion/init.lua @@ -0,0 +1,83 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + + local pos = data:GetOrigin() + local normal = data:GetNormal() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 1.0, 1.5 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 50, 50 ) + + for i=1, 10 do + + local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos ) + particle:SetVelocity( VectorRand() * 50 + normal * 50 ) + particle:SetDieTime( math.Rand( 0.3, 0.6 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 5, 10 ) ) + particle:SetEndSize( math.Rand( 30, 60 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 200, 150, 100 ) + + end + + for i=1, math.random(5,10) do + + local vec = normal * math.random( 150, 200 ) + VectorRand() * 50 + local normalized = vec:GetNormal():Angle() + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( normal * math.random(150,200) + VectorRand() * 50 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 1.5, 3.5 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 4, 8 ) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 200, 100, 50 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( math.Rand( 0, 0.2 ) ) + + end + + emitter:Finish() + + local dlight = DynamicLight( self:EntIndex() ) + + if dlight then + + dlight.Pos = pos + dlight.r = 255 + dlight.g = 150 + dlight.b = 50 + dlight.Brightness = 3 + dlight.Decay = 512 + dlight.size = 256 * math.Rand( 0.5, 1.0 ) + dlight.DieTime = CurTime() + 5 + + end + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/fire_tracer/init.lua b/entities/effects/fire_tracer/init.lua new file mode 100644 index 0000000..3f8842b --- /dev/null +++ b/entities/effects/fire_tracer/init.lua @@ -0,0 +1,87 @@ + +EFFECT.Mat = Material( "trails/plasma" ) +EFFECT.Sprite = Material( "effects/yellowflare" ) + +function EFFECT:Init( data ) + + self.Position = data:GetStart() + self.WeaponEnt = data:GetEntity() + self.Attachment = data:GetAttachment() + + self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment ) + self.EndPos = data:GetOrigin() + + local dir = self.StartPos - self.EndPos + dir:Normalize() + + self.Dir = dir + + self.Entity:SetRenderBoundsWS( self.StartPos, self.EndPos ) + + self.Alpha = 100 + self.Color = Color( 250, 150, 50, self.Alpha ) + + local dlight = DynamicLight( self:EntIndex() ) + + if dlight then + + dlight.Pos = self.StartPos + dlight.r = 255 + dlight.g = 150 + dlight.b = 50 + dlight.Brightness = 3 + dlight.Decay = 256 + dlight.size = 256 * math.Rand( 0.5, 1.0 ) + dlight.DieTime = CurTime() + 5 + + end + +end + +function EFFECT:Think( ) + + self.Entity:SetRenderBoundsWS( self.StartPos, self.EndPos ) + + self.Alpha = self.Alpha - FrameTime() * 200 + self.Color = Color( 250, 150, 50, self.Alpha ) + + return self.Alpha > 0 + +end + +function EFFECT:Render( ) + + if self.Alpha < 1 then return end + + --[[self.Length = ( self.StartPos - self.EndPos ):Length() + + render.SetMaterial( self.Mat ) + render.DrawBeam( self.StartPos, self.EndPos, ( 100 / self.Alpha ) * 0.5 + 0.5, 0, 0, self.Color )]] + + if ( self.Alpha < 1 ) then return end + + self.Length = (self.StartPos - self.EndPos):Length() + + local texcoord = CurTime() * -0.2 + + for i = 1, 10 do + + render.SetMaterial( self.Mat ) + + texcoord = texcoord + i * 0.05 * texcoord + + render.DrawBeam( self.StartPos, + self.EndPos, + i * self.Alpha * 0.03, + texcoord, + texcoord + (self.Length / (128 + self.Alpha)), + self.Color ) + + render.SetMaterial( self.Sprite ) + + render.DrawSprite( self.StartPos + self.Dir * i, i * 5, i * 5, Color( self.Color.r, self.Color.g, self.Color.b, self.Alpha ) ) + render.DrawSprite( self.EndPos, i * 5, i * 5, Color( self.Color.r, self.Color.g, self.Color.b, self.Alpha ) ) + + end + +end diff --git a/entities/effects/gore_explosion/init.lua b/entities/effects/gore_explosion/init.lua new file mode 100644 index 0000000..e4406a1 --- /dev/null +++ b/entities/effects/gore_explosion/init.lua @@ -0,0 +1,129 @@ + + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 150, 200 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 6.0, 8.0 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 100, 250 ) ) + particle:SetEndSize( 200 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -5 ) ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 12 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 250 + Vector(0,0,50) ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 40, 0, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "Blood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 15 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) ) + + if i < 5 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + + if LocalPlayer():GetPos():Distance( pos ) <= 300 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 300 ) + + for i=1, math.Round( frac * 12 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/head_gib/init.lua b/entities/effects/head_gib/init.lua new file mode 100644 index 0000000..8a36dd9 --- /dev/null +++ b/entities/effects/head_gib/init.lua @@ -0,0 +1,91 @@ + + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( 0.5 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 5.0, 7.0 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 40, 80 ) ) + particle:SetEndSize( 200 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -5 ) ) + + for i=1, math.random(5,10) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 2, 4 ) ) + particle:SetEndSize( math.random( 10, 20 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 6 do + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,0,75) ) + particle:SetDieTime( 0.5 ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 30, 60 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + emitter:Finish() + + for i=1, 3 do + + local ed = EffectData() + ed:SetOrigin( pos ) + ed:SetScale( 1 ) + util.Effect( "player_gib", ed, true, true ) + + end + + if LocalPlayer():GetPos():Distance( pos ) <= 100 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 100 ) + + for i=1, math.Round( frac * 6 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end + diff --git a/entities/effects/headshot/init.lua b/entities/effects/headshot/init.lua new file mode 100644 index 0000000..7aadb41 --- /dev/null +++ b/entities/effects/headshot/init.lua @@ -0,0 +1,66 @@ + + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + local emitter = ParticleEmitter( pos ) + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( 0.3 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 50, 100 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + local particle = emitter:Add( "particles/smokey", pos ) + particle:SetDieTime( math.Rand( 10, 20 ) ) + particle:SetStartAlpha( math.random( 20, 40 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( 10 ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + + for i=1, math.random(2,4) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 2, 4 ) ) + particle:SetEndSize( math.random( 10, 20 ) ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 50, 0, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + emitter:Finish() + + if LocalPlayer():GetPos():Distance( pos ) <= 100 then + + local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 100 ) + + for i=1, math.Round( frac * 3 ) do + + AddStain() + + end + + end + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end + diff --git a/entities/effects/immolate/init.lua b/entities/effects/immolate/init.lua new file mode 100644 index 0000000..e6a7cc1 --- /dev/null +++ b/entities/effects/immolate/init.lua @@ -0,0 +1,88 @@ + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 5 + self.SmokeTime = 0 + self.Ent = data:GetEntity() + + if not IsValid( self.Ent ) then self.DieTime = 0 return end + + self.Emitter = ParticleEmitter( self.Ent:GetPos() ) + + if LocalPlayer() != self.Ent then return end + + LocalPlayer():EmitSound( "ambient/fire/ignite.wav", 100, 80 ) + +end + +function EFFECT:Think() + + if IsValid( self.Ent ) then + + if self.Ent:IsPlayer() and ( !self.Ent:Alive() or self.Ent == LocalPlayer() ) then + + self.DieTime = 0 + + end + + end + + if self.DieTime < CurTime() or not IsValid( self.Ent ) then + + if self.Emitter then + + self.Emitter:Finish() + + end + + return false + + end + + local pos + + for i=1, 3 do + + pos = self.Ent:GetPos() + Vector(0,0,math.random(1,50)) + Vector(math.random(-10,10),math.random(-10,10),0) + + local particle = self.Emitter:Add( "effects/muzzleflash" .. math.random(1,4), pos ) + particle:SetVelocity( Vector(0,0,80) ) + particle:SetDieTime( math.Rand( 0.2, 0.4 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random(5,15) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.random(-180,180) ) + particle:SetColor( 255, 200, 200 ) + particle:SetGravity( Vector( 0, 0, 500 ) ) + + end + + if self.SmokeTime < CurTime() then + + self.SmokeTime = CurTime() + 0.02 + + local particle = self.Emitter:Add( "particles/smokey", pos ) + particle:SetVelocity( Vector(0,0,30) ) + particle:SetDieTime( math.Rand( 1.0, 2.5 ) ) + particle:SetStartAlpha( 50 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 25, 50 ) ) + particle:SetRoll( 0 ) + particle:SetColor( 50, 50, 50 ) + particle:SetGravity( Vector( 0, 0, 30 ) ) + + end + + return true + +end + +function EFFECT:Render() + +end + + + + diff --git a/entities/effects/player_gib/init.lua b/entities/effects/player_gib/init.lua new file mode 100644 index 0000000..2afcae0 --- /dev/null +++ b/entities/effects/player_gib/init.lua @@ -0,0 +1,58 @@ + +function EFFECT:Init( data ) + + local scale = data:GetScale() + + if scale < 2 then + self.Entity:SetModel( table.Random( GAMEMODE.SmallGibs ) ) + else + self.Entity:SetModel( table.Random( GAMEMODE.BigGibs ) ) + end + + self.Entity:PhysicsInit( SOLID_VPHYSICS ) + self.Entity:SetMaterial( "models/flesh" ) + + self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS ) + self.Entity:SetCollisionBounds( Vector( -128 -128, -128 ), Vector( 128, 128, 128 ) ) + self.Entity:SetAngles( Angle( math.Rand(0,360), math.Rand(0,360), math.Rand(0,360) ) ) + + local phys = self.Entity:GetPhysicsObject() + + if IsValid( phys ) then + + local vec = VectorRand() + vec.z = math.Clamp( vec.z, -0.4, 0.8 ) + + phys:Wake() + phys:SetMass( 100 ) + phys:AddAngleVelocity( VectorRand() * 500 ) + phys:SetMaterial( "gmod_silent" ) + + if scale < 2 then + + phys:SetVelocity( vec * math.Rand( 100, 200 ) ) + + else + + phys:SetVelocity( vec * math.Rand( 300, 600 ) ) + + end + + end + + self.LifeTime = CurTime() + 15 + +end + +function EFFECT:Think( ) + + return self.LifeTime > CurTime() + +end + +function EFFECT:Render() + + self.Entity:DrawModel() + +end + diff --git a/entities/effects/puke_explosion/init.lua b/entities/effects/puke_explosion/init.lua new file mode 100644 index 0000000..9a13226 --- /dev/null +++ b/entities/effects/puke_explosion/init.lua @@ -0,0 +1,119 @@ + +EFFECT.Color = Color(100,50,0) + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = 0 + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 10 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 300 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 ) + particle:SetGravity( Vector( 0, 0, -400 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random( 1, 2 ), pos + Vector( 0, 0, math.random( -10, 10 ) ) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "yellowblood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 10 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector( 0, 0, math.random( 0, 30 ) ) ) + + if i < 5 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + +end + +function EFFECT:Think() + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + 0.5 + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/puke_spray/init.lua b/entities/effects/puke_spray/init.lua new file mode 100644 index 0000000..b2d73ac --- /dev/null +++ b/entities/effects/puke_spray/init.lua @@ -0,0 +1,119 @@ + +EFFECT.Color = Color(100,50,0) + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 1.5 + self.SoundTime = 0 + + local pos = data:GetOrigin() + Vector(0,0,50) + local emitter = ParticleEmitter( pos ) + + self.Pos = pos + + local particle = emitter:Add( "effects/blood_core", pos ) + particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( 10 ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 20, 40 ) ) + particle:SetEndSize( math.random( 50, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 10 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos ) + particle:SetVelocity( vec * 200 ) + particle:SetDieTime( math.Rand( 0.8, 1.0 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 10, 20 ) ) + particle:SetEndSize( math.random( 100, 150 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, math.random(3,6) do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) ) + particle:SetVelocity( vec * 300 ) + particle:SetLifeTime( 0 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 255 ) + particle:SetStartSize( math.random( 8, 12 ) ) + particle:SetEndSize( 1 ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( self.Color.r, self.Color.g, 0 ) + + particle:SetGravity( Vector( 0, 0, -500 ) ) + particle:SetCollide( true ) + particle:SetBounce( 0.5 ) + + particle:SetCollideCallback( function( part, pos, normal ) + + util.Decal( "yellowblood", pos + normal, pos - normal ) + + end ) + + end + + emitter:Finish() + + for i=1, 5 do + + local ed = EffectData() + ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) ) + + if i < 3 then + ed:SetScale( 1 ) + else + ed:SetScale( 2 ) + end + + util.Effect( "player_gib", ed, true, true ) + + end + +end + +function EFFECT:Think( ) + + if self.SoundTime < CurTime() then + + sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) ) + + self.SoundTime = CurTime() + 0.5 + + end + + return self.DieTime > CurTime() + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/rad_explosion/init.lua b/entities/effects/rad_explosion/init.lua new file mode 100644 index 0000000..e888a2e --- /dev/null +++ b/entities/effects/rad_explosion/init.lua @@ -0,0 +1,55 @@ + +function EFFECT:Init( data ) + + local pos = data:GetOrigin() + Vector(0,0,40) + local emitter = ParticleEmitter( pos ) + + for i=1, math.random(4,8) do + + local particle = emitter:Add( "effects/blood", pos ) + particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) ) + particle:SetDieTime( 1.0 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 5, 10 ) ) + particle:SetEndSize( math.random( 20, 40 ) ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetColor( 100, 200, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + end + + for i=1, 20 do + + local vec = VectorRand() + vec.z = math.Rand( -0.2, 1.0 ) + + local particle = emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( vec * 300 ) + particle:SetDieTime( math.Rand( 2.5, 3.5 ) ) + particle:SetStartAlpha( 200 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 2, 4 ) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.random( -360, 360 ) ) + particle:SetColor( 100, 200, 0 ) + particle:SetGravity( Vector( 0, 0, -300 ) ) + + particle:SetCollide( true ) + particle:SetBounce( math.Rand( 0.1, 0.5 ) ) + + end + + emitter:Finish() + +end + +function EFFECT:Think( ) + + return false + +end + +function EFFECT:Render() + +end diff --git a/entities/effects/radiation/init.lua b/entities/effects/radiation/init.lua new file mode 100644 index 0000000..e9021c9 --- /dev/null +++ b/entities/effects/radiation/init.lua @@ -0,0 +1,70 @@ + +function EFFECT:Init( data ) + + self.DieTime = CurTime() + 5 + self.PartTime = 0 + self.Ent = data:GetEntity() + + if not IsValid( self.Ent ) then self.DieTime = 0 return end + + self.Emitter = ParticleEmitter( self.Ent:GetPos() ) + +end + +function EFFECT:Think() + + if IsValid( self.Ent ) then + + if self.Ent:IsPlayer() and ( !self.Ent:Alive() or self.Ent == LocalPlayer() ) then + + self.DieTime = 0 + + end + + end + + if self.DieTime < CurTime() or not IsValid( self.Ent ) then + + if self.Emitter then + + self.Emitter:Finish() + + end + + return false + + end + + if self.PartTime < CurTime() then + + self.PartTime = CurTime() + math.Rand( 0.2, 0.4 ) + + local pos = self.Ent:GetPos() + Vector(0,0,math.random(1,40)) + Vector(math.random(-10,10),math.random(-10,10),0) + + local particle = self.Emitter:Add( "effects/yellowflare", pos ) + particle:SetVelocity( VectorRand() * 5 ) + particle:SetDieTime( math.Rand( 2.0, 4.0 ) ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random( 1, 3 ) ) + particle:SetEndSize( 0 ) + particle:SetRoll( math.random( -180, 180 ) ) + particle:SetColor( 100, 200, 0 ) + particle:SetGravity( Vector( 0, 0, -500 ) ) + + particle:SetCollide( true ) + particle:SetBounce( math.Rand( 0, 0.2 ) ) + + end + + return true + +end + +function EFFECT:Render() + +end + + + + diff --git a/entities/effects/smoke_crater/init.lua b/entities/effects/smoke_crater/init.lua new file mode 100644 index 0000000..68c713b --- /dev/null +++ b/entities/effects/smoke_crater/init.lua @@ -0,0 +1,52 @@ + + +function EFFECT:Init( data ) + + self.Pos = data:GetOrigin() + self.Magnitude = data:GetMagnitude() or 1 + + self.Emitter = ParticleEmitter( self.Pos ) + self.DieTime = CurTime() + 15 + self.Interval = 0 + +end + + +function EFFECT:Think( ) + + if self.Interval < CurTime() then + + self.Interval = CurTime() + 0.2 + + local particle = self.Emitter:Add( "particles/smokey", self.Pos + VectorRand() * 10 ) + + particle:SetVelocity( Vector( math.Rand(-3,3), math.Rand(-3,3), math.Rand(20,40) ) + WindVector ) + particle:SetDieTime( math.Rand( 10, 15 ) + self.Magnitude ) + particle:SetStartAlpha( math.random( 25, 50 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 5, 25 ) * self.Magnitude ) + particle:SetEndSize( math.Rand( 50, 200 ) * self.Magnitude ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local rand = math.random(10,50) + particle:SetColor( rand, rand, rand ) + + end + + if self.DieTime > CurTime() then + + return true + + else + + self.Emitter:Finish() + return false + + end + +end + +function EFFECT:Render() + +end diff --git a/entities/entities/info_evac/init.lua b/entities/entities/info_evac/init.lua new file mode 100644 index 0000000..40e6489 --- /dev/null +++ b/entities/entities/info_evac/init.lua @@ -0,0 +1,12 @@ + + +ENT.Type = "point" +ENT.Base = "base_point" + +function ENT:Initialize() + +end + +function ENT:KeyValue( key, value ) + +end diff --git a/entities/entities/info_lootspawn/init.lua b/entities/entities/info_lootspawn/init.lua new file mode 100644 index 0000000..957aeb9 --- /dev/null +++ b/entities/entities/info_lootspawn/init.lua @@ -0,0 +1,12 @@ + + +ENT.Type = "anim" +ENT.Base = "base_point" + +function ENT:Initialize() + +end + +function ENT:KeyValue( key, value ) + +end diff --git a/entities/entities/info_npcspawn/init.lua b/entities/entities/info_npcspawn/init.lua new file mode 100644 index 0000000..c7e915b --- /dev/null +++ b/entities/entities/info_npcspawn/init.lua @@ -0,0 +1,18 @@ + + +ENT.Type = "anim" +ENT.Base = "base_point" + +function ENT:Initialize() + + self.Entity:PhysicsInit( SOLID_VPHYSICS ) + self.Entity:SetMoveType( MOVETYPE_NONE ) + self.Entity:SetSolid( SOLID_VPHYSICS ) + + self.Entity:DrawShadow( false ) + +end + +function ENT:KeyValue( key, value ) + +end diff --git a/entities/entities/info_player_army/init.lua b/entities/entities/info_player_army/init.lua new file mode 100644 index 0000000..40e6489 --- /dev/null +++ b/entities/entities/info_player_army/init.lua @@ -0,0 +1,12 @@ + + +ENT.Type = "point" +ENT.Base = "base_point" + +function ENT:Initialize() + +end + +function ENT:KeyValue( key, value ) + +end diff --git a/entities/entities/info_player_zombie/init.lua b/entities/entities/info_player_zombie/init.lua new file mode 100644 index 0000000..40e6489 --- /dev/null +++ b/entities/entities/info_player_zombie/init.lua @@ -0,0 +1,12 @@ + + +ENT.Type = "point" +ENT.Base = "base_point" + +function ENT:Initialize() + +end + +function ENT:KeyValue( key, value ) + +end diff --git a/entities/entities/info_trader/init.lua b/entities/entities/info_trader/init.lua new file mode 100644 index 0000000..7f4d109 --- /dev/null +++ b/entities/entities/info_trader/init.lua @@ -0,0 +1,115 @@ +ENT.Type = "point" +ENT.Base = "base_point" + +ENT.BuybackScale = 1.0 + +function ENT:Initialize() + + self.Items = {} + + self.Entity:GenerateInventory() + +end + +function ENT:GenerateInventory() + + for k,v in pairs( item.GetByType( ITEM_SUPPLY ) ) do + + self.Entity:AddItem( v.ID ) + + end + + for k,v in pairs( item.GetByType( ITEM_BUYABLE ) ) do + + self.Entity:AddItem( v.ID ) + + end + + for k,v in pairs( item.GetByType( ITEM_MISC ) ) do + + self.Entity:AddItem( v.ID ) + + end + + for k,v in pairs( item.GetByType( ITEM_AMMO ) ) do + + self.Entity:AddItem( v.ID ) + + end + + if self.Special then + + for k,v in pairs( item.GetByType( ITEM_SPECIAL ) ) do + + self.Entity:AddItem( v.ID ) + + end + + end + + for k,v in pairs( item.GetByType( ITEM_WPN_COMMON ) ) do + + self.Entity:AddItem( v.ID ) + + end + + if self.Special then + + for k,v in pairs( item.GetByType( ITEM_WPN_SPECIAL ) ) do + + self.Entity:AddItem( v.ID ) + + end + + end + +end + +function ENT:SetSpecial( bool ) + + self.Special = bool + +end + +function ENT:GetBuybackScale() + + return self.BuybackScale + +end + +function ENT:GetItems() + + return self.Items + +end + +function ENT:AddItem( id ) + + local tbl = item.GetByID( id ) + + if tbl.SaleOverride then return end + + self.Items = self.Items or {} + + table.insert( self.Items, id ) + +end + +function ENT:Think() + +end + +function ENT:OnUsed( ply ) + + ply.Stash = self.Entity + ply:ToggleStashMenu( self.Entity, true, "StoreMenu", self.Entity:GetBuybackScale() ) + +end + +function ENT:OnExit( ply ) + + ply:ToggleStashMenu( self.Entity, false, "StoreMenu", self.Entity:GetBuybackScale() ) + ply.Stash = nil + +end + diff --git a/entities/entities/npc_nb_base/shared.lua b/entities/entities/npc_nb_base/shared.lua new file mode 100644 index 0000000..c2557bb --- /dev/null +++ b/entities/entities/npc_nb_base/shared.lua @@ -0,0 +1,959 @@ + +AddCSLuaFile() + +ENT.Base = "base_nextbot" + +// Moddable + +ENT.Skins = 0 +ENT.AttackAnims = nil +ENT.AnimSpeed = 0.8 +ENT.AttackTime = 0.5 +ENT.MeleeDistance = 64 +ENT.BreakableDistance = 96 +ENT.Damage = 35 +ENT.BaseHealth = 100 +ENT.MoveSpeed = 225 +ENT.JumpHeight = 80 +ENT.BumpSpeed = 500 +ENT.MoveAnim = ACT_RUN + +ENT.Models = nil +ENT.Legs = Model( "models/zombie/classic_legs.mdl" ) +ENT.Model = Model( "models/zombie/classic.mdl" ) + +ENT.WoodHit = Sound( "Wood_Plank.Break" ) +ENT.WoodBust = Sound( "Wood_Crate.Break" ) + +ENT.ClawHit = { Sound( "npc/zombie/claw_strike1.wav" ), +Sound( "npc/zombie/claw_strike2.wav" ), +Sound( "npc/zombie/claw_strike3.wav" ) } + +ENT.ClawMiss = { Sound( "npc/zombie/claw_miss1.wav" ), +Sound( "npc/zombie/claw_miss2.wav" ) } + +ENT.VoiceSounds = {} + +ENT.NextBot = true +ENT.ShouldDrawPath = false +ENT.Obstructed = false +ENT.FireDamageTime = 0 +ENT.FireTime = 0 + +ENT.DoorHit = Sound( "npc/zombie/zombie_hit.wav" ) + +function ENT:Initialize() + + if self.Models then + + local model = table.Random( self.Models ) + self.Entity:SetModel( model ) + + else + + self.Entity:SetModel( self.Model ) + + end + + self.Entity:SetHealth( self.BaseHealth ) + self.Entity:SetCollisionGroup( COLLISION_GROUP_NPC ) + self.Entity:SetCollisionBounds( Vector(-4,-4,0), Vector(4,4,64) ) // nice fat shaming + self.Entity:SetSkin( math.random( 0, self.Skins ) ) + + if(self.loco != nil) then + self.loco:SetDeathDropHeight( 1000 ) + self.loco:SetAcceleration( 500 ) + self.loco:SetJumpHeight( self.JumpHeight ) + end + + self.DmgTable = {} + self.LastPos = self.Entity:GetPos() + self.Stuck = CurTime() + 10 + +end + +function ENT:Think() + + self.Entity:OnThink() + + if ( self.IdleTalk or 0 ) < CurTime() then + + self.Entity:VoiceSound( self.VoiceSounds.Taunt ) + self.IdleTalk = CurTime() + math.Rand(10,20) + + end + + if ( self.Stuck or 0 ) < CurTime() then + + self.Entity:StuckThink() + + self.Stuck = CurTime() + 10 + self.LastPos = self.Entity:GetPos() + + end + + if self.Entity:OnFire() and self.FireDamageTime < CurTime() then + + self.FireDamageTime = CurTime() + 0.25 + + self.Entity:TakeDamage( 10, self.FireAttacker ) + + elseif self.FireSound and not self.Entity:OnFire() then + + self.Entity:StopFireSounds() + + end + + if self.CurAttack and self.CurAttack < CurTime() then + + self.CurAttack = nil + + if IsValid( self.CurEnemy ) then + + if self.CurEnemy:IsPlayer() then + + local enemy = self.Entity:CanAttackEnemy( self.CurEnemy ) + + if IsValid( enemy ) then + + local snd = table.Random( self.ClawHit ) + self.Entity:EmitSound( snd, 100, math.random(90,110) ) + self.Entity:OnHitEnemy( enemy ) + + else + + local snd = table.Random( self.ClawMiss ) + self.Entity:EmitSound( snd, 100, math.random(90,110) ) + + end + + elseif self.CurEnemy.NextBot then + + local enemy = self.Entity:CanAttackEnemy( self.CurEnemy ) + + if IsValid( enemy ) then + + local snd = table.Random( self.ClawHit ) + self.Entity:EmitSound( snd, 100, math.random(90,110) ) + self.Entity:OnHitBot( enemy ) + + else + + local snd = table.Random( self.ClawMiss ) + self.Entity:EmitSound( snd, 100, math.random(90,110) ) + + end + + elseif ( self.CurEnemy:GetPos():Distance( self.Entity:GetPos() ) <= self.BreakableDistance ) or self.CurEnemy == self.Entity:GetBreakable() then + + self.Entity:EmitSound( self.DoorHit, 100, math.random(90,110) ) + self.Entity:OnHitBreakable( self.CurEnemy ) + + end + + else + + local snd = table.Random( self.ClawMiss ) + self.Entity:EmitSound( snd, 100, math.random(90,110) ) + + end + + end + +end + +function ENT:OnHitBot( enemy ) + + enemy:TakeDamage( self.Damage, self.Entity ) + +end + +function ENT:OnThink() + +end + +function ENT:StuckThink() + self.LastPos = self.LastPos or Vector(0,0,0) + if self.LastPos:Distance( self.Entity:GetPos() ) < 50 then + + self.Entity:StartRespawn() + + end + +end + +function ENT:StartRespawn() + GAMEMODE.NPCSpawns = GAMEMODE.NPCSpawns or {} + for k,v in pairs( GAMEMODE.NPCSpawns ) do + + if IsValid( v ) then + + local box = ents.FindInBox( v:GetPos() + Vector( -32, -32, 0 ), v:GetPos() + Vector( 32, 32, 64 ) ) + + if table.Count( box ) <= 1 then + + self.Entity:SetPos( v:GetPos() ) + + return + + end + + end + + end + +end + +function ENT:OnLimbHit( hitgroup, dmginfo ) + + if not IsValid( self.Entity ) then return end + + if hitgroup == HITGROUP_HEAD then + + local snd = table.Random( GAMEMODE.HeadShot ) + + self.Entity:EmitSound( snd, 90, math.random( 100, 120 ) ) + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), true ) + + local effectdata = EffectData() + effectdata:SetOrigin( dmginfo:GetDamagePosition() ) + util.Effect( "headshot", effectdata, true, true ) + + dmginfo:ScaleDamage( 2.75 ) + dmginfo:GetAttacker():NoticeOnce( "Headshot combos earn you more " .. GAMEMODE.CurrencyName .. "s", GAMEMODE.Colors.Blue, 5 ) + dmginfo:GetAttacker():AddHeadshot() + + elseif hitgroup == HITGROUP_CHEST then + + dmginfo:ScaleDamage( 1.25 ) + + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), false ) + if SERVER then dmginfo:GetAttacker():ResetHeadshots() end + + elseif hitgroup == HITGROUP_STOMACH then + + dmginfo:ScaleDamage( 0.75 ) + + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), false ) + if SERVER then dmginfo:GetAttacker():ResetHeadshots() end + + else + + dmginfo:ScaleDamage( 0.50 ) + + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), false ) + if SERVER then dmginfo:GetAttacker():ResetHeadshots() end + + end + +end + +function ENT:OnInjured( dmginfo ) + + if IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():GetClass() == "trigger_hurt" then + + self.Entity:SpawnRagdoll( dmginfo ) + + return + + end + + if dmginfo:IsExplosionDamage() then + + dmginfo:ScaleDamage( 1.75 ) + + elseif not self.Entity:OnFire() then + + local snd = table.Random( GAMEMODE.GoreBullet ) + sound.Play( snd, self.Entity:GetPos() + Vector(0,0,50), 75, math.random( 90, 110 ), 1.0 ) + + end + + //self.Entity:SetHealth( math.Clamp( self.Entity:Health() - dmginfo:GetDamage(), 0, 1000 ) ) + self.Entity:AddDamageTaken( dmginfo:GetAttacker(), dmginfo:GetDamage() ) + + if self.Entity:Health() > 0 and math.random(1,2) == 1 then + + self.Entity:VoiceSound( self.VoiceSounds.Pain ) + + end + +end + +function ENT:SpawnRagdoll( damageinfo, model, pos, override ) + + timer.Simple( 0.2, function() if IsValid( self.Entity ) then self.Entity:Remove() end end ) + + if not model then + + --[[umsg.Start( "Ragdoll" ) + umsg.Vector( self.Entity:GetPos() ) + + if self.Entity:OnFire() then + + umsg.Short(2) + + else + + umsg.Short(1) + + end + + umsg.Short( self.Entity:EntIndex() ) + umsg.End() + + //self:Fire( "BecomeRagdoll", "", 0 ) ]] + + self.Entity:BecomeRagdoll( damageinfo ) + + else + + local ang = self.Entity:GetAngles() + + local shooter = ents.Create( "env_shooter" ) + shooter:SetPos( pos or self.Entity:GetPos() ) + shooter:SetKeyValue( "m_iGibs", "1" ) + shooter:SetKeyValue( "shootsounds", "3" ) + shooter:SetKeyValue( "gibangles", ang.p.." "..ang.y.." "..ang.r ) + shooter:SetKeyValue( "angles", ang.p.." "..ang.y.." "..ang.r ) + shooter:SetKeyValue( "shootmodel", model ) + shooter:SetKeyValue( "simulation", "2" ) + shooter:SetKeyValue( "gibanglevelocity", math.random(-50,50).." "..math.random(-150,150).." "..math.random(-150,150) ) + shooter:SetKeyValue( "m_flVelocity", tostring( math.Rand( -20, 20 ) ) ) + shooter:SetKeyValue( "m_flVariance", tostring( math.Rand( -2, 2 ) ) ) + + shooter:Spawn() + + shooter:Fire( "shoot", 0, 0 ) + shooter:Fire( "kill", 0.1, 0.1 ) + + if not override then + + self.Entity:Remove() + + end + + end + +end + +function ENT:OnKilled( dmginfo ) + + if self.Dying then return end + + self.Dying = true + + self.Entity:OnDeath( dmginfo ) + + if dmginfo then + + local ent1 = self.Entity:GetHighestDamager() + local tbl = self.Entity:GetHighestDamagers() + + if tbl then + + for k,v in pairs( tbl ) do + + if IsValid( v ) and v != ent1 then + + v:AddCash( GAMEMODE.AssistValues[ self.Entity:GetClass() ] ) + v:AddStat( "Assist" ) + + end + + end + + end + + if IsValid( ent1 ) then + + if math.random(1,40) == 1 then + + ent1:RadioSound( VO_TAUNT ) + + end + + ent1:AddCash( GAMEMODE.KillValues[ self.Entity:GetClass() ] ) + ent1:AddFrags( 1 ) + + local dist = math.floor( ent1:GetPos():Distance( self.Entity:GetPos() ) / 8 ) + + if dist > ent1:GetStat( "Longshot" ) then + + ent1:SetStat( "Longshot", dist ) + + end + + if dmginfo:IsExplosionDamage() then + + local snd = table.Random( GAMEMODE.GoreSplash ) + self.Entity:EmitSound( snd, 90, math.random( 60, 80 ) ) + + local effectdata = EffectData() + effectdata:SetOrigin( self.Entity:GetPos() + Vector(0,0,20) ) + util.Effect( "body_gib", effectdata, true, true ) + + local ed = EffectData() + ed:SetOrigin( self.Entity:GetPos() ) + util.Effect( "gore_explosion", ed, true, true ) + + ent1:AddStat( "Explode" ) + + local corpse = table.Random( GAMEMODE.Corpses ) + self.Entity:SpawnRagdoll( dmginfo, corpse ) + + elseif ent1:HasShotgun() and ent1:GetPos():Distance( self.Entity:GetPos() ) < 100 then + + local snd = table.Random( GAMEMODE.GoreSplash ) + self.Entity:EmitSound( snd, 90, math.random( 60, 80 ) ) + + local vec = ( self.Entity:GetPos() - ent1:GetPos() ) + vec:Normalize() + + local effectdata = EffectData() + effectdata:SetOrigin( self.Entity:GetPos() + Vector(0,0,20) ) + effectdata:SetNormal( vec ) + util.Effect( "body_gib", effectdata, true, true ) + + ent1:AddStat( "Meat" ) + + self.Entity:SpawnRagdoll( dmginfo, self.Legs ) + + elseif ent1:HasMelee() then + + ent1:AddStat( "Knife" ) + + self.Entity:VoiceSound( self.VoiceSounds.Death ) + self.Entity:SpawnRagdoll( dmginfo ) + + if self.Entity:OnFire() then + + umsg.Start( "Burned" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + end + + if self.Entity:GetHeadshotter( ent1 ) then + + local snd = table.Random( GAMEMODE.GoreSplash ) + self.Entity:EmitSound( snd, 90, math.random( 90, 110 ) ) + + local effectdata = EffectData() + effectdata:SetOrigin( self.Entity:GetPos() + Vector(0,0,40) ) + util.Effect( "head_gib", effectdata, true, true ) + + umsg.Start( "Headless" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + end + + elseif self.Entity:GetHeadshotter( ent1 ) then //self.HeadshotEffects + + local snd = table.Random( GAMEMODE.GoreSplash ) + self.Entity:EmitSound( snd, 90, math.random( 90, 110 ) ) + + local effectdata = EffectData() + effectdata:SetOrigin( self.Entity:GetPos() + Vector(0,0,40) ) + util.Effect( "head_gib", effectdata, true, true ) + + umsg.Start( "Headless" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + if self.Entity:OnFire() then + + umsg.Start( "Burned" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + end + + self.Entity:SpawnRagdoll( dmginfo ) + + else + + self.Entity:VoiceSound( self.VoiceSounds.Death ) + self.Entity:SpawnRagdoll( dmginfo ) + + if self.Entity:OnFire() then + + umsg.Start( "Burned" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + end + + end + + end + + end + +end + +function ENT:OnDeath( dmginfo ) // override this + +end + +function ENT:OnFire() + + return self.FireTime > CurTime() + +end + +function ENT:DoIgnite( att ) + + if self.Entity:OnFire() then return end + + if IsValid( att ) and att:IsPlayer() and att:Team() == TEAM_ARMY then + + att:AddStat( "Igniter" ) + + end + + self.FireTime = CurTime() + 5 + self.FireAttacker = att + self.FireSound = true + + local ed = EffectData() + ed:SetEntity( self.Entity ) + util.Effect( "immolate", ed, true, true ) + + self.Entity:EmitSound( table.Random( GAMEMODE.Burning ), 100, 80 ) + self.Entity:EmitSound( GAMEMODE.BurnFlesh ) + +end + +function ENT:StopFireSounds() + + self.Entity:StopSound( GAMEMODE.BurnFlesh ) + +end + +function ENT:AddDamageTaken( attacker, dmg ) + + if not attacker:IsPlayer() then return end + + if not self.DmgTable[ attacker ] then + + self.DmgTable[ attacker ] = {} + self.DmgTable[ attacker ].Dmg = dmg + + elseif not self.DmgTable[ attacker ].Dmg then + + self.DmgTable[ attacker ].Dmg = dmg + + else + + self.DmgTable[ attacker ].Dmg = self.DmgTable[ attacker ].Dmg + dmg + + end + +end + +function ENT:GetHeadshotter( attacker ) + + if not self.DmgTable[ attacker ] then return false end + + return self.DmgTable[ attacker ].Headshot + +end + +function ENT:SetHeadshotter( attacker, head ) + + if not self.DmgTable[ attacker ] then + + self.DmgTable[ attacker ] = {} + + end + + self.DmgTable[ attacker ].Headshot = head + +end + +function ENT:GetHighestDamager() + + local ent1 = NULL + local high = 0 + + for k,v in pairs( self.DmgTable ) do + + if IsValid( k ) and v.Dmg and v.Dmg > high then + + high = v.Dmg + ent1 = k + + end + + end + + return ent1 + +end + +function ENT:GetHighestDamagers() + + local high = 0 + local tbl = {} + + for k,v in pairs( self.DmgTable ) do + + if IsValid( k ) and k:IsPlayer() then + + table.insert( tbl, k ) + + end + + end + + return tbl + +end + +function ENT:VoiceSound( tbl ) + + if ( self.VoiceTime or 0 ) > CurTime() then return end + + self.VoiceTime = CurTime() + 1.5 + + local snd = table.Random( tbl ) + sound.Play( snd, self.Entity:GetPos() + Vector(0,0,50), 75, ( self.SoundOverride or math.random( 90, 100 ) ), 0.7 ) + +end + +function ENT:StartAttack( enemy ) + + self.Stuck = CurTime() + 10 + self.CurAttack = CurTime() + self.AttackTime + self.CurEnemy = enemy + + self.Entity:VoiceSound( self.VoiceSounds.Attack ) + +end + +function ENT:OnHitEnemy( enemy ) + + enemy:TakeDamage( self.Damage, self.Entity ) + +end + +function ENT:OnHitBreakable( ent ) + + if not IsValid( ent ) then return end + + if string.find( ent:GetClass(), "func_breakable" ) then + + ent:TakeDamage( 25, self.Entity, self.Entity ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + elseif string.find( ent:GetClass(), "func_door" ) then + + ent:Remove() + + else + + if not ent.Hits then + + ent.Hits = 1 + ent.MaxHits = math.random(10,20) + + ent:EmitSound( self.WoodHit ) + + else + + ent.Hits = ent.Hits + 1 + + if ent.Hits > ent.MaxHits then + + if ent:GetModel() != "models/props_debris/wood_board04a.mdl" then + + local prop = ents.Create( "prop_physics" ) + prop:SetModel( ent:GetModel() ) + prop:SetPos( ent:GetPos() ) + prop:SetAngles( ent:GetAngles() + Angle( math.random(-10,10), math.random(-5,5), math.random(-5,5) ) ) + prop:SetSkin( ent:GetSkin() ) + prop:SetCollisionGroup( COLLISION_GROUP_DEBRIS ) + prop:Spawn() + + local dir = ( ent:GetPos() - self.Entity:GetPos() ):Normalize() + local phys = prop:GetPhysicsObject() + + if IsValid( phys ) and dir then + + phys:ApplyForceCenter( dir * phys:GetMass() * 800 ) + phys:AddAngleVelocity( VectorRand() * 200 ) + + end + + ent:EmitSound( self.WoodBust ) + ent:Remove() + + else + + ent:Fire( "break", "", 0 ) + + end + + else + + ent:EmitSound( self.WoodHit ) + + end + + end + + end + +end + +function ENT:BehaveAct() // what does this do? + +end + +function ENT:IsZombie() + + return true + +end + +function ENT:CanTarget( v ) + + return ( ( v:IsPlayer() and v:Alive() and v:GetObserverMode() == OBS_MODE_NONE and v:Team() == TEAM_ARMY ) or ( v.NextBot and not v:IsZombie() ) ) + +end + +function ENT:FindEnemy() + + local tbl = team.GetPlayers( TEAM_ARMY ) + tbl = table.Add( tbl, ents.FindByClass( "npc_scientist" ) ) + + self.EnemyTable = tbl + + if #tbl < 1 then + + return NULL + + else + + local enemy = NULL + local dist = 99999 + + for k,v in pairs( tbl ) do + + local compare = v:GetPos():Distance( self.Entity:GetPos() ) + + if compare < dist and self.Entity:CanTarget( v ) then + + enemy = v + dist = compare + + end + + end + + return enemy + + end + +end + +function ENT:CanAttack( ent ) + + return IsValid( ent ) and self.Entity:CanTarget( ent ) and ent:GetPos():Distance( self.Entity:GetPos() ) <= self.MeleeDistance and self.Entity:MeleeTrace( ent ) + +end + +function ENT:MeleeTrace( ent ) + + local trace = {} + trace.start = self.Entity:GetPos() + Vector(0,0,40) + trace.endpos = ent:GetPos() + Vector(0,0,40) + trace.filter = { ent, self.Entity } + + local tr = util.TraceLine( trace ) + + if not tr.Hit then + + return true + + end + + if tr.HitWorld or tr.Entity:GetClass() == "prop_door_rotating" or tr.Entity:GetClass() == "func_breakable" or tr.Entity:GetClass() == "func_breakable_surf" then + + return false + + end + + return true + +end + +function ENT:CanAttackEnemy( ent ) + + if self.Entity:CanAttack( ent ) then + + return ent + + end + + if #self.EnemyTable < 1 then return end + + for k,v in pairs( self.EnemyTable ) do + + if self.Entity:CanAttack( v ) then + + return v + + end + + end + +end + +function ENT:GetBreakable() + + local tbl = ents.FindByModel( "models/props_debris/wood_board04a.mdl" ) + tbl = table.Add( tbl, table.Copy( GAMEMODE.Breakables ) ) + + local remove + + for k,v in pairs( tbl ) do + + if IsValid( v ) and v:GetPos() != Vector(0,0,0) and v:GetPos():Distance( self.Entity:GetPos() ) <= self.BreakableDistance then + + return v + + end + + end + + local trace = {} + trace.start = self.Entity:GetPos() + Vector(0,0,50) + trace.endpos = trace.start + self.Entity:GetForward() * self.BreakableDistance + trace.filter = self.Entity + + local tr = util.TraceLine( trace ) + + if table.HasValue( GAMEMODE.Breakables, tr.Entity ) then + + return tr.Entity + + end + + return NULL + +end + +function ENT:OnStuck() + + local ent = self.Entity:GetBreakable() + + if IsValid( ent ) then + + self.Obstructed = true + + else + + self.Obstructed = false + + //self.loco:SetDesiredSpeed( self.BumpSpeed ) + //self.loco:Jump() + //self.loco:SetDesiredSpeed( self.BumpSpeed ) + + end + + self.loco:ClearStuck() + +end + +function ENT:OnUnStuck() + + self.Obstructed = false + +end + +function ENT:BreakableRoutine() + + local ent = self.Entity:GetBreakable() + + while IsValid( ent ) do + + local anim = table.Random( self.AttackAnims ) + + self.Entity:StartAttack( ent ) + self.Entity:PlaySequenceAndWait( anim, self.AnimSpeed ) + + ent = self.Entity:GetBreakable() + + end + +end + +function ENT:EnemyRoutine() + + local closest = self.Entity:CanAttackEnemy( enemy ) + + while IsValid( closest ) do + + local anim = table.Random( self.AttackAnims ) + + self.Entity:StartAttack( closest ) + self.Entity:PlaySequenceAndWait( anim, self.AnimSpeed ) + //self.Entity:StartActivity( ACT_MELEE_ATTACK1 ) + + closest = self.Entity:CanAttackEnemy( closest ) + + end + +end + +function ENT:RunBehaviour() + + while true do + + 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 ) + + 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 } + + self.Entity:MoveToPos( enemy:GetPos(), opts ) + + self.Entity:StartActivity( ACT_IDLE ) + + self.Entity:BreakableRoutine() + self.Entity:EnemyRoutine() + + self.Entity:StartActivity( ACT_IDLE ) + + end + + coroutine.yield() + + end + +end diff --git a/entities/entities/npc_nb_common/shared.lua b/entities/entities/npc_nb_common/shared.lua new file mode 100644 index 0000000..8890529 --- /dev/null +++ b/entities/entities/npc_nb_common/shared.lua @@ -0,0 +1,83 @@ + +AddCSLuaFile() + +ENT.Base = "npc_nb_base" + +// Moddable + +ENT.Skins = 22 +ENT.AttackAnims = { "attack01", "attack02", "attack03", "attack04" } +ENT.AnimSpeed = 0.8 +ENT.AttackTime = 0.5 +ENT.MeleeDistance = 64 +ENT.BreakableDistance = 96 +ENT.Damage = 30 +ENT.BaseHealth = 90 +ENT.MoveSpeed = 175 +ENT.MoveAnim = ACT_RUN + +ENT.Models = { Model( "models/zed/malezed_04.mdl" ), +Model( "models/zed/malezed_06.mdl" ), +Model( "models/zed/malezed_08.mdl" ) } + +ENT.VoiceSounds = {} + +ENT.VoiceSounds.Death = { Sound( "nuke/redead/death_1.wav" ), +Sound( "nuke/redead/death_2.wav" ), +Sound( "nuke/redead/death_3.wav" ), +Sound( "nuke/redead/death_4.wav" ), +Sound( "nuke/redead/death_5.wav" ), +Sound( "nuke/redead/death_6.wav" ), +Sound( "nuke/redead/death_7.wav" ), +Sound( "nuke/redead/death_8.wav" ), +Sound( "nuke/redead/death_9.wav" ), +Sound( "nuke/redead/death_10.wav" ) } + +ENT.VoiceSounds.Pain = { Sound( "nuke/redead/pain_1.wav" ), +Sound( "nuke/redead/pain_2.wav" ), +Sound( "nuke/redead/pain_3.wav" ), +Sound( "nuke/redead/pain_4.wav" ), +Sound( "nuke/redead/pain_5.wav" ), +Sound( "nuke/redead/pain_6.wav" ), +Sound( "nuke/redead/pain_7.wav" ), +Sound( "nuke/redead/pain_8.wav" ), +Sound( "nuke/redead/pain_9.wav" ), +Sound( "nuke/redead/pain_10.wav" ) } + +ENT.VoiceSounds.Taunt = { Sound( "nuke/redead/idle_1.wav" ), +Sound( "nuke/redead/idle_2.wav" ), +Sound( "nuke/redead/idle_3.wav" ), +Sound( "nuke/redead/idle_4.wav" ), +Sound( "nuke/redead/idle_5.wav" ), +Sound( "nuke/redead/idle_6.wav" ), +Sound( "nuke/redead/idle_7.wav" ), +Sound( "nuke/redead/idle_8.wav" ), +Sound( "nuke/redead/idle_9.wav" ), +Sound( "nuke/redead/idle_10.wav" ) } + +ENT.VoiceSounds.Attack = { Sound( "nuke/redead/attack_1.wav" ), +Sound( "nuke/redead/attack_2.wav" ), +Sound( "nuke/redead/attack_3.wav" ), +Sound( "nuke/redead/attack_4.wav" ), +Sound( "nuke/redead/attack_5.wav" ), +Sound( "nuke/redead/attack_6.wav" ), +Sound( "nuke/redead/attack_7.wav" ), +Sound( "nuke/redead/attack_8.wav" ), +Sound( "nuke/redead/attack_9.wav" ), +Sound( "nuke/redead/attack_10.wav" ) } + +function ENT:OnDeath( dmginfo ) + +end + +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 diff --git a/entities/entities/npc_nb_contagion/shared.lua b/entities/entities/npc_nb_contagion/shared.lua new file mode 100644 index 0000000..14d1503 --- /dev/null +++ b/entities/entities/npc_nb_contagion/shared.lua @@ -0,0 +1,100 @@ + +AddCSLuaFile() + +ENT.Base = "npc_nb_base" + +// Moddable + +ENT.AttackAnims = { "attackB", "attackD", "attackE", "attackF", "swatleftmid", "swatrightmid" } +ENT.AnimSpeed = 1.2 +ENT.AttackTime = 0.5 +ENT.MeleeDistance = 64 +ENT.BreakableDistance = 96 +ENT.Damage = 60 +ENT.BaseHealth = 200 +ENT.MoveSpeed = 50 +ENT.MoveAnim = ACT_WALK + +ENT.Models = nil +ENT.Model = Model( "models/zombie/classic.mdl" ) + +ENT.VoiceSounds = {} + +ENT.VoiceSounds.Death = { Sound( "npc/zombie/zombie_die1.wav" ), + Sound( "npc/zombie/zombie_die2.wav" ), + Sound( "npc/zombie/zombie_die3.wav" ), + Sound( "npc/zombie/zombie_voice_idle6.wav" ), + Sound( "npc/zombie/zombie_voice_idle11.wav" ) } + +ENT.VoiceSounds.Pain = { Sound( "npc/zombie/zombie_pain1.wav" ), + Sound( "npc/zombie/zombie_pain2.wav" ), + Sound( "npc/zombie/zombie_pain3.wav" ), + Sound( "npc/zombie/zombie_pain4.wav" ), + Sound( "npc/zombie/zombie_pain5.wav" ), + Sound( "npc/zombie/zombie_pain6.wav" ), + Sound( "npc/zombie/zombie_alert1.wav" ), + Sound( "npc/zombie/zombie_alert2.wav" ), + Sound( "npc/zombie/zombie_alert3.wav" ) } + +ENT.VoiceSounds.Taunt = { Sound( "npc/zombie/zombie_voice_idle1.wav" ), + Sound( "npc/zombie/zombie_voice_idle2.wav" ), + Sound( "npc/zombie/zombie_voice_idle3.wav" ), + Sound( "npc/zombie/zombie_voice_idle4.wav" ), + Sound( "npc/zombie/zombie_voice_idle5.wav" ), + Sound( "npc/zombie/zombie_voice_idle7.wav" ), + Sound( "npc/zombie/zombie_voice_idle8.wav" ), + Sound( "npc/zombie/zombie_voice_idle9.wav" ), + Sound( "npc/zombie/zombie_voice_idle10.wav" ), + Sound( "npc/zombie/zombie_voice_idle12.wav" ), + Sound( "npc/zombie/zombie_voice_idle13.wav" ), + Sound( "npc/zombie/zombie_voice_idle14.wav" ) } + +ENT.VoiceSounds.Attack = { Sound( "npc/zombie/zo_attack1.wav" ), +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 ) + +end + +function ENT:OnHitEnemy( enemy ) + + enemy:TakeDamage( self.Damage, self.Entity ) + enemy:ViewBounce( 30 ) + + umsg.Start( "Drunk", enemy ) + umsg.Short( 3 ) + umsg.End() + +end
\ No newline at end of file diff --git a/entities/entities/npc_nb_leaper/shared.lua b/entities/entities/npc_nb_leaper/shared.lua new file mode 100644 index 0000000..174fa0f --- /dev/null +++ b/entities/entities/npc_nb_leaper/shared.lua @@ -0,0 +1,151 @@ + +AddCSLuaFile() + +ENT.Base = "npc_nb_base" + +// Moddable + +ENT.AttackAnims = { "Melee" } +ENT.AnimSpeed = 1.0 +ENT.AttackTime = 0.3 +ENT.MeleeDistance = 64 +ENT.BreakableDistance = 96 +ENT.Damage = 35 +ENT.BaseHealth = 60 +ENT.MoveSpeed = 250 +ENT.JumpHeight = 300 +ENT.MoveAnim = ACT_RUN + +ENT.Models = nil +ENT.Model = Model( "models/zombie/fast.mdl" ) +ENT.Legs = Model( "models/gibs/fast_zombie_legs.mdl" ) + +ENT.VoiceSounds = {} + +ENT.VoiceSounds.Death = { Sound( "npc/fast_zombie/fz_alert_close1.wav" ), +Sound( "npc/fast_zombie/fz_alert_far1.wav" ) } + +ENT.VoiceSounds.Pain = { Sound( "npc/fast_zombie/idle1.wav" ), +Sound( "npc/fast_zombie/idle2.wav" ), +Sound( "npc/fast_zombie/idle3.wav" ), +Sound( "npc/headcrab_poison/ph_hiss1.wav" ), +Sound( "npc/headcrab_poison/ph_idle1.wav" ) } + +ENT.VoiceSounds.Taunt = { Sound( "npc/fast_zombie/fz_frenzy1.wav" ), +Sound( "npc/fast_zombie/fz_scream1.wav" ), +Sound( "npc/barnacle/barnacle_pull1.wav" ), +Sound( "npc/barnacle/barnacle_pull2.wav" ), +Sound( "npc/barnacle/barnacle_pull3.wav" ), +Sound( "npc/barnacle/barnacle_pull4.wav" ) } + +ENT.VoiceSounds.Attack = { Sound( "npc/fast_zombie/wake1.wav" ), +Sound( "npc/fast_zombie/leap1.wav" ) } + +ENT.Leap = Sound( "npc/fast_zombie/fz_scream1.wav" ) + +function ENT:OnDeath( dmginfo ) + +end + +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() + +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 + +function ENT:DownTrace() + + local trace = {} + 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 + +function ENT:RunBehaviour() + + while true do + + 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 ) + + 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:BreakableRoutine() + self.Entity:EnemyRoutine() + + self.Entity:StartActivity( ACT_IDLE ) + + end + + coroutine.yield() + + end + +end
\ No newline at end of file diff --git a/entities/entities/npc_nb_poison/shared.lua b/entities/entities/npc_nb_poison/shared.lua new file mode 100644 index 0000000..c4c67b3 --- /dev/null +++ b/entities/entities/npc_nb_poison/shared.lua @@ -0,0 +1,121 @@ + +AddCSLuaFile() + +ENT.Base = "npc_nb_base" + +// Moddable + +ENT.AttackAnims = { "melee_01" } +ENT.AnimSpeed = 1.2 +ENT.AttackTime = 0.5 +ENT.MeleeDistance = 64 +ENT.BreakableDistance = 96 +ENT.Damage = 65 +ENT.BaseHealth = 700 +ENT.MoveSpeed = 75 +ENT.MoveAnim = ACT_WALK + +ENT.Radius = 175 +ENT.SoundRadius = 500 +ENT.EffectTime = 0 + +ENT.Models = nil +ENT.Model = Model( "models/zombie/poison.mdl" ) + +ENT.VoiceSounds = {} + +ENT.VoiceSounds.Death = { Sound( "npc/zombie_poison/pz_die1.wav" ), +Sound( "npc/zombie_poison/pz_die2.wav" ), +Sound( "npc/zombie_poison/pz_idle2.wav" ), +Sound( "npc/zombie_poison/pz_warn2.wav" ) } + +ENT.VoiceSounds.Pain = { Sound( "npc/zombie_poison/pz_idle3.wav" ), +Sound( "npc/zombie_poison/pz_idle4.wav" ), +Sound( "npc/zombie_poison/pz_pain1.wav" ), +Sound( "npc/zombie_poison/pz_pain2.wav" ), +Sound( "npc/zombie_poison/pz_pain3.wav" ), +Sound( "npc/zombie_poison/pz_warn1.wav" ) } + +ENT.VoiceSounds.Taunt = { Sound( "npc/zombie_poison/pz_alert1.wav" ), +Sound( "npc/zombie_poison/pz_alert2.wav" ), +Sound( "npc/zombie_poison/pz_call1.wav" ), +Sound( "npc/zombie_poison/pz_throw2.wav" ), +Sound( "npc/zombie_poison/pz_throw3.wav" ) } + +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 ) + +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: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 + +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 ) + + 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 diff --git a/entities/entities/npc_scientist/shared.lua b/entities/entities/npc_scientist/shared.lua new file mode 100644 index 0000000..a39a533 --- /dev/null +++ b/entities/entities/npc_scientist/shared.lua @@ -0,0 +1,699 @@ + +AddCSLuaFile() + +ENT.Base = "base_nextbot" + +// Moddable + +ENT.AnimSpeed = 0.65 +ENT.HealDistance = 96 +ENT.AttackTime = 1.5 +ENT.BaseHealth = 100 +ENT.MoveSpeed = 175 +ENT.MoveAnim = ACT_RUN + +ENT.Models = { Model( "models/characters/hostage_04.mdl" ), Model( "models/kleiner.mdl" ) } +ENT.Legs = Model( "models/zombie/classic_legs.mdl" ) + +ENT.Pain = { "vo/k_lab/kl_ahhhh.wav", +"vo/k_lab/kl_dearme.wav", +"vo/k_lab/kl_getoutrun02.wav", +"vo/k_lab/kl_interference.wav", +"vo/k_lab/kl_mygoodness01.wav", +"vo/k_lab/kl_ohdear.wav" } + +ENT.Death = { "vo/k_lab/kl_ahhhh.wav", +"vo/k_lab/kl_getoutrun03.wav", +"vo/k_lab/kl_hedyno03.wav", +"vo/k_lab2/kl_greatscott.wav", +"vo/trainyard/kl_morewarn01.wav" } + +ENT.Happy = { "vo/k_lab/kl_excellent.wav", +"vo/k_lab/kl_moduli02.wav", +"vo/k_lab/kl_mygoodness03.wav", +"vo/k_lab/kl_relieved.wav", +"vo/k_lab2/kl_givenuphope.wav", +"vo/k_lab2/kl_howandwhen02.wav", +"vo/k_lab2/kl_notallhopeless_b.wav", +"vo/k_lab2/kl_slowteleport01.wav", +"vo/k_lab2/kl_slowteleport02.wav", +"vo/k_lab/kl_nownow02.wav" } + +ENT.Alert = { "vo/k_lab/kl_getoutrun02.wav", +"vo/k_lab/kl_getoutrun03.wav", +"vo/k_lab2/kl_greatscott.wav", +"vo/trainyard/kl_morewarn01.wav", +"vo/k_lab/kl_ohdear.wav" } + +// Other stuff + +ENT.HeadshotNoise = Sound( "Player.DamageHeadShot" ) + +ENT.NextBot = true +ENT.ShouldDrawPath = false +ENT.FireDamageTime = 0 +ENT.FireTime = 0 +ENT.HealTime = 0 +ENT.DmgTable = {} + +function ENT:Initialize() + + local model = table.Random( self.Models ) + self.Entity:SetModel( model ) + + self.Entity:SetHealth( self.BaseHealth ) + self.Entity:SetCollisionGroup( COLLISION_GROUP_NPC ) + self.Entity:SetCollisionBounds( Vector(-4,-4,0), Vector(4,4,64) ) + + self.loco:SetDeathDropHeight( 1000 ) + self.loco:SetAcceleration( 500 ) + + self.LastPos = self.Entity:GetPos() + self.Stuck = CurTime() + 10 + +end + +function ENT:Heal( ply ) + + self.Entity:VoiceSound( self.Happy ) + + ply:EmitSound( "HealthVial.Touch", 50, 120 ) + ply:AddHealth( 20 ) + ply:Notice( "+20 Health", GAMEMODE.Colors.Green ) + +end + +function ENT:Think() + + if ( self.Stuck or 0 ) < CurTime() then + + self.Entity:StuckThink() + + self.Stuck = CurTime() + 10 + self.LastPos = self.Entity:GetPos() + + end + + if self.Entity:OnFire() and self.FireDamageTime < CurTime() then + + self.FireDamageTime = CurTime() + 0.25 + + self.Entity:TakeDamage( 10, self.FireAttacker ) + + elseif self.FireSound and not self.Entity:OnFire() then + + self.Entity:StopFireSounds() + + end + + if ( self.ZombieTimer or 0 ) < CurTime() then + + self.ZombieTimer = CurTime() + 10 + + if self.Entity:NearZombie() then + + self.Entity:VoiceSound( self.Alert ) + + end + + end + + if self.CurAttack and self.CurAttack < CurTime() then + + self.CurAttack = nil + + if IsValid( self.CurEnemy ) and self.Entity:CanAttack( self.CurEnemy ) then + + self.Entity:Heal( self.CurEnemy ) + + end + + end + +end + +function ENT:NearZombie() + + for k,v in pairs( ents.FindByClass( "npc_nb*" ) ) do + + if v:GetPos():Distance( self.Entity:GetPos() ) < 300 then + + return v + + end + + end + +end + +function ENT:StuckThink() + self.LastPos = self.LastPos or Vector(0,0,0) + if self.LastPos:Distance( self.Entity:GetPos() ) < 50 then + + self.Entity:Respawn() + + end + +end + +function ENT:Respawn() + + for k,v in pairs( GAMEMODE.NPCSpawns ) do + + if IsValid( v ) then + + local box = ents.FindInBox( v:GetPos() + Vector( -32, -32, 0 ), v:GetPos() + Vector( 32, 32, 64 ) ) + local can = true + + for k,v in pairs( box ) do + + if v.NextBot then + + can = false + + end + + end + + if can then + + self.Entity:SetPos( v:GetPos() ) + return + + end + + end + + end + +end + +function ENT:OnLimbHit( hitgroup, dmginfo ) + + if not IsValid( self.Entity ) then return end + + if hitgroup == HITGROUP_HEAD then + + self.Entity:EmitSound( self.HeadshotNoise, 80, math.random( 100, 120 ) ) + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), true ) + + local effectdata = EffectData() + effectdata:SetOrigin( dmginfo:GetDamagePosition() ) + util.Effect( "headshot", effectdata, true, true ) + + dmginfo:ScaleDamage( 2.75 ) + + elseif hitgroup == HITGROUP_CHEST then + + dmginfo:ScaleDamage( 1.25 ) + + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), false ) + dmginfo:GetAttacker():ResetHeadshots() + + elseif hitgroup == HITGROUP_STOMACH then + + dmginfo:ScaleDamage( 0.75 ) + + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), false ) + dmginfo:GetAttacker():ResetHeadshots() + + else + + dmginfo:ScaleDamage( 0.50 ) + + self.Entity:SetHeadshotter( dmginfo:GetAttacker(), false ) + dmginfo:GetAttacker():ResetHeadshots() + + end + +end + +function ENT:OnInjured( dmginfo ) + + if dmginfo:IsExplosionDamage() then + + dmginfo:ScaleDamage( 1.75 ) + + elseif not self.Entity:OnFire() then + + local snd = table.Random( GAMEMODE.GoreBullet ) + sound.Play( snd, self.Entity:GetPos() + Vector(0,0,50), 75, math.random( 90, 110 ), 1.0 ) + + end + + self.Entity:AddDamageTaken( dmginfo:GetAttacker(), dmginfo:GetDamage() ) + + if self.Entity:Health() > 0 and math.random(1,2) == 1 then + + self.Entity:VoiceSound( self.Pain ) + + end + + local att = dmginfo:GetAttacker() + + if IsValid( att ) and att.NextBot then + + //self.Entity:OnKilled( dmginfo ) + + end + +end + +function ENT:SpawnRagdoll( dmginfo, model, pos, override ) + + timer.Simple( 0.2, function() if IsValid( self.Entity ) then self.Entity:Remove() end end ) + + if not model then + + self.Entity:BecomeRagdoll( dmginfo ) + + else + + local ang = self.Entity:GetAngles() + + local shooter = ents.Create( "env_shooter" ) + shooter:SetPos( pos or self.Entity:GetPos() ) + shooter:SetKeyValue( "m_iGibs", "1" ) + shooter:SetKeyValue( "shootsounds", "3" ) + shooter:SetKeyValue( "gibangles", ang.p.." "..ang.y.." "..ang.r ) + shooter:SetKeyValue( "angles", ang.p.." "..ang.y.." "..ang.r ) + shooter:SetKeyValue( "shootmodel", model ) + shooter:SetKeyValue( "simulation", "2" ) + shooter:SetKeyValue( "gibanglevelocity", math.random(-50,50).." "..math.random(-150,150).." "..math.random(-150,150) ) + shooter:SetKeyValue( "m_flVelocity", tostring( math.Rand( -20, 20 ) ) ) + shooter:SetKeyValue( "m_flVariance", tostring( math.Rand( -2, 2 ) ) ) + + shooter:Spawn() + + shooter:Fire( "shoot", 0, 0 ) + shooter:Fire( "kill", 0.1, 0.1 ) + + if not override then + + self.Entity:Remove() + + end + + end + +end + +function ENT:OnKilled( dmginfo ) + + if self.Dying then return end + + self.Dying = true + + self.Entity:OnDeath( dmginfo ) + self.Entity:SetNWBool( "Dead", true ) + + if dmginfo then + + local ent1 = self.Entity:GetHighestDamager() + + if IsValid( ent1 ) then + + if dmginfo:IsExplosionDamage() then + + local snd = table.Random( GAMEMODE.GoreSplash ) + self.Entity:EmitSound( snd, 90, math.random( 60, 80 ) ) + + local effectdata = EffectData() + effectdata:SetOrigin( self.Entity:GetPos() + Vector(0,0,20) ) + util.Effect( "body_gib", effectdata, true, true ) + + local ed = EffectData() + ed:SetOrigin( self.Entity:GetPos() ) + util.Effect( "gore_explosion", ed, true, true ) + + local corpse = table.Random( GAMEMODE.Corpses ) + self.Entity:SpawnRagdoll( dmginfo, corpse ) + + elseif ent1:HasShotgun() and ent1:GetPos():Distance( self.Entity:GetPos() ) < 100 then + + local snd = table.Random( GAMEMODE.GoreSplash ) + self.Entity:EmitSound( snd, 90, math.random( 60, 80 ) ) + + local effectdata = EffectData() + effectdata:SetOrigin( self.Entity:GetPos() + Vector(0,0,20) ) + util.Effect( "body_gib", effectdata, true, true ) + + self.Entity:SpawnRagdoll( dmginfo, self.Legs ) + + elseif ent1:HasMelee() then + + self.Entity:VoiceSound( self.Death ) + self.Entity:SpawnRagdoll( dmginfo ) + + if self.Entity:OnFire() then + + umsg.Start( "Burned" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + end + + elseif self.Entity:GetHeadshotter( ent1 ) then //self.HeadshotEffects + + local snd = table.Random( GAMEMODE.GoreSplash ) + self.Entity:EmitSound( snd, 90, math.random( 90, 110 ) ) + + local effectdata = EffectData() + effectdata:SetOrigin( self.Entity:GetPos() + Vector(0,0,40) ) + util.Effect( "head_gib", effectdata, true, true ) + + umsg.Start( "Headless" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + if self.Entity:OnFire() then + + umsg.Start( "Burned" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + end + + self.Entity:SpawnRagdoll( dmginfo ) + + else + + self.Entity:VoiceSound( self.Death ) + self.Entity:SpawnRagdoll( dmginfo ) + + if self.Entity:OnFire() then + + umsg.Start( "Burned" ) + umsg.Vector( self.Entity:GetPos() ) + umsg.End() + + end + + end + + else + + self.Entity:SpawnRagdoll( dmginfo ) + + end + + end + +end + +function ENT:OnDeath( dmginfo ) + + for i=1, math.random(1,3) do + + local tbl = item.RandomItem( ITEM_SUPPLY ) + + local prop = ents.Create( "prop_physics" ) + prop:SetPos( self.Entity:GetPos() + Vector(0,0,30) + VectorRand() * 5 ) + prop:SetModel( tbl.Model ) + prop:SetCollisionGroup( COLLISION_GROUP_WEAPON ) + prop:Spawn() + + end + + if math.random(1,4) != 1 then + + local model = table.Random{ "models/healthvial.mdl", "models/items/healthkit.mdl" } + + local prop = ents.Create( "prop_physics" ) + prop:SetPos( self.Entity:GetPos() + Vector(0,0,30) + VectorRand() * 5 ) + prop:SetModel( model ) + prop:SetCollisionGroup( COLLISION_GROUP_WEAPON ) + prop:Spawn() + + end + +end + +function ENT:OnFire() + + return self.FireTime > CurTime() + +end + +function ENT:DoIgnite( att ) + + if self.Entity:OnFire() then return end + + if IsValid( att ) and att:IsPlayer() and att:Team() == TEAM_ARMY then + + att:AddStat( "Igniter" ) + + end + + self.FireTime = CurTime() + 5 + self.FireAttacker = att + self.FireSound = true + + local ed = EffectData() + ed:SetEntity( self.Entity ) + util.Effect( "immolate", ed, true, true ) + + self.Entity:EmitSound( table.Random( GAMEMODE.Burning ), 100, 80 ) + self.Entity:EmitSound( GAMEMODE.BurnFlesh ) + +end + +function ENT:StopFireSounds() + + self.Entity:StopSound( GAMEMODE.BurnFlesh ) + +end + +function ENT:AddDamageTaken( attacker, dmg ) + + if not attacker:IsPlayer() then return end + + if not self.DmgTable[ attacker ] then + + self.DmgTable[ attacker ] = {} + self.DmgTable[ attacker ].Dmg = dmg + + elseif not self.DmgTable[ attacker ].Dmg then + + self.DmgTable[ attacker ].Dmg = dmg + + else + + self.DmgTable[ attacker ].Dmg = self.DmgTable[ attacker ].Dmg + dmg + + end + +end + +function ENT:GetHeadshotter( attacker ) + + if not self.DmgTable[ attacker ] then return false end + + return self.DmgTable[ attacker ].Headshot + +end + +function ENT:SetHeadshotter( attacker, head ) + + if not self.DmgTable[ attacker ] then + + self.DmgTable[ attacker ] = {} + + end + + self.DmgTable[ attacker ].Headshot = head + +end + +function ENT:GetHighestDamager() + + local ent1 = NULL + local high = 0 + + for k,v in pairs( self.DmgTable ) do + + if IsValid( k ) and v.Dmg and v.Dmg > high then + + high = v.Dmg + ent1 = k + + end + + end + + return ent1 + +end + +function ENT:VoiceSound( tbl ) + + if ( self.VoiceTime or 0 ) > CurTime() then return end + + self.VoiceTime = CurTime() + 1.5 + + local snd = table.Random( tbl ) + sound.Play( snd, self.Entity:GetPos() + Vector(0,0,50), 75, 100, 0.7 ) + +end + +function ENT:StartAttack( enemy ) + + self.CurAttack = CurTime() + self.AttackTime + self.CurEnemy = enemy + +end + +function ENT:OnHitEnemy( enemy ) + + enemy:TakeDamage( self.Damage, self.Entity ) + +end + +function ENT:BehaveAct() // what does this do? + +end + +function ENT:IsZombie() + + return false + +end + +function ENT:CanTarget( v ) + + return ( v:Alive() and v:GetObserverMode() == OBS_MODE_NONE and v:Team() == TEAM_ARMY ) + +end + +function ENT:FindHuman() + + local tbl = team.GetPlayers( TEAM_ARMY ) + + self.EnemyTable = tbl + + if #tbl < 1 then + + return NULL + + else + + local enemy = NULL + local dist = 99999 + + for k,v in pairs( tbl ) do + + local compare = v:GetPos():Distance( self.Entity:GetPos() ) + + if compare < dist and self.Entity:CanTarget( v ) then + + enemy = v + dist = compare + + end + + end + + return enemy + + end + +end + +function ENT:CanAttack( ent ) + + return IsValid( ent ) and self.Entity:CanTarget( ent ) and ent:GetPos():Distance( self.Entity:GetPos() ) <= self.HealDistance + +end + +function ENT:CanAttackEnemy( ent ) + + if self.Entity:CanAttack( ent ) then + + return ent + + end + + if #self.EnemyTable < 1 then return end + + for k,v in pairs( self.EnemyTable ) do + + if self.Entity:CanAttack( v ) then + + return v + + end + + end + +end + +function ENT:OnStuck() + + //self.loco:ClearStuck() + self.Entity:VoiceSound( self.Alert ) + +end + +function ENT:OnUnStuck() + + //self.Obstructed = false + +end + +function ENT:StartAttack( enemy ) + + self.CurAttack = CurTime() + self.AttackTime + self.CurEnemy = enemy + +end + +function ENT:EnemyRoutine() + + local closest = self.Entity:CanAttackEnemy( enemy ) + + while IsValid( closest ) do + + self.Entity:StartAttack( closest ) + self.Entity:PlaySequenceAndWait( "open_door_away", self.AnimSpeed ) + + coroutine.wait( 1.0 ) + + closest = self.Entity:CanAttackEnemy( closest ) + + end + +end + +function ENT:RunBehaviour() + + while true do + + self.Entity:StartActivity( self.MoveAnim ) + self.loco:SetDesiredSpeed( self.MoveSpeed ) + + local enemy = self.Entity:FindHuman() + + 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 ) + + else + + local opts = { draw = self.ShouldDrawPath, maxage = 1, tolerance = self.HealDistance } + + self.Entity:MoveToPos( enemy:GetPos(), opts ) + + self.Entity:StartActivity( ACT_IDLE ) + + self.Entity:EnemyRoutine() + + self.Entity:StartActivity( ACT_IDLE ) + + end + + coroutine.yield() + + end + +end diff --git a/entities/entities/point_evac/cl_init.lua b/entities/entities/point_evac/cl_init.lua new file mode 100644 index 0000000..c069cf8 --- /dev/null +++ b/entities/entities/point_evac/cl_init.lua @@ -0,0 +1,19 @@ + +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:Think() + +end + +function ENT:OnRemove() + +end + +function ENT:Draw() + +end + diff --git a/entities/entities/point_evac/init.lua b/entities/entities/point_evac/init.lua new file mode 100644 index 0000000..040bf87 --- /dev/null +++ b/entities/entities/point_evac/init.lua @@ -0,0 +1,117 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +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: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 + +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 ) + + 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 + +function ENT:UpdateTransmitState() + + return TRANSMIT_ALWAYS + +end diff --git a/entities/entities/point_evac/shared.lua b/entities/entities/point_evac/shared.lua new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/point_evac/shared.lua @@ -0,0 +1,3 @@ +ENT.Type = "anim" +ENT.Base = "base_anim" + diff --git a/entities/entities/point_radiation/init.lua b/entities/entities/point_radiation/init.lua new file mode 100644 index 0000000..7821c2d --- /dev/null +++ b/entities/entities/point_radiation/init.lua @@ -0,0 +1,94 @@ + +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 ) + + self.Artifact = ent + +end + +function ENT:GetArtifact() + + return self.Artifact or NULL + +end + +function ENT:SetActive( bool ) + + self.Active = bool + +end + +function ENT:IsActive() + + return self.Active + +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 + +function ENT:GetRadiationRadius() + + return self.Radius + +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: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 new file mode 100644 index 0000000..e978063 --- /dev/null +++ b/entities/entities/point_stash/cl_init.lua @@ -0,0 +1,11 @@ + +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:Draw() + +end + diff --git a/entities/entities/point_stash/init.lua b/entities/entities/point_stash/init.lua new file mode 100644 index 0000000..94fcc43 --- /dev/null +++ b/entities/entities/point_stash/init.lua @@ -0,0 +1,170 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +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 ) + +end + +function ENT:GetCash() + + return self.Cash + +end + +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 + +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 + +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 + +function ENT:Use( ply, caller ) + +end + +function ENT:GetItems() + + return self.Items + +end + +function ENT:AddItem( id ) + + self.Items = self.Items or {} + + table.insert( self.Items, id ) + + self.Entity:Synch() + +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 + +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 new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/point_stash/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..88a116a --- /dev/null +++ b/entities/entities/sent_antidote/cl_init.lua @@ -0,0 +1,44 @@ + +include('shared.lua') + +function ENT:Initialize() + + GAMEMODE.ClientAntidote = self.Entity + +end + +function ENT:Think() + +end + +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 diff --git a/entities/entities/sent_antidote/init.lua b/entities/entities/sent_antidote/init.lua new file mode 100644 index 0000000..8fc742d --- /dev/null +++ b/entities/entities/sent_antidote/init.lua @@ -0,0 +1,86 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +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:SetOverride() + + self.Override = true + +end + +function ENT:SetCures( num ) + + self.CureCount = num + +end + +function ENT:CuresLeft() + + return self.CureCount + +end + +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 + +end diff --git a/entities/entities/sent_antidote/shared.lua b/entities/entities/sent_antidote/shared.lua new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_antidote/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_barrel_biohazard/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_barrel_biohazard/init.lua b/entities/entities/sent_barrel_biohazard/init.lua new file mode 100644 index 0000000..b776619 --- /dev/null +++ b/entities/entities/sent_barrel_biohazard/init.lua @@ -0,0 +1,137 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "Metal_Barrel.ImpactSoft" ) +ENT.DieSound = Sound( "Breakable.Metal" ) +ENT.Model = Model( "models/props/de_train/barrel.mdl" ) +ENT.Damage = 60 +ENT.Radius = 300 +ENT.Skins = {2,4,5,6} + +function ENT:Initialize() + + local skin = table.Random( self.Skins ) + + 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 ) + + self.Speed = num + +end + +function ENT:Think() + +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 + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_barrel_biohazard/shared.lua b/entities/entities/sent_barrel_biohazard/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_barrel_biohazard/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_barrel_radioactive/cl_init.lua b/entities/entities/sent_barrel_radioactive/cl_init.lua new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_barrel_radioactive/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_barrel_radioactive/init.lua b/entities/entities/sent_barrel_radioactive/init.lua new file mode 100644 index 0000000..ef2fcd0 --- /dev/null +++ b/entities/entities/sent_barrel_radioactive/init.lua @@ -0,0 +1,131 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "Metal_Barrel.ImpactSoft" ) +ENT.DieSound = Sound( "Breakable.Metal" ) +ENT.Model = Model( "models/props/de_train/barrel.mdl" ) +ENT.Damage = 60 +ENT.Radius = 300 +ENT.Skins = {0,1,7} + +function ENT:Initialize() + + local skin = table.Random( self.Skins ) + + 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 ) + + self.Speed = num + +end + +function ENT:Think() + +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" ) + 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 + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_barrel_radioactive/shared.lua b/entities/entities/sent_barrel_radioactive/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_barrel_radioactive/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_bonuscrate/cl_init.lua b/entities/entities/sent_bonuscrate/cl_init.lua new file mode 100644 index 0000000..f1cad0f --- /dev/null +++ b/entities/entities/sent_bonuscrate/cl_init.lua @@ -0,0 +1,13 @@ + +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_bonuscrate/init.lua b/entities/entities/sent_bonuscrate/init.lua new file mode 100644 index 0000000..3817a61 --- /dev/null +++ b/entities/entities/sent_bonuscrate/init.lua @@ -0,0 +1,97 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.Bang = Sound( "Wood.ImpactHard" ) +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 ) + + end + + self.Removing = false + self.Contents = { 1 } + self.Users = {} + self.Uses = math.random( 1, 5 ) + +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 + +function ENT:AddUser( ply ) + + table.insert( self.Users, ply ) + +end + +function ENT:Use( ply, caller ) + + if not IsValid( ply ) or table.HasValue( self.Users, ply ) or ply:Team() != TEAM_ARMY or self.Removing then return end + + 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 + + self.Entity:Remove() + + end + +end + +function ENT:PhysicsCollide( data, phys ) + + if data.Speed > 50 and data.DeltaTime > 0.15 then + + self.Entity:EmitSound( self.Bang ) + + end + +end + diff --git a/entities/entities/sent_bonuscrate/shared.lua b/entities/entities/sent_bonuscrate/shared.lua new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_bonuscrate/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..1821218 --- /dev/null +++ b/entities/entities/sent_c4/cl_init.lua @@ -0,0 +1,36 @@ +include('shared.lua') + +function ENT:Initialize() + + self.Light = Material( "sprites/light_glow02_add" ) + self.Beep = CurTime() + 1 + +end + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_c4/init.lua b/entities/entities/sent_c4/init.lua new file mode 100644 index 0000000..3410fca --- /dev/null +++ b/entities/entities/sent_c4/init.lua @@ -0,0 +1,120 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.ExplodeSound = { 1, 2, 4, 5, 6, 8 } +ENT.DebrisSound = Sound( "weapons/c4/c4_exp_deb2.wav" ) +ENT.DebrisSound2 = Sound( "weapons/debris2.wav" ) +ENT.BeepSound = Sound( "weapons/c4/c4_beep1.wav" ) +ENT.Damage = 400 +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 ) + + self.Speed = num + +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() + + self.Entity:EmitSound( "explode_" .. table.Random( self.ExplodeSound ), 300, 100 ) + self.Entity:EmitSound( self.DebrisSound, 300, 100 ) + self.Entity:EmitSound( self.DebrisSound2, 300, 100 ) + + 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 + +function ENT:OnRemove() + +end + +function ENT:OnTakeDamage( dmginfo ) + +end + +function ENT:PhysicsCollide( data, phys ) + +end + diff --git a/entities/entities/sent_c4/shared.lua b/entities/entities/sent_c4/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_c4/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_cash/cl_init.lua b/entities/entities/sent_cash/cl_init.lua new file mode 100644 index 0000000..d0fb196 --- /dev/null +++ b/entities/entities/sent_cash/cl_init.lua @@ -0,0 +1,18 @@ + +include('shared.lua') + +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 + diff --git a/entities/entities/sent_cash/init.lua b/entities/entities/sent_cash/init.lua new file mode 100644 index 0000000..1adb29e --- /dev/null +++ b/entities/entities/sent_cash/init.lua @@ -0,0 +1,84 @@ + +AddCSLuaFile( "cl_init.lua" ) +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() + + 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 + +function ENT:SetCash( amt ) + + self.Cash = amt + + self.Entity:SetNWInt( "Cash", amt ) + +end + +function ENT:GetCash() + + return self.Cash + +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 new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_cash/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..3ff2828 --- /dev/null +++ b/entities/entities/sent_dropflare/cl_init.lua @@ -0,0 +1,73 @@ +include('shared.lua') + +function ENT:Initialize() + + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + self.Smoke = 0 + +end + +function ENT:OnRemove() + + if self.Emitter then + + self.Emitter:Finish() + + end + +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 ) ) + particle:SetStartAlpha( 100 ) + particle:SetEndAlpha( 0 ) + 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 + dlight.b = 50 + dlight.Brightness = 3 + dlight.Decay = 2048 + dlight.size = 256 * math.Rand( 0.5, 1.0 ) + dlight.DieTime = CurTime() + 1 + + end + +end + +local matFlare = Material( "effects/blueflare1" ) + +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 + diff --git a/entities/entities/sent_dropflare/init.lua b/entities/entities/sent_dropflare/init.lua new file mode 100644 index 0000000..b806886 --- /dev/null +++ b/entities/entities/sent_dropflare/init.lua @@ -0,0 +1,84 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.Burn = Sound( "Weapon_FlareGun.Burn" ) +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 ) + + self.DieTime = CurTime() + t + +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 + +function ENT:OnRemove() + + self.Entity:StopSound( self.Burn ) + +end + +function ENT:OnTakeDamage( dmginfo ) + +end + +function ENT:PhysicsCollide( data, phys ) + +end + +function ENT:UpdateTransmitState() + + return TRANSMIT_ALWAYS + +end + diff --git a/entities/entities/sent_dropflare/shared.lua b/entities/entities/sent_dropflare/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_dropflare/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_droppedgun/cl_init.lua b/entities/entities/sent_droppedgun/cl_init.lua new file mode 100644 index 0000000..f1cad0f --- /dev/null +++ b/entities/entities/sent_droppedgun/cl_init.lua @@ -0,0 +1,13 @@ + +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_droppedgun/init.lua b/entities/entities/sent_droppedgun/init.lua new file mode 100644 index 0000000..20d6571 --- /dev/null +++ b/entities/entities/sent_droppedgun/init.lua @@ -0,0 +1,49 @@ + +AddCSLuaFile( "cl_init.lua" ) +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: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 new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_droppedgun/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..fb83991 --- /dev/null +++ b/entities/entities/sent_fire/cl_init.lua @@ -0,0 +1,120 @@ + +include('shared.lua') + +function ENT:Initialize() + + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + + self.SmokeTime = 0 + self.LightTime = 0 + + self.Entity:DoTraces() + +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 + +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 ) + particle:SetStartAlpha( 255 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random(15,25) + ( math.random(25,50) * tbl.Scale ) ) + particle:SetEndSize( 0 ) + 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 ) ) ) + particle:SetStartAlpha( 50 + tbl.Scale * 75 ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.random(10,20) ) + particle:SetEndSize( math.random(30,60) + ( math.random(40,80) * tbl.Scale ) ) + 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 + dlight.b = 50 + dlight.Brightness = 4 + dlight.Decay = 2048 + dlight.size = 256 * math.Rand( 0.8, 1.2 ) + dlight.DieTime = CurTime() + 1 + + end + + end + +end + +function ENT:OnRemove() + + if self.Emitter then + + self.Emitter:Finish() + + end + +end + +function ENT:Draw() + +end + diff --git a/entities/entities/sent_fire/init.lua b/entities/entities/sent_fire/init.lua new file mode 100644 index 0000000..d643ada --- /dev/null +++ b/entities/entities/sent_fire/init.lua @@ -0,0 +1,74 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.BurnSound = Sound( "fire_large" ) +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: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 ) + + self.LifeTime = num + +end + +function ENT:OnRemove() + + self.Entity:StopSound( self.BurnSound ) + +end + +function ENT:Think() + + if self.DieTime < CurTime() then + + self.Entity:Remove() + + end + +end + +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 + +function ENT:UpdateTransmitState() + + return TRANSMIT_ALWAYS + +end diff --git a/entities/entities/sent_fire/shared.lua b/entities/entities/sent_fire/shared.lua new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_fire/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..d6bf3a4 --- /dev/null +++ b/entities/entities/sent_flare/cl_init.lua @@ -0,0 +1,86 @@ +include('shared.lua') + +function ENT:Initialize() + + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + self.Smoke = 0 + +end + +function ENT:OnRemove() + + if self.Emitter then + + self.Emitter:Finish() + + end + +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 ) ) + particle:SetStartAlpha( 100 ) + particle:SetEndAlpha( 0 ) + 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 + dlight.b = 50 + dlight.Brightness = 3 + 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" ) + +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 + diff --git a/entities/entities/sent_flare/init.lua b/entities/entities/sent_flare/init.lua new file mode 100644 index 0000000..7e36159 --- /dev/null +++ b/entities/entities/sent_flare/init.lua @@ -0,0 +1,78 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.Burn = Sound( "Weapon_FlareGun.Burn" ) +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 + +function ENT:OnRemove() + + self.Entity:StopSound( self.Burn ) + +end + +function ENT:OnTakeDamage( dmginfo ) + +end + +function ENT:PhysicsCollide( data, phys ) + +end + +function ENT:UpdateTransmitState() + + return TRANSMIT_ALWAYS + +end + diff --git a/entities/entities/sent_flare/shared.lua b/entities/entities/sent_flare/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_flare/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_fuel_diesel/cl_init.lua b/entities/entities/sent_fuel_diesel/cl_init.lua new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_fuel_diesel/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_fuel_diesel/init.lua b/entities/entities/sent_fuel_diesel/init.lua new file mode 100644 index 0000000..9340505 --- /dev/null +++ b/entities/entities/sent_fuel_diesel/init.lua @@ -0,0 +1,117 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "Metal_Box.ImpactHard" ) +ENT.DieSound = Sound( "ambient/fire/ignite.wav" ) +ENT.Model = Model( "models/props_junk/metalgascan.mdl" ) +ENT.Damage = 80 +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 ) + + self.Speed = num + +end + +function ENT:Think() + +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 + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_fuel_diesel/shared.lua b/entities/entities/sent_fuel_diesel/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_fuel_diesel/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_fuel_gas/cl_init.lua b/entities/entities/sent_fuel_gas/cl_init.lua new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_fuel_gas/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_fuel_gas/init.lua b/entities/entities/sent_fuel_gas/init.lua new file mode 100644 index 0000000..6672661 --- /dev/null +++ b/entities/entities/sent_fuel_gas/init.lua @@ -0,0 +1,117 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "Metal_Box.ImpactHard" ) +ENT.DieSound = Sound( "ambient/fire/ignite.wav" ) +ENT.Model = Model( "models/props_junk/gascan001a.mdl" ) +ENT.Damage = 50 +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 ) + + self.Speed = num + +end + +function ENT:Think() + +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 + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_fuel_gas/shared.lua b/entities/entities/sent_fuel_gas/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_fuel_gas/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_grenade/cl_init.lua b/entities/entities/sent_grenade/cl_init.lua new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_grenade/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_grenade/init.lua b/entities/entities/sent_grenade/init.lua new file mode 100644 index 0000000..3973d4f --- /dev/null +++ b/entities/entities/sent_grenade/init.lua @@ -0,0 +1,113 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "physics/metal/metal_grenade_impact_hard2.wav" ) +ENT.Damage = 250 +ENT.Radius = 300 +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 ) + + self.Speed = num + +end + +function ENT:Think() + + if self.Delay < CurTime() then + + self.Entity:Explode() + + end + +end + +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 + +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 + diff --git a/entities/entities/sent_grenade/shared.lua b/entities/entities/sent_grenade/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_grenade/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_grenade_incendiary/cl_init.lua b/entities/entities/sent_grenade_incendiary/cl_init.lua new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_grenade_incendiary/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_grenade_incendiary/init.lua b/entities/entities/sent_grenade_incendiary/init.lua new file mode 100644 index 0000000..906fe1f --- /dev/null +++ b/entities/entities/sent_grenade_incendiary/init.lua @@ -0,0 +1,116 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "physics/metal/metal_grenade_impact_hard2.wav" ) +ENT.DieSound = Sound( "ambient/fire/ignite.wav" ) +ENT.Damage = 30 +ENT.Radius = 200 +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 ) + + self.Speed = num + +end + +function ENT:Think() + + if self.Delay < CurTime() then + + self.Entity:Explode() + + end + +end + +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() + +end + +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 + diff --git a/entities/entities/sent_grenade_incendiary/shared.lua b/entities/entities/sent_grenade_incendiary/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_grenade_incendiary/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_heliflare/cl_init.lua b/entities/entities/sent_heliflare/cl_init.lua new file mode 100644 index 0000000..30e76c6 --- /dev/null +++ b/entities/entities/sent_heliflare/cl_init.lua @@ -0,0 +1,84 @@ +include('shared.lua') + +function ENT:Initialize() + + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + self.Smoke = 0 + +end + +function ENT:OnRemove() + + if self.Emitter then + + self.Emitter:Finish() + + end + +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 ) ) + particle:SetStartAlpha( 100 ) + particle:SetEndAlpha( 0 ) + 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 + dlight.b = 50 + dlight.Brightness = 3 + 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" ) + +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 + diff --git a/entities/entities/sent_heliflare/init.lua b/entities/entities/sent_heliflare/init.lua new file mode 100644 index 0000000..914b5c1 --- /dev/null +++ b/entities/entities/sent_heliflare/init.lua @@ -0,0 +1,76 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.Rotor = Sound( "NPC_AttackHelicopter.RotorsLoud" ) +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 + +function ENT:OnRemove() + + self.Entity:StopSound( self.Rotor ) + +end + +function ENT:OnTakeDamage( dmginfo ) + +end + +function ENT:PhysicsCollide( data, phys ) + +end + +function ENT:UpdateTransmitState() + + return TRANSMIT_ALWAYS + +end + diff --git a/entities/entities/sent_heliflare/shared.lua b/entities/entities/sent_heliflare/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_heliflare/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_lootbag/cl_init.lua b/entities/entities/sent_lootbag/cl_init.lua new file mode 100644 index 0000000..5af3dc2 --- /dev/null +++ b/entities/entities/sent_lootbag/cl_init.lua @@ -0,0 +1,15 @@ + +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:Draw() + + if IsValid( self.Entity:GetNWEntity( "QuestOwner", nil ) ) and self.Entity:GetNWEntity( "QuestOwner", nil ) != LocalPlayer() then return end + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_lootbag/init.lua b/entities/entities/sent_lootbag/init.lua new file mode 100644 index 0000000..7a93b0a --- /dev/null +++ b/entities/entities/sent_lootbag/init.lua @@ -0,0 +1,149 @@ + +AddCSLuaFile( "cl_init.lua" ) +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 ) + +end + +function ENT:GetCash() + + return self.Cash + +end + +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 + +function ENT:SetRemoval( num ) + + self.DieTime = CurTime() + num + +end + +--[[function ENT:OnExit( 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 IsValid( self.Entity:GetUser() ) then + + self.Entity:SetUser() + ply:ToggleStashMenu( self.Entity, false, "StashMenu" ) + + end + +end + +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 ) + ply:AddCash( self:GetCash() ) + + self.Entity:Remove() + +end + +function ENT:GetItems() + + return self.Items or {} + +end + +function ENT:AddItem( id ) + + self.Items = self.Items or {} + + table.insert( self.Items, id ) + + //self.Entity:Synch() + +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 + +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 new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_lootbag/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_oxygen/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_oxygen/init.lua b/entities/entities/sent_oxygen/init.lua new file mode 100644 index 0000000..550be32 --- /dev/null +++ b/entities/entities/sent_oxygen/init.lua @@ -0,0 +1,117 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "Metal_Box.ImpactHard" ) +ENT.Model = Model( "models/props_phx/misc/potato_launcher_explosive.mdl" ) +ENT.Damage = 150 +ENT.Radius = 350 +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 ) + + self.Speed = num + +end + +function ENT:Think() + +end + +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 + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_oxygen/shared.lua b/entities/entities/sent_oxygen/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_oxygen/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_propane_canister/cl_init.lua b/entities/entities/sent_propane_canister/cl_init.lua new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_propane_canister/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_propane_canister/init.lua b/entities/entities/sent_propane_canister/init.lua new file mode 100644 index 0000000..b36368f --- /dev/null +++ b/entities/entities/sent_propane_canister/init.lua @@ -0,0 +1,111 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "Canister.ImpactHard" ) +ENT.DieSound = Sound( "PropaneTank.Burst" ) +ENT.Model = Model( "models/props_junk/propane_tank001a.mdl" ) +ENT.Damage = 180 +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 ) + + self.Speed = num + +end + +function ENT:Think() + +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 + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_propane_canister/shared.lua b/entities/entities/sent_propane_canister/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_propane_canister/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_propane_tank/cl_init.lua b/entities/entities/sent_propane_tank/cl_init.lua new file mode 100644 index 0000000..514bad0 --- /dev/null +++ b/entities/entities/sent_propane_tank/cl_init.lua @@ -0,0 +1,20 @@ +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:OnRemove() + +end + +function ENT:Think() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_propane_tank/init.lua b/entities/entities/sent_propane_tank/init.lua new file mode 100644 index 0000000..caadbf5 --- /dev/null +++ b/entities/entities/sent_propane_tank/init.lua @@ -0,0 +1,111 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.HitSound = Sound( "Canister.ImpactHard" ) +ENT.DieSound = Sound( "PropaneTank.Burst" ) +ENT.Model = Model( "models/props_junk/propanecanister001a.mdl" ) +ENT.Damage = 180 +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 ) + + self.Speed = num + +end + +function ENT:Think() + +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 + +function ENT:OnRemove() + +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 + diff --git a/entities/entities/sent_propane_tank/shared.lua b/entities/entities/sent_propane_tank/shared.lua new file mode 100644 index 0000000..8b0a8a2 --- /dev/null +++ b/entities/entities/sent_propane_tank/shared.lua @@ -0,0 +1,2 @@ +ENT.Type = "anim" +ENT.Base = "base_anim"
\ No newline at end of file diff --git a/entities/entities/sent_radiation/cl_init.lua b/entities/entities/sent_radiation/cl_init.lua new file mode 100644 index 0000000..e07f410 --- /dev/null +++ b/entities/entities/sent_radiation/cl_init.lua @@ -0,0 +1,52 @@ + +include('shared.lua') + +function ENT:Initialize() + + self.Emitter = ParticleEmitter( self.Entity:GetPos() ) + self.DieTime = CurTime() + 30 + self.LightTime = 0 + +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.DieTime = CurTime() + 1 + + end + + end + +end + +function ENT:OnRemove() + + if self.Emitter then + + self.Emitter:Finish() + + end + +end + +function ENT:Draw() + +end + diff --git a/entities/entities/sent_radiation/init.lua b/entities/entities/sent_radiation/init.lua new file mode 100644 index 0000000..52eabb4 --- /dev/null +++ b/entities/entities/sent_radiation/init.lua @@ -0,0 +1,90 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +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: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 ) + + self.Distance = num + +end + +function ENT:SetLifeTime( num ) + + self.LifeTime = num + +end + +function ENT:OnRemove() + +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: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 + +end diff --git a/entities/entities/sent_radiation/shared.lua b/entities/entities/sent_radiation/shared.lua new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_radiation/shared.lua @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..f1cad0f --- /dev/null +++ b/entities/entities/sent_supplycrate/cl_init.lua @@ -0,0 +1,13 @@ + +include('shared.lua') + +function ENT:Initialize() + +end + +function ENT:Draw() + + self.Entity:DrawModel() + +end + diff --git a/entities/entities/sent_supplycrate/init.lua b/entities/entities/sent_supplycrate/init.lua new file mode 100644 index 0000000..932ca4e --- /dev/null +++ b/entities/entities/sent_supplycrate/init.lua @@ -0,0 +1,79 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) +include( 'shared.lua' ) + +ENT.Bang = Sound( "Wood.ImpactHard" ) +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 + self.Contents = { 1 } + +end + +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 + +function ENT:SetContents( tbl ) + + self.Contents = tbl + +end + +function ENT:SetUser( ply ) + + self.User = ply + +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 + + ply:AddMultipleToInventory( self.Contents ) + + self.Entity:EmitSound( self.Open ) + self.Entity:Remove() + +end + +function ENT:PhysicsCollide( data, phys ) + + if data.Speed > 50 and data.DeltaTime > 0.15 then + + self.Entity:EmitSound( self.Bang ) + + end + +end + diff --git a/entities/entities/sent_supplycrate/shared.lua b/entities/entities/sent_supplycrate/shared.lua new file mode 100644 index 0000000..8e216e2 --- /dev/null +++ b/entities/entities/sent_supplycrate/shared.lua @@ -0,0 +1,3 @@ +ENT.Type = "anim" +ENT.Base = "base_anim" + diff --git a/entities/weapons/rad_ak47/shared.lua b/entities/weapons/rad_ak47/shared.lua new file mode 100644 index 0000000..36d2799 --- /dev/null +++ b/entities/weapons/rad_ak47/shared.lua @@ -0,0 +1,37 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_ak47.mdl" +SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl" + +SWEP.SprintPos = Vector (-1.3057, -4.167, 0.3971) +SWEP.SprintAng = Vector (-9.8658, -38.0733, 13.8555) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_AK47.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 55 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_awp/shared.lua b/entities/weapons/rad_awp/shared.lua new file mode 100644 index 0000000..f20fd07 --- /dev/null +++ b/entities/weapons/rad_awp/shared.lua @@ -0,0 +1,46 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_snip_awp.mdl" +SWEP.WorldModel = "models/weapons/w_snip_awp.mdl" + +SWEP.SprintPos = Vector(-2.4134, -2.7816, 0.4499) +SWEP.SprintAng = Vector(-4.2748, -48.8937, -0.0962) + +SWEP.ZoomModes = { 0, 35, 5 } +SWEP.ZoomSpeeds = { 0.25, 0.30, 0.30 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Sniper" + +SWEP.Primary.Sound = Sound( "Weapon_AWP.Single" ) +SWEP.Primary.Recoil = 17.5 +SWEP.Primary.Damage = 175 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.001 +SWEP.Primary.SniperCone = 0.015 +SWEP.Primary.Delay = 1.500 + +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Automatic = false + +SWEP.MinShellDelay = 0.8 +SWEP.MaxShellDelay = 1.0 diff --git a/entities/weapons/rad_axe/shared.lua b/entities/weapons/rad_axe/shared.lua new file mode 100644 index 0000000..2411957 --- /dev/null +++ b/entities/weapons/rad_axe/shared.lua @@ -0,0 +1,213 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 80 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Axe" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "melee2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_axe/v_axe.mdl" +SWEP.WorldModel = "models/weapons/w_axe.mdl" + +SWEP.HoldPos = Vector (1.1747, -16.6759, -5.7913) +SWEP.HoldAng = Vector (23.7548, -8.0105, -5.154) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.Hit = Sound( "weapons/crowbar/crowbar_impact2.wav" ) +SWEP.Primary.Sound = Sound( "weapons/iceaxe/iceaxe_swing1.wav" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 100 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.300 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return self.Weapon:MoveViewModelTo( self.HoldPos, self.HoldAng, pos, ang, 1 ) + +end + +function SWEP:SecondaryAttack() + +end + +function SWEP:PrimaryAttack() + + if SERVER then + + self.Owner:AddStamina( -4 ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + +end + +function SWEP:Think() + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + end + + if self.MoveTime and self.MoveTime < CurTime() and SERVER then + + self.MoveTime = nil + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) + self.Owner:DrawViewModel( false ) + + end + +end + +function SWEP:MeleeTrace( dmg ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + 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 + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + 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 + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(60,80) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + + if ent:IsPlayer() then + + local snd = table.Random( GAMEMODE.AxeHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + ent:SetHeadshotter( self.Owner, true ) + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + local snd = table.Random( GAMEMODE.AxeHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:DrawHUD() + +end diff --git a/entities/weapons/rad_base/shared.lua b/entities/weapons/rad_base/shared.lua new file mode 100644 index 0000000..63ef374 --- /dev/null +++ b/entities/weapons/rad_base/shared.lua @@ -0,0 +1,958 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + + SWEP.Weight = 1 + SWEP.AutoSwitchTo = false + SWEP.AutoSwitchFrom = false + +end + +if CLIENT then + + SWEP.DrawAmmo = true + SWEP.DrawCrosshair = false + SWEP.CSMuzzleFlashes = true + + 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" + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.SprintPos = Vector(0,0,0) +SWEP.SprintAng = Vector(0,0,0) + +SWEP.ZoomModes = { 0, 50, 10 } +SWEP.ZoomSpeeds = { 5, 5, 5 } + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Empty = Sound( "weapons/clipempty_rifle.wav" ) +SWEP.Primary.Sound = Sound( "Weapon_USP.Single" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 10 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.025 +SWEP.Primary.SniperCone = 0.025 +SWEP.Primary.Delay = 0.150 + +SWEP.Primary.Ammo = "Pistol" +SWEP.Primary.ClipSize = 50 +SWEP.Primary.DefaultClip = 200 +SWEP.Primary.Automatic = false + +SWEP.Secondary.Sound = Sound( "weapons/zoom.wav" ) +SWEP.Secondary.Laser = Sound( "weapons/ar2/ar2_empty.wav" ) +SWEP.Secondary.Delay = 0.5 + +SWEP.Secondary.Ammo = "none" +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false + +SWEP.LaserOffset = Vector(0,0,0) +SWEP.HolsterMode = false +SWEP.HolsterTime = 0 +SWEP.LastRunFrame = 0 + +SWEP.MinShellDelay = 0.3 +SWEP.MaxShellDelay = 0.6 + +SWEP.FalloffDistances = {} +SWEP.FalloffDistances[ "Sniper" ] = { Range = 3500, Falloff = 8000 } +SWEP.FalloffDistances[ "Rifle" ] = { Range = 2000, Falloff = 2000 } +SWEP.FalloffDistances[ "SMG" ] = { Range = 1500, Falloff = 1500 } +SWEP.FalloffDistances[ "Pistol" ] = { Range = 1000, Falloff = 500 } +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.Pitches = {} +SWEP.Pitches[ "Pistol" ] = 100 +SWEP.Pitches[ "SMG" ] = 90 +SWEP.Pitches[ "Rifle" ] = 80 +SWEP.Pitches[ "Sniper" ] = 70 +SWEP.Pitches[ "Buckshot" ] = 100 + +function SWEP:GetViewModelPosition( pos, ang ) + + local newpos = nil + local newang = nil + local movetime = 0.25 + local duration = 0//self.Weapon:GetNWInt( "ViewTime", 0 ) + + local pang = self.Owner:EyeAngles() + local vel = self.Owner:GetVelocity() + + //if not newpos or not newang then + + // newpos = pos + // newang = ang + + //end + + local mul = 0 + + self.SwayScale = 1.0 + self.BobScale = 1.0 + + if ( self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 ) or GAMEMODE:ElementsVisible() or self.HolsterMode then + + self.SwayScale = 1.25 + self.BobScale = 1.25 + + if not self.SprintStart then + + self.SprintStart = CurTime() + + end + + mul = math.Clamp( ( CurTime() - self.SprintStart ) / movetime, 0, 1 ) + mul = -( mul - 1 ) ^ 2 + 1 + + newang = self.SprintAng + newpos = self.SprintPos + + else + + if self.SprintStart then + + self.SprintEnd = CurTime() + self.SprintStart = nil + + end + + if self.SprintEnd then + + mul = math.Clamp( ( CurTime() - self.SprintEnd ) / movetime, 0, 1 ) + mul = ( mul - 1 ) ^ 2 + + newang = self.SprintAng + newpos = self.SprintPos + + if mul == 0 then + + self.SprintEnd = nil + + end + + else + + mul = self:GetMoveScale( movetime, duration, mul ) + + end + end + + return self:MoveViewModelTo( newpos, newang, pos, ang, mul ) + +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 + +function SWEP:AngApproach( newang, ang, mul ) + + if not newang then return ang end + + 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 ) + + 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 + +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 + +function SWEP:Initialize() + + self.Weapon:SetWeaponHoldType( self.HoldType ) + +end + +function SWEP:Deploy() + + if SERVER then + + self.Weapon:SetZoomMode( 1 ) + self.Owner:DrawViewModel( true ) + + end + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:Holster() + + return true + +end + +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 + +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 + +function SWEP:GetZoomMode() + + return self.Weapon:GetNWInt( "Mode", 1 ) + +end + +function SWEP:UnZoom() + + if CLIENT then return end + + 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 + + self.Weapon:SetClip1( self.Primary.ClipSize ) + + return + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + 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 + +function SWEP:DoReload() + + local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD ) + + self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.080 ) + + self.ReloadTime = CurTime() + time + +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: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 + + self.Weapon:EmitSound( self.Primary.Empty ) + + 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 + + return false + + end + + return true + +end + +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 ) + + 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 + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + 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 + +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() + + self.Weapon:EmitSound( self.Secondary.Laser ) + self.Weapon:SetNWBool( "Laser", !self.Weapon:GetNWBool( "Laser", false ) ) + +end + +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 ) + + local scale = 1 + + if distance > self.FalloffDistances[ self.AmmoType ].Range then + + scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) ) + + 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.Tracer = 0 + 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 ) + + if ( mat_type == MAT_GLASS || mat_type == MAT_ALIENFLESH || mat_type == MAT_FLESH ) then + return damage + elseif ( mat_type == MAT_PLASTIC || mat_type == MAT_WOOD ) then + return damage - distance + 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 + + // 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 ) + + // 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 = + { + Num = 1, + Src = PeneTrace.HitPos, + 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 ) + + 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 ( 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 ) + + 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 = + { + Num = 1, + Src = PeneTrace.HitPos, + Dir = tr.Normal, + Spread = Vector( 0, 0, 0 ), + Tracer = 0, + Force = 5, + Damage = new_damage, + AmmoType = "Pistol", + } + + bullet.Callback = function( a, b, c ) + + 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 ) + + 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 + + SWEP.CrossRed = CreateClientConVar( "cl_redead_crosshair_r", 255, true, false ) + SWEP.CrossGreen = CreateClientConVar( "cl_redead_crosshair_g", 255, true, false ) + 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" ) + +end + +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 + +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 + + 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 + diff --git a/entities/weapons/rad_berettas/shared.lua b/entities/weapons/rad_berettas/shared.lua new file mode 100644 index 0000000..4ffeebd --- /dev/null +++ b/entities/weapons/rad_berettas/shared.lua @@ -0,0 +1,91 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_elite.mdl" +SWEP.WorldModel = "models/weapons/w_pist_elite.mdl" + +SWEP.SprintPos = Vector (-0.626, 0.5615, 3.5852) +SWEP.SprintAng = Vector (-25.2347, -3.1815, 0.3427) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.AnimPos = 1 + +SWEP.Anims = {} +SWEP.Anims[1] = ACT_VM_SECONDARYATTACK +SWEP.Anims[2] = ACT_VM_PRIMARYATTACK + +SWEP.Primary.Sound = Sound( "Weapon_Elite.Single" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.180 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = false + +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( 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 + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + 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_cmp/shared.lua b/entities/weapons/rad_cmp/shared.lua new file mode 100644 index 0000000..35a68ef --- /dev/null +++ b/entities/weapons/rad_cmp/shared.lua @@ -0,0 +1,174 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 55 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "CMP-250" + SWEP.IconLetter = "f" + SWEP.Slot = 3 + SWEP.Slotpos = 1 + +end + +SWEP.HoldType = "smg" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_smg1.mdl" +SWEP.WorldModel = "models/weapons/w_smg1.mdl" + +SWEP.SprintPos = Vector (3.6907, -0.6364, -0.5846) +SWEP.SprintAng = Vector (-2.2928, 28.9069, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" +SWEP.FirstShot = true + +SWEP.Primary.Sound = Sound( "Weapon_smg1.Burst" ) +SWEP.Primary.Sound2 = Sound( "weapons/smg1/smg1_fireburst1.wav" ) +SWEP.Primary.ReloadSound = Sound( "Weapon_smg1.reload" ) +SWEP.Primary.Recoil = 12.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 3 +SWEP.Primary.Cone = 0.045 +SWEP.Primary.Delay = 0.600 + +SWEP.Primary.ClipSize = 18 +SWEP.Primary.Automatic = true + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + 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 ) + self.Owner:EmitSound( self.Primary.Sound2, 100, math.random( 120, 130 ) ) + + end + +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 ) < self.Primary.NumShots then + + self.Weapon:EmitSound( self.Primary.Empty ) + + 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 + + return false + + end + + return true + +end + +--[[function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + if self.FirstShot then + + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.ShotDelay ) + self.AutoShoot = CurTime() + self.Primary.ShotDelay + + else + + self.Owner:EmitSound( self.Primary.Sound2, 100, math.random(95,105) ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + + end + + self.FirstShot = !self.FirstShot + + 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]] + +function SWEP:DoReload() + + local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD ) + + self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.100 ) + self.Weapon:EmitSound( self.Primary.ReloadSound ) + + self.ReloadTime = CurTime() + time + +end + +function SWEP:ReloadThink() + + if self.ReloadTime and self.ReloadTime <= CurTime() then + + self.ReloadTime = nil + self.Weapon:SetClip1( self.Primary.ClipSize ) + + end + +end
\ No newline at end of file diff --git a/entities/weapons/rad_crowbar/shared.lua b/entities/weapons/rad_crowbar/shared.lua new file mode 100644 index 0000000..54134ac --- /dev/null +++ b/entities/weapons/rad_crowbar/shared.lua @@ -0,0 +1,220 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 75 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Crowbar" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "melee2" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" + +SWEP.HoldPos = Vector(8.72, 0, 3.319) +SWEP.HoldAng = Vector(0, 0, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.Hit = Sound( "weapons/crowbar/crowbar_impact2.wav" ) +SWEP.Primary.Sound = Sound( "weapons/iceaxe/iceaxe_swing1.wav" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 90 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.950 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return pos, ang //self.Weapon:MoveViewModelTo( self.HoldPos, self.HoldAng, pos, ang, 1 ) + +end + +function SWEP:SecondaryAttack() + +end + +function SWEP:PrimaryAttack() + + if SERVER then + + self.Owner:AddStamina( -3 ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + +end + +function SWEP:Think() + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + end + + if self.MoveTime and self.MoveTime < CurTime() and SERVER then + + self.MoveTime = nil + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) + self.Owner:DrawViewModel( false ) + + end + +end + +function SWEP:MeleeTrace( dmg ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + 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 + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + 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 + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(60,80) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + + if ent:IsPlayer() then + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + if math.random(1,3) == 1 then + + ent:SetHeadshotter( self.Owner, true ) + + end + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:DrawHUD() + +end diff --git a/entities/weapons/rad_deagle/shared.lua b/entities/weapons/rad_deagle/shared.lua new file mode 100644 index 0000000..1bc4118 --- /dev/null +++ b/entities/weapons/rad_deagle/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_deagle.mdl" +SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" + +SWEP.SprintPos = Vector (-4.2232, -5.1203, -2.0386) +SWEP.SprintAng = Vector (12.7496, -52.6848, -7.5206) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_Deagle.Single" ) +SWEP.Primary.Recoil = 11.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.030 +SWEP.Primary.Delay = 0.380 + +SWEP.Primary.ClipSize = 7 +SWEP.Primary.Automatic = false
\ No newline at end of file diff --git a/entities/weapons/rad_experimental/shared.lua b/entities/weapons/rad_experimental/shared.lua new file mode 100644 index 0000000..f8da7b8 --- /dev/null +++ b/entities/weapons/rad_experimental/shared.lua @@ -0,0 +1,154 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_irifle.mdl" +SWEP.WorldModel = "models/weapons/w_irifle.mdl" + +//SWEP.SprintPos = Vector (4.9288, -2.4157, 2.2032) +//SWEP.SprintAng = Vector (0.8736, 40.1165, 28.0526) + +SWEP.SprintPos = Vector(0.55, -5.119, -1.025) +SWEP.SprintAng = Vector(7.44, 25.079, 16.26) + +SWEP.IsSniper = false +SWEP.AmmoType = "Prototype" +SWEP.LaserOffset = Angle( -90, -0.9, 0 ) +SWEP.LaserScale = 0.25 +//SWEP.IronsightsFOV = 60 + +SWEP.Gore = Sound( "npc/roller/mine/rmine_explode_shock1.wav" ) + +SWEP.Primary.Sound = Sound( "Airboat.FireGunHeavy" ) +SWEP.Primary.Sound2 = Sound( "npc/scanner/scanner_electric2.wav" ) +SWEP.Primary.Recoil = 19.5 +SWEP.Primary.Damage = 350 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.010 +SWEP.Primary.Delay = 1.400 + +SWEP.Primary.ClipSize = 3 +SWEP.Primary.Automatic = true + +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 + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(90,100) ) + self.Weapon:EmitSound( self.Primary.Sound2, 100, math.random(120,130) ) + 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 + +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.Tracer = 1 + 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 new file mode 100644 index 0000000..b7966f4 --- /dev/null +++ b/entities/weapons/rad_famas/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "FAMAS" + SWEP.IconLetter = "v" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_famas.mdl" +SWEP.WorldModel = "models/weapons/w_rif_famas.mdl" + +SWEP.SprintPos = Vector(4.9288, -2.4157, 2.2032) +SWEP.SprintAng = Vector(0.8736, 40.1165, 28.0526) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_famas.Single" ) +SWEP.Primary.Recoil = 7.5 +SWEP.Primary.Damage = 45 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 25 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_firegun/shared.lua b/entities/weapons/rad_firegun/shared.lua new file mode 100644 index 0000000..a8e3ae8 --- /dev/null +++ b/entities/weapons/rad_firegun/shared.lua @@ -0,0 +1,190 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_physcannon.mdl" +SWEP.WorldModel = "models/weapons/w_physics.mdl" + +//SWEP.SprintPos = Vector (4.9288, -2.4157, 2.2032) +//SWEP.SprintAng = Vector (0.8736, 40.1165, 28.0526) + +SWEP.SprintPos = Vector(5.36, -0.401, 2.88) +SWEP.SprintAng = Vector(-3.201, 26.799, 5.4) + +SWEP.IsSniper = false +SWEP.AmmoType = "Prototype" +SWEP.LaserOffset = Angle( -90, -0.9, 0 ) +SWEP.LaserScale = 0.25 +//SWEP.IronsightsFOV = 60 + +SWEP.Burn = Sound( "ambient/fire/ignite.wav" ) +SWEP.Burn2 = Sound( "Weapon_Mortar.Impact" ) + +SWEP.Primary.Sound = Sound( "Weapon_mortar.single" ) +SWEP.Primary.Sound2 = Sound( "weapons/physcannon/physcannon_charge.wav" ) +SWEP.Primary.Recoil = 15.5 +SWEP.Primary.Damage = 80 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.015 +SWEP.Primary.Delay = 1.700 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +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 ) + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(90,100) ) + //self.Weapon:EmitSound( self.Primary.Sound3, 100, 80 ) + 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 + +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" } + +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.Tracer = 1 + 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 new file mode 100644 index 0000000..28ce60e --- /dev/null +++ b/entities/weapons/rad_fiveseven/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_fiveseven.mdl" +SWEP.WorldModel = "models/weapons/w_pist_fiveseven.mdl" + +SWEP.SprintPos = Vector (1.3846, -0.6033, -7.1994) +SWEP.SprintAng = Vector (33.9412, 15.0662, 6.288) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_fiveseven.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_g3/shared.lua b/entities/weapons/rad_g3/shared.lua new file mode 100644 index 0000000..8e9d8b7 --- /dev/null +++ b/entities/weapons/rad_g3/shared.lua @@ -0,0 +1,76 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_snip_g3sg1.mdl" +SWEP.WorldModel = "models/weapons/w_snip_g3sg1.mdl" + +SWEP.SprintPos = Vector(-2.8398, -3.656, 0.5519) +SWEP.SprintAng = Vector(0.1447, -34.0929, 0) + +SWEP.ZoomModes = { 0, 35, 10 } +SWEP.ZoomSpeeds = { 0.25, 0.40, 0.40 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Sniper" + +SWEP.Primary.Sound = Sound( "Weapon_G3SG1.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 100 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.002 +SWEP.Primary.SniperCone = 0.035 +SWEP.Primary.Delay = 0.380 + +SWEP.Primary.ClipSize = 20 +SWEP.Primary.Automatic = true + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + 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 diff --git a/entities/weapons/rad_galil/shared.lua b/entities/weapons/rad_galil/shared.lua new file mode 100644 index 0000000..246ab86 --- /dev/null +++ b/entities/weapons/rad_galil/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "IMI Galil" + SWEP.IconLetter = "v" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_galil.mdl" +SWEP.WorldModel = "models/weapons/w_rif_galil.mdl" + +SWEP.SprintPos = Vector (5.6501, -4.3222, 2.1819) +SWEP.SprintAng = Vector (-10.5144, 47.7303, 2.2908) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_Galil.Single" ) +SWEP.Primary.Recoil = 7.5 +SWEP.Primary.Damage = 50 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.110 + +SWEP.Primary.ClipSize = 40 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_glock/shared.lua b/entities/weapons/rad_glock/shared.lua new file mode 100644 index 0000000..fd00c73 --- /dev/null +++ b/entities/weapons/rad_glock/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl" +SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl" + +SWEP.SprintPos = Vector (0.6553, 0.446, 3.2583) +SWEP.SprintAng = Vector (-15.5938, -2.8864, -1.5457) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_Glock.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 15 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_grenade/shared.lua b/entities/weapons/rad_grenade/shared.lua new file mode 100644 index 0000000..516f491 --- /dev/null +++ b/entities/weapons/rad_grenade/shared.lua @@ -0,0 +1,151 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_eq_fraggrenade.mdl" +SWEP.WorldModel = "models/weapons/w_eq_fraggrenade.mdl" + +SWEP.SprintPos = Vector (10.9603, -1.1484, -0.4996) +SWEP.SprintAng = Vector (13.9974, 21.7915, 59.3288) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" +SWEP.ThrowPower = 350 + +SWEP.Primary.Sound = Sound( "WeaponFrag.Throw" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 1 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.100 +SWEP.Primary.Delay = 2.300 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false + +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 + + 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 + + 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 + +function SWEP:SecondaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + 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 + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + 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() + + 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:SetAnimation( PLAYER_ATTACK1 ) + +end + +function SWEP:DrawHUD() + +end + diff --git a/entities/weapons/rad_hammer/shared.lua b/entities/weapons/rad_hammer/shared.lua new file mode 100644 index 0000000..5bf20ee --- /dev/null +++ b/entities/weapons/rad_hammer/shared.lua @@ -0,0 +1,483 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 80 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Hammer" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "melee" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_hammer/v_hammer.mdl" +SWEP.WorldModel = "models/weapons/w_hammer.mdl" + +SWEP.Barricade = Model( "models/props_debris/wood_board04a.mdl" ) + +SWEP.HoldPos = Vector (1.1747, -16.6759, -5.7913) +SWEP.HoldAng = Vector (23.7548, -8.0105, -5.154) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Click = Sound( "Buttons.snd14" ) +SWEP.Deny = Sound( "HL1/fvox/buzz.wav" ) + +SWEP.Primary.Hit = Sound( "weapons/crowbar/crowbar_impact1.wav" ) +SWEP.Primary.Sound = Sound( "weapons/iceaxe/iceaxe_swing1.wav" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 50 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.100 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +SWEP.Position = 35 +SWEP.BuildAng = 0 + +function SWEP:GetViewModelPosition( pos, ang ) + + return self.Weapon:MoveViewModelTo( self.HoldPos, self.HoldAng, pos, ang, 1 ) + +end + +function SWEP:ReleaseGhost() + + if IsValid( self.GhostEntity ) then + + self.GhostEntity:Remove() + self.GhostEntity = nil + + end + +end + +function SWEP:MakeGhost( model, pos, angle ) + + self.GhostEntity = ents.CreateClientProp( model ) + //self.GhostEntity:SetModel( model ) + self.GhostEntity:SetPos( pos ) + self.GhostEntity:SetAngles( angle ) + self.GhostEntity:Spawn() + + self.GhostEntity:SetSolid( SOLID_VPHYSICS ) + self.GhostEntity:SetMoveType( MOVETYPE_NONE ) + self.GhostEntity:SetNotSolid( true ) + self.GhostEntity:SetRenderMode( RENDERMODE_TRANSALPHA ) + self.GhostEntity:SetColor( Color( 255, 255, 255, 200 ) ) + +end + +function SWEP:UpdateGhost() + + if not IsValid( self.GhostEntity ) then return end + + local tr = util.GetPlayerTrace( self.Owner ) + local trace = util.TraceLine( tr ) + + if not trace.Hit then return end + + local ang = ( trace.HitNormal * -1 ):Angle() + Angle( 0, 0, math.NormalizeAngle( 90 + self.Weapon:GetNWInt( "BuildAng", 0 ) ) ) + local pos = trace.HitPos + + local trlength = self.Weapon:GetOwner():GetPos() - trace.HitPos + trlength = trlength:Length() + + if trlength < 150 and ( trace.HitWorld or trace.Entity:GetClass() == "prop_door_rotating" ) then + + self.GhostEntity:SetColor( Color( 50, 255, 50, 200 ) ) + + else + + self.GhostEntity:SetColor( Color( 255, 50, 50, 200 ) ) + + end + + if not trace.HitWorld and not trace.Entity:GetClass() == "prop_door_rotating" then + + self.GhostEntity:SetColor( Color( 255, 50, 50, 200 ) ) + self.GhostEntity:SetModel( self.Barricade ) + self.GhostEntity:SetPos( pos + ( self.GhostEntity:GetUp() * self.Position ) ) + self.GhostEntity:SetAngles( ang ) + + elseif string.find( trace.Entity:GetClass(), "prop_door" ) then + + self.GhostEntity:SetModel( "models/props_c17/tools_wrench01a.mdl" ) + self.GhostEntity:SetPos( trace.HitPos + trace.HitNormal * 5 ) + self.GhostEntity:SetAngles( ( trace.HitNormal * -1 ):Angle() + Angle(0,90,90) ) + + else + + self.GhostEntity:SetModel( self.Barricade ) + self.GhostEntity:SetPos( pos + ( self.GhostEntity:GetUp() * self.Position ) ) + self.GhostEntity:SetAngles( ang ) + + end + +end + +function SWEP:SetPlacePosition( ent ) + + local tr = util.GetPlayerTrace( self:GetOwner() ) + local trace = util.TraceLine( tr ) + + if not trace.Hit then return end + + local ang = ( trace.HitNormal * -1 ):Angle() + Angle( 0, 0, math.NormalizeAngle( 90 + self.Weapon:GetNWInt( "BuildAng", 0 ) ) ) + ent:SetAngles( ang ) + + local pos = trace.HitPos + ent:SetPos( pos + ( ent:GetUp() * self.Position ) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + phys:EnableMotion( false ) + + end + +end + +function SWEP:Deploy() + + if SERVER then + + self.Owner:DrawViewModel( true ) + self.Owner:NoticeOnce( "Toggle build mode with your reload key", GAMEMODE.Colors.Blue, 5, 2 ) + + else + + self.Weapon:ReleaseGhost() + + end + + self.InIron = false + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:Holster() + + if CLIENT then + + self.Weapon:ReleaseGhost() + + end + + return true + +end + +function SWEP:Reload() + + if CLIENT then return end + + if ( self.ReloadTime or 0 ) < CurTime() then + + self.ReloadTime = CurTime() + 0.75 + + self.Weapon:SetNWBool( "BuildMode", !self.Weapon:GetNWBool( "BuildMode", false ) ) + + self.Owner:EmitSound( self.Click, 50, 120 ) + self.Owner:NoticeOnce( "Rotate your barricade by right clicking", GAMEMODE.Colors.Blue, 5, 2 ) + + end + +end + +function SWEP:SecondaryAttack() + + if CLIENT then return end + + if ( self.SecondDelay or 0 ) < CurTime() and self.Weapon:GetNWBool( "BuildMode", false ) then + + self.SecondDelay = CurTime() + 0.25 + self.BuildAng = self.BuildAng + 45 + + if self.BuildAng == 360 then + + self.BuildAng = 0 + + end + + self.Weapon:SetNWInt( "BuildAng", self.BuildAng ) + self.Owner:EmitSound( self.Click ) + + end + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:GetNWBool( "BuildMode", false ) then + + if SERVER then + + self.Owner:AddStamina( -2 ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + + else + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:BarricadeTrace() + + end + +end + +function SWEP:BarricadeTrace() + + if CLIENT then return end + + local trace = util.GetPlayerTrace( self.Owner ) + local tr = util.TraceLine( trace ) + local trlength = self.Weapon:GetOwner():GetPos() - tr.HitPos + trlength = trlength:Length() + + local has, id = self.Owner:GetWood() + + if not has then + + self.Owner:Notice( "You don't have enough wood", GAMEMODE.Colors.Red ) + self.Owner:EmitSound( self.Deny, 50, 100 ) + + return + + end + + if tr.HitWorld and trlength < 150 then + + self.Owner:Notice( "Built a barricade using 1 piece of wood", GAMEMODE.Colors.Green ) + self.Owner:NoticeOnce( "You can also repair doors", GAMEMODE.Colors.Blue, 5, 2 ) + + local prop = ents.Create( "prop_physics" ) + prop:SetModel( self.Barricade ) + prop:Spawn() + prop:SetHealth( 350 ) + prop:SetCustomCollisionCheck() + prop.IsWood = true + + self.Weapon:SetPlacePosition( prop ) + + elseif string.find( tr.Entity:GetClass(), "prop_door" ) and trlength < 150 then + + self.Owner:Notice( "Fortified a door using 1 piece of wood", GAMEMODE.Colors.Green ) + + tr.Entity.MaxHits = 30 + tr.Entity.Hits = 0 + + else + + self.Owner:Notice( "You can't build a barricade here", GAMEMODE.Colors.Red ) + self.Owner:EmitSound( self.Deny, 50, 100 ) + + return + + end + + self.Owner:AddStamina( -15 ) + self.Owner:RemoveFromInventory( id ) + self.Owner:AddStat( "Wood" ) + self.Owner:AddCash( 1 ) + + self.Owner:EmitSound( table.Random( GAMEMODE.Drill ), 100, math.random(90,110) ) + self.Owner:EmitSound( table.Random( GAMEMODE.WoodHammer ), 100, math.random(90,110) ) + +end + +function SWEP:MeleeTrace( dmg ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + 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 + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + 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 + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(60,80) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + + if ent:IsPlayer() then + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if math.random(1,3) == 1 then + + ent:SetHeadshotter( self.Owner, true ) + + end + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:Think() + + if CLIENT then + + if self.Weapon:GetNWBool( "BuildMode", false ) then + + if not self.GhostEntity then + + self.Weapon:MakeGhost( self.Barricade, self.Owner:GetPos() + Vector(0,0,100), Angle(0,0,0)) + + else + + self.Weapon:UpdateGhost() + + end + + elseif IsValid( self.GhostEntity ) then + + self.Weapon:ReleaseGhost() + + end + + end + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + end + + if self.MoveTime and self.MoveTime < CurTime() and SERVER then + + self.MoveTime = nil + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) + self.Owner:DrawViewModel( false ) + + end + +end + +function SWEP:DrawHUD() + +end diff --git a/entities/weapons/rad_incendiarygrenade/shared.lua b/entities/weapons/rad_incendiarygrenade/shared.lua new file mode 100644 index 0000000..3dda5dc --- /dev/null +++ b/entities/weapons/rad_incendiarygrenade/shared.lua @@ -0,0 +1,151 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_eq_flashbang.mdl" +SWEP.WorldModel = "models/weapons/w_eq_flashbang.mdl" + +SWEP.SprintPos = Vector (10.9603, -1.1484, -0.4996) +SWEP.SprintAng = Vector (13.9974, 21.7915, 59.3288) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" +SWEP.ThrowPower = 300 + +SWEP.Primary.Sound = Sound( "WeaponFrag.Throw" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 1 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.100 +SWEP.Primary.Delay = 2.300 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false + +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 + + 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 + + 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 + +function SWEP:SecondaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + 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 + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + 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() + + if SERVER then + + self.Owner:ViewBounce( self.Primary.Recoil ) + + end + + 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 new file mode 100644 index 0000000..50e7691 --- /dev/null +++ b/entities/weapons/rad_inv/shared.lua @@ -0,0 +1,562 @@ +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" +SWEP.Base = "rad_base" + +SWEP.ViewModel = "" +SWEP.WorldModel = "" + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.ClipSize = 1 + +SWEP.Scroll = Sound( "ui/buttonrollover.wav" ) +SWEP.Selection = Sound( "ui/buttonclickrelease.wav" ) +SWEP.Cancel = Sound( "common/wpn_denyselect.wav" ) + +SWEP.YPos = 10 +SWEP.XPos = 10 +SWEP.NumPanels = 5 +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 + +end + +function SWEP:Deploy() + + 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 + + end + + if not self.Deployed then + + self.Deployed = true + self.LastInv = Inv_Size() + self.InvPos = 1 + + self.Weapon:GeneratePanels() + + end + + return true + +end + +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 + +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 = {} + +end + +function SWEP:RemovePanel() + + if not self.InvPanels[1] then return end + + self.InvPanels[1].Removal = true + +end + +function SWEP:RemoveAllPanels() + + for k,v in pairs( self.InvPanels ) do + + v.Removal = true + + end + +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 + +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 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: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.End() + +end + +function RecvSynch() + + InvSWEPSynch = true + +end +usermessage.Hook( "InvSWEP", RecvSynch ) + +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 ) ) + draw.SimpleText( name, "InventoryFont", self.PanelSize * 1.5 + 24 + ( w * 0.5 ), 12 + ( i - 1 ) * 25 + ( h * 0.5 ), col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + +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 new file mode 100644 index 0000000..12dad13 --- /dev/null +++ b/entities/weapons/rad_itemplacer/shared.lua @@ -0,0 +1,295 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + + SWEP.Weight = 1 + SWEP.AutoSwitchTo = false + SWEP.AutoSwitchFrom = false + +end + +if CLIENT then + + ClientItemPlacerTbl = {} + ClientItemPlacerTbl[ "teh" ] = {} + + SWEP.DrawAmmo = true + SWEP.DrawCrosshair = true + SWEP.CSMuzzleFlashes = true + + 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" + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.Primary.Swap = Sound( "weapons/clipempty_rifle.wav" ) +SWEP.Primary.Sound = Sound( "NPC_CombineCamera.Click" ) +SWEP.Primary.Delete1 = Sound( "Weapon_StunStick.Melee_Hit" ) +SWEP.Primary.Delete = Sound( "Weapon_StunStick.Melee_HitWorld" ) + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 99999 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.AmmoType = "Knife" + +SWEP.ItemTypes = { "info_player_zombie", +"info_player_army", +"info_lootspawn", +"info_npcspawn", +"info_evac", +"point_radiation" } + +SWEP.ServersideItems = { "info_player_zombie", +"info_player_army", +"info_lootspawn", +"info_npcspawn", +"info_evac", +"point_radiation" } + +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 + +net.Receive( "ItemPlacerSynch", function( len ) + + ClientItemPlacerTbl[ net.ReadString() ] = net.ReadTable() + +end ) + +--[[function PlacerSynch( handler, id, encoded, decoded ) + + ClientItemPlacerTbl[ decoded.Name ] = decoded.Ents + +end +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() + + 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 + +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() + + return true + +end + +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() + ent.AdminPlaced = true + +end + +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 + +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 + + diff --git a/entities/weapons/rad_knife/shared.lua b/entities/weapons/rad_knife/shared.lua new file mode 100644 index 0000000..8b06c17 --- /dev/null +++ b/entities/weapons/rad_knife/shared.lua @@ -0,0 +1,199 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Knife" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "knife" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_knife_t.mdl" +SWEP.WorldModel = "models/weapons/w_knife_t.mdl" + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.Hit = Sound( "Weapon_Knife.HitWall" ) +SWEP.Primary.HitFlesh = Sound( "Weapon_Knife.Hit" ) +SWEP.Primary.Sound = Sound( "Weapon_Knife.Slash" ) +SWEP.Primary.Deploy = Sound( "Weapon_Knife.Deploy" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.950 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return pos, ang + +end + +function SWEP:SecondaryAttack() + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + + if SERVER then + + self.Owner:AddStamina( -1 ) + + end + +end + +function SWEP:Think() + +end + +function SWEP:MeleeTrace( dmg ) + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + 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 + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + 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 + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(90,110) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + self.Owner:AddStamina( -2 ) + + if ent:IsPlayer() then + + ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:DrawHUD() + +end + +function SWEP:Deploy() + + if SERVER then + + self.Owner:DrawViewModel( true ) + self.Owner:EmitSound( self.Primary.Deploy, 100, math.random(90,110) ) + + end + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end diff --git a/entities/weapons/rad_m1014/shared.lua b/entities/weapons/rad_m1014/shared.lua new file mode 100644 index 0000000..9d4ca65 --- /dev/null +++ b/entities/weapons/rad_m1014/shared.lua @@ -0,0 +1,299 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_shot_xm1014.mdl" +SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl" + +SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) + +SWEP.IsSniper = false +SWEP.AmmoType = "Buckshot" + +SWEP.Primary.Sound = Sound( "weapons/shotgun/shotgun_fire6.wav" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.080 +SWEP.Primary.Delay = 0.320 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Automatic = true + +function SWEP:Deploy() + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetVar( "PumpTime", 0 ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) + + if SERVER then + + self.Weapon:SetZoomMode( 1 ) + + end + + self.InIron = false + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +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 + + self.Weapon:EmitSound( self.Primary.Empty ) + 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 + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + 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 + +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 + +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.Tracer = 0 + 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() + + 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 new file mode 100644 index 0000000..7e72cd2 --- /dev/null +++ b/entities/weapons/rad_m249/shared.lua @@ -0,0 +1,40 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_mach_m249para.mdl" +SWEP.WorldModel = "models/weapons/w_mach_m249para.mdl" + +SWEP.SprintPos = Vector (4.0541, -2.0077, -5.4061) +SWEP.SprintAng = Vector (11.4322, 40.43, -7.9447) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_M249.Single" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 75 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +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 new file mode 100644 index 0000000..3e95b6e --- /dev/null +++ b/entities/weapons/rad_mac10/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_mac10.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl" + +SWEP.SprintPos = Vector(-4.7699, -7.2246, -2.8428) +SWEP.SprintAng = Vector(4.4604, -47.001, 6.8488) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_mac10.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.050 +SWEP.Primary.Delay = 0.080 + +SWEP.Primary.ClipSize = 40 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_mp5/shared.lua b/entities/weapons/rad_mp5/shared.lua new file mode 100644 index 0000000..e41ef49 --- /dev/null +++ b/entities/weapons/rad_mp5/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_mp5.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl" + +SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_MP5Navy.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.085 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_p228/shared.lua b/entities/weapons/rad_p228/shared.lua new file mode 100644 index 0000000..56c1415 --- /dev/null +++ b/entities/weapons/rad_p228/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_p228.mdl" +SWEP.WorldModel = "models/weapons/w_pist_p228.mdl" + +SWEP.SprintPos = Vector(-0.8052, 0, 3.0657) +SWEP.SprintAng = Vector(-16.9413, -5.786, 4.0159) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_P228.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.150 + +SWEP.Primary.ClipSize = 12 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_p90/shared.lua b/entities/weapons/rad_p90/shared.lua new file mode 100644 index 0000000..2055466 --- /dev/null +++ b/entities/weapons/rad_p90/shared.lua @@ -0,0 +1,42 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_p90.mdl" +SWEP.WorldModel = "models/weapons/w_smg_p90.mdl" + +SWEP.SprintPos = Vector(-4.7699, -7.2246, -2.8428) +SWEP.SprintAng = Vector(4.4604, -47.001, 6.8488) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.LaserOffset = Angle( 39.9, -50, -90 ) +SWEP.LaserScale = 0.75 + +SWEP.Primary.Sound = Sound( "Weapon_p90.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.075 + +SWEP.Primary.ClipSize = 50 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_propplacer/shared.lua b/entities/weapons/rad_propplacer/shared.lua new file mode 100644 index 0000000..77a0e96 --- /dev/null +++ b/entities/weapons/rad_propplacer/shared.lua @@ -0,0 +1,382 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + + SWEP.Weight = 1 + SWEP.AutoSwitchTo = false + SWEP.AutoSwitchFrom = false + +end + +if CLIENT then + + SWEP.DrawAmmo = true + SWEP.DrawCrosshair = true + SWEP.CSMuzzleFlashes = true + + SWEP.ViewModelFOV = 74 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Prop Placement Tool" + SWEP.Slot = 5 + SWEP.Slotpos = 7 + + function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) + + end + +end + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.Primary.Swap = Sound( "weapons/clipempty_rifle.wav" ) +SWEP.Primary.Sound = Sound( "NPC_CombineCamera.Click" ) +SWEP.Primary.Delete = Sound( "Weapon_StunStick.Melee_HitWorld" ) + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 99999 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.AmmoType = "Knife" + +SWEP.PropList = { "models/props_c17/oildrum001.mdl", +"models/props_c17/canister02a.mdl", +"models/props_c17/furniturewashingmachine001a.mdl", +"models/props_c17/pulleywheels_large01.mdl", +"models/props_c17/pulleywheels_small01.mdl", +"models/props_c17/chair02a.mdl", +"models/props_c17/concrete_barrier001a.mdl", +"models/props_c17/door01_left.mdl", +"models/props_c17/fence01a.mdl", +"models/props_c17/fence01b.mdl", +"models/props_c17/fence03a.mdl", +"models/props_c17/lockers001a.mdl", +"models/props_c17/traffic_light001a.mdl", +"models/props_c17/trappropeller_engine.mdl", +"models/props_c17/furniturebathtub001a.mdl", +"models/props_c17/furniturefridge001a.mdl", +"models/props_interiors/refrigerator01a.mdl", +"models/props_interiors/refrigeratordoor01a.mdl", +"models/props_interiors/vendingmachinesoda01a.mdl", +"models/props_wasteland/cargo_container01.mdl", +"models/props_wasteland/controlroom_storagecloset001a.mdl", +"models/props_wasteland/laundry_cart001.mdl", +"models/props_wasteland/controlroom_chair001a.mdl", +"models/props_wasteland/controlroom_desk001a.mdl", +"models/props_wasteland/controlroom_desk001b.mdl", +"models/props_wasteland/controlroom_filecabinet002a.mdl", +"models/props_wasteland/controlroom_filecabinet001a.mdl", +"models/props_wasteland/laundry_cart002.mdl", +"models/props_wasteland/dockplank01b.mdl", +"models/props_wasteland/barricade001a.mdl", +"models/props_wasteland/barricade002a.mdl", +"models/props_wasteland/wheel01.mdl", +"models/props_wasteland/buoy01.mdl", +"models/props_wasteland/prison_bedframe001b.mdl", +"models/props_wasteland/kitchen_fridge001a.mdl", +"models/props_vehicles/car001a_hatchback.mdl", +"models/props_vehicles/car001b_hatchback.mdl", +"models/props_vehicles/car002a_physics.mdl", +"models/props_vehicles/car002b_physics.mdl", +"models/props_vehicles/car003a_physics.mdl", +"models/props_vehicles/car003b_physics.mdl", +"models/props_vehicles/car004a_physics.mdl", +"models/props_vehicles/car004b_physics.mdl", +"models/props_vehicles/car005b_physics.mdl", +"models/props_vehicles/van001a_physics.mdl", +"models/props_vehicles/generatortrailer01.mdl", +"models/props_vehicles/trailer002a.mdl", +"models/props_vehicles/truck001a.mdl", +"models/props_vehicles/carparts_door01a.mdl", +"models/props_vehicles/carparts_wheel01a.mdl", +"models/props_vehicles/carparts_tire01a.mdl", +"models/props_vehicles/carparts_axel01a.mdl", +"models/props_vehicles/tire001b_truck.mdl", +"models/props_vehicles/tire001a_tractor.mdl", +"models/props_trainstation/train003.mdl", +"models/props_canal/boat001a.mdl", +"models/props_canal/boat001b.mdl", +"models/props_canal/boat002b.mdl", +"models/props_debris/metal_panel01a.mdl", +"models/props_debris/metal_panel02a.mdl", +"models/props_junk/trashdumpster02b.mdl", +"models/props_junk/ravenholmsign.mdl", +"models/props_junk/ibeam01a.mdl", +"models/props_junk/ibeam01a_cluster01.mdl", +"models/props_junk/wood_pallet001a.mdl", +"models/props_junk/propanecanister001a.mdl", +"models/props_junk/pushcart01a.mdl", +"models/props_junk/cinderblock01a.mdl", +"models/props_junk/wood_crate001a.mdl", +"models/props_junk/wood_crate002a.mdl", +"models/props_junk/trashdumpster01a.mdl", +"models/props_junk/wheebarrow01a.mdl", +"models/props_junk/metalgascan.mdl", +"models/props_junk/trashdumpster02.mdl", +//"models/props/de_train/barrel.mdl", +"models/props/de_train/pallet_barrels.mdl", +"models/props/de_prodigy/tirestack.mdl", +"models/props/de_prodigy/tirestack2.mdl", +"models/props/de_prodigy/tirestack3.mdl", +"models/props/de_prodigy/concretebags.mdl", +"models/props/de_prodigy/concretebags2.mdl", +"models/props/de_prodigy/concretebags3.mdl", +"models/props/de_prodigy/concretebags4.mdl", +"models/props/de_prodigy/pushcart.mdl", +"models/props/de_prodigy/spoolwire.mdl", +"models/props/de_prodigy/spool.mdl", +"models/props/de_prodigy/ammo_can_02.mdl", +"models/props/de_prodigy/ammo_can_01.mdl", +"models/props/de_prodigy/ammo_can_03.mdl", +"models/props/de_nuke/cinderblock_stack.mdl", +"models/props/cs_militia/militiarock05.mdl", +"models/props/cs_militia/sawhorse.mdl", +"models/props/cs_militia/table_kitchen.mdl", +"models/props/cs_militia/footlocker01_open.mdl", +"models/props/cs_militia/footlocker01_closed.mdl", +"models/props_junk/MetalBucket01a.mdl", +"models/props_junk/MetalBucket02a.mdl", +"models/props_junk/plasticbucket001a.mdl", +"models/props_wasteland/kitchen_shelf001a.mdl", +"models/props_c17/chair_stool01a.mdl", +"models/props_c17/chair_office01a.mdl", +"models/props_c17/SuitCase001a.mdl", +"models/props_interiors/Radiator01a.mdl", +"models/props_junk/bicycle01a.mdl", +"models/props_lab/citizenradio.mdl", +"models/props_lab/kennel_physics.mdl", +"models/props_lab/partsbin01.mdl", +"models/props_vehicles/carparts_muffler01a.mdl", +"models/props/cs_office/shelves_metal.mdl", +"models/props_phx/construct/concrete_barrier01.mdl", +"models/props_phx/construct/concrete_barrier00.mdl", +"models/props/cs_assault/handtruck.mdl", +"models/props/de_nuke/nuclearcontainerboxclosed.mdl", +"models/props/de_nuke/crate_small.mdl", +"models/props_vehicles/trailer001a.mdl", +"models/props_lab/lockers.mdl", +"models/props_trainstation/train002.mdl", +"models/props_vehicles/wagon001a.mdl", +"models/props_wasteland/gear01.mdl", +"models/props_wasteland/cafeteria_bench001a.mdl", +"models/props_wasteland/cafeteria_table001a.mdl", +"models/props/CS_militia/crate_extrasmallmill.mdl", +"models/props/CS_militia/microwave01.mdl", +"models/props/CS_militia/paintbucket01.mdl", +"models/props/CS_militia/refrigerator01.mdl", +"models/props/CS_militia/toilet.mdl", +"models/props/CS_militia/wood_table.mdl", +"models/props/cs_italy/it_mkt_table2.mdl", +"models/props/de_inferno/wine_barrel.mdl", +"models/props_c17/streetsign004f.mdl", +"models/props_c17/FurnitureDresser001a.mdl", +"models/props_vehicles/truck003a.mdl", +"models/items/car_battery01.mdl", +"models/props_c17/canister_propane01a.mdl", +"models/props_junk/metal_paintcan001b.mdl"} + +function SWEP:Initialize() + + if SERVER then + + self.Weapon:SetWeaponHoldType( self.HoldType ) + + end + +end + +function SWEP:Deploy() + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +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( "prop_physics" ) ) do + + if v:GetPos():Distance( tr.HitPos ) < dist and v.AdminPlaced then + + dist = v:GetPos():Distance( tr.HitPos ) + closest = v + + end + + end + + if IsValid( closest ) then + + closest:Remove() + + self.Owner:EmitSound( self.Primary.Delete ) + + end + + end + +end + +function SWEP:Reload() + + if CLIENT then return end + + for k,v in pairs( ents.FindByClass( "prop_physics" ) ) do + + if v.AdminPlaced then + + v:Remove() + + end + + end + + self.Owner:EmitSound( self.Primary.Delete ) + +end + +function SWEP:Holster() + + return true + +end + +function SWEP:ShootEffects() + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + +end + +function SWEP:PlaceItem() + + if not self.Owner:IsAdmin() or not self.Owner:IsSuperAdmin() then return end + + if not self.Owner.PropPos then self.Owner.PropPos = 1 end + + if self.Owner.PropPos < 1 or self.Owner.PropPos > #self.PropList then return end + + local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) ) + + local ent = ents.Create( "prop_physics" ) + ent:SetPos( tr.HitPos + tr.HitNormal * 50 ) + ent:SetModel( self.PropList[ self.Owner.PropPos ] ) + ent:SetSkin( math.random( 0, 6 ) ) + ent:Spawn() + ent.AdminPlaced = true + +end + +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() + + end + +end + +function SWEP:SecondaryAttack() + + self.Weapon:SetNextSecondaryFire( CurTime() + 0.5 ) + + self.Weapon:EmitSound( self.Primary.Swap ) + + if CLIENT then + + self.Weapon:Menu() + + end + +end + +function SWEP:DrawHUD() + + draw.SimpleText( "PRIMARY FIRE: Create Prop SECONDARY FIRE: Choose Prop Model +USE: Delete Nearest Prop RELOAD: Remove All Placed Props", "AmmoFontSmall", ScrW() * 0.5, ScrH() - 100, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + +end + +if CLIENT then + + function SWEP:Menu() + + if ( self.MenuTime or 0 ) > CurTime() then return end + + self.MenuTime = CurTime() + 1 + + gui.EnableScreenClicker( true ) + + local frame = vgui.Create( "PanelBase" ) + frame:SetSize( 300, 370 ) + frame:Center() + //frame:ShowCloseButton( false ) + + local plist = vgui.Create( "DPanelList", frame ) + plist:SetPos( 15, 15 ) + plist:SetSize( 270, 340 ) + plist:SetSpacing( 0 ) + plist:EnableHorizontal( true ) + plist:EnableVerticalScrollbar( true ) + + for k, v in pairs( self.PropList ) do + + local icon = vgui.Create( "SpawnIcon", plist ) + icon:SetModel( v ) + icon:SetToolTip() + icon:SetSize( 64, 64 ) + icon.OnMousePressed = function( mc ) + + RunConsoleCommand( "chooseprop", tostring( k ) ) + + gui.EnableScreenClicker( false ) + surface.PlaySound( Sound( "buttons/button14.wav" ) ) + + frame:Remove() + + end + + plist:AddItem( icon ) + + end + + end + + return + +end + +function ChooseProp( ply, cmd, args ) + + ply.PropPos = tonumber( args[1] ) + +end + +concommand.Add( "chooseprop", ChooseProp ) diff --git a/entities/weapons/rad_revolver/shared.lua b/entities/weapons/rad_revolver/shared.lua new file mode 100644 index 0000000..2b34184 --- /dev/null +++ b/entities/weapons/rad_revolver/shared.lua @@ -0,0 +1,71 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_357.mdl" +SWEP.WorldModel = "models/weapons/w_357.mdl" + +SWEP.SprintPos = Vector (2.4955, 2.1219, 2.9007) +SWEP.SprintAng = Vector (-10.2034, 15.2433, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_357.Single" ) +SWEP.Primary.Recoil = 13.5 +SWEP.Primary.Damage = 50 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.030 +SWEP.Primary.Delay = 0.850 + +SWEP.Primary.ClipSize = 6 +SWEP.Primary.Automatic = false + +function SWEP:ShootEffects() + + if SERVER then + + self.Owner:ViewBounce( self.Primary.Recoil ) + + end + + 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 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 diff --git a/entities/weapons/rad_scout/shared.lua b/entities/weapons/rad_scout/shared.lua new file mode 100644 index 0000000..d7fa4d0 --- /dev/null +++ b/entities/weapons/rad_scout/shared.lua @@ -0,0 +1,46 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_snip_scout.mdl" +SWEP.WorldModel = "models/weapons/w_snip_scout.mdl" + +SWEP.SprintPos = Vector(-1.7763, -1.9796, 1.677) +SWEP.SprintAng = Vector(-11.9431, -36.4352, 0) + +SWEP.ZoomModes = { 0, 40, 10 } +SWEP.ZoomSpeeds = { 0.25, 0.40, 0.40 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Sniper" + +SWEP.Primary.Sound = Sound( "Weapon_Scout.Single" ) +SWEP.Primary.Recoil = 15.5 +SWEP.Primary.Damage = 110 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.001 +SWEP.Primary.SniperCone = 0.035 +SWEP.Primary.Delay = 1.400 + +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Automatic = false + +SWEP.MinShellDelay = 0.8 +SWEP.MaxShellDelay = 1.0 diff --git a/entities/weapons/rad_sg552/shared.lua b/entities/weapons/rad_sg552/shared.lua new file mode 100644 index 0000000..9d22ef2 --- /dev/null +++ b/entities/weapons/rad_sg552/shared.lua @@ -0,0 +1,159 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_sg552.mdl" +SWEP.WorldModel = "models/weapons/w_rif_sg552.mdl" + +SWEP.SprintPos = Vector (-2.629, -4.8963, 1.4033) +SWEP.SprintAng = Vector (-7.3401, -31.7536, 3.9563) + +SWEP.ZoomModes = { 0, 35 } +SWEP.ZoomSpeeds = { 0.25, 0.35 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_SG552.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 60 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.005 +SWEP.Primary.SniperCone = 0.020 +SWEP.Primary.Delay = 0.210 + +SWEP.Primary.ClipSize = 30 +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] ) + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + 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 + +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 + + 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 diff --git a/entities/weapons/rad_shotgun/shared.lua b/entities/weapons/rad_shotgun/shared.lua new file mode 100644 index 0000000..d754462 --- /dev/null +++ b/entities/weapons/rad_shotgun/shared.lua @@ -0,0 +1,320 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_shot_m3super91.mdl" +SWEP.WorldModel = "models/weapons/w_annabelle.mdl" + +SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) + +SWEP.IsSniper = false +SWEP.AmmoType = "Buckshot" + +SWEP.Primary.Sound = Sound( "weapons/shotgun/shotgun_fire6.wav" ) +SWEP.Primary.Pump = Sound( "Weapon_M3.Pump" ) +SWEP.Primary.Recoil = 8.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.085 +SWEP.Primary.Delay = 0.500 + +SWEP.Primary.ClipSize = 5 +SWEP.Primary.Automatic = false + +SWEP.MinShellDelay = 0.5 +SWEP.MaxShellDelay = 0.7 + +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 + +function SWEP:CanPrimaryAttack() + + if self.HolsterMode or self.LastRunFrame > CurTime() then return false end + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then + + self.Weapon:EmitSound( self.Primary.Empty ) + 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() + + 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 ) + + 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 + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + 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 + +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() + + self.Weapon:SetNWBool( "Reloading", false ) + 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 + +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.Tracer = 0 + 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() + + if self.Weapon:ShouldNotDraw() then return end + + 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 diff --git a/entities/weapons/rad_spas12/shared.lua b/entities/weapons/rad_spas12/shared.lua new file mode 100644 index 0000000..c3bcfb7 --- /dev/null +++ b/entities/weapons/rad_spas12/shared.lua @@ -0,0 +1,342 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true +SWEP.UseShellSounds = false + +SWEP.ViewModel = "models/weapons/c_shotgun.mdl" +SWEP.WorldModel = "models/weapons/w_shotgun.mdl" + +//SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +//SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) +SWEP.SprintPos = Vector (1.4752, 0.0296, -3.577) +SWEP.SprintAng = Vector (5.8948, 20.2814, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "Buckshot" + +SWEP.Primary.Sound = Sound( "Weapon_Shotgun.Double" ) +SWEP.Primary.Pump = Sound( "Weapon_Shotgun.Special1" ) +SWEP.Primary.ReloadSound = Sound( "Weapon_Shotgun.Reload" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.080 +SWEP.Primary.Delay = 0.500 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Automatic = false + +function SWEP:Deploy() + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetVar( "PumpTime", 0 ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) + + if SERVER then + + self.Weapon:SetZoomMode( 1 ) + + end + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +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 + + self.Weapon:EmitSound( self.Primary.Empty ) + 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() + + 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 ) + + 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 + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + 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 + +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() + + self.Weapon:SetNWBool( "Reloading", false ) + 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 + +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.Tracer = 0 + 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() + + if self.Weapon:ShouldNotDraw() then return end + + 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 diff --git a/entities/weapons/rad_tmp/shared.lua b/entities/weapons/rad_tmp/shared.lua new file mode 100644 index 0000000..f0a794a --- /dev/null +++ b/entities/weapons/rad_tmp/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_tmp.mdl" +SWEP.WorldModel = "models/weapons/w_smg_tmp.mdl" + +SWEP.SprintPos = Vector (2.0027, -0.751, 0.1411) +SWEP.SprintAng = Vector (-1.2669, -27.7284, 10.4434) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_USP.SilencedShot" ) +SWEP.Primary.Recoil = 4.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.075 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_ump45/shared.lua b/entities/weapons/rad_ump45/shared.lua new file mode 100644 index 0000000..b8191ca --- /dev/null +++ b/entities/weapons/rad_ump45/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_ump45.mdl" +SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl" + +SWEP.SprintPos = Vector (-1.0859, -4.2523, -1.1534) +SWEP.SprintAng = Vector (-4.8822, -38.3984, 14.6527) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_UMP45.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.045 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 25 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_usp/shared.lua b/entities/weapons/rad_usp/shared.lua new file mode 100644 index 0000000..91db700 --- /dev/null +++ b/entities/weapons/rad_usp/shared.lua @@ -0,0 +1,39 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_usp.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.SprintPos = Vector (0.4776, 0.446, 3.1631) +SWEP.SprintAng = Vector (-15.3501, -1.3761, -1.5457) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_USP.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.150 + +SWEP.Primary.ClipSize = 12 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_z_banshee/shared.lua b/entities/weapons/rad_z_banshee/shared.lua new file mode 100644 index 0000000..00e881a --- /dev/null +++ b/entities/weapons/rad_z_banshee/shared.lua @@ -0,0 +1,131 @@ +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" + +SWEP.ViewModel = "models/Zed/weapons/v_banshee.mdl" + +SWEP.Taunt = Sound( "npc/stalker/go_alert2a.wav" ) + +SWEP.Die = { "npc/headcrab_poison/ph_scream1.wav", +"npc/headcrab_poison/ph_scream2.wav", +"npc/headcrab_poison/ph_scream3.wav"} + +SWEP.Primary.Hit = Sound( "npc/antlion/shell_impact3.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/antlion/foot4.wav" ) +SWEP.Primary.Sound = Sound( "npc/zombie/zo_attack1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.900 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "Right click to use your scream ability", GAMEMODE.Colors.Blue, 5, 10 ) + self.Owner:NoticeOnce( "Your scream will disorient nearby people", GAMEMODE.Colors.Blue, 5, 12 ) + +end + +function SWEP:Holster() + + if SERVER then + + self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(40,60) ) + + end + + return true + +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 ) + + 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 diff --git a/entities/weapons/rad_z_base/shared.lua b/entities/weapons/rad_z_base/shared.lua new file mode 100644 index 0000000..0748b8d --- /dev/null +++ b/entities/weapons/rad_z_base/shared.lua @@ -0,0 +1,289 @@ +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" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/zed/weapons/v_undead.mdl" + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" +SWEP.ThinkTime = 0 + +SWEP.Primary.Door = Sound( "Wood_Plank.Break" ) +SWEP.Primary.Hit = Sound( "npc/zombie/claw_strike1.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/zombie/claw_strike2.wav" ) +SWEP.Primary.Sound = Sound( "npc/fast_zombie/idle1.wav" ) +SWEP.Primary.Miss = Sound( "npc/zombie/claw_miss1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.500 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return pos, ang + +end + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "Hit people to infect them", GAMEMODE.Colors.Blue, 5, 10 ) + +end + +function SWEP:Deploy() + + self.Owner:DrawWorldModel( false ) + + if SERVER then + + self.Weapon:NoobHelp() + + end + + return true + +end + +function SWEP:Holster() + + if SERVER then + + self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) ) + + end + + return true + +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() + + if self.ThinkTime != 0 and self.ThinkTime < CurTime() then + + self.Weapon:MeleeTrace( self.Primary.Damage ) + + self.ThinkTime = 0 + + end + +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 + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + 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 + + self.Owner:EmitSound( self.Primary.Miss, 100, math.random(90,110) ) + + 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 + + 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) ) + prop:SetModel( ent:GetModel() ) + prop:SetSkin( ent:GetSkin() ) + prop:SetCollisionGroup( COLLISION_GROUP_WEAPON ) + prop:Spawn() + + 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 new file mode 100644 index 0000000..0bfb142 --- /dev/null +++ b/entities/weapons/rad_z_contagion/shared.lua @@ -0,0 +1,66 @@ +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" + +SWEP.ViewModel = "models/Zed/weapons/v_ghoul.mdl" + +SWEP.Taunt = {"npc/zombie/zombie_voice_idle1.wav", +"npc/zombie/zombie_voice_idle2.wav", +"npc/zombie/zombie_voice_idle3.wav", +"npc/zombie/zombie_voice_idle4.wav", +"npc/zombie/zombie_voice_idle5.wav", +"npc/zombie/zombie_voice_idle7.wav", +"npc/zombie/zombie_voice_idle8.wav", +"npc/zombie/zombie_voice_idle9.wav", +"npc/zombie/zombie_voice_idle10.wav", +"npc/zombie/zombie_voice_idle12.wav", +"npc/zombie/zombie_voice_idle13.wav", +"npc/zombie/zombie_voice_idle14.wav" } + +SWEP.Die = { "npc/zombie/zombie_die1.wav", +"npc/zombie/zombie_die2.wav", +"npc/zombie/zombie_die3.wav", +"npc/zombie/zombie_voice_idle6.wav", +"npc/zombie/zombie_voice_idle11.wav" } + +SWEP.Primary.Sound = Sound( "npc/zombie/zombie_pain1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 45 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.800 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "You will unleash a toxic shower when you die", GAMEMODE.Colors.Blue, 5, 10 ) + +end + +function SWEP:OnHitHuman( ent, dmg ) + + ent:ViewBounce( 20 ) + + self.Owner:AddZedDamage( dmg ) + self.Owner:DrawBlood( 5 ) + +end diff --git a/entities/weapons/rad_z_leaper/shared.lua b/entities/weapons/rad_z_leaper/shared.lua new file mode 100644 index 0000000..e123b48 --- /dev/null +++ b/entities/weapons/rad_z_leaper/shared.lua @@ -0,0 +1,96 @@ +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" +SWEP.HoldType = "slam" +SWEP.ViewModel = "models/Zed/weapons/v_wretch.mdl" + +SWEP.Taunt = { "npc/fast_zombie/fz_frenzy1.wav", +"npc/barnacle/barnacle_pull1.wav", +"npc/barnacle/barnacle_pull2.wav", +"npc/barnacle/barnacle_pull3.wav", +"npc/barnacle/barnacle_pull4.wav" } + +SWEP.Die = { "npc/fast_zombie/fz_alert_close1.wav", +"npc/fast_zombie/fz_alert_far1.wav" } + +SWEP.Scream = Sound( "npc/fast_zombie/fz_scream1.wav" ) + +SWEP.Primary.Hit = Sound( "npc/zombie/claw_strike1.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/zombie/claw_strike2.wav" ) +SWEP.Primary.Sound = Sound( "npc/fast_zombie/wake1.wav" ) +SWEP.Primary.Miss = Sound( "npc/zombie/claw_miss1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 15 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.200 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +SWEP.JumpTime = 0 + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "Your attacks cause bleeding", GAMEMODE.Colors.Blue, 5, 10 ) + +end + +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 + +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 new file mode 100644 index 0000000..feeae59 --- /dev/null +++ b/entities/weapons/rad_z_runner/shared.lua @@ -0,0 +1,44 @@ +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" + +SWEP.Base = "rad_z_base" + +SWEP.Taunt = { "npc/zombie/zombie_alert1.wav", +"npc/zombie/zombie_alert2.wav", +"npc/zombie/zombie_alert3.wav" } + +SWEP.Die = { "vo/npc/vortigaunt/vortigese02.wav", +"vo/npc/vortigaunt/vortigese03.wav", +"vo/npc/vortigaunt/vortigese05.wav", +"vo/npc/vortigaunt/vortigese07.wav" } + +SWEP.Primary.Hit = Sound( "npc/zombie/claw_strike1.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/zombie/claw_strike2.wav" ) +SWEP.Primary.Sound = Sound( "npc/fast_zombie/idle1.wav" ) +SWEP.Primary.Miss = Sound( "npc/zombie/claw_miss1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.500 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true |
