This commit is contained in:
lifestorm
2024-08-04 23:54:45 +03:00
parent 8064ba84d8
commit 6a58f406b1
7522 changed files with 4011896 additions and 15 deletions

View File

@@ -0,0 +1,162 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
include("shared.lua")
ENT.mat = Material( "sprites/animglow02" )
ENT.mat2 = Material( "effects/simfphys_armed/spark" )
function ENT:Initialize()
self.Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
self.OldPos = self:GetPos()
self.emitter = ParticleEmitter(self.OldPos, false )
end
function ENT:Draw()
if not self.Dir or not self.Size or not self.Len then return end
if self.Size > 5 then return end
local pos = self:GetPos()
render.SetMaterial( self.mat2 )
render.DrawBeam( pos + self.Dir * self.Len, self.OldPos - self.Dir * self.Len, self.Size * 5, 1, 0, Color( 255, 255, 255, 255 ) )
end
function ENT:Think()
local pos = self:GetPos()
if pos ~= self.OldPos then
self:doFX( pos, self.OldPos )
self.OldPos = pos
end
return true
end
function ENT:doFX( newpos, oldpos )
if not self.emitter then return end
local Sub = (newpos - oldpos)
local Dir = Sub:GetNormalized()
local Len = Sub:Length()
self.Len = Len
self.Dir = Dir
self.Size = self:GetSize()
for i = 1, Len, 15 do
local pos = oldpos + Dir * i
local particle = self.emitter:Add( self.Materials[math.random(1, table.Count(self.Materials) )], pos )
if particle then
particle:SetGravity( Vector(0,0,100) + VectorRand() * 50 )
particle:SetVelocity( -Dir * 500 )
particle:SetAirResistance( 600 )
particle:SetDieTime( math.Rand(0.1,0.5) )
particle:SetStartAlpha( 80 )
particle:SetStartSize( (math.Rand(6,12) / 20) * self.Size )
particle:SetEndSize( (math.Rand(20,30) / 20) * self.Size )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 120,120,120 )
particle:SetCollide( false )
end
if self.Size > 5 then
local particle = self.emitter:Add( self.mat, pos )
if particle then
particle:SetVelocity( -Dir * 300 + self:GetVelocity())
particle:SetDieTime( 0.1 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( self.Size )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
end
end
end
function ENT:OnRemove()
if self.emitter then
self.emitter:Finish()
end
end
function ENT:Explosion( pos )
if not self.emitter then return end
for i = 0,60 do
local particle = self.emitter:Add( self.Materials[math.random(1,table.Count( self.Materials ))], pos )
if particle then
particle:SetVelocity( VectorRand() * 600 )
particle:SetDieTime( math.Rand(4,6) )
particle:SetAirResistance( math.Rand(200,600) )
particle:SetStartAlpha( 255 )
particle:SetStartSize( math.Rand(10,30) )
particle:SetEndSize( math.Rand(80,120) )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 50,50,50 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
for i = 0, 40 do
local particle = self.emitter:Add( "sprites/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( VectorRand() * 500 )
particle:SetDieTime( 0.14 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 )
particle:SetEndSize( math.Rand(30,60) )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
local dlight = DynamicLight( math.random(0,9999) )
if dlight then
dlight.pos = pos
dlight.r = 255
dlight.g = 180
dlight.b = 100
dlight.brightness = 8
dlight.Decay = 2000
dlight.Size = 200
dlight.DieTime = CurTime() + 0.1
end
end

View File

@@ -0,0 +1,187 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "cl_init.lua" )
include('shared.lua')
local ImpactSounds = {
"physics/metal/metal_sheet_impact_bullet1.wav",
"weapons/rpg/shotdown.wav",
}
local DeflectSounds = {
"simulated_vehicles/weapons/physproj_rico.wav",
"simulated_vehicles/weapons/physproj_rico1.wav",
"simulated_vehicles/weapons/physproj_rico2.wav",
"simulated_vehicles/weapons/physproj_rico3.wav",
}
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local size = math.random( 16, 48 )
local ent = ents.Create( ClassName )
ent:SetPos( tr.HitPos + tr.HitNormal * size )
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
self:SetModel( "models/weapons/w_missile_launch.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_NONE )
self:SetRenderMode( RENDERMODE_TRANSALPHA )
local pObj = self:GetPhysicsObject()
if IsValid( pObj ) then
pObj:EnableMotion( false )
end
self.SpawnTime = CurTime()
self.Vel = self:GetForward() * 200
end
function ENT:Think()
local curtime = CurTime()
self:NextThink( curtime )
local Size = self:GetSize() * 0.5
local FixTick = FrameTime() * 66.666
local trace = util.TraceHull( {
start = self:GetPos(),
endpos = self:GetPos() + self.Vel * FixTick,
maxs = Size,
mins = -Size,
filter = function( ent )
if ent ~= self and ent:GetClass() ~= "gmod_sent_vehicle_fphysics_wheel" and not table.HasValue( self.Filter, ent ) then return true end
end
} )
if trace.Hit then
self:SetPos( trace.HitPos )
local shootDirection = self:GetForward()
local hitangle = math.deg( math.acos( math.Clamp( trace.HitNormal:Dot(shootDirection) ,-1,1) ) ) - 90
self.DeflectAng = self.DeflectAng or 25
if hitangle < self.DeflectAng and not self.Bounced and (trace.Entity:GetClass() == "prop_physics" or trace.Entity.LVS) then
local thVel = self.Vel:Length()
local Ax = math.deg( math.acos( math.Clamp( trace.HitNormal:Dot(shootDirection) ,-1,1) ) )
local Fx = math.cos( math.rad( Ax ) ) * thVel
self.Vel = (shootDirection * thVel - trace.HitNormal * Fx * 2) * math.max((1 - hitangle / 45) * 0.5,0.2)
trace.Entity:GetPhysicsObject():ApplyForceOffset( shootDirection * thVel * self.Force * 0.5, trace.HitPos )
table.insert( self.Filter, trace.Entity )
self:SetPos( self:GetPos() + self.Vel * FixTick )
self.Vel = self.Vel - Vector(0,0,0.15) * FixTick
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetNormal( self.Vel:GetNormalized() * 10 )
util.Effect( "simfphys_tracer_hit", effectdata, true, true )
if Size >= 5 then
sound.Play( Sound( DeflectSounds[ math.random(1,table.Count( DeflectSounds )) ] ), trace.HitPos, 140)
else
sound.Play( Sound( "simulated_vehicles/weapons/physproj_rico"..math.random(1,3)..".wav" ), trace.HitPos, 140)
end
self.Bounced = true -- only bounce once
else
local bullet = {}
bullet.Num = 1
bullet.Src = self:GetPos() - shootDirection * 10
bullet.Dir = shootDirection
bullet.Spread = Vector(0,0,0)
bullet.Tracer = 0
bullet.TracerName = "simfphys_tracer"
bullet.Force = self.Force
bullet.Damage = self.Damage
bullet.HullSize = self:GetSize()
bullet.Attacker = self.Attacker
bullet.Callback = function(att, tr, dmginfo)
if tr.Entity:GetClass():lower() == "npc_helicopter" then
dmginfo:SetDamageType(DMG_AIRBOAT)
else
dmginfo:SetDamageType(DMG_DIRECT)
end
local attackingEnt = IsValid( self.AttackingEnt ) and self.AttackingEnt or self
local attacker = IsValid( self.Attacker ) and self.Attacker or self
util.BlastDamage( attackingEnt, attacker, tr.HitPos,self.BlastRadius,self.BlastDamage)
util.Decal("scorch", tr.HitPos - tr.HitNormal, tr.HitPos + tr.HitNormal)
if tr.Entity ~= Entity(0) then
if simfphys.IsCar( tr.Entity ) then
local effectdata = EffectData()
effectdata:SetOrigin( tr.HitPos )
effectdata:SetNormal( tr.HitNormal )
util.Effect( "manhacksparks", effectdata, true, true )
sound.Play( Sound( ImpactSounds[ math.random(1,table.Count( ImpactSounds )) ] ), tr.HitPos, 140)
end
end
end
self:FireBullets( bullet )
self:Remove()
end
else
self:SetPos( self:GetPos() + self.Vel * FixTick )
local Rate = FrameTime() * 30
self.smVal = self.smVal and self.smVal + math.Clamp(15 - self.smVal,-Rate,Rate) or 0
self.Vel = self.Vel - Vector(0,0,self.smVal / 100) * FixTick
end
if (self.SpawnTime + 12) < curtime then
self:Remove()
end
return true
end
function ENT:PhysicsCollide( data )
end
function ENT:OnTakeDamage( dmginfo )
return
end
function ENT:Use( activator, caller )
end
function ENT:OnRemove()
local effectdata = EffectData()
effectdata:SetOrigin( self:GetPos() )
util.Effect( self:GetBlastEffect(), effectdata )
end

View File

@@ -0,0 +1,26 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
ENT.Type = "anim"
ENT.PrintName = "tank projectile"
ENT.Author = ""
ENT.Information = ""
ENT.Category = "simfphys Armed Vehicles"
ENT.Spawnable = false
ENT.AdminOnly = false
function ENT:SetupDataTables()
self:NetworkVar( "String",1, "BlastEffect" )
self:NetworkVar( "Float",1, "Size" )
end