add sborka
This commit is contained in:
176
garrysmod/addons/swbombs/lua/entities/sw_aircraft_fueltank.lua
Normal file
176
garrysmod/addons/swbombs/lua/entities/sw_aircraft_fueltank.lua
Normal file
@@ -0,0 +1,176 @@
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.DoNotDuplicate = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Entity",0, "Base" )
|
||||
self:NetworkVar( "Entity",1, "DoorHandler" )
|
||||
|
||||
self:NetworkVar( "Float",0, "Fuel" )
|
||||
self:NetworkVar( "Float",1, "Size" )
|
||||
self:NetworkVar( "Float",2, "HP" )
|
||||
self:NetworkVar( "Float",3, "MaxHP" )
|
||||
|
||||
self:NetworkVar( "Int",0, "FuelType" )
|
||||
|
||||
self:NetworkVar( "Bool",0, "Destroyed" )
|
||||
|
||||
if SERVER then
|
||||
self:SetMaxHP( 100 )
|
||||
self:SetHP( 100 )
|
||||
self:SetFuel( 1 )
|
||||
self:NetworkVarNotify( "Fuel", self.OnFuelChanged )
|
||||
end
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetMoveType( MOVETYPE_NONE )
|
||||
self:SetSolid( SOLID_NONE )
|
||||
self:DrawShadow( false )
|
||||
debugoverlay.Cross( self:GetPos(), 20, 5, Color( 255, 93, 0 ) )
|
||||
end
|
||||
|
||||
function ENT:ExtinguishAndRepair()
|
||||
self:SetHP( self:GetMaxHP() )
|
||||
self:SetDestroyed( false )
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
self:NextThink( CurTime() + 1 )
|
||||
|
||||
if self:GetDestroyed() then
|
||||
local Base = self:GetBase()
|
||||
|
||||
if not IsValid( Base ) then return end
|
||||
|
||||
if self:GetFuel() > 0 then
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetDamage( 100 )
|
||||
dmg:SetAttacker( IsValid( Base.LastAttacker ) and Base.LastAttacker or game.GetWorld() )
|
||||
dmg:SetInflictor( IsValid( Base.LastInflictor ) and Base.LastInflictor or game.GetWorld() )
|
||||
dmg:SetDamageType( DMG_BURN )
|
||||
Base:TakeDamageInfo( dmg )
|
||||
|
||||
self:SetFuel( math.max( self:GetFuel() - 0.05, 0 ) )
|
||||
else
|
||||
self:SetDestroyed( false )
|
||||
end
|
||||
else
|
||||
local base = self:GetBase()
|
||||
|
||||
if IsValid( base ) and base:GetEngineActive() then
|
||||
self:SetFuel( math.max( self:GetFuel() - (1 / self:GetSize()) * base:GetThrottle() ^ 2, 0 ) )
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:TakeTransmittedDamage( dmginfo )
|
||||
if self:GetDestroyed() then return end
|
||||
|
||||
local Damage = dmginfo:GetDamage()
|
||||
|
||||
if Damage <= 0 then return end
|
||||
|
||||
local CurHealth = self:GetHP()
|
||||
|
||||
local NewHealth = math.Clamp( CurHealth - Damage, 0, self:GetMaxHP() )
|
||||
|
||||
self:SetHP( NewHealth )
|
||||
|
||||
if NewHealth <= 0 then
|
||||
self:SetDestroyed( true )
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage( dmginfo )
|
||||
end
|
||||
|
||||
function ENT:OnFuelChanged( name, old, new)
|
||||
if new == old then return end
|
||||
|
||||
if new <= 0 then
|
||||
local base = self:GetBase()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
base:StopEngine()
|
||||
|
||||
base:EmitSound("vehicles/jetski/jetski_off.wav")
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
end
|
||||
|
||||
function ENT:RemoveFireSound()
|
||||
if self.FireBurnSND then
|
||||
self.FireBurnSND:Stop()
|
||||
self.FireBurnSND = nil
|
||||
end
|
||||
|
||||
self.ShouldStopFire = nil
|
||||
end
|
||||
|
||||
function ENT:StopFireSound()
|
||||
if self.ShouldStopFire or not self.FireBurnSND then return end
|
||||
|
||||
self.ShouldStopFire = true
|
||||
|
||||
self:EmitSound("ambient/fire/mtov_flame2.wav")
|
||||
|
||||
self.FireBurnSND:ChangeVolume( 0, 0.5 )
|
||||
|
||||
timer.Simple( 1, function()
|
||||
if not IsValid( self ) then return end
|
||||
|
||||
self:RemoveFireSound()
|
||||
end )
|
||||
end
|
||||
|
||||
function ENT:StartFireSound()
|
||||
if self.ShouldStopFire or self.FireBurnSND then return end
|
||||
|
||||
self.FireBurnSND = CreateSound( self, "ambient/fire/firebig.wav" )
|
||||
self.FireBurnSND:PlayEx(0,100)
|
||||
self.FireBurnSND:ChangeVolume( LVS.EngineVolume, 1 )
|
||||
|
||||
self:EmitSound("ambient/fire/gascan_ignite1.wav")
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:RemoveFireSound()
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
self:SetNextClientThink( CurTime() + 0.05 )
|
||||
|
||||
self:DamageFX()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:DamageFX()
|
||||
if not self:GetDestroyed() or self:GetFuel() <= 0 then
|
||||
self:StopFireSound()
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
self:StartFireSound()
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( self:GetPos() )
|
||||
effectdata:SetEntity( self:GetBase() )
|
||||
util.Effect( "lvs_carfueltank_fire", effectdata )
|
||||
end
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
include("shared.lua")
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
@@ -0,0 +1,301 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
ent.Owner = ply
|
||||
return ent
|
||||
end
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/sw/shared/airdrop_large.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(SOLID_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetUseType(3)
|
||||
self:SetVar(1, 22)
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
phys:SetMass(5000)
|
||||
end
|
||||
self:SetBodygroup(1,1)
|
||||
self.Broken = false
|
||||
self.Smoking = false
|
||||
self.SmokeAmount = 100
|
||||
end
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime()+0.05)
|
||||
if self:GetVelocity():Length() >= 500 then
|
||||
timer.Simple(1,function()
|
||||
if IsValid(self) then
|
||||
if self.Broken then return end
|
||||
if self:GetOpen() == false and not self:IsPlayerHolding() then
|
||||
self:SetOpen(true)
|
||||
self:EmitSound("sw/misc/chute_1.wav")
|
||||
self:SetBodygroup(1,0)
|
||||
|
||||
self.Chute1 = ents.Create("prop_physics")
|
||||
self.Chute1:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute1:SetPos(self:GetPos()+self:GetRight()*250+self:GetUp()*25)
|
||||
self.Chute1:SetAngles(self:GetAngles())
|
||||
self.Chute1:Spawn()
|
||||
self.Chute1:Activate()
|
||||
self.Chute1.Owner=self.Owner
|
||||
self.Chute1:PhysWake()
|
||||
self.Chute1:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute1:GetPhysicsObject():SetMass(100)
|
||||
local Wire1 = constraint.Rope(self,self.Chute1,0,0,Vector(0,0,72),Vector(0,0,0),500,0,0,1 )
|
||||
|
||||
self.Chute2 = ents.Create("prop_physics")
|
||||
self.Chute2:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute2:SetPos(self:GetPos()-self:GetRight()*250+self:GetUp()*25)
|
||||
self.Chute2:SetAngles(self:GetAngles())
|
||||
self.Chute2:Spawn()
|
||||
self.Chute2:Activate()
|
||||
self.Chute2.Owner=self.Owner
|
||||
self.Chute2:PhysWake()
|
||||
self.Chute2:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute2:GetPhysicsObject():SetMass(100)
|
||||
local Wire2 = constraint.Rope(self,self.Chute2,0,0,Vector(0,0,72),Vector(0,0,0),500,0,0,1 )
|
||||
|
||||
self.Chute3 = ents.Create("prop_physics")
|
||||
self.Chute3:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute3:SetPos(self:GetPos()+self:GetForward()*250+self:GetUp()*25)
|
||||
self.Chute3:SetAngles(self:GetAngles())
|
||||
self.Chute3:Spawn()
|
||||
self.Chute3:Activate()
|
||||
self.Chute3.Owner=self.Owner
|
||||
self.Chute3:PhysWake()
|
||||
self.Chute3:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute3:GetPhysicsObject():SetMass(100)
|
||||
local Wire3 = constraint.Rope(self,self.Chute3,0,0,Vector(0,0,72),Vector(0,0,0),500,0,0,1 )
|
||||
|
||||
if IsValid(self.Chute1) then
|
||||
self.Chute1:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*1)
|
||||
end
|
||||
if IsValid(self.Chute2) then
|
||||
self.Chute2:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*1)
|
||||
end
|
||||
if IsValid(self.Chute3) then
|
||||
self.Chute3:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
else
|
||||
if self:GetVelocity():Length() <= 10 then
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
timer.Simple(1,function()
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
self:SetBodygroup(1,1)
|
||||
if IsValid(self.Chute1) then
|
||||
self.Chute1:Remove()
|
||||
end
|
||||
if IsValid(self.Chute2) then
|
||||
self.Chute2:Remove()
|
||||
end
|
||||
if IsValid(self.Chute3) then
|
||||
self.Chute3:Remove()
|
||||
end
|
||||
self:SetOpen(false)
|
||||
self.Smoking = true
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.Smoking then
|
||||
if self.Broken then return end
|
||||
if self.SmokeAmount >= 1 then
|
||||
self.NextSmoke = self.NextSmoke or 0
|
||||
if self.NextSmoke < CurTime() then
|
||||
self.NextSmoke = CurTime() + 0.01
|
||||
self.SmokeAmount = self.SmokeAmount - 1
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( self:GetPos()+self:GetUp() * 10 )
|
||||
effectdata:SetColor(255,0,0,255)
|
||||
util.Effect( "sw_practice_smoke_v3", effectdata )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self:GetHP() <= 0 then
|
||||
if !self.Broken then
|
||||
self:SetBodygroup(2,math.random(1,9))
|
||||
self.Broken = true
|
||||
end
|
||||
end
|
||||
end
|
||||
function giveammo(ply)
|
||||
local wep = ply:GetActiveWeapon()
|
||||
local priAmmo = wep:GetPrimaryAmmoType()
|
||||
local secAmmo = wep:GetSecondaryAmmoType()
|
||||
local priMag = wep:GetMaxClip1()
|
||||
local secMag = wep:GetMaxClip2()
|
||||
if priAmmo == -1 and secAmmo == -1 then
|
||||
return false
|
||||
end
|
||||
if priMag ~= -1 then
|
||||
ply:GiveAmmo( (priMag*3), priAmmo )
|
||||
if secAmmo ~= -1 then
|
||||
ply:GiveAmmo( 1, secAmmo )
|
||||
end
|
||||
return true
|
||||
elseif priMag == -1 then
|
||||
ply:GiveAmmo( 1, priAmmo )
|
||||
return true
|
||||
end
|
||||
if priAmmo == -1 and secMag ~= -1 then
|
||||
ply:GiveAmmo( 1, secAmmo )
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function ENT:Use( ply )
|
||||
if self.Broken then return end
|
||||
self.Smoking = false
|
||||
local tab = self:GetTable()
|
||||
if tab[1] == 22 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 21 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,1)
|
||||
end
|
||||
elseif tab[1] == 20 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 19 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,2)
|
||||
end
|
||||
elseif tab[1] == 18 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 17 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,3)
|
||||
end
|
||||
elseif tab[1] == 16 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 15 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,4)
|
||||
end
|
||||
elseif tab[1] == 14 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 13 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,5)
|
||||
end
|
||||
elseif tab[1] == 12 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 11 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,6)
|
||||
end
|
||||
elseif tab[1] == 10 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 9 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,7)
|
||||
end
|
||||
elseif tab[1] == 8 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 7 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,8)
|
||||
end
|
||||
elseif tab[1] == 6 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 5 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,9)
|
||||
end
|
||||
elseif tab[1] == 4 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 3 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
self:SetBodygroup(2,10)
|
||||
end
|
||||
elseif tab[1] == 2 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 1 then
|
||||
if giveammo(ply) == true then
|
||||
self:SetBodygroup(2,11)
|
||||
self.Broken = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Damage
|
||||
function ENT:PhysicsCollide( data )
|
||||
if data.Speed > 5 and data.DeltaTime > 0.1 then
|
||||
local VelDif = data.OurOldVelocity:Length() - data.OurNewVelocity:Length()
|
||||
|
||||
if VelDif > 20 then
|
||||
self:SetHP( self:GetHP() - VelDif*2 )
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:OnTakeDamage( dmginfo )
|
||||
self:TakePhysicsDamage( dmginfo )
|
||||
|
||||
local Damage = dmginfo:GetDamage()
|
||||
local CurHealth = self:GetHP()
|
||||
local NewHealth = CurHealth - Damage
|
||||
local ShieldCanBlock = dmginfo:IsBulletDamage() or dmginfo:IsDamageType( DMG_AIRBOAT )
|
||||
|
||||
self:SetHP( NewHealth )
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if IsValid(self.Chute1) then
|
||||
self.Chute1:Remove()
|
||||
end
|
||||
if IsValid(self.Chute2) then
|
||||
self.Chute2:Remove()
|
||||
end
|
||||
if IsValid(self.Chute3) then
|
||||
self.Chute3:Remove()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.Category = "SW Bombs V3"
|
||||
ENT.ClassName = "sw_airdrop_large_v3"
|
||||
|
||||
ENT.PrintName = "Airdrop"
|
||||
|
||||
ENT.Spawnable = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool", 0, "Open" )
|
||||
self:NetworkVar( "Float", 1, "HP")
|
||||
self:SetHP(500)
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
include("shared.lua")
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
175
garrysmod/addons/swbombs/lua/entities/sw_airdrop_v3/init.lua
Normal file
175
garrysmod/addons/swbombs/lua/entities/sw_airdrop_v3/init.lua
Normal file
@@ -0,0 +1,175 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
ent.Owner = ply
|
||||
return ent
|
||||
end
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/sw/shared/airdrop.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(SOLID_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetUseType(3)
|
||||
self:SetVar(1, 10)
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
self.Broken = false
|
||||
end
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime()+0.05)
|
||||
if self:GetVelocity():Length() >= 500 then
|
||||
timer.Simple(1,function()
|
||||
if IsValid(self) then
|
||||
if self.Broken then return end
|
||||
if self:GetOpen() == false and not self:IsPlayerHolding() then
|
||||
self:SetOpen(true)
|
||||
self:EmitSound("sw/misc/chute_1.wav")
|
||||
self.Chute = ents.Create("prop_physics")
|
||||
self.Chute:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute:SetPos(self:GetPos()+self:GetUp()*25)
|
||||
self.Chute:SetAngles(self:GetAngles())
|
||||
self.Chute:Spawn()
|
||||
self.Chute:Activate()
|
||||
self.Chute.Owner=self.Owner
|
||||
self.Chute:PhysWake()
|
||||
self.Chute:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute:GetPhysicsObject():SetMass(100)
|
||||
local Wire = constraint.Rope(self,self.Chute,0,0,Vector(30,0,20),Vector(0,0,0),150,0,0,1 )
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
else
|
||||
if self:GetVelocity():Length() <= 10 then
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
timer.Simple(1,function()
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:Remove()
|
||||
end
|
||||
|
||||
self:SetOpen(false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self:GetHP() <= 0 then
|
||||
if !self.Broken then
|
||||
self.Broken = true
|
||||
end
|
||||
end
|
||||
end
|
||||
function giveammo(ply)
|
||||
local wep = ply:GetActiveWeapon()
|
||||
local priAmmo = wep:GetPrimaryAmmoType()
|
||||
local secAmmo = wep:GetSecondaryAmmoType()
|
||||
local priMag = wep:GetMaxClip1()
|
||||
local secMag = wep:GetMaxClip2()
|
||||
if priAmmo == -1 and secAmmo == -1 then
|
||||
return false
|
||||
end
|
||||
if priMag ~= -1 then
|
||||
ply:GiveAmmo( (priMag*2), priAmmo )
|
||||
if secAmmo ~= -1 then
|
||||
ply:GiveAmmo( 1, secAmmo )
|
||||
end
|
||||
return true
|
||||
elseif priMag == -1 then
|
||||
ply:GiveAmmo( 1, priAmmo )
|
||||
return true
|
||||
end
|
||||
if priAmmo == -1 and secMag ~= -1 then
|
||||
ply:GiveAmmo( 1, secAmmo )
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
function ENT:Use( ply )
|
||||
if self.Broken then return end
|
||||
local tab = self:GetTable()
|
||||
if tab[1] == 10 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 9 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 8 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 7 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 6 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 5 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 4 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 3 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 2 then
|
||||
if giveammo(ply) == true then
|
||||
tab[1] = tab[1] - 1
|
||||
end
|
||||
elseif tab[1] == 1 then
|
||||
if giveammo(ply) == true then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Damage
|
||||
function ENT:PhysicsCollide( data )
|
||||
if data.Speed > 5 and data.DeltaTime > 0.1 then
|
||||
local VelDif = data.OurOldVelocity:Length() - data.OurNewVelocity:Length()
|
||||
|
||||
if VelDif > 50 then
|
||||
self:SetHP( self:GetHP() - VelDif*2 )
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:OnTakeDamage( dmginfo )
|
||||
self:TakePhysicsDamage( dmginfo )
|
||||
|
||||
local Damage = dmginfo:GetDamage()
|
||||
local CurHealth = self:GetHP()
|
||||
local NewHealth = CurHealth - Damage
|
||||
local ShieldCanBlock = dmginfo:IsBulletDamage() or dmginfo:IsDamageType( DMG_AIRBOAT )
|
||||
|
||||
self:SetHP( NewHealth )
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:Remove()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.Category = "SW Bombs V3"
|
||||
ENT.ClassName = "sw_airdrop_v3"
|
||||
|
||||
ENT.PrintName = "Care package"
|
||||
|
||||
ENT.Spawnable = true
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool", 0, "Open" )
|
||||
self:NetworkVar( "Float", 1, "HP")
|
||||
self:SetHP(250)
|
||||
end
|
||||
601
garrysmod/addons/swbombs/lua/entities/sw_base_bomb_v3.lua
Normal file
601
garrysmod/addons/swbombs/lua/entities/sw_base_bomb_v3.lua
Normal file
@@ -0,0 +1,601 @@
|
||||
AddCSLuaFile()
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "Bomb basescript V3"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/bombs/ao25m1.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_25kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ArmSound = "sw/bomb/arm.wav"
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 500
|
||||
ENT.ImpactSpeed = 100
|
||||
ENT.ImpactDepth = 25
|
||||
ENT.Mass = 0
|
||||
ENT.Durability = 10
|
||||
ENT.DetonateHeight = 0
|
||||
|
||||
--Explosion
|
||||
ENT.DamageType = DMG_BURN
|
||||
ENT.ExplosionDamage = 10000
|
||||
ENT.ExplosionRadius = 300
|
||||
ENT.BlastRadius = 450
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 600
|
||||
ENT.FragCount = 100
|
||||
|
||||
--Guidance
|
||||
ENT.DiveHeight = 1000
|
||||
ENT.Agility = 100
|
||||
ENT.HaveGuidance = false
|
||||
ENT.GuidanceActive = false
|
||||
ENT.LaserGuided = false
|
||||
ENT.LaserCode = "view"
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Bool",0,"Timed", {KeyName = "timed", Edit = { type = "Boolean", category = "Fuze"}})
|
||||
self:NetworkVar("Int",1,"Timer", { KeyName = "timer", Edit = { type = "Int", min = 0, max = 120, category = "Fuze"} } )
|
||||
self:NetworkVar("Bool",2,"AirDetonate", {KeyName = "airdetonate", Edit = { type = "Boolean", category = "Fuze"}})
|
||||
self:NetworkVar("Int",3,"DetonateHeight", { KeyName = "detonateheight", Edit = { type = "Int", min = 0, max = 2000, category = "Fuze"} } )
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
local angle_reg = Angle(0,0,0)
|
||||
local angle_dif = Angle(-90,0,0)
|
||||
local Normal = Vector(1,1,0)
|
||||
local Normal2 = Vector(0.1,1,1)
|
||||
local trlength = Vector(0,0,9000)
|
||||
local angle_zero = Angle()
|
||||
local angle_1 = Angle(-90,0,0)
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel(self.Model)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup( COLLISION_GROUP_WORLD )
|
||||
self:PhysWake()
|
||||
local pObj = self:GetPhysicsObject()
|
||||
pObj:SetMass( self.Mass )
|
||||
pObj:EnableGravity( false )
|
||||
pObj:EnableMotion( true )
|
||||
pObj:EnableDrag( false )
|
||||
self:StartMotionController()
|
||||
self:PhysWake()
|
||||
self.InGround = false
|
||||
self.InEntity = false
|
||||
self.Exploded = false
|
||||
self.Armed = false
|
||||
self.CurDurability = self.Durability
|
||||
self.AirDetTicks = 0
|
||||
self.FreefallTicks=0
|
||||
self:OnSpawn()
|
||||
end
|
||||
|
||||
function ENT:OnSpawn()
|
||||
end
|
||||
|
||||
--Arming
|
||||
function ENT:Use( activator, caller )
|
||||
if !self.Exploded and !self.Armed then
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
end
|
||||
end
|
||||
|
||||
--Think
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime())
|
||||
if self.Armed then
|
||||
if self:GetAirDetonate() then
|
||||
if IsValid(self) and (self:GetVelocity():Length() > self.ImpactSpeed) and not self:IsPlayerHolding() then
|
||||
self.AirDetTicks = self.AirDetTicks + 1
|
||||
if self.AirDetTicks >= 15 then
|
||||
local tr = util.TraceLine({
|
||||
start = self:LocalToWorld(self:OBBCenter()),
|
||||
endpos = self:LocalToWorld(self:OBBCenter()) - Vector(0,0,self:GetDetonateHeight()),
|
||||
filter = self,
|
||||
})
|
||||
if tr.Hit then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.GuidanceActive then
|
||||
self:LaserGuidance()
|
||||
self:Guidance(self:GetPhysicsObject())
|
||||
end
|
||||
end
|
||||
if self.InGround or self.InEntity then
|
||||
if self:IsPlayerHolding() then
|
||||
self.InGround = false
|
||||
self.InEntity = false
|
||||
end
|
||||
end
|
||||
|
||||
self:OnTick()
|
||||
return true
|
||||
end
|
||||
function ENT:OnTick()
|
||||
end
|
||||
|
||||
--Flight physics
|
||||
function ENT:PhysicsSimulate( phys, deltatime )
|
||||
phys:Wake()
|
||||
local ForceLinear, ForceAngle = phys:CalculateForceOffset( physenv.GetGravity(), phys:LocalToWorld( phys:GetMassCenter() + Vector(10,0,0) ) )
|
||||
if self.WingsOpen then
|
||||
ForceAngle = ForceAngle - phys:GetAngleVelocity() * 30
|
||||
else
|
||||
ForceAngle = ForceAngle - phys:GetAngleVelocity() * 5
|
||||
if not self.GuidanceActive then
|
||||
phys:AddAngleVelocity(Vector(self:GetVelocity():Length()*0.01,0,0))
|
||||
end
|
||||
end
|
||||
return ForceAngle, ForceLinear, SIM_GLOBAL_ACCELERATION
|
||||
end
|
||||
|
||||
--Guidance
|
||||
function ENT:LaserGuidance()
|
||||
if self.Armed and not (self.InGround or self.InEntity) then
|
||||
if self.LaserGuided then
|
||||
if IsValid(self.Launcher) then
|
||||
local Parent = self.Launcher
|
||||
local phys = self:GetPhysicsObject()
|
||||
local ID = Parent:LookupAttachment( self.LaserCode )
|
||||
local Attachment = Parent:GetAttachment( ID )
|
||||
if Parent:GetAttachment( ID ) then
|
||||
local TargetDir = Attachment.Ang:Forward()
|
||||
local tr = util.TraceHull( {
|
||||
start = Attachment.Pos,
|
||||
endpos = (Attachment.Pos + TargetDir * 999999),
|
||||
mins = Vector( -1, -1, -1 ),
|
||||
maxs = Vector( 1, 1, 1 ),
|
||||
filter = {self,Parent,Parent.wheel_C,Parent.wheel_R,Parent.wheel_L}
|
||||
} )
|
||||
self.target = tr.Entity
|
||||
self.targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:Guidance(ph)
|
||||
if self.target != NULL then
|
||||
if IsValid(self.target) or self.target:GetClass() == "worldspawn" then
|
||||
if not (self.InGround or self.Armed or self.InEntity) then return end
|
||||
local pos = self:GetPos()
|
||||
local vel = self:WorldToLocal(pos+ph:GetVelocity())*0.4
|
||||
vel.x = 0
|
||||
local target = self.target:LocalToWorld(self.targetOffset)
|
||||
local v = self:WorldToLocal(target + Vector(0,0,math.Clamp((pos*Normal):Distance(target*Normal)/5 - 50,0,self.DiveHeight or 0))):GetNormal()
|
||||
if isnumber(self.Agility) then
|
||||
v.y = math.Clamp(v.y*10,-1,1)*self.Agility
|
||||
v.z = math.Clamp(v.z*10,-1,1)*self.Agility
|
||||
else
|
||||
v.y = math.Clamp(v.y*10,-1,1)*10
|
||||
v.z = math.Clamp(v.z*10,-1,1)*10
|
||||
end
|
||||
ph:AddAngleVelocity(
|
||||
ph:GetAngleVelocity()*-0.4
|
||||
+ Vector(math.Rand(-1,1), math.Rand(-1,1), math.Rand(-1,1))*5
|
||||
+ Vector(0,-vel.z,vel.y)
|
||||
+ Vector(0,-v.z,v.y)
|
||||
)
|
||||
ph:AddVelocity(self:GetForward()*10 - self:LocalToWorld(vel*Normal2) + pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Taking damage
|
||||
function ENT:OnTakeDamage(dmginfo)
|
||||
if self.Exploded then return end
|
||||
local inflictor = dmginfo:GetInflictor()
|
||||
local attacker = dmginfo:GetAttacker()
|
||||
if IsValid(inflictor) and (inflictor.IsGredBomb or inflictor.lvsProjectile or inflictor.SWBombV3 ) then return end
|
||||
if IsValid(attacker) and (attacker.IsGredBomb or attacker.lvsProjectile or attacker.SWBombV3 ) then return end
|
||||
self:TakePhysicsDamage(dmginfo)
|
||||
self.CurDurability = self.CurDurability - dmginfo:GetDamage()
|
||||
if self.Armed then
|
||||
if self.CurDurability <= 0 then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
else
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
end
|
||||
end
|
||||
|
||||
--Explosion
|
||||
function ENT:Explode(pos)
|
||||
if !self.Exploded then return end
|
||||
if !self.Armed then return end
|
||||
pos = self:LocalToWorld(self:OBBCenter())
|
||||
if(self:WaterLevel() >= 1) then
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos + Vector(0,0,9000),
|
||||
filter = self,
|
||||
})
|
||||
local tr2 = util.TraceLine({
|
||||
start = tr.HitPos,
|
||||
endpos = tr.HitPos - Vector(0,0,9000),
|
||||
filter = self,
|
||||
mask = MASK_WATER + CONTENTS_TRANSLUCENT,
|
||||
})
|
||||
if tr2.Hit then
|
||||
ParticleEffect(self.EffectWater, tr2.HitPos,(self.AngEffect and angle_dif or angle_reg), nil)
|
||||
end
|
||||
else
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos - Vector(0, 0, self.TraceLength),
|
||||
filter = self,
|
||||
})
|
||||
if tr.HitWorld then
|
||||
ParticleEffect(self.Effect,pos,(self.AngEffect and angle_dif or angle_reg),nil)
|
||||
else
|
||||
ParticleEffect(self.EffectAir,pos,(self.AngEffect and angle_dif or angle_reg),nil)
|
||||
end
|
||||
end
|
||||
debugoverlay.Sphere(pos,self.ExplosionRadius,5,Color(255,0,0,100),false)
|
||||
debugoverlay.Sphere(pos,self.BlastRadius,5,Color(200,150,0,100),false)
|
||||
debugoverlay.Sphere(pos,self.FragRadius,5,Color(200,200,0,100),false)
|
||||
|
||||
--Deadly zone
|
||||
if self.ExplosionRadius > 0 then
|
||||
for k, v in pairs(ents.FindInSphere(pos,self.ExplosionRadius)) do
|
||||
if v:IsValid() and not v.SWBombV3 then
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetDamage(self.ExplosionDamage)
|
||||
dmg:SetDamageType(self.DamageType)
|
||||
dmg:SetAttacker((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld())
|
||||
v:TakeDamageInfo(dmg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Blast wave
|
||||
if self.BlastRadius > 0 then
|
||||
util.BlastDamage( self, ((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld()), pos, self.BlastRadius,self.ExplosionDamage/2 )
|
||||
self:BlastDoors(self, pos, 10)
|
||||
end
|
||||
|
||||
--Frags
|
||||
if self.FragCount > 0 then
|
||||
self:Fragmentation(self,pos,10000,self.FragDamage,self.FragRadius,((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld()))
|
||||
end
|
||||
|
||||
swv3.CreateSound(pos,false,self.ExplosionSound,self.FarExplosionSound,self.DistExplosionSound)
|
||||
timer.Simple(0,function()
|
||||
if !IsValid(self) then return end
|
||||
self:Remove()
|
||||
end)
|
||||
end
|
||||
|
||||
--Impact
|
||||
function ENT:PhysicsCollide( data, physobj )
|
||||
if self:GetVelocity():Length() >= self.ImpactSpeed then
|
||||
local tr = util.TraceLine({
|
||||
start = self:LocalToWorld(self:OBBCenter()),
|
||||
endpos =self:LocalToWorld(self:OBBCenter())+self:GetAngles():Forward()*self.TraceLength,
|
||||
filter = self,
|
||||
})
|
||||
if not (self.InGround or self.InEntity) then
|
||||
if tr.Hit and tr.HitWorld and not tr.HitSky then
|
||||
if self:WaterLevel() <= 0 then
|
||||
self:EmitSound(self.ImpactSound)
|
||||
self:EmitSound(self.DebrisSound)
|
||||
else
|
||||
self:EmitSound(self.WaterImpactSound)
|
||||
end
|
||||
self:SetPos(self:GetPos()+self:GetAngles():Forward()*(self.ImpactDepth))
|
||||
self:SetAngles(self:GetAngles())
|
||||
self:GetPhysicsObject():EnableMotion(false)
|
||||
self.InGround = true
|
||||
elseif tr.Hit and not tr.HitWorld and not tr.HitSky then
|
||||
if IsValid(tr.Entity) then
|
||||
if self:WaterLevel() <= 0 then
|
||||
self:EmitSound(self.ImpactSound)
|
||||
self:EmitSound(self.DebrisSound)
|
||||
else
|
||||
self:EmitSound(self.WaterImpactSound)
|
||||
end
|
||||
self:SetPos(self:GetPos()+self:GetAngles():Forward()*(self.ImpactDepth))
|
||||
self:SetAngles(self:GetAngles())
|
||||
self:SetParent(tr.Entity)
|
||||
self.InEntity = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.Armed then
|
||||
if self:GetTimed() then
|
||||
timer.Simple(self:GetTimer(),function()
|
||||
if IsValid(self) then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
end)
|
||||
else
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
else
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Door blasting
|
||||
function ENT:IsDoor(ent)
|
||||
local Class = ent:GetClass()
|
||||
|
||||
return (Class == "prop_door") or (Class == "prop_door_rotating") or (Class == "func_door") or (Class == "func_door_rotating")
|
||||
end
|
||||
function ENT:BlastDoors(blaster, pos, power, range, ignoreVisChecks)
|
||||
for k, door in pairs(ents.FindInSphere(pos, 40 * power * (range or 1))) do
|
||||
if self:IsDoor(door) then
|
||||
local proceed = ignoreVisChecks
|
||||
|
||||
if not proceed then
|
||||
local tr = util.QuickTrace(pos, door:LocalToWorld(door:OBBCenter()) - pos, blaster)
|
||||
proceed = IsValid(tr.Entity) and (tr.Entity == door)
|
||||
end
|
||||
|
||||
if proceed then
|
||||
self:BlastDoor(door, (door:LocalToWorld(door:OBBCenter()) - pos):GetNormalized() * 1000)
|
||||
end
|
||||
end
|
||||
if door:GetClass() == "func_breakable_surf" then
|
||||
door:Fire("Break")
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:BlastDoor(ent, vel)
|
||||
local Moddel, Pozishun, Ayngul, Muteeriul, Skin = ent:GetModel(), ent:GetPos(), ent:GetAngles(), ent:GetMaterial(), ent:GetSkin()
|
||||
sound.Play("Wood_Crate.Break", Pozishun, 60, 100)
|
||||
sound.Play("Wood_Furniture.Break", Pozishun, 60, 100)
|
||||
ent:Fire("unlock", "", 0)
|
||||
ent:Fire("open", "", 0)
|
||||
ent:SetNoDraw(true)
|
||||
ent:SetNotSolid(true)
|
||||
|
||||
if Moddel and Pozishun and Ayngul then
|
||||
local Replacement = ents.Create("prop_physics")
|
||||
Replacement:SetModel(Moddel)
|
||||
Replacement:SetPos(Pozishun + Vector(0, 0, 1))
|
||||
Replacement:SetAngles(Ayngul)
|
||||
|
||||
if Muteeriul then
|
||||
Replacement:SetMaterial(Muteeriul)
|
||||
end
|
||||
|
||||
if Skin then
|
||||
Replacement:SetSkin(Skin)
|
||||
end
|
||||
|
||||
Replacement:SetModelScale(.9, 0)
|
||||
Replacement:Spawn()
|
||||
Replacement:Activate()
|
||||
|
||||
if vel then
|
||||
Replacement:GetPhysicsObject():SetVelocity(vel)
|
||||
|
||||
timer.Simple(0, function()
|
||||
if IsValid(Replacement) then
|
||||
Replacement:GetPhysicsObject():ApplyForceCenter(vel * 100)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
timer.Simple(3, function()
|
||||
if IsValid(Replacement) then
|
||||
Replacement:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
end
|
||||
end)
|
||||
|
||||
timer.Simple(30, function()
|
||||
if IsValid(ent) then
|
||||
ent:SetNotSolid(false)
|
||||
ent:SetNoDraw(false)
|
||||
end
|
||||
|
||||
if IsValid(Replacement) then
|
||||
Replacement:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
--Frags
|
||||
function ENT:Fragmentation(shooter, origin, fragNum, fragDmg, fragMaxDist, attacker, direction, spread, zReduction)
|
||||
shooter = shooter or game.GetWorld()
|
||||
zReduction = zReduction or 2
|
||||
|
||||
local Spred = Vector(0, 0, 0)
|
||||
local BulletsFired, MaxBullets, disperseTime = 0, self.FragCount, .5
|
||||
|
||||
if fragNum >= 12000 then
|
||||
disperseTime = 2
|
||||
elseif fragNum >= 6000 then
|
||||
disperseTime = 1
|
||||
end
|
||||
|
||||
for i = 1, fragNum do
|
||||
timer.Simple((i / fragNum) * disperseTime, function()
|
||||
local Dir
|
||||
|
||||
if direction and spread then
|
||||
Dir = Vector(direction.x, direction.y, direction.z)
|
||||
Dir = Dir + VectorRand() * math.Rand(0, spread)
|
||||
Dir:Normalize()
|
||||
else
|
||||
Dir = VectorRand()
|
||||
end
|
||||
|
||||
if zReduction then
|
||||
Dir.z = Dir.z / zReduction
|
||||
Dir:Normalize()
|
||||
end
|
||||
|
||||
local Tr = util.QuickTrace(origin, Dir * fragMaxDist, shooter)
|
||||
|
||||
if Tr.Hit and not Tr.HitSky and not Tr.HitWorld and (BulletsFired < MaxBullets) then
|
||||
local LowFrag = (Tr.Entity.IsVehicle and Tr.Entity:IsVehicle()) or Tr.Entity.LFS or Tr.Entity.LVS or Tr.Entity.EZlowFragPlease
|
||||
|
||||
if (not LowFrag) or (LowFrag and math.random(1, 4) == 2) then
|
||||
|
||||
local firer = (IsValid(shooter) and shooter) or game.GetWorld()
|
||||
|
||||
firer:FireBullets({
|
||||
Attacker = attacker,
|
||||
Damage = fragDmg,
|
||||
Force = fragDmg / 8,
|
||||
Num = 1,
|
||||
Src = origin,
|
||||
Tracer = 0,
|
||||
Dir = Dir,
|
||||
Spread = Spred,
|
||||
AmmoType = "Buckshot"
|
||||
})
|
||||
BulletsFired = BulletsFired + 1
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Initialize()
|
||||
self.snd = CreateSound(self, self.WhistleSound)
|
||||
self.snd:SetSoundLevel( 110 )
|
||||
self.snd:PlayEx(0,150)
|
||||
end
|
||||
function ENT:CalcDoppler()
|
||||
local Ent = LocalPlayer()
|
||||
local ViewEnt = Ent:GetViewEntity()
|
||||
|
||||
local sVel = self:GetVelocity()
|
||||
local oVel = Ent:GetVelocity()
|
||||
local SubVel = oVel - sVel
|
||||
local SubPos = self:GetPos() - Ent:GetPos()
|
||||
|
||||
local DirPos = SubPos:GetNormalized()
|
||||
local DirVel = SubVel:GetNormalized()
|
||||
local A = math.acos( math.Clamp( DirVel:Dot( DirPos ) ,-1,1) )
|
||||
return (1 + math.cos( A ) * SubVel:Length() / 13503.9)
|
||||
end
|
||||
function ENT:Think()
|
||||
if self.snd then
|
||||
self.snd:ChangePitch( 100 * self:CalcDoppler(), 1 )
|
||||
self.snd:ChangeVolume(math.Clamp(-(self:GetVelocity().z + 1000) / 3000,0,1), 2)
|
||||
end
|
||||
end
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
function ENT:SoundStop()
|
||||
if self.snd then
|
||||
self.snd:Stop()
|
||||
end
|
||||
end
|
||||
function ENT:OnRemove()
|
||||
self:SoundStop()
|
||||
end
|
||||
end
|
||||
949
garrysmod/addons/swbombs/lua/entities/sw_base_rocket_v3.lua
Normal file
949
garrysmod/addons/swbombs/lua/entities/sw_base_rocket_v3.lua
Normal file
@@ -0,0 +1,949 @@
|
||||
AddCSLuaFile()
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
sound.Add( {
|
||||
name = "SW_ROCKET_ENG_LOOP",
|
||||
channel = CHAN_AUTO,
|
||||
volume = 1.0,
|
||||
level = 80,
|
||||
sound = "sw/rocket/rocket_fly_loop.wav"
|
||||
} )
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "Rocket basescript V3"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
ENT.IsRocket = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/rockets/s1of.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_25kg"
|
||||
ENT.AngEffect = true
|
||||
ENT.RocketTrail = "Small_mis_thrust"
|
||||
ENT.RocketBurnoutTrail = "Small_mis_burnout"
|
||||
ENT.Tracer1Att = nil
|
||||
ENT.Tracer2Att = nil
|
||||
ENT.Engine1Att = nil
|
||||
ENT.Engine2Att = nil
|
||||
|
||||
--Sounds
|
||||
ENT.ArmSound = "sw/bomb/arm.wav"
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
ENT.EngineSound = "SW_ROCKET_ENG_LOOP"
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.DetonateHeight = 0
|
||||
ENT.MaxVelocity = 100
|
||||
ENT.FuelBurnoutTime = 1
|
||||
ENT.RotationalForce = 1000
|
||||
|
||||
--Explosion
|
||||
ENT.DamageType = DMG_BURN
|
||||
ENT.ExplosionDamage = 1000
|
||||
ENT.ExplosionRadius = 300
|
||||
ENT.BlastRadius = 450
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 600
|
||||
ENT.FragCount = 100
|
||||
ENT.ArmorPenetration = 1000
|
||||
ENT.PenetrationDamage = 1000
|
||||
|
||||
--Guidance
|
||||
ENT.DiveHeight = 0
|
||||
ENT.Agility = 100
|
||||
ENT.HaveGuidance = false
|
||||
ENT.GuidanceActive = false
|
||||
ENT.LaserGuided = false
|
||||
ENT.LaserCode = "view"
|
||||
ENT.SpiralRate = -0.4
|
||||
ENT.SpiralRadius = 0
|
||||
ENT.IRunstable = false
|
||||
ENT.IRradius = 0
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Bool",0,"AirDetonate", {KeyName = "airdetonate", Edit = { type = "Boolean", category = "Fuze"}})
|
||||
self:NetworkVar("Int",1,"DetonateHeight", { KeyName = "detonateheight", Edit = { type = "Int", min = 0, max = 2000, category = "Fuze"} } )
|
||||
self:NetworkVar("Int",2,"TracerScale")
|
||||
self:NetworkVar("Bool",3,"RadioFuze", {KeyName = "radiofuze", Edit = { type = "Boolean", category = "Fuze"}})
|
||||
self:NetworkVar("Int",4,"RadioFuzeRadius", { KeyName = "radiofuzeradius", Edit = { type = "Int", min = 0, max = 5000, category = "Fuze"} })
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
local angle_reg = Angle(0,0,0)
|
||||
local angle_dif = Angle(-90,0,0)
|
||||
local Normal = Vector(1,1,0)
|
||||
local Normal2 = Vector(0.1,1,1)
|
||||
local trlength = Vector(0,0,9000)
|
||||
local angle_zero = Angle()
|
||||
local angle_1 = Angle(-90,0,0)
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel(self.Model)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup( COLLISION_GROUP_NONE )
|
||||
self:PhysWake()
|
||||
local pObj = self:GetPhysicsObject()
|
||||
pObj:SetMass( self.Mass )
|
||||
pObj:EnableGravity( false )
|
||||
pObj:EnableMotion( true )
|
||||
pObj:EnableDrag( false )
|
||||
self:StartMotionController()
|
||||
self:PhysWake()
|
||||
self.InGround = false
|
||||
self.InEntity = false
|
||||
self.Exploded = false
|
||||
self.Armed = false
|
||||
self.CurDurability = self.Durability
|
||||
self.AirDetTicks = 0
|
||||
self.MaxVelocityUnitsSquared = self.MaxVelocity and self:ConvertMetersToUnits(self.MaxVelocity^2) or nil
|
||||
end
|
||||
|
||||
--Arming
|
||||
function ENT:Use( activator, caller )
|
||||
if !self.Exploded and !self.Armed then
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
self:Launch()
|
||||
end
|
||||
end
|
||||
function ENT:Launch()
|
||||
if self.Exploded or self.Burnt or self.Fired then return end
|
||||
|
||||
self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if !IsValid(phys) then return end
|
||||
|
||||
self.ImpactSpeed = 10
|
||||
|
||||
self.Fired = true
|
||||
self:SetNWBool("Fired",true)
|
||||
|
||||
constraint.RemoveAll(self)
|
||||
|
||||
phys:Wake()
|
||||
phys:EnableMotion(true)
|
||||
|
||||
|
||||
self:InitLaunch(phys)
|
||||
end
|
||||
function ENT:InitLaunch(phys)
|
||||
|
||||
self:EmitSound(self.StartSound)
|
||||
util.ScreenShake( self:GetPos(), 1, 10, 1, 150+self.ExplosionRadius, true, nil )
|
||||
self:SetBodygroup(1,1)
|
||||
|
||||
phys:AddAngleVelocity(Vector(self.RotationalForce or 0,0,0))
|
||||
|
||||
if self.RocketTrail then
|
||||
timer.Simple(0,function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
if self.Engine1Att then
|
||||
local ID = self:LookupAttachment( self.Engine1Att )
|
||||
ParticleEffectAttach(self.RocketTrail,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
if self.Engine2Att then
|
||||
local ID = self:LookupAttachment( self.Engine2Att )
|
||||
ParticleEffectAttach(self.RocketTrail,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
if not self.Engine1Att and not self.Engine2Att then
|
||||
ParticleEffectAttach(self.RocketTrail,PATTACH_ABSORIGIN_FOLLOW,self,1)
|
||||
end
|
||||
|
||||
if self.Tracer1Att then
|
||||
if self.TracerEffect then
|
||||
local ID = self:LookupAttachment( self.Tracer1Att )
|
||||
ParticleEffectAttach(self.TracerEffect,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
end
|
||||
if self.Tracer2Att then
|
||||
if self.TracerEffect then
|
||||
local ID = self:LookupAttachment( self.Tracer2Att )
|
||||
ParticleEffectAttach(self.TracerEffect,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if self.FuelBurnoutTime and self.FuelBurnoutTime != 0 then
|
||||
timer.Simple(self.FuelBurnoutTime,function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
self.Burnt = true
|
||||
self:SetNWBool("Burnt",true)
|
||||
self:StopParticles()
|
||||
self:StopSound(self.EngineSound)
|
||||
self:StopSound(self.StartSound)
|
||||
|
||||
if self.Engine1Att then
|
||||
local ID = self:LookupAttachment( self.Engine1Att )
|
||||
ParticleEffectAttach(self.RocketBurnoutTrail,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
if self.Engine2Att then
|
||||
local ID = self:LookupAttachment( self.Engine2Att )
|
||||
ParticleEffectAttach(self.RocketBurnoutTrail,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
if not self.Engine1Att and not self.Engine2Att then
|
||||
ParticleEffectAttach(self.RocketBurnoutTrail,PATTACH_ABSORIGIN_FOLLOW,self,1)
|
||||
end
|
||||
if self.Tracer1Att then
|
||||
if self.TracerEffect then
|
||||
local ID = self:LookupAttachment( self.Tracer1Att )
|
||||
ParticleEffectAttach(self.TracerEffect,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
end
|
||||
if self.Tracer2Att then
|
||||
if self.TracerEffect then
|
||||
local ID = self:LookupAttachment( self.Tracer2Att )
|
||||
ParticleEffectAttach(self.TracerEffect,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
--Think
|
||||
function ENT:ConvertMetersToUnits(Meters)
|
||||
return Meters / 0.01905
|
||||
end
|
||||
function ENT:ConvertUnitsToMeters(Units)
|
||||
return Units * 0.01905
|
||||
end
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime())
|
||||
if self:IsPlayerHolding() then
|
||||
self:SetNWBool("IsPlayerHolding",true)
|
||||
else
|
||||
self:SetNWBool("IsPlayerHolding",false)
|
||||
end
|
||||
if self.Armed then
|
||||
if self:GetAirDetonate() then
|
||||
if IsValid(self) and (self:GetVelocity():Length() > self.ImpactSpeed) and not self:IsPlayerHolding() then
|
||||
self.AirDetTicks = self.AirDetTicks + 1
|
||||
if self.AirDetTicks >= 50 then
|
||||
local tr = util.TraceLine({
|
||||
start = self:LocalToWorld(self:OBBCenter()),
|
||||
endpos = self:LocalToWorld(self:OBBCenter()) - Vector(0,0,self:GetDetonateHeight()),
|
||||
filter = self,
|
||||
})
|
||||
if tr.Hit then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.CruiseMode and self.GuidanceActive then
|
||||
local ph = self:GetPhysicsObject()
|
||||
local target = self.target:LocalToWorld(self.targetOffset)
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = (self:GetPos() + (self:GetAngles():Forward()*7500) - (self:GetAngles():Up()*2500) ),
|
||||
filter = {self}
|
||||
} )
|
||||
if tr.Hit then
|
||||
local distance = self:GetPos():Distance(target)
|
||||
if distance > 10000 then
|
||||
ph:AddVelocity(self:GetAngles():Up()*500)
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.GuidanceActive then
|
||||
self:LaserGuidance()
|
||||
self:Guidance(self:GetPhysicsObject())
|
||||
if IsValid(self.target) then
|
||||
if self.WithOffset then
|
||||
self.TargetForwardOffset = self:GetPos():Distance(self.target:GetPos())/(self.OffsetMultiplier or 2)
|
||||
self.targetOffset = self.target:WorldToLocal(self.target:GetPos()+(self.target:GetForward()*self.TargetForwardOffset))
|
||||
end
|
||||
end
|
||||
if self.IRunstable == true then
|
||||
for _, e in pairs(ents.FindInCone(self:GetPos(),self:GetForward(),1500,math.cos(math.rad(self.SeekerCone)))) do
|
||||
if IsValid( e ) and e:GetClass() == "misc_flare" then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = e:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == e then
|
||||
self.LaserGuided = false
|
||||
self.target = e
|
||||
end
|
||||
end
|
||||
if IsValid( e ) and e:GetClass() == "sw_flr" then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = e:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == e then
|
||||
self.LaserGuided = false
|
||||
self.target = e
|
||||
end
|
||||
end
|
||||
if IsValid( e ) and e:GetClass() == "sw_flare_v3" then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = e:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == e then
|
||||
self.LaserGuided = false
|
||||
self.target = e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self:GetRadioFuze() then
|
||||
for _, e in pairs(ents.FindInSphere(self:GetPos(), self:GetRadioFuzeRadius())) do
|
||||
if IsValid( e ) and e != self.Launcher then
|
||||
if self.LaserGuided == true then
|
||||
if e.IsRocket == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
if e.Fired == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
if e.Armed == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
if e.Burnt == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
if ((e.LFS and e:GetEngineActive()) or ((e:GetClass() == "lvs_helicopter_engine" or e:GetClass() == "lvs_fighterplane_engine") and e:GetBase():GetEngineActive()) or (e.isWacAircraft and e.active)) then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
else
|
||||
if ((e.LFS and e:GetEngineActive()) or ((e:GetClass() == "lvs_helicopter_engine" or e:GetClass() == "lvs_fighterplane_engine") and e:GetBase():GetEngineActive()) or (e.isWacAircraft and e.active)) then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
|
||||
if e.IsRocket == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
if e.Fired == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
if e.Armed == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
if e.Burnt == true and e.Launcher != self.Launcher then
|
||||
self.Exploded = true
|
||||
self:Explode()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self:GetNWBool("Fired") == true then
|
||||
if not self.Burnt then
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if IsValid(phys) then
|
||||
if self.MaxVelocityUnitsSquared and phys:GetVelocity():LengthSqr() < self.MaxVelocityUnitsSquared then
|
||||
phys:ApplyForceCenter(self:GetForward() * 500000)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.InGround or self.InEntity then
|
||||
if self:IsPlayerHolding() then
|
||||
self.InGround = false
|
||||
self.InEntity = false
|
||||
end
|
||||
end
|
||||
|
||||
self:OnTick()
|
||||
return true
|
||||
end
|
||||
function ENT:OnTick()
|
||||
end
|
||||
|
||||
--Flight physics
|
||||
function ENT:PhysicsSimulate( phys, deltatime )
|
||||
if self.GuidanceActive or IsValid(self.target) then return end
|
||||
phys:Wake()
|
||||
local ForceLinear, ForceAngle = phys:CalculateForceOffset( physenv.GetGravity(), phys:LocalToWorld( phys:GetMassCenter() + Vector(10,0,0) ) )
|
||||
ForceAngle = ForceAngle - phys:GetAngleVelocity() * 30
|
||||
if self.RotationalForce and self.Fired then
|
||||
phys:AddAngleVelocity(Vector(self.RotationalForce,0,0))
|
||||
end
|
||||
return ForceAngle, ForceLinear, SIM_GLOBAL_ACCELERATION
|
||||
end
|
||||
|
||||
--Guidance
|
||||
function ENT:LaserGuidance()
|
||||
if self.Armed and not (self.InGround or self.InEntity) then
|
||||
if self.LaserGuided then
|
||||
if IsValid(self.Launcher) then
|
||||
local Parent = self.Launcher
|
||||
local phys = self:GetPhysicsObject()
|
||||
local ID = Parent:LookupAttachment( self.LaserCode )
|
||||
local Attachment = Parent:GetAttachment( ID )
|
||||
if Parent:GetAttachment( ID ) then
|
||||
local TargetDir = Attachment.Ang:Forward()
|
||||
local tr = util.TraceLine( {
|
||||
start = Attachment.Pos,
|
||||
endpos = (Attachment.Pos + TargetDir * 999999),
|
||||
filter = {self,Parent,Parent.wheel_C,Parent.wheel_R,Parent.wheel_L}
|
||||
} )
|
||||
self.target = tr.Entity
|
||||
self.targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
|
||||
phys:SetVelocity( self:GetVelocity() + self:GetAngles():Forward() * 50 )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:Guidance(ph)
|
||||
if self.target != NULL then
|
||||
if IsValid(self.target) or self.target:GetClass() == "worldspawn" then
|
||||
if not (self.InGround or self.Armed or self.InEntity) then return end
|
||||
local pos = self:GetPos()
|
||||
local vel = self:WorldToLocal(pos+ph:GetVelocity())*0.4
|
||||
vel.x = 0
|
||||
local target = self.target:LocalToWorld(self.targetOffset)
|
||||
local v = self:WorldToLocal(target + Vector(0,0,math.Clamp((pos*Normal):Distance(target*Normal)/5 - 10,0,self.DiveHeight or 0))):GetNormal()
|
||||
if isnumber(self.Agility) then
|
||||
v.y = math.Clamp(v.y*10,-1,1)*self.Agility
|
||||
v.z = math.Clamp(v.z*10,-1,1)*self.Agility
|
||||
else
|
||||
v.y = math.Clamp(v.y*10,-1,1)*10
|
||||
v.z = math.Clamp(v.z*10,-1,1)*10
|
||||
end
|
||||
if self.Fired then
|
||||
if self.SpiralRadius > 0 then
|
||||
self.SpiralRadius = self.SpiralRadius - FrameTime()*(self.StabilisationTime or 50)
|
||||
end
|
||||
if self.SpiralRadius < 0 then
|
||||
self.SpiralRadius = self.SpiralRadius + FrameTime()*(self.StabilisationTime or 50)
|
||||
end
|
||||
if self.SpiralRate > 0 then
|
||||
self.SpiralRate = self.SpiralRate - FrameTime()
|
||||
end
|
||||
if self.SpiralRate < 0 then
|
||||
self.SpiralRate = self.SpiralRate + FrameTime()
|
||||
end
|
||||
end
|
||||
if self.SpiralRadnom then
|
||||
ph:AddAngleVelocity(
|
||||
ph:GetAngleVelocity()*self.SpiralRate
|
||||
+ Vector(math.Rand(-self.SpiralRadius,self.SpiralRadius), math.Rand(-self.SpiralRadius,self.SpiralRadius), math.Rand(-self.SpiralRadius,self.SpiralRadius))
|
||||
+ Vector(0,-vel.z,vel.y)
|
||||
+ Vector(0,-v.z,v.y)
|
||||
)
|
||||
else
|
||||
ph:AddAngleVelocity(
|
||||
ph:GetAngleVelocity()*self.SpiralRate
|
||||
+ Vector(self.SpiralRadius, self.SpiralRadius, self.SpiralRadius)
|
||||
+ Vector(0,-vel.z,vel.y)
|
||||
+ Vector(0,-v.z,v.y)
|
||||
)
|
||||
end
|
||||
ph:AddVelocity(self:GetForward() - self:LocalToWorld(vel*Normal2) + pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Taking damage
|
||||
function ENT:OnTakeDamage(dmginfo)
|
||||
if self.Exploded then return end
|
||||
local inflictor = dmginfo:GetInflictor()
|
||||
local attacker = dmginfo:GetAttacker()
|
||||
if IsValid(inflictor) and (inflictor.IsGredBomb or inflictor.lvsProjectile or inflictor.SWBombV3 ) then return end
|
||||
self:TakePhysicsDamage(dmginfo)
|
||||
self.CurDurability = self.CurDurability - dmginfo:GetDamage()
|
||||
if self.Armed then
|
||||
if self.CurDurability <= 0 then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
else
|
||||
if !self.Armed and !self.Fired then
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
self:Launch()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Explosion
|
||||
function ENT:Explode(pos)
|
||||
if !self.Exploded then return end
|
||||
if !self.Armed then return end
|
||||
pos = self:LocalToWorld(self:OBBCenter())
|
||||
if(self:WaterLevel() >= 1) then
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos + Vector(0,0,9000),
|
||||
filter = self,
|
||||
})
|
||||
local tr2 = util.TraceLine({
|
||||
start = tr.HitPos,
|
||||
endpos = tr.HitPos - Vector(0,0,9000),
|
||||
filter = self,
|
||||
mask = MASK_WATER + CONTENTS_TRANSLUCENT,
|
||||
})
|
||||
if tr2.Hit then
|
||||
ParticleEffect(self.EffectWater, tr2.HitPos,(self.AngEffect and angle_dif or angle_reg), nil)
|
||||
end
|
||||
else
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos - Vector(0, 0, self.TraceLength),
|
||||
filter = self,
|
||||
})
|
||||
if tr.HitWorld then
|
||||
ParticleEffect(self.Effect,pos,(self.AngEffect and angle_dif or angle_reg),nil)
|
||||
else
|
||||
ParticleEffect(self.EffectAir,pos,(self.AngEffect and angle_dif or angle_reg),nil)
|
||||
end
|
||||
end
|
||||
|
||||
if self.HEAT then
|
||||
local heat = {}
|
||||
heat.Src = self:GetPos()
|
||||
heat.Dir = self:GetAngles():Forward()
|
||||
heat.Spread = Vector(0,0,0)
|
||||
heat.Force = self.ArmorPenetration+math.Rand(-self.ArmorPenetration/10,self.ArmorPenetration/10)
|
||||
heat.HullSize = self.HEATRadius or 0
|
||||
heat.Damage = self.PenetrationDamage+math.Rand(-self.PenetrationDamage/5,self.PenetrationDamage/5)
|
||||
heat.Velocity = 10000
|
||||
heat.Attacker = self.Owner
|
||||
LVS:FireBullet( heat )
|
||||
|
||||
--Blast wave
|
||||
if self.ExplosionRadius > 0 then
|
||||
util.BlastDamage( self, ((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld()), pos, self.ExplosionRadius,self.ExplosionDamage )
|
||||
self:BlastDoors(self, pos, 10)
|
||||
end
|
||||
|
||||
--Frags
|
||||
if self.FragCount > 0 then
|
||||
self:Fragmentation(self,pos,10000,self.FragDamage,self.FragRadius,((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld()))
|
||||
end
|
||||
|
||||
debugoverlay.Text(pos+Vector(0,0,10),"Penetration: "..heat.Force,5)
|
||||
debugoverlay.Text(pos-Vector(0,0,10),"Damage: "..heat.Damage,5)
|
||||
debugoverlay.Sphere(pos,self.ExplosionRadius,5,Color(200,150,0,100),false)
|
||||
debugoverlay.Sphere(pos,self.FragRadius,5,Color(200,200,0,100),false)
|
||||
else
|
||||
debugoverlay.Sphere(pos,self.ExplosionRadius,5,Color(255,0,0,100),false)
|
||||
debugoverlay.Sphere(pos,self.BlastRadius,5,Color(200,150,0,100),false)
|
||||
debugoverlay.Sphere(pos,self.FragRadius,5,Color(200,200,0,100),false)
|
||||
|
||||
--Deadly zone
|
||||
if self.ExplosionRadius > 0 then
|
||||
for k, v in pairs(ents.FindInSphere(pos,self.ExplosionRadius)) do
|
||||
if v:IsValid() and not v.SWBombV3 then
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetDamage(self.ExplosionDamage)
|
||||
dmg:SetDamageType(self.DamageType)
|
||||
dmg:SetAttacker((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld())
|
||||
v:TakeDamageInfo(dmg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Blast wave
|
||||
if self.BlastRadius > 0 then
|
||||
util.BlastDamage( self, ((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld()), pos, self.BlastRadius,self.ExplosionDamage/2 )
|
||||
self:BlastDoors(self, pos, 10)
|
||||
end
|
||||
|
||||
--Frags
|
||||
if self.FragCount > 0 then
|
||||
self:Fragmentation(self,pos,10000,self.FragDamage,self.FragRadius,((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld()))
|
||||
end
|
||||
end
|
||||
|
||||
swv3.CreateSound(pos,false,self.ExplosionSound,self.FarExplosionSound,self.DistExplosionSound)
|
||||
timer.Simple(0,function()
|
||||
if !IsValid(self) then return end
|
||||
self:Remove()
|
||||
end)
|
||||
end
|
||||
|
||||
--Impact
|
||||
function ENT:PhysicsCollide( data, physobj )
|
||||
if self:GetVelocity():Length() >= self.ImpactSpeed then
|
||||
if self.Armed then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
else
|
||||
if !self.Armed and !self.Fired then
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
self:Launch()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Door blasting
|
||||
function ENT:IsDoor(ent)
|
||||
local Class = ent:GetClass()
|
||||
|
||||
return (Class == "prop_door") or (Class == "prop_door_rotating") or (Class == "func_door") or (Class == "func_door_rotating")
|
||||
end
|
||||
function ENT:BlastDoors(blaster, pos, power, range, ignoreVisChecks)
|
||||
for k, door in pairs(ents.FindInSphere(pos, 40 * power * (range or 1))) do
|
||||
if self:IsDoor(door) then
|
||||
local proceed = ignoreVisChecks
|
||||
|
||||
if not proceed then
|
||||
local tr = util.QuickTrace(pos, door:LocalToWorld(door:OBBCenter()) - pos, blaster)
|
||||
proceed = IsValid(tr.Entity) and (tr.Entity == door)
|
||||
end
|
||||
|
||||
if proceed then
|
||||
self:BlastDoor(door, (door:LocalToWorld(door:OBBCenter()) - pos):GetNormalized() * 1000)
|
||||
end
|
||||
end
|
||||
if door:GetClass() == "func_breakable_surf" then
|
||||
door:Fire("Break")
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:BlastDoor(ent, vel)
|
||||
local Moddel, Pozishun, Ayngul, Muteeriul, Skin = ent:GetModel(), ent:GetPos(), ent:GetAngles(), ent:GetMaterial(), ent:GetSkin()
|
||||
sound.Play("Wood_Crate.Break", Pozishun, 60, 100)
|
||||
sound.Play("Wood_Furniture.Break", Pozishun, 60, 100)
|
||||
ent:Fire("unlock", "", 0)
|
||||
ent:Fire("open", "", 0)
|
||||
ent:SetNoDraw(true)
|
||||
ent:SetNotSolid(true)
|
||||
|
||||
if Moddel and Pozishun and Ayngul then
|
||||
local Replacement = ents.Create("prop_physics")
|
||||
Replacement:SetModel(Moddel)
|
||||
Replacement:SetPos(Pozishun + Vector(0, 0, 1))
|
||||
Replacement:SetAngles(Ayngul)
|
||||
|
||||
if Muteeriul then
|
||||
Replacement:SetMaterial(Muteeriul)
|
||||
end
|
||||
|
||||
if Skin then
|
||||
Replacement:SetSkin(Skin)
|
||||
end
|
||||
|
||||
Replacement:SetModelScale(.9, 0)
|
||||
Replacement:Spawn()
|
||||
Replacement:Activate()
|
||||
|
||||
if vel then
|
||||
Replacement:GetPhysicsObject():SetVelocity(vel)
|
||||
|
||||
timer.Simple(0, function()
|
||||
if IsValid(Replacement) then
|
||||
Replacement:GetPhysicsObject():ApplyForceCenter(vel * 100)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
timer.Simple(3, function()
|
||||
if IsValid(Replacement) then
|
||||
Replacement:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
end
|
||||
end)
|
||||
|
||||
timer.Simple(30, function()
|
||||
if IsValid(ent) then
|
||||
ent:SetNotSolid(false)
|
||||
ent:SetNoDraw(false)
|
||||
end
|
||||
|
||||
if IsValid(Replacement) then
|
||||
Replacement:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
--Frags
|
||||
function ENT:Fragmentation(shooter, origin, fragNum, fragDmg, fragMaxDist, attacker, direction, spread, zReduction)
|
||||
shooter = shooter or game.GetWorld()
|
||||
zReduction = zReduction or 2
|
||||
|
||||
local Spred = Vector(0, 0, 0)
|
||||
local BulletsFired, MaxBullets, disperseTime = 0, self.FragCount, .5
|
||||
|
||||
if fragNum >= 12000 then
|
||||
disperseTime = 2
|
||||
elseif fragNum >= 6000 then
|
||||
disperseTime = 1
|
||||
end
|
||||
|
||||
for i = 1, fragNum do
|
||||
timer.Simple((i / fragNum) * disperseTime, function()
|
||||
local Dir
|
||||
|
||||
if direction and spread then
|
||||
Dir = Vector(direction.x, direction.y, direction.z)
|
||||
Dir = Dir + VectorRand() * math.Rand(0, spread)
|
||||
Dir:Normalize()
|
||||
else
|
||||
Dir = VectorRand()
|
||||
end
|
||||
|
||||
if zReduction then
|
||||
Dir.z = Dir.z / zReduction
|
||||
Dir:Normalize()
|
||||
end
|
||||
|
||||
local Tr = util.QuickTrace(origin, Dir * fragMaxDist, shooter)
|
||||
|
||||
if Tr.Hit and not Tr.HitSky and not Tr.HitWorld and (BulletsFired < MaxBullets) then
|
||||
local LowFrag = (Tr.Entity.IsVehicle and Tr.Entity:IsVehicle()) or Tr.Entity.LFS or Tr.Entity.LVS or Tr.Entity.EZlowFragPlease
|
||||
|
||||
if (not LowFrag) or (LowFrag and math.random(1, 4) == 2) then
|
||||
|
||||
local firer = (IsValid(shooter) and shooter) or game.GetWorld()
|
||||
|
||||
firer:FireBullets({
|
||||
Attacker = attacker,
|
||||
Damage = fragDmg,
|
||||
Force = fragDmg / 8,
|
||||
Num = 1,
|
||||
Src = origin,
|
||||
Tracer = 0,
|
||||
Dir = Dir,
|
||||
Spread = Spred,
|
||||
AmmoType = "Buckshot"
|
||||
})
|
||||
BulletsFired = BulletsFired + 1
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Initialize()
|
||||
self.snd = CreateSound(self, self.WhistleSound)
|
||||
self.snd:SetSoundLevel( 110 )
|
||||
self.snd:PlayEx(0,150)
|
||||
|
||||
self.EngSND = CreateSound( self, self.EngineSound )
|
||||
end
|
||||
function ENT:CalcDoppler()
|
||||
local Ent = LocalPlayer()
|
||||
local ViewEnt = Ent:GetViewEntity()
|
||||
|
||||
local sVel = self:GetVelocity()
|
||||
local oVel = Ent:GetVelocity()
|
||||
local SubVel = oVel - sVel
|
||||
local SubPos = self:GetPos() - Ent:GetPos()
|
||||
|
||||
local DirPos = SubPos:GetNormalized()
|
||||
local DirVel = SubVel:GetNormalized()
|
||||
local A = math.acos( math.Clamp( DirVel:Dot( DirPos ) ,-1,1) )
|
||||
return (1 + math.cos( A ) * SubVel:Length() / 13503.9)
|
||||
end
|
||||
function ENT:Think()
|
||||
if self.snd then
|
||||
self.snd:ChangePitch( 100 * self:CalcDoppler(), 1 )
|
||||
self.snd:ChangeVolume(math.Clamp(-(self:GetVelocity().z + 1000) / 3000,0,1), 2)
|
||||
end
|
||||
if self.Fired then
|
||||
self.EngSND:Play()
|
||||
end
|
||||
if self:GetNWBool("Fired",false) and not self:GetNWBool("IsPlayerHolding",true) then
|
||||
if self:GetTracerScale() then
|
||||
if self.Tracer1Att and not self.TracerEffect then
|
||||
self.Tracer = Material("sprites/animglow02")
|
||||
self.Tracer:SetVector("$color", Vector(255,0,0))
|
||||
if IsValid(self.Emitter) then
|
||||
local particle
|
||||
for i = 0,1 do
|
||||
local ID = self:LookupAttachment( self.Tracer1Att )
|
||||
local Attachment = self:GetAttachment( ID )
|
||||
particle = self.Emitter:Add(self.Tracer,Attachment.Pos)
|
||||
if particle then
|
||||
particle:SetVelocity(self:GetVelocity())
|
||||
particle:SetDieTime(0.015)
|
||||
particle:SetAirResistance(0)
|
||||
particle:SetStartAlpha(255)
|
||||
particle:SetStartSize(self:GetTracerScale()*2)
|
||||
particle:SetEndSize(self:GetTracerScale()*2)
|
||||
particle:SetRoll(math.Rand(-1,1))
|
||||
particle:SetGravity(Vector(0,0,0))
|
||||
particle:SetCollide(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.Emitter = ParticleEmitter(self:GetPos(),false)
|
||||
end
|
||||
end
|
||||
if self.Tracer2Att and not self.TracerEffect then
|
||||
self.Tracer = Material("sprites/animglow02")
|
||||
self.Tracer:SetVector("$color", Vector(255,0,0))
|
||||
if IsValid(self.Emitter) then
|
||||
local particle
|
||||
for i = 0,1 do
|
||||
local ID = self:LookupAttachment( self.Tracer2Att )
|
||||
local Attachment = self:GetAttachment( ID )
|
||||
particle = self.Emitter:Add(self.Tracer,Attachment.Pos)
|
||||
if particle then
|
||||
particle:SetVelocity(self:GetVelocity())
|
||||
particle:SetDieTime(0.015)
|
||||
particle:SetAirResistance(0)
|
||||
particle:SetStartAlpha(255)
|
||||
particle:SetStartSize(self:GetTracerScale()*2)
|
||||
particle:SetEndSize(self:GetTracerScale()*2)
|
||||
particle:SetRoll(math.Rand(-1,1))
|
||||
particle:SetGravity(Vector(0,0,0))
|
||||
particle:SetCollide(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.Emitter = ParticleEmitter(self:GetPos(),false)
|
||||
end
|
||||
end
|
||||
if not self.Tracer1Att and not self.Tracer2Att then
|
||||
self.Tracer = Material("sprites/animglow02")
|
||||
self.Tracer:SetVector("$color", Vector(255,0,0))
|
||||
if IsValid(self.Emitter) then
|
||||
local particle
|
||||
for i = 0,1 do
|
||||
particle = self.Emitter:Add(self.Tracer,self:GetPos())
|
||||
if particle then
|
||||
particle:SetVelocity(self:GetVelocity())
|
||||
particle:SetDieTime(0.015)
|
||||
particle:SetAirResistance(0)
|
||||
particle:SetStartAlpha(255)
|
||||
particle:SetStartSize(self:GetTracerScale()*2)
|
||||
particle:SetEndSize(self:GetTracerScale()*2)
|
||||
particle:SetRoll(math.Rand(-1,1))
|
||||
particle:SetGravity(Vector(0,0,0))
|
||||
particle:SetCollide(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.Emitter = ParticleEmitter(self:GetPos(),false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
function ENT:SoundStop()
|
||||
if self.snd then
|
||||
self.snd:Stop()
|
||||
end
|
||||
end
|
||||
function ENT:OnRemove()
|
||||
self:SoundStop()
|
||||
end
|
||||
end
|
||||
108
garrysmod/addons/swbombs/lua/entities/sw_base_shell_v3.lua
Normal file
108
garrysmod/addons/swbombs/lua/entities/sw_base_shell_v3.lua
Normal file
@@ -0,0 +1,108 @@
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
|
||||
ENT.PrintName = "Shell basescript V3"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Category = "SW Bombs V3"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminOnly = false
|
||||
|
||||
if SERVER then
|
||||
function ENT:SetDamage( num ) self._dmg = num end
|
||||
function ENT:SetRadius( num ) self._radius = num end
|
||||
function ENT:SetAttacker( ent ) self._attacker = ent end
|
||||
|
||||
function ENT:GetAttacker() return self._attacker or NULL end
|
||||
function ENT:GetDamage() return (self._dmg or 250) end
|
||||
function ENT:GetRadius() return (self._radius or 250) end
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal * 5 )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/Items/grenadeAmmo.mdl" )
|
||||
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
self:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
|
||||
|
||||
self.TrailEntity = util.SpriteTrail( self, 0, Color(120,120,120,120), false, 5, 40, 0.2, 1 / ( 15 + 1 ) * 0.5, "trails/smoke" )
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
self:NextThink( CurTime() )
|
||||
|
||||
if self.Active then
|
||||
self:Detonate()
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Detonate()
|
||||
if self.IsExploded then return end
|
||||
|
||||
self.IsExploded = true
|
||||
|
||||
local Pos = self:GetPos()
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( Pos )
|
||||
|
||||
if self:WaterLevel() >= 2 then
|
||||
util.Effect( "WaterSurfaceExplosion", effectdata, true, true )
|
||||
else
|
||||
util.Effect( "lvs_defence_explosion", effectdata )
|
||||
end
|
||||
|
||||
local dmginfo = DamageInfo()
|
||||
dmginfo:SetDamage( self:GetDamage() )
|
||||
dmginfo:SetAttacker( IsValid( self:GetAttacker() ) and self:GetAttacker() or self )
|
||||
dmginfo:SetDamageType( DMG_BULLET )
|
||||
dmginfo:SetInflictor( self )
|
||||
dmginfo:SetDamagePosition( Pos )
|
||||
|
||||
util.BlastDamageInfo( dmginfo, Pos, self:GetRadius() )
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide( data, physobj )
|
||||
self.Active = true
|
||||
|
||||
if data.Speed > 60 and data.DeltaTime > 0.2 then
|
||||
local VelDif = data.OurOldVelocity:Length() - data.OurNewVelocity:Length()
|
||||
|
||||
if VelDif > 200 then
|
||||
self:EmitSound( "Grenade.ImpactHard" )
|
||||
else
|
||||
self:EmitSound( "Grenade.ImpactSoft" )
|
||||
end
|
||||
|
||||
physobj:SetVelocity( data.OurOldVelocity * 0.5 )
|
||||
end
|
||||
end
|
||||
else
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
end
|
||||
end
|
||||
397
garrysmod/addons/swbombs/lua/entities/sw_base_torpedo_v3.lua
Normal file
397
garrysmod/addons/swbombs/lua/entities/sw_base_torpedo_v3.lua
Normal file
@@ -0,0 +1,397 @@
|
||||
AddCSLuaFile()
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
sound.Add( {
|
||||
name = "SW_TORP_ENG_LOOP",
|
||||
channel = CHAN_AUTO,
|
||||
volume = 1.0,
|
||||
level = 70,
|
||||
sound = "sw/torpedoes/torpedo_run.wav"
|
||||
} )
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "Torpedo basescript V3"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3"
|
||||
ENT.SWBombV3 = true
|
||||
ENT.IsRocket = true
|
||||
|
||||
--Effects
|
||||
ENT.Effect = "gw_250lb_explosion"
|
||||
ENT.EffectAir = "gw_250lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
--Sounds
|
||||
ENT.ArmSound = "sw/bomb/arm.wav"
|
||||
ENT.StartSound = "sw/torpedoes/torpedo_launch_1.wav"
|
||||
ENT.EngineSound = "SW_TORP_ENG_LOOP"
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/torpedoes/45_36.mdl"
|
||||
|
||||
--Physics
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.Mass = 100
|
||||
ENT.MaxVelocity = 1000
|
||||
ENT.WaterThrustForce = 1500
|
||||
ENT.RotationalForce = 0
|
||||
ENT.Buoyancy = 0.15
|
||||
ENT.FuelBurnoutTime = 20
|
||||
ENT.Agility = 100
|
||||
|
||||
|
||||
--Explosion
|
||||
ENT.DamageType = DMG_BURN
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 585.9375
|
||||
ENT.BlastRadius = 878.90625
|
||||
|
||||
if SERVER then
|
||||
local angle_reg = Angle(0,0,0)
|
||||
local angle_dif = Angle(-90,0,0)
|
||||
local Normal = Vector(1,1,0)
|
||||
local Normal2 = Vector(0.1,1,1)
|
||||
local trlength = Vector(0,0,9000)
|
||||
local angle_zero = Angle()
|
||||
local angle_1 = Angle(-90,0,0)
|
||||
|
||||
--Spawn
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
return ent
|
||||
end
|
||||
function ENT:Initialize()
|
||||
self:SetModel(self.Model)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:PhysWake()
|
||||
local pObj = self:GetPhysicsObject()
|
||||
pObj:SetMass( self.Mass )
|
||||
pObj:EnableGravity( true )
|
||||
pObj:EnableMotion( true )
|
||||
pObj:EnableDrag( false )
|
||||
self.Armed = false
|
||||
self.Fired = false
|
||||
self.Exploded = false
|
||||
self.MaxVelocityUnitsSquared = self.MaxVelocity and self:ConvertMetersToUnits(self.MaxVelocity^2) or nil
|
||||
pObj:SetBuoyancyRatio(self.Buoyancy)
|
||||
end
|
||||
|
||||
--Arming
|
||||
function ENT:Use( activator, caller )
|
||||
if !self.Exploded and !self.Armed then
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
self:Launch()
|
||||
end
|
||||
end
|
||||
function ENT:Launch()
|
||||
if self.Exploded then return end
|
||||
|
||||
self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if !IsValid(phys) then return end
|
||||
|
||||
self.ImpactSpeed = 10
|
||||
|
||||
self.Fired = true
|
||||
self:SetNWBool("Fired",true)
|
||||
|
||||
constraint.RemoveAll(self)
|
||||
|
||||
phys:Wake()
|
||||
phys:EnableMotion(true)
|
||||
|
||||
self:InitLaunch(phys)
|
||||
end
|
||||
function ENT:InitLaunch(phys)
|
||||
self:EmitSound(self.StartSound)
|
||||
phys:AddAngleVelocity(Vector(self.RotationalForce or 0,0,0))
|
||||
if self.TorpedoTrail then
|
||||
timer.Simple(0,function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
if self.Engine1Att then
|
||||
local ID = self:LookupAttachment( self.Engine1Att )
|
||||
ParticleEffectAttach(self.TorpedoTrail,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
if self.Engine2Att then
|
||||
local ID = self:LookupAttachment( self.Engine2Att )
|
||||
ParticleEffectAttach(self.TorpedoTrail,PATTACH_POINT_FOLLOW,self,ID)
|
||||
end
|
||||
if not self.Engine1Att and not self.Engine2Att then
|
||||
ParticleEffectAttach(self.TorpedoTrail,PATTACH_ABSORIGIN_FOLLOW,self,1)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if self.FuelBurnoutTime and self.FuelBurnoutTime != 0 then
|
||||
timer.Simple(self.FuelBurnoutTime,function()
|
||||
if !IsValid(self) then return end
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
--Move
|
||||
function ENT:ConvertMetersToUnits(Meters)
|
||||
return Meters / 0.01905
|
||||
end
|
||||
function ENT:ConvertUnitsToMeters(Units)
|
||||
return Units * 0.01905
|
||||
end
|
||||
function ENT:Think()
|
||||
if self.Fired then
|
||||
if self:WaterLevel() >= 1 then
|
||||
local VelForward = self:GetForward()
|
||||
local VelForward_Norm = Vector(VelForward:GetNormalized().x,VelForward:GetNormalized().y,0)
|
||||
if self.MaxVelocityUnitsSquared and self:GetPhysicsObject():GetVelocity():LengthSqr() < self.MaxVelocityUnitsSquared then
|
||||
self:GetPhysicsObject():AddVelocity(VelForward_Norm*(self.WaterThrustForce))
|
||||
end
|
||||
|
||||
if self.GuidanceActive then
|
||||
if self.target != NULL then
|
||||
local ph = self:GetPhysicsObject()
|
||||
if IsValid(self.target) or self.target:GetClass() == "worldspawn" then
|
||||
if not self.Armed or self.InEntity then return end
|
||||
local pos = self:GetPos()
|
||||
local vel = self:WorldToLocal(pos+ph:GetVelocity())*0.4
|
||||
vel.x = 0
|
||||
local target = self.target:LocalToWorld(self.targetOffset)
|
||||
local v = self:WorldToLocal(target + Vector(0,0,math.Clamp((pos*Normal):Distance(target*Normal)/5 - 0,0,0 or 0))):GetNormal()
|
||||
v.y = math.Clamp(v.y*10,-1,1)*(self.Agility or 10)
|
||||
v.z = math.Clamp(v.z*10,-1,1)*(self.Agility or 10)
|
||||
ph:AddAngleVelocity(
|
||||
ph:GetAngleVelocity()*-0.1
|
||||
+ Vector(0,0,0)
|
||||
+ Vector(0,-vel.z,vel.y)
|
||||
+ Vector(0,-v.z,v.y)
|
||||
)
|
||||
ph:AddVelocity(VelForward_Norm - self:LocalToWorld(vel*Normal2) + pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if self.Armed then
|
||||
if self:WaterLevel() >= 1 then
|
||||
self:Launch()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Explosion
|
||||
function ENT:Explode(pos)
|
||||
if !self.Exploded then return end
|
||||
if !self.Armed then return end
|
||||
pos = self:LocalToWorld(self:OBBCenter())
|
||||
if(self:WaterLevel() >= 1) then
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos + Vector(0,0,90000),
|
||||
filter = self,
|
||||
})
|
||||
local tr2 = util.TraceLine({
|
||||
start = tr.HitPos,
|
||||
endpos = tr.HitPos - Vector(0,0,90000),
|
||||
filter = self,
|
||||
mask = MASK_WATER + CONTENTS_TRANSLUCENT,
|
||||
})
|
||||
if tr2.Hit then
|
||||
ParticleEffect(self.EffectWater, tr2.HitPos,(self.AngEffect and angle_dif or angle_reg), nil)
|
||||
end
|
||||
else
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos - Vector(0, 0, self.TraceLength),
|
||||
filter = self,
|
||||
})
|
||||
if tr.HitWorld then
|
||||
ParticleEffect(self.Effect,pos,(self.AngEffect and angle_dif or angle_reg),nil)
|
||||
else
|
||||
ParticleEffect(self.EffectAir,pos,(self.AngEffect and angle_dif or angle_reg),nil)
|
||||
end
|
||||
end
|
||||
debugoverlay.Sphere(pos,self.ExplosionRadius,5,Color(255,0,0,100),false)
|
||||
debugoverlay.Sphere(pos,self.BlastRadius,5,Color(200,150,0,100),false)
|
||||
|
||||
--Deadly zone
|
||||
if self.ExplosionRadius > 0 then
|
||||
for k, v in pairs(ents.FindInSphere(pos,self.ExplosionRadius)) do
|
||||
if v:IsValid() and not v.SWBombV3 then
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetDamage(self.ExplosionDamage)
|
||||
dmg:SetDamageType(self.DamageType)
|
||||
dmg:SetAttacker((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld())
|
||||
v:TakeDamageInfo(dmg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Blast wave
|
||||
if self.BlastRadius > 0 then
|
||||
util.BlastDamage( self, ((IsValid(self:GetCreator()) and self:GetCreator()) or self.Attacker or game.GetWorld()), pos, self.BlastRadius,self.ExplosionDamage/2 )
|
||||
end
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
swv3.CreateSound(pos,false,self.WaterExplosionSound,self.WaterFarExplosionSound,self.DistExplosionSound)
|
||||
else
|
||||
swv3.CreateSound(pos,false,self.ExplosionSound,self.FarExplosionSound,self.DistExplosionSound)
|
||||
end
|
||||
timer.Simple(0,function()
|
||||
if !IsValid(self) then return end
|
||||
self:Remove()
|
||||
end)
|
||||
end
|
||||
|
||||
--Impact
|
||||
function ENT:PhysicsCollide( data, physobj )
|
||||
if self:GetVelocity():Length() >= self.ImpactSpeed then
|
||||
if self:GetNWBool("Fired") == true then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
else
|
||||
if !self.Armed and !self.Fired then
|
||||
self:EmitSound(self.ArmSound)
|
||||
self.Armed = true
|
||||
self:Launch()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Initialize()
|
||||
self.EngSND = CreateSound( self, self.EngineSound )
|
||||
end
|
||||
function ENT:Think()
|
||||
if self:GetNWBool("Fired",false) then
|
||||
if self:WaterLevel() >= 1 then
|
||||
local traceWater = util.TraceLine( {
|
||||
start = self:LocalToWorld(Vector(-25,0,20)),
|
||||
endpos = self:LocalToWorld(Vector(-25,0,20)) - Vector(0,0,40),
|
||||
filter = self,
|
||||
mask = MASK_WATER,
|
||||
} )
|
||||
|
||||
if traceWater.Hit then
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( traceWater.HitPos )
|
||||
effectdata:SetEntity( self )
|
||||
util.Effect( "sw_torpedo_v3", effectdata )
|
||||
end
|
||||
|
||||
self.EngSND:Play()
|
||||
else
|
||||
if self.EngSND then
|
||||
self.EngSND:Stop()
|
||||
end
|
||||
end
|
||||
else
|
||||
if self.EngSND then
|
||||
self.EngSND:Stop()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:GetParticleEmitter( Pos )
|
||||
local EntTable = self:GetTable()
|
||||
|
||||
local T = CurTime()
|
||||
|
||||
if IsValid( EntTable.Emitter ) and (EntTable.EmitterTime or 0) > T then
|
||||
return EntTable.Emitter
|
||||
end
|
||||
|
||||
self:StopEmitter()
|
||||
|
||||
EntTable.Emitter = ParticleEmitter( Pos, false )
|
||||
EntTable.EmitterTime = T + 2
|
||||
|
||||
return EntTable.Emitter
|
||||
end
|
||||
function ENT:StopEmitter()
|
||||
if IsValid( self.Emitter ) then
|
||||
self.Emitter:Finish()
|
||||
end
|
||||
end
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
function ENT:SoundStop()
|
||||
if self.EngSND then
|
||||
self.EngSND:Stop()
|
||||
end
|
||||
end
|
||||
function ENT:OnRemove()
|
||||
self:SoundStop()
|
||||
end
|
||||
end
|
||||
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab100_v3.lua
Normal file
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab100_v3.lua
Normal file
@@ -0,0 +1,118 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_sml_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_sml_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_sml_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_sml_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_sml_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_sml_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_sml_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_sml_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "ФАБ-100"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/bombs/fab100.mdl"
|
||||
ENT.Effect = "ins_c4_explosion"
|
||||
ENT.EffectAir = "ins_c4_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_100kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 50
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 25
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 468.75
|
||||
ENT.BlastRadius = 703.125
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 937.5
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab250m62_v3.lua
Normal file
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab250m62_v3.lua
Normal file
@@ -0,0 +1,118 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_med_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_med_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_med_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_med_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_med_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_med_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_med_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_med_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_med_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_med_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_med_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_med_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_med_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_med_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_med_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_med_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_med_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_med_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_med_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_med_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_med_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_med_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_med_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_med_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "ФАБ-250М62"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/bombs/fab250m62.mdl"
|
||||
ENT.Effect = "gw_250lb_explosion"
|
||||
ENT.EffectAir = "gw_250lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_250kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 60
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 40
|
||||
ENT.Mass = 250
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 585.9375
|
||||
ENT.BlastRadius = 878.90625
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1171.875
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab500m62_v3.lua
Normal file
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab500m62_v3.lua
Normal file
@@ -0,0 +1,118 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_hvy_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_hvy_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_hvy_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_hvy_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_hvy_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_hvy_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_hvy_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_hvy_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_hvy_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_hvy_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_hvy_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_hvy_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_hvy_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_hvy_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_hvy_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_hvy_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_hvy_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_hvy_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_hvy_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_hvy_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_hvy_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_hvy_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_hvy_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_hvy_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "ФАБ-500М62"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/bombs/fab500m62.mdl"
|
||||
ENT.Effect = "gw_500lb_explosion"
|
||||
ENT.EffectAir = "gw_500lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_500kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 65
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 40
|
||||
ENT.Mass = 500
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 732.421875
|
||||
ENT.BlastRadius = 1098.6328125
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1464.84375
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
113
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab50_v3.lua
Normal file
113
garrysmod/addons/swbombs/lua/entities/sw_bomb_fab50_v3.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "ФАБ-50"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/bombs/fab50.mdl"
|
||||
ENT.Effect = "ins_rpg_explosion"
|
||||
ENT.EffectAir = "ins_rpg_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_50kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 30
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 25
|
||||
ENT.Mass = 50
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 5000
|
||||
ENT.ExplosionRadius = 150
|
||||
ENT.BlastRadius = 562.5
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 750
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
143
garrysmod/addons/swbombs/lua/entities/sw_bomb_gbu12_v3.lua
Normal file
143
garrysmod/addons/swbombs/lua/entities/sw_bomb_gbu12_v3.lua
Normal file
@@ -0,0 +1,143 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_med_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_med_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_med_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_med_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_med_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_med_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_med_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_med_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_med_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_med_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_med_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_med_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_med_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_med_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_med_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_med_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_med_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_med_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_med_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_med_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_med_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_med_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_med_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_med_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "GBU-12"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | USA"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/usa/bombs/guided/gbu12.mdl"
|
||||
ENT.Effect = "gw_250lb_explosion"
|
||||
ENT.EffectAir = "gw_250lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_250kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 60
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 25
|
||||
ENT.Mass = 250
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 585.9375
|
||||
ENT.BlastRadius = 878.90625
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1171.875
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.LaserGuided = true
|
||||
ENT.LaserCode = "view"
|
||||
ENT.Agility = 50
|
||||
|
||||
function ENT:OnTick()
|
||||
if self.Armed then
|
||||
local Phys=self:GetPhysicsObject()
|
||||
local Vel=Phys:GetVelocity()
|
||||
local Spd=Vel:Length()
|
||||
if Spd > 150 and not self:IsPlayerHolding() and not constraint.HasConstraints(self) then
|
||||
self.FreefallTicks=self.FreefallTicks+1
|
||||
if self.FreefallTicks >= 15 and not self.WingsOpen then
|
||||
self.WingsOpen = true
|
||||
self.ImpactSpeed = 50
|
||||
self.TraceLength = 150
|
||||
self:SetBodygroup(1,1)
|
||||
end
|
||||
else
|
||||
self.FreefallTicks=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
141
garrysmod/addons/swbombs/lua/entities/sw_bomb_gbu39_v3.lua
Normal file
141
garrysmod/addons/swbombs/lua/entities/sw_bomb_gbu39_v3.lua
Normal file
@@ -0,0 +1,141 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_med_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_med_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_med_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_med_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_med_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_med_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_med_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_med_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_med_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_med_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_med_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_med_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_med_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_med_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_med_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_med_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_med_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_med_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_med_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_med_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_med_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_med_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_med_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_med_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "GBU-39"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | USA"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/usa/bombs/guided/gbu39.mdl"
|
||||
ENT.Effect = "gw_250lb_explosion"
|
||||
ENT.EffectAir = "gw_250lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_250kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 60
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 25
|
||||
ENT.Mass = 250
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 585.9375
|
||||
ENT.BlastRadius = 878.90625
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1171.875
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 50
|
||||
|
||||
function ENT:OnTick()
|
||||
if self.Armed then
|
||||
local Phys=self:GetPhysicsObject()
|
||||
local Vel=Phys:GetVelocity()
|
||||
local Spd=Vel:Length()
|
||||
if Spd > 150 and not self:IsPlayerHolding() and not constraint.HasConstraints(self) then
|
||||
self.FreefallTicks=self.FreefallTicks+1
|
||||
if self.FreefallTicks >= 15 and not self.WingsOpen then
|
||||
self.WingsOpen = true
|
||||
self.ImpactSpeed = 50
|
||||
self.TraceLength = 150
|
||||
self:SetBodygroup(1,1)
|
||||
end
|
||||
else
|
||||
self.FreefallTicks=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
122
garrysmod/addons/swbombs/lua/entities/sw_bomb_kab500kr_v3.lua
Normal file
122
garrysmod/addons/swbombs/lua/entities/sw_bomb_kab500kr_v3.lua
Normal file
@@ -0,0 +1,122 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_hvy_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_hvy_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_hvy_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_hvy_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_hvy_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_hvy_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_hvy_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_hvy_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_hvy_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_hvy_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_hvy_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_hvy_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_hvy_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_hvy_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_hvy_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_hvy_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_hvy_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_hvy_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_hvy_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_hvy_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_hvy_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_hvy_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_hvy_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_hvy_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "КАБ-500КР"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/bombs/guided/kab500kr.mdl"
|
||||
ENT.Effect = "gw_500lb_explosion"
|
||||
ENT.EffectAir = "gw_500lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_500kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 65
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 40
|
||||
ENT.Mass = 500
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 732.421875
|
||||
ENT.BlastRadius = 1098.6328125
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1464.84375
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 50
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_mk82_v3.lua
Normal file
118
garrysmod/addons/swbombs/lua/entities/sw_bomb_mk82_v3.lua
Normal file
@@ -0,0 +1,118 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_med_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_med_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_med_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_med_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_med_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_med_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_med_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_med_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_med_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_med_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_med_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_med_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_med_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_med_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_med_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_med_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_med_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_med_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_med_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_med_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_med_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_med_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_med_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_med_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "MK82"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | USA"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/usa/bombs/mk82.mdl"
|
||||
ENT.Effect = "gw_250lb_explosion"
|
||||
ENT.EffectAir = "gw_250lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_250kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 60
|
||||
ENT.ImpactSpeed = 150
|
||||
ENT.ImpactDepth = 25
|
||||
ENT.Mass = 250
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 585.9375
|
||||
ENT.BlastRadius = 878.90625
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1171.875
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
173
garrysmod/addons/swbombs/lua/entities/sw_flare_v3.lua
Normal file
173
garrysmod/addons/swbombs/lua/entities/sw_flare_v3.lua
Normal file
@@ -0,0 +1,173 @@
|
||||
AddCSLuaFile()
|
||||
ENT.Type = "anim"
|
||||
ENT.SWBombV3 = true
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.PrintName = "Flare"
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = ""
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.Model = "models/sw/shared/flare.mdl"
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( self.Model)
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
|
||||
local pObj = self:GetPhysicsObject()
|
||||
pObj:SetMass( 1 )
|
||||
pObj:EnableGravity( true )
|
||||
pObj:EnableMotion( true )
|
||||
pObj:EnableDrag( true )
|
||||
pObj:SetDragCoefficient(0)
|
||||
pObj:Wake()
|
||||
timer.Simple(3,function()
|
||||
if IsValid(self) then
|
||||
self:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
function ENT:Think()
|
||||
for k,v in pairs( ents.FindInSphere( self:GetPos(), math.random(1500,2000) ) ) do
|
||||
if( IsValid( v ) && IsValid( v.Target ) ) && !string.EndsWith(tostring(v.Target), "gtav_cm_flare]") then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == v then
|
||||
v.Target = self
|
||||
if IsFirstTimePredicted() then
|
||||
timer.Simple(2,function()
|
||||
if IsValid(v) then
|
||||
v:Detonate()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
if ( IsValid(v) ) and v.IsRocket and (v.JDAM or v.GuidanceActive) then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == v then
|
||||
self:SetNWEntity("TarRocket",v)
|
||||
v.target = (self)
|
||||
if v.lg == true then
|
||||
v.lg = false
|
||||
v.target = (self)
|
||||
end
|
||||
if v.LaserGuided == true then
|
||||
v.LaserGuided = false
|
||||
v.target = (self)
|
||||
end
|
||||
end
|
||||
end
|
||||
if ( IsValid(v) ) and v:GetClass() == "lunasflightschool_missile" and IsValid(v:GetLockOn()) then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == v then
|
||||
v:SetLockOn( self )
|
||||
if IsFirstTimePredicted() then
|
||||
timer.Simple(4,function()
|
||||
if IsValid(v) then
|
||||
v:Detonate()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
if ( IsValid(v) ) and v:GetClass() == "lvs_missile" and IsValid(v:GetNWTarget()) then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == v then
|
||||
v:SetNWTarget( self )
|
||||
end
|
||||
end
|
||||
if ( IsValid(v) ) and v:GetClass() == "dronesrewrite_rocketbig" then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == v then
|
||||
v.Enemy = self
|
||||
if IsFirstTimePredicted() then
|
||||
timer.Simple(1,function()
|
||||
if IsValid(v) then
|
||||
v:Boom()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
if ( IsValid(v) ) and v:GetClass() == "rpg_missile" then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
} )
|
||||
if tr.Hit and tr.Entity == v then
|
||||
local d = DamageInfo()
|
||||
d:SetDamage( 100 )
|
||||
d:SetAttacker(self)
|
||||
d:SetDamageType( DMG_MISSILEDEFENSE )
|
||||
v:TakeDamageInfo( d )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
local emitter = ParticleEmitter(Vector(0, 0, 0))
|
||||
function ENT:Initialize()
|
||||
self.lifetime = RealTime()
|
||||
self.cooltime = CurTime()
|
||||
end
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
function ENT:Think()
|
||||
local dist = 0
|
||||
if (self.cooltime < CurTime()) then
|
||||
local smoke = emitter:Add("effects/smoke_a", self:GetPos() + self:GetForward()*-dist)
|
||||
smoke:SetVelocity(self:GetForward()*-10)
|
||||
smoke:SetDieTime(math.Rand(1,3.5))
|
||||
smoke:SetStartAlpha(150)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(90)
|
||||
smoke:SetEndSize(30)
|
||||
smoke:SetRoll(math.Rand(180,480))
|
||||
smoke:SetRollDelta(math.Rand(-4,2))
|
||||
smoke:SetGravity( Vector( 0, math.random(1,90), math.random(151,355) ) )
|
||||
smoke:SetColor( 135,135, 135 )
|
||||
smoke:SetAirResistance(50)
|
||||
local fire = emitter:Add("effects/yellowflare", self:GetPos() + self:GetForward()*-dist)
|
||||
fire:SetVelocity(self:GetForward()*-10)
|
||||
fire:SetDieTime(math.Rand(.25,.35))
|
||||
fire:SetStartAlpha(250)
|
||||
fire:SetEndAlpha(250)
|
||||
fire:SetStartSize(150)
|
||||
fire:SetEndSize(50)
|
||||
fire:SetAirResistance(150)
|
||||
fire:SetRoll(math.Rand(180,480))
|
||||
fire:SetRollDelta(math.Rand(-3,3))
|
||||
fire:SetColor(220,150,0)
|
||||
self.cooltime = CurTime() + .0001
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:OnRemove()
|
||||
if IsValid(self:GetNWEntity("TarRocket")) then
|
||||
self:GetNWEntity("TarRocket").JDAM = false
|
||||
self:GetNWEntity("TarRocket").GuidanceActive = false
|
||||
end
|
||||
end
|
||||
function ENT:PhysicsUpdate()
|
||||
end
|
||||
function ENT:PhysicsCollide()
|
||||
end
|
||||
108
garrysmod/addons/swbombs/lua/entities/sw_heli_wheel_v3.lua
Normal file
108
garrysmod/addons/swbombs/lua/entities/sw_heli_wheel_v3.lua
Normal file
@@ -0,0 +1,108 @@
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.DoNotDuplicate = true
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/props_vehicles/tire001c_car.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:DrawShadow( false )
|
||||
self:AddEFlags( EFL_NO_PHYSCANNON_INTERACTION )
|
||||
end
|
||||
|
||||
function ENT:SetBrakes( active )
|
||||
if not self._CanUseBrakes then
|
||||
actuve = false
|
||||
end
|
||||
|
||||
if active ~= self._BrakesActive then
|
||||
self._BrakesActive = active
|
||||
|
||||
if active then
|
||||
self:StartMotionController()
|
||||
else
|
||||
self:StopMotionController()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:SetBrakeForce( force )
|
||||
self._BrakeForce = force
|
||||
end
|
||||
|
||||
function ENT:GetBrakeForce()
|
||||
return (self._BrakeForce or 60)
|
||||
end
|
||||
|
||||
function ENT:Define( data )
|
||||
local bbox = Vector(data.radius,data.radius,data.radius)
|
||||
|
||||
self:PhysicsInitSphere( data.radius, data.physmat )
|
||||
self:SetCollisionBounds( -bbox, bbox )
|
||||
|
||||
local PhysObj = self:GetPhysicsObject()
|
||||
if IsValid( PhysObj ) then
|
||||
PhysObj:SetMass( data.mass )
|
||||
PhysObj:Wake()
|
||||
PhysObj:SetBuoyancyRatio(0)
|
||||
PhysObj:EnableGravity( false )
|
||||
end
|
||||
|
||||
self._CanUseBrakes = data.brake
|
||||
end
|
||||
|
||||
function ENT:PhysicsSimulate( phys, deltatime )
|
||||
local BrakeForce = Vector( -phys:GetAngleVelocity().x, 0, 0 ) * self:GetBrakeForce()
|
||||
|
||||
return BrakeForce, Vector(0,0,0), SIM_LOCAL_ACCELERATION
|
||||
end
|
||||
|
||||
function ENT:SetBase( ent )
|
||||
self._baseEnt = ent
|
||||
end
|
||||
|
||||
function ENT:GetBase()
|
||||
return self._baseEnt
|
||||
end
|
||||
|
||||
function ENT:Use( ply )
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide( data, physobj )
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage( dmginfo )
|
||||
local base = self:GetBase()
|
||||
|
||||
if not IsValid( base ) then return end
|
||||
|
||||
base:TakeDamageInfo( dmginfo )
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
end
|
||||
248
garrysmod/addons/swbombs/lua/entities/sw_item_refuel.lua
Normal file
248
garrysmod/addons/swbombs/lua/entities/sw_item_refuel.lua
Normal file
@@ -0,0 +1,248 @@
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
|
||||
ENT.PrintName = "Aircraft refueler"
|
||||
ENT.Author = "Luna"
|
||||
ENT.Information = "Refills aircraft fuel tanks"
|
||||
ENT.Category = "[LVS]"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = false
|
||||
|
||||
ENT.Editable = false
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Entity",0, "User" )
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage( dmginfo )
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/props_wasteland/gaspump001a.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetUseType( SIMPLE_USE )
|
||||
|
||||
local PhysObj = self:GetPhysicsObject()
|
||||
|
||||
if not IsValid( PhysObj ) then return end
|
||||
|
||||
PhysObj:EnableMotion( false )
|
||||
end
|
||||
|
||||
function ENT:giveSWEP( ply )
|
||||
self:EmitSound("common/wpn_select.wav")
|
||||
|
||||
ply:SetSuppressPickupNotices( true )
|
||||
ply:Give( "weapon_lvsaircraftfuelfiller" )
|
||||
ply:SetSuppressPickupNotices( false )
|
||||
|
||||
ply:SelectWeapon( "weapon_lvsaircraftfuelfiller" )
|
||||
self:SetUser( ply )
|
||||
|
||||
local SWEP = ply:GetWeapon( "weapon_lvsaircraftfuelfiller" )
|
||||
|
||||
if not IsValid( SWEP ) then return end
|
||||
end
|
||||
|
||||
function ENT:removeSWEP( ply )
|
||||
if ply:HasWeapon( "weapon_lvsaircraftfuelfiller" ) then
|
||||
ply:StripWeapon( "weapon_lvsaircraftfuelfiller" )
|
||||
ply:SwitchToDefaultWeapon()
|
||||
end
|
||||
self:SetUser( NULL )
|
||||
end
|
||||
|
||||
function ENT:checkSWEP( ply )
|
||||
if not ply:Alive() or ply:InVehicle() then
|
||||
|
||||
self:removeSWEP( ply )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local weapon = ply:GetActiveWeapon()
|
||||
|
||||
if not IsValid( weapon ) or weapon:GetClass() ~= "weapon_lvsaircraftfuelfiller" then
|
||||
self:removeSWEP( ply )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if (ply:GetPos() - self:GetPos()):LengthSqr() < 150000 then return end
|
||||
|
||||
self:removeSWEP( ply )
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local ply = self:GetUser()
|
||||
local T = CurTime()
|
||||
|
||||
if IsValid( ply ) then
|
||||
self:checkSWEP( ply )
|
||||
|
||||
self:NextThink( T )
|
||||
else
|
||||
self:NextThink( T + 0.5 )
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Use( ply )
|
||||
if not IsValid( ply ) or not ply:IsPlayer() then return end
|
||||
|
||||
local User = self:GetUser()
|
||||
|
||||
if IsValid( User ) then
|
||||
if User == ply then
|
||||
self:removeSWEP( ply )
|
||||
end
|
||||
else
|
||||
self:giveSWEP( ply )
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
local User = self:GetUser()
|
||||
|
||||
if not IsValid( User ) then return end
|
||||
|
||||
self:removeSWEP( User )
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:CreatePumpEnt()
|
||||
if IsValid( self.PumpEnt ) then return self.PumpEnt end
|
||||
|
||||
self.PumpEnt = ents.CreateClientProp()
|
||||
self.PumpEnt:SetModel( "models/props_equipment/gas_pump_p13.mdl" )
|
||||
self.PumpEnt:SetPos( self:LocalToWorld( Vector(-0.2,-14.6,45.7) ) )
|
||||
self.PumpEnt:SetAngles( self:LocalToWorldAngles( Angle(-0.3,92.3,-0.1) ) )
|
||||
self.PumpEnt:Spawn()
|
||||
self.PumpEnt:Activate()
|
||||
self.PumpEnt:SetParent( self )
|
||||
|
||||
return self.PumpEnt
|
||||
end
|
||||
|
||||
function ENT:RemovePumpEnt()
|
||||
if not IsValid( self.PumpEnt ) then return end
|
||||
|
||||
self.PumpEnt:Remove()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local PumpEnt = self:CreatePumpEnt()
|
||||
|
||||
local ShouldDraw = IsValid( self:GetUser() )
|
||||
local Draw = PumpEnt:GetNoDraw()
|
||||
|
||||
if Draw ~= ShouldDraw then
|
||||
PumpEnt:SetNoDraw( ShouldDraw )
|
||||
end
|
||||
end
|
||||
|
||||
local cable = Material( "cable/cable2" )
|
||||
local function bezier(p0, p1, p2, p3, t)
|
||||
local e = p0 + t * (p1 - p0)
|
||||
local f = p1 + t * (p2 - p1)
|
||||
local g = p2 + t * (p3 - p2)
|
||||
|
||||
local h = e + t * (f - e)
|
||||
local i = f + t * (g - f)
|
||||
|
||||
local p = h + t * (i - h)
|
||||
|
||||
return p
|
||||
end
|
||||
|
||||
ENT.FrameMat = Material( "lvs/3d2dmats/frame.png" )
|
||||
ENT.RefuelMat = Material( "lvs/3d2dmats/refuel.png" )
|
||||
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
self:DrawCable()
|
||||
|
||||
local ply = LocalPlayer()
|
||||
local Pos = self:GetPos()
|
||||
|
||||
if (ply:GetPos() - Pos):LengthSqr() > 5000000 then return end
|
||||
|
||||
local IconColor = Color( 0, 255, 0, 255 )
|
||||
|
||||
cam.Start3D2D( self:LocalToWorld( Vector(10,0,45) ), self:LocalToWorldAngles( Angle(0,90,90) ), 0.1 )
|
||||
draw.NoTexture()
|
||||
surface.SetDrawColor( 0, 0, 0, 255 )
|
||||
surface.DrawRect( -150, -120, 300, 240 )
|
||||
|
||||
surface.SetDrawColor( IconColor )
|
||||
|
||||
surface.SetMaterial( self.FrameMat )
|
||||
surface.DrawTexturedRect( -50, -50, 100, 100 )
|
||||
|
||||
surface.SetMaterial( self.RefuelMat )
|
||||
surface.DrawTexturedRect( -50, -50, 100, 100 )
|
||||
|
||||
draw.SimpleText( "Aircraft fuel", "LVS_FONT", 0, 75, IconColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
cam.End3D2D()
|
||||
end
|
||||
|
||||
function ENT:DrawCable()
|
||||
if LocalPlayer():GetPos():DistToSqr( self:GetPos() ) > 350000 then return end
|
||||
|
||||
local pos = self:LocalToWorld( Vector(10,0,45) )
|
||||
local ang = self:LocalToWorldAngles( Angle(0,90,90) )
|
||||
local ply = self:GetUser()
|
||||
|
||||
local startPos = self:LocalToWorld( Vector(0.06,-17.77,55.48) )
|
||||
local p2 = self:LocalToWorld( Vector(8,-17.77,30) )
|
||||
local p3
|
||||
local endPos
|
||||
|
||||
if IsValid( ply ) then
|
||||
local id = ply:LookupAttachment("anim_attachment_rh")
|
||||
local attachment = ply:GetAttachment( id )
|
||||
|
||||
if not attachment then return end
|
||||
|
||||
endPos = (attachment.Pos + attachment.Ang:Forward() * -3 + attachment.Ang:Right() * 2 + attachment.Ang:Up() * -3.5)
|
||||
p3 = endPos + attachment.Ang:Right() * 5 - attachment.Ang:Up() * 20
|
||||
else
|
||||
p3 = self:LocalToWorld( Vector(0,-20,30) )
|
||||
endPos = self:LocalToWorld( Vector(0.06,-20.3,37) )
|
||||
end
|
||||
|
||||
render.StartBeam( 15 )
|
||||
render.SetMaterial( cable )
|
||||
|
||||
for i = 0,15 do
|
||||
local pos = bezier(startPos, p2, p3, endPos, i / 14)
|
||||
|
||||
local Col = (render.GetLightColor( pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
|
||||
|
||||
render.AddBeam( pos, 1, 0, Color(Col.r,Col.g,Col.b,255) )
|
||||
end
|
||||
|
||||
render.EndBeam()
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:RemovePumpEnt()
|
||||
end
|
||||
end
|
||||
178
garrysmod/addons/swbombs/lua/entities/sw_mine_tm62_v3.lua
Normal file
178
garrysmod/addons/swbombs/lua/entities/sw_mine_tm62_v3.lua
Normal file
@@ -0,0 +1,178 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_bomb_v3" )
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_sml_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_sml_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_sml_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_sml_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_sml_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_sml_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_sml_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_sml_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "ТМ-62"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/bombs/tm62.mdl"
|
||||
ENT.Effect = "ins_rpg_explosion"
|
||||
ENT.EffectAir = "ins_rpg_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Decal = "scorch_1kg"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 50
|
||||
ENT.ImpactSpeed = 25
|
||||
ENT.ImpactDepth = 2
|
||||
ENT.Mass = 1
|
||||
ENT.Durability = 100
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 1000
|
||||
ENT.ExplosionRadius = 50
|
||||
ENT.BlastRadius = 200
|
||||
ENT.FragDamage = 150
|
||||
ENT.FragRadius = 300
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel(self.Model)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup( COLLISION_GROUP_NONE )
|
||||
self:PhysWake()
|
||||
local pObj = self:GetPhysicsObject()
|
||||
pObj:SetMass( self.Mass )
|
||||
pObj:EnableGravity( false )
|
||||
pObj:EnableMotion( true )
|
||||
pObj:EnableDrag( false )
|
||||
self:StartMotionController()
|
||||
self:PhysWake()
|
||||
self.InGround = false
|
||||
self.InEntity = false
|
||||
self.Exploded = false
|
||||
self.Buried = false
|
||||
self.Armed = false
|
||||
self.CurDurability = self.Durability
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide( data, physobj )
|
||||
end
|
||||
|
||||
function ENT:OnTick()
|
||||
|
||||
if self.Armed and not self.Used then
|
||||
timer.Simple(3, function()
|
||||
if IsValid(self) then
|
||||
self:SetPos(self:GetPos()-self:GetUp()*2)
|
||||
self:GetPhysicsObject():EnableMotion(false)
|
||||
self.Buried = true
|
||||
end
|
||||
end)
|
||||
self.Used = true
|
||||
end
|
||||
|
||||
if self.Armed and self.Buried then
|
||||
for k, v in pairs(ents.FindInSphere(self:LocalToWorld(self:OBBCenter()),self.ExplosionRadius/2)) do
|
||||
if v:IsValid() and v:IsVehicle() then
|
||||
timer.Simple(0.5,function()
|
||||
if IsValid(self) then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Touch( ent )
|
||||
if self.Armed and self.Buried then
|
||||
if ent:IsVehicle() then
|
||||
self.Exploded = true
|
||||
self:Explode(self:GetPos())
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
include("shared.lua")
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
@@ -0,0 +1,188 @@
|
||||
AddCSLuaFile("shared.lua")
|
||||
AddCSLuaFile( "cl_init.lua" )
|
||||
include("shared.lua")
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
ent.Owner = ply
|
||||
return ent
|
||||
end
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/sw/shared/backpack.mdl")
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetUseType( SIMPLE_USE )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
self:AddFlags( FL_OBJECT )
|
||||
local PObj = self:GetPhysicsObject()
|
||||
if not IsValid( PObj ) then
|
||||
self:Remove()
|
||||
print("SW Bombs V2: Missing model. Entity terminated.")
|
||||
return
|
||||
end
|
||||
self:PhysWake()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime()+0.05)
|
||||
if self:GetAutoMode() then
|
||||
if self:GetVelocity():Length() >= 500 then
|
||||
if self:GetOpen() == false and not self:IsPlayerHolding() then
|
||||
self:SetOpen(true)
|
||||
self:EmitSound("sw/misc/chute_1.wav")
|
||||
self.Chute1 = ents.Create("prop_physics")
|
||||
self.Chute1:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute1:SetPos(self:GetPos()+self:GetRight()*250+self:GetUp()*25)
|
||||
self.Chute1:SetAngles(self:GetAngles())
|
||||
self.Chute1:Spawn()
|
||||
self.Chute1:Activate()
|
||||
self.Chute1.Owner=self.Owner
|
||||
self.Chute1:PhysWake()
|
||||
self.Chute1:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute1:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute1:GetPhysicsObject():SetMass(100)
|
||||
local Wire1 = constraint.Rope(self,self.Chute1,0,0,Vector(0,0,0),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
|
||||
self.Chute2 = ents.Create("prop_physics")
|
||||
self.Chute2:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute2:SetPos(self:GetPos()-self:GetRight()*250+self:GetUp()*25)
|
||||
self.Chute2:SetAngles(self:GetAngles())
|
||||
self.Chute2:Spawn()
|
||||
self.Chute2:Activate()
|
||||
self.Chute2.Owner=self.Owner
|
||||
self.Chute2:PhysWake()
|
||||
self.Chute2:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute2:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute2:GetPhysicsObject():SetMass(100)
|
||||
local Wire2 = constraint.Rope(self,self.Chute2,0,0,Vector(0,0,0),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
|
||||
self.Chute3 = ents.Create("prop_physics")
|
||||
self.Chute3:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute3:SetPos(self:GetPos()+self:GetForward()*250+self:GetUp()*25)
|
||||
self.Chute3:SetAngles(self:GetAngles())
|
||||
self.Chute3:Spawn()
|
||||
self.Chute3:Activate()
|
||||
self.Chute3.Owner=self.Owner
|
||||
self.Chute3:PhysWake()
|
||||
self.Chute3:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute3:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute3:GetPhysicsObject():SetMass(100)
|
||||
local Wire3 = constraint.Rope(self,self.Chute3,0,0,Vector(0,0,0),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
end
|
||||
else
|
||||
if self:GetVelocity():Length() <= 10 then
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
timer.Simple(3,function()
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
if IsValid(self.Chute1) then
|
||||
self.Chute1:Remove()
|
||||
end
|
||||
if IsValid(self.Chute2) then
|
||||
self.Chute2:Remove()
|
||||
end
|
||||
if IsValid(self.Chute3) then
|
||||
self.Chute3:Remove()
|
||||
end
|
||||
self:SetOpen(false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for _, e in pairs(ents.FindInSphere(self:GetPos(), 500)) do
|
||||
if e == self.Owner then
|
||||
if IsValid( e ) then
|
||||
local Open = self:GetOpen()
|
||||
OpenSwitch = self.Owner:KeyDown(IN_SCORE)
|
||||
if self.OldOpenSwitch ~= OpenSwitch then
|
||||
if OpenSwitch and Open == false then
|
||||
self:SetOpen(true)
|
||||
self:EmitSound("sw/misc/chute_1.wav")
|
||||
self.Chute1 = ents.Create("prop_physics")
|
||||
self.Chute1:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute1:SetPos(self:GetPos()+self:GetRight()*250+self:GetUp()*25)
|
||||
self.Chute1:SetAngles(self:GetAngles())
|
||||
self.Chute1:Spawn()
|
||||
self.Chute1:Activate()
|
||||
self.Chute1.Owner=self.Owner
|
||||
self.Chute1:PhysWake()
|
||||
self.Chute1:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute1:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute1:GetPhysicsObject():SetMass(100)
|
||||
local Wire1 = constraint.Rope(self,self.Chute1,0,0,Vector(0,-15,10),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
|
||||
self.Chute2 = ents.Create("prop_physics")
|
||||
self.Chute2:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute2:SetPos(self:GetPos()-self:GetRight()*250+self:GetUp()*25)
|
||||
self.Chute2:SetAngles(self:GetAngles())
|
||||
self.Chute2:Spawn()
|
||||
self.Chute2:Activate()
|
||||
self.Chute2.Owner=self.Owner
|
||||
self.Chute2:PhysWake()
|
||||
self.Chute2:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute2:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute2:GetPhysicsObject():SetMass(100)
|
||||
local Wire2 = constraint.Rope(self,self.Chute2,0,0,Vector(0,-15,10),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
|
||||
self.Chute3 = ents.Create("prop_physics")
|
||||
self.Chute3:SetModel("models/sw/shared/chute_2.mdl")
|
||||
self.Chute3:SetPos(self:GetPos()+self:GetForward()*250+self:GetUp()*25)
|
||||
self.Chute3:SetAngles(self:GetAngles())
|
||||
self.Chute3:Spawn()
|
||||
self.Chute3:Activate()
|
||||
self.Chute3.Owner=self.Owner
|
||||
self.Chute3:PhysWake()
|
||||
self.Chute3:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute3:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute3:GetPhysicsObject():SetMass(100)
|
||||
local Wire3 = constraint.Rope(self,self.Chute3,0,0,Vector(0,-15,10),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
elseif OpenSwitch and Open == true then
|
||||
if IsValid(self.Chute1) then
|
||||
self.Chute1:Remove()
|
||||
end
|
||||
if IsValid(self.Chute2) then
|
||||
self.Chute2:Remove()
|
||||
end
|
||||
if IsValid(self.Chute3) then
|
||||
self.Chute3:Remove()
|
||||
end
|
||||
self:SetOpen(false)
|
||||
end
|
||||
self.OldOpenSwitch = OpenSwitch
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if IsValid(self.Chute1) then
|
||||
self.Chute1:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
end
|
||||
if IsValid(self.Chute2) then
|
||||
self.Chute2:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
end
|
||||
if IsValid(self.Chute3) then
|
||||
self.Chute3:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
end
|
||||
return true
|
||||
end
|
||||
function ENT:OnRemove()
|
||||
if IsValid(self.Chute1) then
|
||||
self.Chute1:Remove()
|
||||
end
|
||||
if IsValid(self.Chute2) then
|
||||
self.Chute2:Remove()
|
||||
end
|
||||
if IsValid(self.Chute3) then
|
||||
self.Chute3:Remove()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
ENT.Base = "base_anim"
|
||||
ENT.Type = "anim"
|
||||
ENT.SW_ENT = true
|
||||
ENT.PrintName = "Parachute heavy"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Category = "SW Bombs V3"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
ENT.Editable = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool", 0, "Open" )
|
||||
self:NetworkVar( "Int",1, "RopeLength", { KeyName = "ropelength", Edit = { type = "Int", order = 1,min = 0, max = 2500, category = "Misc"} } )
|
||||
self:NetworkVar( "Bool", 2, "AutoMode", { KeyName = "automode", Edit = { type = "Bool", category = "Misc"} } )
|
||||
self:SetRopeLength(300)
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
include("shared.lua")
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
116
garrysmod/addons/swbombs/lua/entities/sw_parachute_v3/init.lua
Normal file
116
garrysmod/addons/swbombs/lua/entities/sw_parachute_v3/init.lua
Normal file
@@ -0,0 +1,116 @@
|
||||
AddCSLuaFile("shared.lua")
|
||||
AddCSLuaFile( "cl_init.lua" )
|
||||
include("shared.lua")
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
ent.Owner = ply
|
||||
return ent
|
||||
end
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/sw/shared/backpack.mdl")
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetUseType( SIMPLE_USE )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
self:AddFlags( FL_OBJECT )
|
||||
local PObj = self:GetPhysicsObject()
|
||||
if not IsValid( PObj ) then
|
||||
self:Remove()
|
||||
print("SW Bombs V3: Missing model. Entity terminated.")
|
||||
return
|
||||
end
|
||||
self:PhysWake()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime()+0.05)
|
||||
if self:GetAutoMode() then
|
||||
if self:GetVelocity():Length() >= 500 then
|
||||
if self:GetOpen() == false and not self:IsPlayerHolding() then
|
||||
self:SetOpen(true)
|
||||
self:EmitSound("sw/misc/chute_1.wav")
|
||||
self.Chute = ents.Create("prop_physics")
|
||||
self.Chute:SetModel("models/sw/shared/chute_1.mdl")
|
||||
self.Chute:SetPos(self:GetPos()+self:GetUp()*25)
|
||||
self.Chute:SetAngles(self:GetAngles())
|
||||
self.Chute:Spawn()
|
||||
self.Chute:Activate()
|
||||
self.Chute.Owner=self.Owner
|
||||
self.Chute:PhysWake()
|
||||
self.Chute:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute:GetPhysicsObject():SetMass(100)
|
||||
local Wire = constraint.Rope(self,self.Chute,0,0,Vector(0,-15,10),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
end
|
||||
end
|
||||
else
|
||||
if self:GetVelocity():Length() <= 10 then
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
timer.Simple(3,function()
|
||||
if IsValid(self) then
|
||||
if self:GetOpen() == true and not self:IsPlayerHolding() then
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:Remove()
|
||||
end
|
||||
self:SetOpen(false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for _, e in pairs(ents.FindInSphere(self:GetPos(), 500)) do
|
||||
if e == self.Owner then
|
||||
if IsValid( e ) then
|
||||
local Open = self:GetOpen()
|
||||
OpenSwitch = self.Owner:KeyDown(IN_SCORE)
|
||||
if self.OldOpenSwitch ~= OpenSwitch then
|
||||
if OpenSwitch and Open == false then
|
||||
self:SetOpen(true)
|
||||
self:EmitSound("sw/misc/chute_1.wav")
|
||||
self.Chute = ents.Create("prop_physics")
|
||||
self.Chute:SetModel("models/sw/shared/chute_1.mdl")
|
||||
self.Chute:SetPos(self:GetPos()+self:GetUp()*25)
|
||||
self.Chute:SetAngles(self:GetAngles())
|
||||
self.Chute:Spawn()
|
||||
self.Chute:Activate()
|
||||
self.Chute.Owner=self.Owner
|
||||
self.Chute:PhysWake()
|
||||
self.Chute:GetPhysicsObject():EnableDrag(true)
|
||||
self.Chute:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
self.Chute:GetPhysicsObject():SetMass(100)
|
||||
local Wire = constraint.Rope(self,self.Chute,0,0,Vector(0,-15,10),Vector(0,0,0),self:GetRopeLength(),0,0,1 )
|
||||
elseif OpenSwitch and Open == true then
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:Remove()
|
||||
end
|
||||
self:SetOpen(false)
|
||||
end
|
||||
self.OldOpenSwitch = OpenSwitch
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:GetPhysicsObject():SetDragCoefficient(self:GetVelocity():Length()*10)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if IsValid(self.Chute) then
|
||||
self.Chute:Remove()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
ENT.Base = "base_anim"
|
||||
ENT.Type = "anim"
|
||||
ENT.SW_ENT = true
|
||||
ENT.PrintName = "Parachute"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Category = "SW Bombs V3"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
ENT.Editable = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool", 0, "Open" )
|
||||
self:NetworkVar( "Int",1, "RopeLength", { KeyName = "ropelength", Edit = { type = "Int", order = 1,min = 0, max = 2500, category = "Misc"} } )
|
||||
self:NetworkVar( "Bool", 2, "AutoMode", { KeyName = "automode", Edit = { type = "Bool", category = "Misc"} } )
|
||||
self:SetRopeLength(50)
|
||||
end
|
||||
172
garrysmod/addons/swbombs/lua/entities/sw_rocket_4k40_v3.lua
Normal file
172
garrysmod/addons/swbombs/lua/entities/sw_rocket_4k40_v3.lua
Normal file
@@ -0,0 +1,172 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_hvy_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_hvy_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_hvy_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_hvy_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_hvy_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_hvy_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_hvy_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_hvy_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_hvy_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_hvy_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_hvy_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_hvy_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_hvy_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_hvy_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_hvy_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_hvy_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_hvy_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_hvy_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_hvy_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_hvy_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_hvy_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_hvy_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_hvy_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_hvy_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "4К40"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/ssm/p15.mdl"
|
||||
ENT.Effect = "mk84_air"
|
||||
ENT.EffectAir = "mk84_explod"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.AngEffect = false
|
||||
ENT.RocketTrail = "Big_mis_thrust"
|
||||
ENT.RocketBurnoutTrail = "Big_mis_burnout"
|
||||
ENT.Engine1Att = "engine_1"
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 250
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 500
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 500
|
||||
ENT.MaxVelocity = 320
|
||||
ENT.FuelBurnoutTime = 3
|
||||
ENT.RotationalForce = 0
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 915.52734375
|
||||
ENT.BlastRadius = 1373.291015625
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1831.0546875
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 50
|
||||
|
||||
if SERVER then
|
||||
function ENT:OnTick()
|
||||
if self.Fired and self.GuidanceActive == false and self.target == nil then
|
||||
for k, v in pairs( ents.FindInCone(self:GetPos(),self:GetForward(),5000,math.cos(math.rad(25))) ) do
|
||||
if v:GetClass() == "lvs_wheeldrive_engine" or v.IsSimfphyscar or v:IsVehicle() then
|
||||
if IsValid(v) then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
filter = function( ent )
|
||||
if ent == self then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
} )
|
||||
debugoverlay.Line(self:GetPos(),v:GetPos(),1,Color(255,255,255),false)
|
||||
if tr.Hit and tr.Entity == v then
|
||||
self.GuidanceActive = true
|
||||
self.DiveHeight = 100
|
||||
self.target = v
|
||||
self.targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
|
||||
else
|
||||
self.GuidanceActive = false
|
||||
self.target = nil
|
||||
self.DiveHeight = 0
|
||||
end
|
||||
else
|
||||
self.GuidanceActive = false
|
||||
self.target = nil
|
||||
self.DiveHeight = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
end
|
||||
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m113_v3.lua
Normal file
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m113_v3.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "9М113"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/atgm/9m113.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Engine1Att = "engine_1"
|
||||
ENT.Engine2Att = "engine_2"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 240
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 70
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 140
|
||||
ENT.FragCount = 100
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ent:SetTracerScale(5)
|
||||
return ent
|
||||
end
|
||||
127
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m117_v3.lua
Normal file
127
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m117_v3.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "9М117"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/atgm/9m117.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 375
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 10000
|
||||
ENT.ExplosionRadius = 70
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 140
|
||||
ENT.FragCount = 100
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ent:SetTracerScale(5)
|
||||
return ent
|
||||
end
|
||||
134
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m119_v3.lua
Normal file
134
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m119_v3.lua
Normal file
@@ -0,0 +1,134 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "9М119"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/atgm/9m119.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 800
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
ENT.RotationalForce = 0
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 300
|
||||
ENT.ExplosionRadius = 70
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 140
|
||||
ENT.FragCount = 0
|
||||
|
||||
ENT.HEAT = true
|
||||
ENT.HEATRadius = 3
|
||||
ENT.ArmorPenetration = 80000
|
||||
ENT.PenetrationDamage = 4000
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.LaserGuided = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ent:SetTracerScale(5)
|
||||
return ent
|
||||
end
|
||||
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m127_v3.lua
Normal file
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m127_v3.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "9М127"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/atgm/9m127.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Engine1Att = "engine_1"
|
||||
ENT.Engine2Att = "engine_2"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 300
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 611
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 10000
|
||||
ENT.ExplosionRadius = 200
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 140
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 150
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ent:SetTracerScale(5)
|
||||
return ent
|
||||
end
|
||||
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m133_v3.lua
Normal file
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_9m133_v3.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "9М133"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/atgm/9m133.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 250
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 3500
|
||||
ENT.ExplosionRadius = 70
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 140
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.LaserGuided = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ent:SetTracerScale(5)
|
||||
return ent
|
||||
end
|
||||
127
garrysmod/addons/swbombs/lua/entities/sw_rocket_agm114_v3.lua
Normal file
127
garrysmod/addons/swbombs/lua/entities/sw_rocket_agm114_v3.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "AGM-114"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | USA"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/usa/missiles/agm/agm114.mdl"
|
||||
ENT.Effect = "ins_c4_explosion"
|
||||
ENT.EffectAir = "ins_c4_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 50
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 475
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 10000
|
||||
ENT.ExplosionRadius = 200
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 280
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
132
garrysmod/addons/swbombs/lua/entities/sw_rocket_agm65_v3.lua
Normal file
132
garrysmod/addons/swbombs/lua/entities/sw_rocket_agm65_v3.lua
Normal file
@@ -0,0 +1,132 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "AGM-65"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | USA"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/usa/missiles/agm/agm65.mdl"
|
||||
ENT.Effect = "ins_c4_explosion"
|
||||
ENT.EffectAir = "ins_c4_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 306
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 300
|
||||
ENT.ExplosionRadius = 140
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 280
|
||||
ENT.FragCount = 0
|
||||
|
||||
ENT.HEAT = true
|
||||
ENT.HEATRadius = 2
|
||||
ENT.ArmorPenetration = 83000
|
||||
ENT.PenetrationDamage = 2500
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_bgm71_v3.lua
Normal file
128
garrysmod/addons/swbombs/lua/entities/sw_rocket_bgm71_v3.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "BGM-71"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | USA"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/usa/missiles/atgm/bgm71.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.Engine1Att = "engine_1"
|
||||
ENT.Engine2Att = "engine_2"
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 240
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 10000
|
||||
ENT.ExplosionRadius = 70
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 140
|
||||
ENT.FragCount = 100
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ent:SetTracerScale(8)
|
||||
return ent
|
||||
end
|
||||
171
garrysmod/addons/swbombs/lua/entities/sw_rocket_grome1_v3.lua
Normal file
171
garrysmod/addons/swbombs/lua/entities/sw_rocket_grome1_v3.lua
Normal file
@@ -0,0 +1,171 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_hvy_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_hvy_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_hvy_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_hvy_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_hvy_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_hvy_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_hvy_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_hvy_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_hvy_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_hvy_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_hvy_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_hvy_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_hvy_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_hvy_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_hvy_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_hvy_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_hvy_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_hvy_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_hvy_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_hvy_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_hvy_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_hvy_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_hvy_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_hvy_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "ГРОМ-Э1"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/agm/9a7759.mdl"
|
||||
ENT.Effect = "gw_250lb_explosion"
|
||||
ENT.EffectAir = "gw_250lb_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.AngEffect = false
|
||||
ENT.RocketTrail = "Med_mis_thrust"
|
||||
ENT.RocketBurnoutTrail = "Med_mis_burnout"
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 250
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 500
|
||||
ENT.MaxVelocity = 300
|
||||
ENT.FuelBurnoutTime = 1.5
|
||||
ENT.RotationalForce = 0
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 732.421875
|
||||
ENT.BlastRadius = 1098.6328125
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 1464.84375
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 75
|
||||
|
||||
if SERVER then
|
||||
function ENT:OnTick()
|
||||
if self.Fired and self.GuidanceActive == false and self.target == nil then
|
||||
for k, v in pairs( ents.FindInCone(self:GetPos(),self:GetForward(),2500,math.cos(math.rad(15))) ) do
|
||||
if v:GetClass() == "lvs_wheeldrive_engine" or v.IsSimfphyscar or v:IsVehicle() then
|
||||
if IsValid(v) then
|
||||
local tr = util.TraceLine( {
|
||||
start = self:GetPos(),
|
||||
endpos = v:GetPos(),
|
||||
filter = function( ent )
|
||||
if ent == self then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
} )
|
||||
debugoverlay.Line(self:GetPos(),v:GetPos(),1,Color(255,255,255),false)
|
||||
if tr.Hit and tr.Entity == v then
|
||||
self.GuidanceActive = true
|
||||
self.DiveHeight = 100
|
||||
self.target = v
|
||||
self.targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
|
||||
else
|
||||
self.GuidanceActive = false
|
||||
self.target = nil
|
||||
self.DiveHeight = 0
|
||||
end
|
||||
else
|
||||
self.GuidanceActive = false
|
||||
self.target = nil
|
||||
self.DiveHeight = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
end
|
||||
62
garrysmod/addons/swbombs/lua/entities/sw_rocket_hydra_v3.lua
Normal file
62
garrysmod/addons/swbombs/lua/entities/sw_rocket_hydra_v3.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "Hydra 70"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | USA"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/usa/rockets/hydra70.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.ImpactSound = "sw/bomb/impact_1.wav"
|
||||
ENT.DebrisSound = "sw/bomb/debris_1.wav"
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = "sw/explosion/exp_tny_1.wav"
|
||||
ENT.FarExplosionSound = "sw/explosion/exp_sml_dst_1.wav"
|
||||
ENT.DistExplosionSound = "sw/explosion/exp_sml_far_1.wav"
|
||||
ENT.WaterExplosionSound = "sw/explosion/exp_trp_1.wav"
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 50
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 600
|
||||
ENT.FuelBurnoutTime = 1.3
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 1500
|
||||
ENT.ExplosionRadius = 70
|
||||
ENT.BlastRadius = 140
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 210
|
||||
ENT.FragCount = 0
|
||||
136
garrysmod/addons/swbombs/lua/entities/sw_rocket_kh25ml_v3.lua
Normal file
136
garrysmod/addons/swbombs/lua/entities/sw_rocket_kh25ml_v3.lua
Normal file
@@ -0,0 +1,136 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_sml_cls_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_sml_cls_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_sml_cls_3.wav"
|
||||
ExpSnds[4] = "sw/explosion/exp_sml_cls_4.wav"
|
||||
ExpSnds[5] = "sw/explosion/exp_sml_cls_5.wav"
|
||||
ExpSnds[6] = "sw/explosion/exp_sml_cls_6.wav"
|
||||
ExpSnds[7] = "sw/explosion/exp_sml_cls_7.wav"
|
||||
ExpSnds[8] = "sw/explosion/exp_sml_cls_8.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "Х-25МЛ"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/missiles/agm/kh25ml.mdl"
|
||||
ENT.Effect = "ins_c4_explosion"
|
||||
ENT.EffectAir = "ins_c4_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
ENT.AngEffect = false
|
||||
ENT.RocketTrail = "Med_mis_thrust"
|
||||
ENT.RocketBurnoutTrail = "Med_mis_burnout"
|
||||
ENT.Engine1Att = "engine_1"
|
||||
ENT.Engine2Att = "engine_2"
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 250
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 500
|
||||
ENT.MaxVelocity = 870
|
||||
ENT.FuelBurnoutTime = 3
|
||||
ENT.RotationalForce = 0
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 15000
|
||||
ENT.ExplosionRadius = 468.75
|
||||
ENT.BlastRadius = 703.125
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 937.5
|
||||
ENT.FragCount = 0
|
||||
|
||||
--Guidance
|
||||
ENT.HaveGuidance = true
|
||||
ENT.Agility = 75
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
123
garrysmod/addons/swbombs/lua/entities/sw_rocket_pg9v_v3.lua
Normal file
123
garrysmod/addons/swbombs/lua/entities/sw_rocket_pg9v_v3.lua
Normal file
@@ -0,0 +1,123 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "ПГ-9В"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/rockets/pg9v.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 100
|
||||
ENT.ImpactSpeed = 100
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 1
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 700
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 1000
|
||||
ENT.ExplosionRadius = 70
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 140
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
136
garrysmod/addons/swbombs/lua/entities/sw_rocket_s13_v3.lua
Normal file
136
garrysmod/addons/swbombs/lua/entities/sw_rocket_s13_v3.lua
Normal file
@@ -0,0 +1,136 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "С-13"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/rockets/s13.mdl"
|
||||
ENT.Effect = "ins_c4_explosion"
|
||||
ENT.EffectAir = "ins_c4_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 250
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 530
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 10000
|
||||
ENT.ExplosionRadius = 200
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 250
|
||||
ENT.FragCount = 0
|
||||
|
||||
function ENT:OnTick()
|
||||
if self.InGround or self.InEntity then
|
||||
local tr = util.TraceLine({
|
||||
start = self:LocalToWorld(self:OBBCenter()),
|
||||
endpos =self:LocalToWorld(self:OBBCenter())+self:GetAngles():Forward()*self.TraceLength,
|
||||
filter = self,
|
||||
})
|
||||
if not tr.Hit then
|
||||
self:SetParent(NULL)
|
||||
self:GetPhysicsObject():EnableMotion(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
123
garrysmod/addons/swbombs/lua/entities/sw_rocket_s13of_v3.lua
Normal file
123
garrysmod/addons/swbombs/lua/entities/sw_rocket_s13of_v3.lua
Normal file
@@ -0,0 +1,123 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local ImpSnds = {}
|
||||
ImpSnds[1] = "sw/bomb/impact_1.wav"
|
||||
ImpSnds[2] = "sw/bomb/impact_2.wav"
|
||||
ImpSnds[3] = "sw/bomb/impact_3.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
local DbrSnds = {}
|
||||
DbrSnds[1] = "sw/bomb/debris_1.wav"
|
||||
DbrSnds[2] = "sw/bomb/debris_2.wav"
|
||||
DbrSnds[3] = "sw/bomb/debris_3.wav"
|
||||
DbrSnds[4] = "sw/bomb/debris_4.wav"
|
||||
|
||||
local ExpSnds = {}
|
||||
ExpSnds[1] = "sw/explosion/exp_tny_1.wav"
|
||||
ExpSnds[2] = "sw/explosion/exp_tny_2.wav"
|
||||
ExpSnds[3] = "sw/explosion/exp_tny_3.wav"
|
||||
|
||||
local FarExpSnds = {}
|
||||
FarExpSnds[1] = "sw/explosion/exp_sml_dst_1.wav"
|
||||
FarExpSnds[2] = "sw/explosion/exp_sml_dst_2.wav"
|
||||
FarExpSnds[3] = "sw/explosion/exp_sml_dst_3.wav"
|
||||
FarExpSnds[4] = "sw/explosion/exp_sml_dst_4.wav"
|
||||
FarExpSnds[5] = "sw/explosion/exp_sml_dst_5.wav"
|
||||
FarExpSnds[6] = "sw/explosion/exp_sml_dst_6.wav"
|
||||
FarExpSnds[7] = "sw/explosion/exp_sml_dst_7.wav"
|
||||
FarExpSnds[8] = "sw/explosion/exp_sml_dst_8.wav"
|
||||
|
||||
local DstExpSnds = {}
|
||||
DstExpSnds[1] = "sw/explosion/exp_sml_far_1.wav"
|
||||
DstExpSnds[2] = "sw/explosion/exp_sml_far_2.wav"
|
||||
DstExpSnds[3] = "sw/explosion/exp_sml_far_3.wav"
|
||||
DstExpSnds[4] = "sw/explosion/exp_sml_far_4.wav"
|
||||
DstExpSnds[5] = "sw/explosion/exp_sml_far_5.wav"
|
||||
DstExpSnds[6] = "sw/explosion/exp_sml_far_6.wav"
|
||||
DstExpSnds[7] = "sw/explosion/exp_sml_far_7.wav"
|
||||
DstExpSnds[8] = "sw/explosion/exp_sml_far_8.wav"
|
||||
|
||||
local WtrExpSnds = {}
|
||||
WtrExpSnds[1] = "sw/explosion/exp_trp_1.wav"
|
||||
WtrExpSnds[2] = "sw/explosion/exp_trp_2.wav"
|
||||
WtrExpSnds[3] = "sw/explosion/exp_trp_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "С-13ОФ"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/rockets/s13of.mdl"
|
||||
ENT.Effect = "ins_c4_explosion"
|
||||
ENT.EffectAir = "ins_c4_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.ImpactSound = table.Random(ImpSnds)
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.DebrisSound = table.Random(DbrSnds)
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = table.Random(ExpSnds)
|
||||
ENT.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ENT.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ENT.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 530
|
||||
ENT.FuelBurnoutTime = 1.25
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 3000
|
||||
ENT.ExplosionRadius = 125
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 250
|
||||
ENT.FragCount = 100
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
if not tr.Hit then return end
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal )
|
||||
ent:SetAngles( Angle(0, ply:EyeAngles().y, 0 ) )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent.StartSound = table.Random(StartSnds)
|
||||
ent.ImpactSound = table.Random(ImpSnds)
|
||||
ent.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ent.DebrisSound = table.Random(DbrSnds)
|
||||
ent.ExplosionSound = table.Random(ExpSnds)
|
||||
ent.FarExplosionSound = table.Random(FarExpSnds)
|
||||
ent.DistExplosionSound = table.Random(DstExpSnds)
|
||||
ent.WaterExplosionSound = table.Random(WtrExpSnds)
|
||||
|
||||
return ent
|
||||
end
|
||||
62
garrysmod/addons/swbombs/lua/entities/sw_rocket_s8ko_v3.lua
Normal file
62
garrysmod/addons/swbombs/lua/entities/sw_rocket_s8ko_v3.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
AddCSLuaFile()
|
||||
DEFINE_BASECLASS( "sw_base_rocket_v3" )
|
||||
|
||||
local StartSnds = {}
|
||||
StartSnds[1] = "sw/rocket/rocket_start_01.wav"
|
||||
StartSnds[2] = "sw/rocket/rocket_start_02.wav"
|
||||
StartSnds[3] = "sw/rocket/rocket_start_03.wav"
|
||||
StartSnds[4] = "sw/rocket/rocket_start_04.wav"
|
||||
|
||||
local WtrImpSnds = {}
|
||||
WtrImpSnds[1] = "sw/bomb/impact_wtr_1.wav"
|
||||
WtrImpSnds[2] = "sw/bomb/impact_wtr_2.wav"
|
||||
WtrImpSnds[3] = "sw/bomb/impact_wtr_3.wav"
|
||||
|
||||
--Main info
|
||||
ENT.Type = "anim"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.AdminOnly = false
|
||||
ENT.PrintName = "С-8КО"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Contact = "shermannwolf@gmail.com"
|
||||
ENT.Category = "SW Bombs V3 | RUS"
|
||||
ENT.Editable = true
|
||||
ENT.SWBombV3 = true
|
||||
|
||||
--Visual
|
||||
ENT.Model = "models/sw/rus/rockets/s8.mdl"
|
||||
ENT.Effect = "ins_m203_explosion"
|
||||
ENT.EffectAir = "ins_m203_explosion"
|
||||
ENT.EffectWater = "ins_water_explosion"
|
||||
|
||||
ENT.AngEffect = true
|
||||
|
||||
--Sounds
|
||||
ENT.WaterImpactSoundSound = table.Random(WtrImpSnds)
|
||||
ENT.ImpactSound = "sw/bomb/impact_1.wav"
|
||||
ENT.DebrisSound = "sw/bomb/debris_1.wav"
|
||||
ENT.WhistleSound = "sw/bomb/whistle.wav"
|
||||
ENT.ExplosionSound = "sw/explosion/exp_tny_1.wav"
|
||||
ENT.FarExplosionSound = "sw/explosion/exp_sml_dst_1.wav"
|
||||
ENT.DistExplosionSound = "sw/explosion/exp_sml_far_1.wav"
|
||||
ENT.WaterExplosionSound = "sw/explosion/exp_trp_1.wav"
|
||||
ENT.WaterFarExplosionSound = nil
|
||||
ENT.StartSound = table.Random(StartSnds)
|
||||
|
||||
--Physics
|
||||
ENT.TraceLength = 150
|
||||
ENT.ImpactSpeed = 500
|
||||
ENT.ImpactDepth = 0
|
||||
ENT.Mass = 100
|
||||
ENT.Durability = 100
|
||||
ENT.MaxVelocity = 700
|
||||
ENT.FuelBurnoutTime = 1.5
|
||||
|
||||
--Explosion
|
||||
ENT.ExplosionDamage = 2500
|
||||
ENT.ExplosionRadius = 100
|
||||
ENT.BlastRadius = 0
|
||||
ENT.FragDamage = 25
|
||||
ENT.FragRadius = 270
|
||||
ENT.FragCount = 0
|
||||
@@ -0,0 +1,3 @@
|
||||
include("shared.lua")
|
||||
function ENT:LVSHudPaintVehicleIdentifier( X, Y, In_Col, target_ent )
|
||||
end
|
||||
@@ -0,0 +1,92 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
AddCSLuaFile( "cl_init.lua" )
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Mount( ent )
|
||||
if IsValid( self._MountEnt ) or ent._IsMounted then return end
|
||||
|
||||
if ent:IsPlayerHolding() then return end
|
||||
local ID = self:LookupAttachment( "muzzle" )
|
||||
local Attachment = self:GetAttachment( ID )
|
||||
|
||||
ent:SetOwner( self )
|
||||
ent:SetPos( Attachment.Pos+Attachment.Ang:Up()*ent.CatapultPos or 0 )
|
||||
ent:SetAngles( Attachment.Ang )
|
||||
ent:SetlvsLockedStatus( true )
|
||||
ent:SetHP(ent:GetMaxHP())
|
||||
ent:WeaponRestoreAmmo()
|
||||
ent:OnMaintenance()
|
||||
|
||||
|
||||
ent._MountOriginalCollision = ent:GetCollisionGroup()
|
||||
self._MountEnt = ent
|
||||
ent._IsMounted = true
|
||||
|
||||
ent:SetCollisionGroup( COLLISION_GROUP_WORLD )
|
||||
|
||||
self._MountConstraint = constraint.Weld( ent, self, 0, 0, 0, false, false )
|
||||
|
||||
ent:RebuildCrosshairFilterEnts()
|
||||
end
|
||||
|
||||
function ENT:Dismount()
|
||||
if not IsValid( self._MountEnt ) or not IsValid( self._MountConstraint ) then return end
|
||||
|
||||
self._MountConstraint:Remove()
|
||||
|
||||
self._MountEnt._IsMounted = nil
|
||||
|
||||
local ent = self._MountEnt
|
||||
|
||||
timer.Simple(0.1, function()
|
||||
if not IsValid( ent ) then return end
|
||||
|
||||
ent:SetOwner( NULL )
|
||||
ent:SetlvsLockedStatus( true )
|
||||
if not ent:IsPlayerHolding() then
|
||||
ent:SetEngineActive(true)
|
||||
ent:GetPhysicsObject():AddVelocity(ent:GetUp()*150)
|
||||
ent:GetPhysicsObject():AddVelocity(ent:GetForward()*1500)
|
||||
end
|
||||
end)
|
||||
|
||||
timer.Simple(1,function()
|
||||
if ent._MountOriginalCollision then
|
||||
ent:SetCollisionGroup( ent._MountOriginalCollision )
|
||||
|
||||
ent._MountOriginalCollision = nil
|
||||
end
|
||||
|
||||
self._MountEnt.CrosshairFilterEnts = nil
|
||||
|
||||
self._MountEnt = nil
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:OnCollision( data, physobj )
|
||||
local ent = data.HitEntity
|
||||
|
||||
if not IsValid( ent ) or not (ent.LVSUAV and ent.CatapultLaunchable) then return end
|
||||
|
||||
timer.Simple(0, function()
|
||||
if not IsValid( self ) or not IsValid( ent ) then return end
|
||||
|
||||
self:Mount( ent )
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:OnTick()
|
||||
if not IsValid( self._MountEnt ) or not self._MountEnt:IsPlayerHolding() then return end
|
||||
|
||||
self:Dismount()
|
||||
end
|
||||
|
||||
function ENT:Use( ply )
|
||||
if not IsValid( self._MountEnt ) then return end
|
||||
|
||||
self:Dismount()
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:Dismount()
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
ENT.Base = "lvs_base_wheeldrive_trailer"
|
||||
|
||||
ENT.PrintName = "UAV Catapult"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Information = ""
|
||||
ENT.Category = "SW Bombs V3"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
ENT.MDL = "models/sw/shared/catapult.mdl"
|
||||
ENT.AITEAM = 0
|
||||
ENT.MaxHealth = 200
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
include("entities/lvs_tank_wheeldrive/modules/cl_attachable_playermodels.lua")
|
||||
|
||||
function ENT:DrawDriver()
|
||||
if IsValid(self:GetNWEntity("UAV")) then
|
||||
local pod = self:GetNWEntity("UAV"):GetDriverSeat()
|
||||
|
||||
if not IsValid( pod ) then self:RemovePlayerModel( "driver" ) return self:SetBodygroup(1,0) end
|
||||
|
||||
local plyL = LocalPlayer()
|
||||
local ply = pod:GetDriver()
|
||||
|
||||
if not IsValid( ply ) then self:RemovePlayerModel( "driver" ) return self:SetBodygroup(1,0) end
|
||||
|
||||
local model = self:CreatePlayerModel( ply, "driver" )
|
||||
model:SetSequence( "cidle_knife" )
|
||||
model:SetRenderOrigin( LocalToWorld(Vector(-30,0,-5),Angle(0,0,0),(self:LocalToWorld(Vector(0,0,0))),self:GetAngles()) )
|
||||
model:SetRenderAngles( self:LocalToWorldAngles(Angle(0,0,0)) )
|
||||
model:DrawModel()
|
||||
|
||||
self:SetBodygroup(1,1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function ENT:PreDraw()
|
||||
self:DrawDriver()
|
||||
|
||||
return true
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
include("shared.lua")
|
||||
include("cl_attached_playermodels.lua")
|
||||
@@ -0,0 +1,45 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
AddCSLuaFile( "cl_init.lua" )
|
||||
AddCSLuaFile( "cl_attached_playermodels.lua" )
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:OnSpawn( PObj )
|
||||
PObj:SetMass(100)
|
||||
local DriverSeat = self:AddDriverSeat( Vector(-50,50,-5), Angle(0,-90,0) )
|
||||
DriverSeat.HidePlayer = true
|
||||
DriverSeat.ExitPos = Vector(-20,0,20)
|
||||
end
|
||||
|
||||
function ENT:Use( ply )
|
||||
if IsValid(self:GetNWEntity("UAV")) then
|
||||
if self:GetNWEntity("UAV"):GetAI() then return end
|
||||
ply:EnterVehicle(self:GetNWEntity("UAV"):GetDriverSeat())
|
||||
self:GetNWEntity("UAV"):AlignView( ply )
|
||||
|
||||
if hook.Run( "LVS.CanPlayerDrive", ply, self ) ~= false then
|
||||
ply:EnterVehicle( self:GetNWEntity("UAV"):GetDriverSeat() )
|
||||
self:GetNWEntity("UAV"):AlignView( ply )
|
||||
else
|
||||
hook.Run( "LVS.OnPlayerCannotDrive", ply, self )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Explode()
|
||||
if self.ExplodedAlready then return end
|
||||
|
||||
self.ExplodedAlready = true
|
||||
|
||||
if IsValid(self:GetNWEntity("UAV")) then
|
||||
local Driver = self:GetNWEntity("UAV"):GetDriver()
|
||||
|
||||
if IsValid( Driver ) then
|
||||
self:HurtPlayer( Driver, Driver:Health() + Driver:Armor(), self.FinalAttacker, self.FinalInflictor )
|
||||
end
|
||||
self:GetNWEntity("UAV"):SetlvsLockedStatus(true)
|
||||
end
|
||||
|
||||
self:OnFinishExplosion()
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
ENT.Base = "lvs_base_wheeldrive_trailer"
|
||||
|
||||
ENT.PrintName = "[LVS] UAV Control"
|
||||
ENT.Author = "Shermann Wolf"
|
||||
ENT.Information = ""
|
||||
ENT.Category = "[LVS]"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
ENT.MDL = "models/sw/shared/uav_control.mdl"
|
||||
|
||||
ENT.AITEAM = 0
|
||||
|
||||
ENT.MaxHealth = 250
|
||||
|
||||
function ENT:CalcMainActivity( ply )
|
||||
if ply ~= self:GetDriver() then return self:CalcMainActivityPassenger( ply ) end
|
||||
|
||||
if ply.m_bWasNoclipping then
|
||||
ply.m_bWasNoclipping = nil
|
||||
ply:AnimResetGestureSlot( GESTURE_SLOT_CUSTOM )
|
||||
|
||||
if CLIENT then
|
||||
ply:SetIK( true )
|
||||
end
|
||||
end
|
||||
|
||||
ply.CalcIdeal = ACT_STAND
|
||||
ply.CalcSeqOverride = ply:LookupSequence( "cidle_knife" )
|
||||
|
||||
return ply.CalcIdeal, ply.CalcSeqOverride
|
||||
end
|
||||
Reference in New Issue
Block a user