add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,384 @@
swv3 = swv3 or {}
local util = util
local pairs = pairs
local table = table
local istable = istable
local IsInWorld = util.IsInWorld
local TraceLine = util.TraceLine
local QuickTrace = util.QuickTrace
local Effect = util.Effect
local MASK_ALL = MASK_ALL
local tableinsert = table.insert
local IsValid = IsValid
local DMG_BLAST = DMG_BLAST
local soundSpeed = 18005.25*18005.25 -- 343m/s
local Level = {
[1] = {
112,
150,
150,
},
[2] = {
112,
150,
150,
},
[3] = {
112,
150,
150,
},
}
local BigExplosionSoundLevels = {
[1] = {
150,
150,
150,
},
[2] = {
150,
150,
150,
},
[3] = {
150,
150,
150,
},
}
local BigExplosionSounds = {
}
net.Receive("swv3_net_sound_new",function()
local pos = net.ReadVector()
local tab = net.ReadTable()
if not tab[1] then return end
local e1 = tab[1]
local e2 = tab[2] or e1
local e3 = tab[3] or e2
local div = math.Clamp(math.ceil(1),1,#Level)
local vol = 1
local currange = 1000 / div
local curRange_min = currange*5
curRange_min = curRange_min*curRange_min
local curRange_mid = currange*14
curRange_mid = curRange_mid * curRange_mid
local curRange_max = currange*40
curRange_max = curRange_max * curRange_max
local ply = LocalPlayer():GetViewEntity()
local plypos = ply:GetPos()
local distance = ply:GetPos():DistToSqr(pos)
hook.Run("SWV3Explosion",e1,pos,distance,e2,e3)
if distance <= curRange_min then
if not LocalPlayer():InVehicle() then
util.ScreenShake(pos,10,75,2,math.sqrt(curRange_min))
end
if BigExplosionSounds[e1] then
sound.Play(e1,pos,BigExplosionSoundLevels[div][1],100,1 * vol)
else
sound.Play(e1,pos,Level[div][1],100,1 * vol)
end
elseif distance <= curRange_mid then
timer.Simple(distance/soundSpeed,function()
if not LocalPlayer():InVehicle() then
util.ScreenShake(pos,3,75,1.5,math.sqrt(curRange_mid))
end
if BigExplosionSounds[e3] then
sound.Play(e2,pos,BigExplosionSoundLevels[div][2],100,1 * vol)
else
sound.Play(e2,pos,Level[div][2],100,0.5 * vol)
end
end)
else
timer.Simple(distance/soundSpeed,function()
if BigExplosionSounds[e2] then
sound.Play(e1,pos,BigExplosionSoundLevels[div][3],100,1 * vol)
else
sound.Play(e3,pos,Level[div][3],100,1 * vol)
end
end)
end
end)
--Particles
game.AddParticles( "particles/Missile_Thrust.pcf")
game.AddParticles( "particles/Rocket_Thrust.pcf")
game.AddParticles( "particles/AAM_Thrust.pcf")
game.AddParticles( "particles/WP_trail.pcf")
game.AddParticles( "particles/sw_flare.pcf")
game.AddParticles( "particles/gb5_emp.pcf")
game.AddParticles( "particles/gwa_agm62.pcf")
game.AddParticles( "particles/gw_mark77.pcf")
game.AddParticles( "particles/gwa_m388.pcf")
game.AddParticles( "particles/gwa_t12.pcf")
game.AddParticles( "particles/gwa_blu1.pcf")
game.AddParticles( "particles/gwa_fab100.pcf")
game.AddParticles( "particles/gw_moab_gp100_pack.pcf")
game.AddParticles( "particles/gw_gbu12.pcf")
game.AddParticles( "particles/gw_mk84.pcf")
game.AddParticles( "particles/gw_m66.pcf")
game.AddParticles( "particles/gwa_blockbuster.pcf")
game.AddParticles( "particles/gwa_mk82a3.pcf")
game.AddParticles( "particles/gw_rocket_test.pcf")
game.AddParticles( "particles/gw_death.pcf")
game.AddParticles( "particles/gwa_mop.pcf")
game.AddParticles( "particles/gwa_sdb.pcf")
game.AddParticles( "particles/gwa_water_splode.pcf")
game.AddParticles( "particles/gwa_foab.pcf")
game.AddParticles( "particles/gwa_tallboy.pcf")
game.AddParticles( "particles/gwa_m61.pcf")
game.AddParticles( "particles/gwa_foab_new.pcf")
game.AddParticles( "particles/gwa_w48.pcf")
game.AddParticles( "particles/gwa_actual_tallboy.pcf")
game.AddParticles( "particles/gwa_grigori.pcf")
game.AddParticles( "particles/gwa_grandslam.pcf")
game.AddParticles( "particles/gwa_agm_norm.pcf")
game.AddParticles( "particles/gwa_fizzle.pcf")
game.AddParticles( "particles/gwa_littleboy_fizzle.pcf")
game.AddParticles( "particles/gwa_gas.pcf")
game.AddParticles( "particles/gwa_rds1.pcf")
game.AddParticles( "particles/gw_m66_new.pcf")
game.AddParticles( "particles/gw_dirty.pcf")
game.AddParticles( "particles/gw_b61.pcf")
game.AddParticles( "particles/gw_gbu12_new.pcf")
game.AddParticles( "particles/gw_mike.pcf")
game.AddParticles( "particles/gw_must.pcf")
game.AddParticles( "particles/gw_250lb.pcf")
game.AddParticles( "particles/gw_500lb.pcf")
game.AddParticles( "particles/gw_1000kg.pcf")
game.AddParticles( "particles/gw_bunker.pcf")
game.AddParticles( "particles/gw_2000lb.pcf")
game.AddParticles( "particles/gw_foabn.pcf")
game.AddParticles( "particles/gw_moabn.pcf")
game.AddParticles( "particles/doi_explosion_fx.pcf")
game.AddParticles( "particles/doi_explosion_fx_b.pcf")
game.AddParticles( "particles/doi_explosion_fx_c.pcf")
game.AddParticles( "particles/doi_explosion_fx_grenade.pcf")
game.AddParticles( "particles/doi_explosion_fx_new.pcf")
game.AddParticles( "particles/doi_impact_fx.pcf" )
game.AddParticles( "particles/doi_weapon_fx.pcf" )
game.AddParticles( "particles/gb_water.pcf")
game.AddParticles( "particles/gb5_100lb.pcf")
game.AddParticles( "particles/gb5_500lb.pcf")
game.AddParticles( "particles/gb5_1000lb.pcf")
game.AddParticles( "particles/gb5_jdam.pcf")
game.AddParticles( "particles/gb5_large_explosion.pcf")
game.AddParticles( "particles/gb5_napalm.pcf")
game.AddParticles( "particles/gb5_light_bomb.pcf")
game.AddParticles( "particles/gb5_high_explosive_2.pcf")
game.AddParticles( "particles/gb5_high_explosive.pcf")
game.AddParticles( "particles/gb5_fireboom.pcf")
game.AddParticles( "particles/neuro_tank_ap.pcf")
game.AddParticles( "particles/ins_rockettrail.pcf")
game.AddParticles( "particles/ammo_cache_ins.pcf")
game.AddParticles( "particles/doi_rockettrail.pcf")
game.AddParticles( "particles/mnb_flamethrower.pcf")
game.AddParticles( "particles/impact_fx_ins.pcf" )
game.AddParticles( "particles/environment_fx.pcf")
game.AddParticles( "particles/water_impact.pcf")
game.AddParticles( "particles/explosion_fx_ins.pcf")
game.AddParticles( "particles/weapon_fx_tracers.pcf" )
game.AddParticles( "particles/weapon_fx_ins.pcf" )
game.AddParticles( "particles/gred_particles.pcf" )
game.AddParticles( "particles/fire_01.pcf" )
game.AddParticles( "particles/doi_explosions_smoke.pcf" )
game.AddParticles( "particles/explosion_fx_ins_b.pcf" )
game.AddParticles( "particles/ins_smokegrenade.pcf" )
game.AddParticles( "particles/ww1_gas.pcf" )
--Decals
game.AddDecal("scorch_1kg","decals/scorch_1kg")
game.AddDecal("scorch_25kg","decals/scorch_25kg")
game.AddDecal("scorch_50kg","decals/scorch_50kg")
game.AddDecal("scorch_100kg","decals/scorch_100kg")
game.AddDecal("scorch_250kg","decals/scorch_250kg")
game.AddDecal("scorch_500kg","decals/scorch_500kg")
game.AddDecal("scorch_1000kg","decals/scorch_1000kg")
game.AddDecal("scorch_1500kg","decals/scorch_1500kg")
game.AddDecal("scorch_3000kg","decals/scorch_3000kg")
game.AddDecal("scorch_5000kg","decals/scorch_5000kg")
game.AddDecal("scorch_9000kg","decals/scorch_9000kg")
--Fonts
surface.CreateFont( "sw_digital", {
font = "DS-Digital",
extended = false,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont("sw_hud", {
font = "Roboto",
size = 20,
weight = 550,
antialias = true,
scanlines = 2,
shadow = true
})
--Missile coordinates
swv3 = istable( swv3 ) and swv3 or {}
swv3.ThemeColor = Color(255,0,0,255)
CreateClientConVar( "sw_coord_x", 0, true, true,"Missile target coordinate on X axis")
CreateClientConVar( "sw_coord_y", 0, true, true,"Missile target coordinate on Y axis")
CreateClientConVar( "sw_coord_z", 0, true, true,"Missile target coordinate on Z axis")
CreateClientConVar( "sw_launch_allowed", 0, true, true,"Allow missile launch")
local FrameSizeX = 500
local FrameSizeY = 190
function swv3:OpenCoordinatesMenu( keep_position )
local xPos
local yPos
if IsValid( swv3.Frame ) then
if keep_position then
xPos = swv3.Frame:GetX()
yPos = swv3.Frame:GetY()
end
swv3.Frame:Close()
swv3.Frame = nil
end
swv3.Frame = vgui.Create( "DFrame" )
swv3.Frame:SetSize( FrameSizeX, FrameSizeY )
swv3.Frame:SetTitle( "" )
swv3.Frame:SetDraggable( true )
swv3.Frame:SetScreenLock( true )
swv3.Frame:MakePopup()
swv3.Frame:Center()
if keep_position and xPos and yPos then
swv3.Frame:SetPos( xPos, yPos )
end
local LCFrame = vgui.Create( "DPanel",swv3.Frame )
LCFrame:SetPos(330,80)
LCFrame:SetSize( 150, 60 )
local XCoord = vgui.Create( "DLabel",LCFrame )
local YCoord = vgui.Create( "DLabel",LCFrame )
local ZCoord = vgui.Create( "DLabel",LCFrame )
local LC = vgui.Create( "DLabel",LCFrame )
local Status = vgui.Create( "DLabel",LCFrame )
LC:SetPos(0,45)
LC:SetTextColor(Color(0,0,0))
LC:SetText( "Status:" )
local LaunchButton = vgui.Create( "DButton", swv3.Frame )
LaunchButton:SetPos( 330, 30 )
LaunchButton:SetSize( 150, 30 )
local XFrame = vgui.Create( "DPanel",swv3.Frame )
XFrame:SetPos(10,30)
XFrame:SetSize( 300, 40 )
local XLabel = vgui.Create( "DLabel",XFrame )
XLabel:SetTextColor(Color(255,0,0))
XLabel:SetText( "X coordinate" )
local XEntry = vgui.Create( "DTextEntry",XFrame) -- create the form as a child of frame
XEntry:SetNumeric(true)
XEntry:SetPos(0,15)
XEntry:Dock( BOTTOM )
XEntry.OnEnter = function( self )
local X = GetConVar("sw_coord_x")
X:SetInt(self:GetValue())
end
local YFrame = vgui.Create( "DPanel",swv3.Frame )
YFrame:SetPos(10,80)
YFrame:SetSize( 300, 40 )
local YLabel = vgui.Create( "DLabel",YFrame )
YLabel:SetTextColor(Color(255,0,0))
YLabel:SetText( "Y coordinate" )
local YEntry = vgui.Create( "DTextEntry",YFrame) -- create the form as a child of frame
YEntry:SetNumeric(true)
YEntry:SetPos(0,15)
YEntry:Dock( BOTTOM )
YEntry.OnEnter = function( self )
local Y = GetConVar("sw_coord_y")
Y:SetInt(self:GetValue())
end
local ZFrame = vgui.Create( "DPanel",swv3.Frame )
ZFrame:SetPos(10,130)
ZFrame:SetSize( 300, 40 )
local ZLabel = vgui.Create( "DLabel",ZFrame )
ZLabel:SetTextColor(Color(255,0,0))
ZLabel:SetText( "Z coordinate" )
local ZEntry = vgui.Create( "DTextEntry",ZFrame) -- create the form as a child of frame
ZEntry:SetNumeric(true)
ZEntry:SetPos(0,15)
ZEntry:Dock( BOTTOM )
ZEntry.OnEnter = function( self )
local Z = GetConVar("sw_coord_z")
Z:SetInt(self:GetValue())
end
swv3.Frame.Paint = function(self, w, h )
draw.RoundedBox( 8, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
draw.RoundedBoxEx( 8, 1, 26, w-2, h-27, Color( 255, 255, 255, 255 ), false, false, true, true )
draw.RoundedBoxEx( 8, 0, 0, w, 25, swv3.ThemeColor, true, true )
draw.SimpleText( "[SW Bombs V3] - Missile target coordinates ", "sw_hud", 5, 11, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
XCoord:SetTextColor(Color(0,0,0))
XCoord:SetText( "X:"..GetConVar("sw_coord_x"):GetInt() )
YCoord:SetPos(0,15)
YCoord:SetTextColor(Color(0,0,0))
YCoord:SetText( "Y:"..GetConVar("sw_coord_y"):GetInt() )
ZCoord:SetPos(0,30)
ZCoord:SetTextColor(Color(0,0,0))
ZCoord:SetText( "Z:"..GetConVar("sw_coord_z"):GetInt() )
Status:SetPos(40,45)
if GetConVar("sw_launch_allowed"):GetInt() == 1 then
LaunchButton:SetText( "Disallow launch" )
LaunchButton.DoClick = function()
RunConsoleCommand( "sw_launch_allowed", 0 )
end
Status:SetTextColor(Color(0,255,0))
Status:SetText( "Ready" )
else
LaunchButton:SetText( "Allow launch" )
LaunchButton.DoClick = function()
RunConsoleCommand( "sw_launch_allowed", 1 )
end
Status:SetTextColor(Color(255,0,0))
Status:SetText( "Standby" )
end
end
end
concommand.Add( "sw_open_targeting_menu", function( ply, cmd, args ) swv3:OpenCoordinatesMenu() end )

View File

@@ -0,0 +1,191 @@
swv3 = swv3 or {}
local util = util
local pairs = pairs
local table = table
local istable = istable
local IsInWorld = util.IsInWorld
local TraceLine = util.TraceLine
local QuickTrace = util.QuickTrace
local Effect = util.Effect
local MASK_ALL = MASK_ALL
local tableinsert = table.insert
local IsValid = IsValid
local DMG_BLAST = DMG_BLAST
local AddNetworkString = util.AddNetworkString
local tab = {}
AddNetworkString("swv3_net_sound_new")
swv3.CreateSound = function(pos,rsound,e1,e2,e3)
tab[1] = e1 or nil
tab[2] = e2 or nil
tab[3] = e3 or nil
net.Start("swv3_net_sound_new")
net.WriteVector(pos)
net.WriteTable(tab)
net.Broadcast()
end
hook.Remove( "PlayerLeaveVehicle", "!!LVS_Exit" )
hook.Add( "PlayerLeaveVehicle", "ExitUAV", function( ply, Pod )
if not ply:IsPlayer() or not IsValid( Pod ) then return end
local Vehicle = Pod:lvsGetVehicle()
if not IsValid( Vehicle ) then return end
if not LVS.FreezeTeams then
ply:lvsSetAITeam( Vehicle:GetAITEAM() )
end
ply._lvsNextUse = CurTime() + 0.25
hook.Run( "LVS.UpdateRelationship", Vehicle )
local pos = Vehicle:LocalToWorld( Vehicle:OBBCenter() )
local vel = Vehicle:GetVelocity()
local radius = Vehicle:BoundingRadius()
local mins, maxs = ply:GetHull()
local PosCenter = Pod:OBBCenter()
local StartPos = Pod:LocalToWorld( PosCenter )
local FilterPlayer = { ply }
local Filter = table.Copy( Vehicle:GetCrosshairFilterEnts() )
table.insert( Filter, ply )
local zOffset = 15
local ValidPositions = {}
if Vehicle.LVSUAV and IsValid(Vehicle:GetNWEntity("UAVControl")) then
local ExitPos = Vehicle:GetNWEntity("UAVControl"):LocalToWorld( Vector(-50,0,20) )
if not ExitPos then return end
if util.IsInWorld( ExitPos ) then
ply:SetPos( ExitPos )
ply:SetEyeAngles( (Pod:GetPos() - ExitPos):Angle() )
end
else
if isvector( Pod.ExitPos ) and Vehicle:GetUp().z > 0.9 then
local data = {
pos = Vehicle:LocalToWorld( Pod.ExitPos ),
dist = 1,
}
table.insert( ValidPositions, data )
end
local LocalDesiredExitPosition = Vehicle:WorldToLocal( Pod:GetPos() )
if vel:Length() > (Pod.PlaceBehindVelocity or 100) then
LocalDesiredExitPosition.y = LocalDesiredExitPosition.y - radius
local traceBehind = util.TraceLine( {
start = pos,
endpos = pos - vel:GetNormalized() * (radius + 50),
filter = Filter,
} )
local tracePlayer = util.TraceHull( {
start = traceBehind.HitPos + Vector(0,0,maxs.z + zOffset),
endpos = traceBehind.HitPos + Vector(0,0,zOffset),
maxs = Vector( maxs.x, maxs.y, 0 ),
mins = Vector( mins.x, mins.y, 0 ),
filter = FilterPlayer,
} )
if not tracePlayer.Hit and util.IsInWorld( tracePlayer.HitPos ) then
local data = {
pos = traceBehind.HitPos,
dist = 0,
}
table.insert( ValidPositions, data )
end
end
local DesiredExitPosition = Pod:LocalToWorld( LocalDesiredExitPosition )
for ang = 0, 360, 15 do
local X = math.cos( math.rad( ang ) ) * radius
local Y = math.sin( math.rad( ang ) ) * radius
local Z = Pod:OBBCenter().z
local EndPos = StartPos + Vector(X,Y,Z)
local traceWall = util.TraceLine( {start = StartPos,endpos = EndPos,filter = Filter} )
local traceVehicle = util.TraceLine( {
start = traceWall.HitPos,
endpos = StartPos,
filter = FilterPlayer,
} )
local CenterWallVehicle = (traceWall.HitPos + traceVehicle.HitPos) * 0.5
if traceWall.Hit or not util.IsInWorld( CenterWallVehicle ) then continue end
local GoundPos = CenterWallVehicle - Vector(0,0,radius)
local traceGround = util.TraceLine( {start = CenterWallVehicle,endpos = GoundPos,filter = Filter} )
if not traceGround.Hit or not util.IsInWorld( traceGround.HitPos ) then continue end
local tracePlayerRoof = util.TraceHull( {
start = traceGround.HitPos + Vector(0,0,zOffset),
endpos = traceGround.HitPos + Vector(0,0,maxs.z + zOffset),
maxs = Vector( maxs.x, maxs.y, 0 ),
mins = Vector( mins.x, mins.y, 0 ),
filter = FilterPlayer,
} )
if tracePlayerRoof.Hit or not util.IsInWorld( tracePlayerRoof.HitPos ) then continue end
local tracePlayer = util.TraceHull( {
start = traceGround.HitPos + Vector(0,0,maxs.z + zOffset),
endpos = traceGround.HitPos + Vector(0,0,zOffset),
maxs = Vector( maxs.x, maxs.y, 0 ),
mins = Vector( mins.x, mins.y, 0 ),
filter = FilterPlayer,
} )
if tracePlayer.Hit then continue end
local traceBack = util.TraceLine( {
start = tracePlayer.HitPos + Vector(0,0,zOffset),
endpos = StartPos,
filter = FilterPlayer,
} )
local data = {
pos = tracePlayer.HitPos,
dist = (traceBack.HitPos - DesiredExitPosition):Length(),
}
table.insert( ValidPositions, data )
end
local ExitPos
local ExitDist
for _, data in pairs( ValidPositions ) do
if not ExitPos or not ExitDist or ExitDist > data.dist then
ExitPos = data.pos
ExitDist = data.dist
end
end
-- all my plans failed, lets just let source do its thing
if not ExitPos then return end
local ViewAngles = (StartPos - ExitPos):Angle()
ViewAngles.p = 0
ViewAngles.r = 0
ply:SetPos( ExitPos )
ply:SetEyeAngles( ViewAngles )
end
end )

View File

@@ -0,0 +1,76 @@
local MatBeam = Material( "effects/lvs_base/spark" )
local GlowMat = Material( "sprites/light_glow02_add" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.OldPos = self.Entity:GetPos()
self.Emitter = ParticleEmitter( self.Entity:LocalToWorld( self.OldPos ), false )
end
end
function EFFECT:Think()
if IsValid( self.Entity ) then
self.nextDFX = self.nextDFX or 0
if self.nextDFX < CurTime() then
self.nextDFX = CurTime() + 0.02
local oldpos = self.OldPos
local newpos = self.Entity:GetPos()
self:SetPos( newpos )
local Sub = (newpos - oldpos)
local Dir = Sub:GetNormalized()
local Len = Sub:Length()
self.OldPos = newpos
end
return true
end
if IsValid( self.Emitter ) then
self.Emitter:Finish()
end
return false
end
function EFFECT:Render()
local ent = self.Entity
if not IsValid( ent ) then return end
local pos = ent:GetPos()
local dir = ent:GetForward()
local len = 250
render.SetMaterial( MatBeam )
render.DrawBeam( pos - dir * len, pos + dir * len * 0.1, 32, 1, 0, Color( 100, 100, 100, 100 ) )
render.DrawBeam( pos - dir * len * 0.5, pos + dir * len * 0.1, 16, 1, 0, Color( 255, 255, 255, 255 ) )
render.SetMaterial( GlowMat )
render.DrawSprite( pos, 250, 250, Color( 100, 100, 100, 255 ) )
end

View File

@@ -0,0 +1,116 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
EFFECT.MatSmoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
self.emitter = ParticleEmitter( pos, false )
self.OldPos = pos
self.Dir = dir
local trace = util.TraceLine( {
start = pos,
endpos = pos - Vector(0,0,500),
mask = MASK_SOLID_BRUSHONLY,
} )
local ply = LocalPlayer()
if not IsValid( ply ) then return end
local ViewEnt = ply:GetViewEntity()
if not IsValid( ViewEnt ) then return end
local Intensity = ply:InVehicle() and 5 or 50
local Ratio = math.min( 250 / (ViewEnt:GetPos() - trace.HitPos):Length(), 1 )
if Ratio < 0 then return end
util.ScreenShake( trace.HitPos, Intensity * Ratio, 0.1, 0.5, 250 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then
if self.emitter then
self.emitter:Finish()
end
local StartPos = self.OldPos
local EndPos = StartPos + self.Dir * 1000
local trace = util.TraceLine( {
start = StartPos,
endpos = EndPos,
} )
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetStart( self.Dir )
effectdata:SetEntity( trace.Entity )
effectdata:SetNormal( trace.HitNormal )
effectdata:SetSurfaceProp( trace.SurfaceProps )
util.Effect( "lvs_bullet_impact_ap", effectdata )
return false
end
if not self.emitter then return true end
local bullet = LVS:GetBullet( self.ID )
local Pos = bullet:GetPos()
local Sub = self.OldPos - Pos
local Dist = Sub:Length()
local Dir = Sub:GetNormalized()
self.OldPos = Pos
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 3000 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len * 0.1, 32, 1, 0, Color( 100, 100, 100, 100 ) )
render.DrawBeam( endpos - dir * len * 0.5, endpos + dir * len * 0.1, 16, 1, 0, Color( 255, 255, 255, 255 ) )
render.SetMaterial( self.MatSprite )
render.DrawSprite( endpos, 250, 250, Color( 100, 100, 100, 255 ) )
end

View File

@@ -0,0 +1,35 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 3000 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len * 0.1, 10, 1, 0, Color( 255, 0, 0, 255 ) )
render.DrawBeam( endpos - dir * len * 0.5, endpos + dir * len * 0.1, 5, 1, 0, Color( 255, 0, 0, 255 ) )
render.SetMaterial( self.MatSprite )
render.DrawSprite( endpos, 400, 400, Color( 125, 0, 0, 255 ) )
end

View File

@@ -0,0 +1,145 @@
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.FireMat = {
[1] = Material( "effects/lvs_base/flamelet1" ),
[2] = Material( "effects/lvs_base/flamelet2" ),
[3] = Material( "effects/lvs_base/flamelet3" ),
[4] = Material( "effects/lvs_base/flamelet4" ),
[5] = Material( "effects/lvs_base/flamelet5" ),
[6] = Material( "effects/lvs_base/fire" ),
}
EFFECT.SmokeMat = {
[1] = Material( "particle/smokesprites_0001" ),
[2] = Material( "particle/smokesprites_0002" ),
[3] = Material( "particle/smokesprites_0003" ),
[4] = Material( "particle/smokesprites_0004" ),
[5] = Material( "particle/smokesprites_0005" ),
[6] = Material( "particle/smokesprites_0006" ),
[7] = Material( "particle/smokesprites_0007" ),
[8] = Material( "particle/smokesprites_0008" ),
[9] = Material( "particle/smokesprites_0009" ),
[10] = Material( "particle/smokesprites_0010" ),
[11] = Material( "particle/smokesprites_0011" ),
[12] = Material( "particle/smokesprites_0012" ),
[13] = Material( "particle/smokesprites_0013" ),
[14] = Material( "particle/smokesprites_0014" ),
[15] = Material( "particle/smokesprites_0015" ),
[16] = Material( "particle/smokesprites_0016" ),
}
EFFECT.Smoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
self.LifeTime = 1
self.DieTime = CurTime() + self.LifeTime
if not IsValid( Ent ) then return end
self.Ent = Ent
self.Pos = Ent:WorldToLocal( Pos + VectorRand() * 20 )
self.RandomSize = math.Rand( 1, 2 )
self.Vel = self.Ent:GetVelocity()
local emitter = Ent:GetParticleEmitter( self.Pos )
if not IsValid( emitter ) then return end
for i = 1, 8 do
local particle = emitter:Add( self.Smoke[ math.random(1, #self.Smoke ) ], Pos )
local Dir = Angle(0,math.Rand(-180,180),0):Forward()
Dir.z = -0.5
Dir:Normalize()
if particle then
particle:SetVelocity( Dir * 250 )
particle:SetDieTime( 0.5 + i * 0.01 )
particle:SetAirResistance( 125 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 200 )
particle:SetEndSize( 400 )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetRollDelta( math.Rand(-1,1) * 3 )
particle:SetColor( 0, 0, 0 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( true )
particle:SetBounce( 0 )
end
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then return false end
if self.DieTime < CurTime() then return false end
self:SetPos( self.Ent:LocalToWorld( self.Pos ) )
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.Pos then return end
self:RenderSmoke()
self:RenderFire()
end
function EFFECT:RenderSmoke()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local Pos = self.Ent:LocalToWorld( self.Pos ) + Vector(0,0,25)
local InvScale = 1 - Scale
local Num = #self.SmokeMat - math.Clamp(math.ceil( Scale * #self.SmokeMat ) - 1,0, #self.SmokeMat - 1)
local C = 10 + 10 * self.RandomSize
local Size = (25 + 30 * InvScale) * self.RandomSize
local Offset = (self.Vel * InvScale ^ 2) * 0.5
render.SetMaterial( self.SmokeMat[ Num ] )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 80 * self.RandomSize) - Offset, Size, Size, Color( C, C, C, 200 * Scale) )
end
function EFFECT:RenderFire()
local Scale = (self.DieTime - 0.4 - CurTime()) / 0.6
if Scale < 0 then return end
local Pos = self.Ent:LocalToWorld( self.Pos )
local InvScale = 1 - Scale
render.SetMaterial( self.GlowMat )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 10), 100 * InvScale, 100 * InvScale, Color( 255, 150, 75, 255) )
local Num = #self.FireMat - math.Clamp(math.ceil( Scale * #self.FireMat ) - 1,0, #self.FireMat - 1)
local Size = (10 + 20 * Scale) * self.RandomSize
local Offset = (self.Vel * InvScale ^ 2) * 0.025
render.SetMaterial( self.FireMat[ Num ] )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 25) - Offset, Size, Size, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,53 @@
--DO NOT EDIT OR REUPLOAD THIS FILE
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin() + VectorRand() * 1
local emitter = ParticleEmitter( Pos, false )
if emitter then
local particle = emitter:Add( Materials[math.Round(math.Rand(1,table.Count( Materials )),0)], Pos )
if particle then
particle:SetVelocity( VectorRand() * 100 )
particle:SetDieTime( math.random(10,15) )
particle:SetAirResistance( 200 )
particle:SetStartAlpha( 155 )
particle:SetStartSize( 10 )
particle:SetEndAlpha( 50 )
particle:SetEndSize( math.Rand(250,300) )
particle:SetRoll( math.Rand(-1,1) * 100 )
particle:SetColor( data:GetColor() )
particle:SetGravity( Vector( 0, 0, 500 ) )
particle:SetCollide( false )
end
emitter:Finish()
end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,57 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
if not IsValid( Ent ) then return end
self.LifeTime = math.Rand(2,4)
self.DieTime = CurTime() + self.LifeTime
self.Splash = {
Pos = Pos,
Mat = Material("effects/splashwake1"),
RandomAng = math.random(0,360),
}
local emitter = Ent:GetParticleEmitter( Ent:GetPos() )
if emitter and emitter.Add then
local particle = emitter:Add( "effects/splash4", Pos + VectorRand(-10,10) - Vector(0,0,20) )
if particle then
particle:SetVelocity( Vector(0,0,250) )
particle:SetDieTime( 0.8 )
particle:SetAirResistance( 60 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 25 )
particle:SetEndSize( 50 )
particle:SetRoll( math.Rand(-1,1) * 100 )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
if CurTime() > self.DieTime then
return false
end
return true
end
function EFFECT:Render()
if self.Splash and self.LifeTime then
local Scale = (self.DieTime - self.LifeTime - CurTime()) / self.LifeTime
local S = 100 - Scale * 200
local Alpha = 100 + 100 * Scale
cam.Start3D2D( self.Splash.Pos + Vector(0,0,1), Angle(0,0,0), 1 )
surface.SetMaterial( self.Splash.Mat )
surface.SetDrawColor( 255, 255, 255 , Alpha )
surface.DrawTexturedRectRotated( 0, 0, S , S, self.Splash.RandomAng )
cam.End3D2D()
end
end

View 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

View File

@@ -0,0 +1,4 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,4 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View 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

View File

@@ -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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,4 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,4 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View 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

View File

@@ -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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,3 @@
include("shared.lua")
function ENT:LVSHudPaintVehicleIdentifier( X, Y, In_Col, target_ent )
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,2 @@
include("shared.lua")
include("cl_attached_playermodels.lua")

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,38 @@
hook.Add( "LVS:Initialize", "SW Controls keys", function()
local KEYS = {
{
name = "+ZOOM",
category = "Misc",
name_menu = "Cam zoom in",
cmd = "lvs_cam_zoom_in"
},
{
name = "-ZOOM",
category = "Misc",
name_menu = "Cam zoom out",
cmd = "lvs_cam_zoom_out"
},
{
name = "AIRBRAKE",
category = "Misc",
name_menu = "Airbrake",
cmd = "lvs_airbrake"
},
{
name = "BAILOUT",
category = "Misc",
name_menu = "Bail out",
cmd = "lvs_bailout"
},
{
name = "CHUTE",
category = "Misc",
name_menu = "Brake chute",
cmd = "lvs_brake_chute"
},
}
for _, v in pairs( KEYS ) do
LVS:AddKey( v.name, v.category, v.name_menu, v.cmd, v.default )
end
end )

View File

@@ -0,0 +1,53 @@
TOOL.Category = "LFS/LVS"
TOOL.Name = "#tool.sw_aamloadout_editor_v3.name"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar[ "aamloadout" ] = 0
if CLIENT then
language.Add( "tool.sw_aamloadout_editor_v3.name", "AAM Loadout Editor" )
language.Add( "tool.sw_aamloadout_editor_v3.desc", "A tool used to set AAM loadout on LFS/LVS-Vehicles" )
language.Add( "tool.sw_aamloadout_editor_v3.0", "Left click on a LFS/LVS-Vehicle to set AAM loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_aamloadout_editor_v3.1", "Left click on a LFS/LVS-Vehicle to set AAM loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_aamloadout_editor_v3.AAMloadout", "Loadout" )
end
function TOOL:LeftClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.AAMLoadouts) then
ent:SetAAMLoadout( self:GetClientNumber( "aamloadout" ) )
end
return true
end
function TOOL:RightClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.AAMLoadouts) then
ent:SetAAMLoadout(0)
end
return true
end
function TOOL:Reload( trace )
end
function TOOL:Think()
end
function TOOL.BuildCPanel( panel )
panel:AddControl( "Header", { Text = "#tool.sw_aamloadout_editor_v3.name", Description = "#tool.sw_aamloadout_editor_v3.desc" } )
panel:AddControl( "Slider",
{
Label = "#tool.sw_aamloadout_editor_v3.AAMloadout",
Type = "Int",
Min = "0",
Max = "10",
Command = "sw_aamloadout_editor_v3_aamloadout",
Help = false
})
end

View File

@@ -0,0 +1,53 @@
TOOL.Category = "LFS/LVS"
TOOL.Name = "#tool.sw_loadout_editor_v3.name"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar[ "loadout" ] = 0
if CLIENT then
language.Add( "tool.sw_loadout_editor_v3.name", "Loadout Editor" )
language.Add( "tool.sw_loadout_editor_v3.desc", "A tool used to set loadout on LFS/LVS-Vehicles" )
language.Add( "tool.sw_loadout_editor_v3.0", "Left click on a LFS/LVS-Vehicle to set loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_loadout_editor_v3.1", "Left click on a LFS/LVS-Vehicle to set loadout,Right click to set 0 loadout." )
language.Add( "tool.sw_loadout_editor_v3.loadout", "Loadout" )
end
function TOOL:LeftClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.Loadouts) then
ent:SetLoadout( self:GetClientNumber( "loadout" ) )
end
return true
end
function TOOL:RightClick( trace )
local ent = trace.Entity
if not IsValid( ent ) or not (ent.LFS or ent.LVS) then return false end
if isnumber(ent.Loadouts) then
ent:SetLoadout(0)
end
return true
end
function TOOL:Reload( trace )
end
function TOOL:Think()
end
function TOOL.BuildCPanel( panel )
panel:AddControl( "Header", { Text = "#tool.sw_loadout_editor_v3.name", Description = "#tool.sw_loadout_editor_v3.desc" } )
panel:AddControl( "Slider",
{
Label = "#tool.sw_loadout_editor_v3.loadout",
Type = "Int",
Min = "0",
Max = "50",
Command = "sw_loadout_editor_v3_loadout",
Help = false
})
end

View File

@@ -0,0 +1,180 @@
include("shared.lua")
local posX = {
0.29,
0.5,
0.71,
0.71,
0.71,
0.5,
0.29,
0.29,
}
local posY = {
0.29,
0.29,
0.29,
0.5,
0.71,
0.71,
0.71,
0.5,
}
local COLOR_GREEN = Color(0,255,0,255)
local COLOR_BLACK = Color(0,0,0,255)
local COLOR_WHITE = Color(255,255,255,255)
local COLOR_WHITE_HOVERED = Color(200,200,200,150)
local HOOK_ADDED = false
local LANGUAGE
local ints = {
[8] = 1,
[2] = 2,
[4] = 3,
}
local function DrawCircle( X, Y, radius )
local segmentdist = 360 / ( 2 * math.pi * radius / 2 )
for a = 0, 360, segmentdist do
surface.DrawLine( X + math.cos( math.rad( a ) ) * radius, Y - math.sin( math.rad( a ) ) * radius, X + math.cos( math.rad( a + segmentdist ) ) * radius, Y - math.sin( math.rad( a + segmentdist ) ) * radius )
end
end
function SWEP:DrawHUD()
local X = ScrW()
local Y = ScrH()
if self.Zoom.Val == 0 then
local tr = self.Owner:GetEyeTrace()
if IsValid(tr.Entity) and tr.StartPos:DistToSqr(tr.HitPos) < self.MaxPairDistance then
if (tr.Entity.LVS or tr.Entity.LFS or (tr.Entity.SWBombV3 and tr.Entity.HaveGuidance)) and tr.Entity:GetNWBool("HaveDesignator") == false then
if !IsValid(self:GetNWEntity("PairedObj")) then
draw.DrawText("Click to pair designator","Trebuchet24",X*0.5,Y*0.25,color_white,TEXT_ALIGN_CENTER)
else
return
end
end
end
end
if IsValid(self:GetNWEntity("Projectile")) then
local Pos = self:GetNWVector("TarPos"):ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
DrawCircle( Pos.x, Pos.y, 10 )
local Pos2 = self:GetNWEntity("Projectile"):GetPos():ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetMaterial(Material("icons/mis.png"))
surface.DrawTexturedRect(Pos2.x,Pos2.y,25,25)
end
if IsValid(self:GetNWEntity("PairedObj")) and self:GetNWEntity("PairedObj").SWBombV3 then
local Pos = self:GetNWVector("TarPos"):ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
DrawCircle( Pos.x, Pos.y, 10 )
local Pos2 = self:GetNWEntity("PairedObj"):GetPos():ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetMaterial(Material("icons/mis.png"))
surface.DrawTexturedRect(Pos2.x,Pos2.y,25,25)
end
if IsValid(self:GetNWEntity("PairedObj")) and not self:GetNWEntity("PairedObj").SWBombV3 then
local Pos = self:GetNWEntity("PairedObj"):GetPos():ToScreen()
surface.SetDrawColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetMaterial(Material("icons/plane.png"))
surface.DrawTexturedRect(Pos.x,Pos.y,25,25)
end
surface.SetDrawColor(0,0,0,self.Zoom.Val*255)
surface.SetTexture(surface.GetTextureID("models/sw/shared/sights/binoculars"))
surface.DrawTexturedRect(0,-(X-Y)/2,X,X)
local tr = self.Owner:GetEyeTrace()
local range = (math.ceil(100*(tr.StartPos:Distance(tr.HitPos)*0.024))/100)
if tr.HitSky then
range = "-"
else
range = range.."m"
end
surface.SetTextColor( 255, 255, 255, self.Zoom.Val*255 )
surface.SetTextPos( (X*0.165), (Y/2) )
surface.DrawText( "Range: "..range )
surface.SetTextPos( (X*0.165), (Y/2) + 16)
surface.DrawText( "X: "..(math.ceil(100*tr.HitPos.x))/100)
surface.SetTextPos( (X*0.165), (Y/2) + 32)
surface.DrawText( "Y: "..(math.ceil(100*tr.HitPos.y)/100) )
surface.SetTextPos( (X*0.165), (Y/2) + 48)
surface.DrawText( "Z: "..(math.ceil(100*tr.HitPos.z)/100) )
if self:GetNWBool("NVG") == true then
surface.SetTextPos( (X*0.165), (Y/2) + 64)
surface.DrawText( "NVG: ON" )
local dlight = DynamicLight(self:EntIndex())
dlight.r = self.Zoom.Val*255
dlight.g = self.Zoom.Val*255
dlight.b = self.Zoom.Val*255
dlight.minlight = 0
dlight.style = 0
dlight.Brightness = self.Zoom.Val*0.1
dlight.Pos = EyePos()
dlight.Size = self.Zoom.Val*2048
dlight.Decay = self.Zoom.Val*10000
dlight.DieTime = CurTime() + 0.1
local mat_color = Material( "pp/colour" )
render.UpdateScreenEffectTexture()
mat_color:SetTexture( "$fbtexture", render.GetScreenEffectTexture() )
mat_color:SetFloat( "$pp_colour_addr", -self.Zoom.Val*255 )
mat_color:SetFloat( "$pp_colour_addg", 0 )
mat_color:SetFloat( "$pp_colour_addb", 0)
mat_color:SetFloat( "$pp_colour_mulr", 0 )
mat_color:SetFloat( "$pp_colour_mulg", 0 )
mat_color:SetFloat( "$pp_colour_mulb", 0 )
mat_color:SetFloat( "$pp_colour_brightness", self.Zoom.Val*0.01 )
mat_color:SetFloat( "$pp_colour_contrast", 1+self.Zoom.Val*5 )
mat_color:SetFloat( "$pp_colour_colour", 1 )
render.SetMaterial( mat_color )
render.DrawScreenQuad()
DrawBloom(self.Zoom.Val*0.5,self.Zoom.Val*1,self.Zoom.Val*10,self.Zoom.Val*10,self.Zoom.Val*2,self.Zoom.Val*1,self.Zoom.Val*1,self.Zoom.Val*1,self.Zoom.Val*1)
else
surface.SetTextPos( (X*0.165), (Y/2) + 64)
surface.DrawText( "NVG: OFF" )
end
end
function SWEP:CalcView(ply,pos,ang,fov)
return pos,ang,fov - (self.Zoom.Val * self.Zoom.FOV)
end
function SWEP:AdjustMouseSensitivity()
return self.Owner:KeyDown(IN_ATTACK2) and 0.1 or 1
end
function SWEP:CalcViewModelView(ViewModel,OldEyePos)
if self.Zoom.Val > 0.8 then
return Vector(0,0,0)
else
return OldEyePos - Vector(0,0,1.3)
end
end
function SWEP:Think()
local keydown = self.Owner:KeyDown(IN_ATTACK2)
self.Zoom.Val = math.Clamp(self.Zoom.Val + (keydown and self.Zoom.Rate or -self.Zoom.Rate),0,1)
if keydown and not self.IsZooming then
self.IsZooming = true
self.IsUnZooming = false
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
elseif !keydown and not self.IsUnZooming and self.IsZooming then
self.IsZooming = false
self.IsUnZooming = true
self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
end
if keydown then
local Zoom = self.Zoom.FOV
local ZoomSwitch = self.Owner:KeyDown(IN_SPEED)
if self.OldZoomSwitch ~= ZoomSwitch then
if ZoomSwitch and Zoom == 70 then
self.Zoom.FOV = 40
elseif ZoomSwitch and Zoom == 40 then
self.Zoom.FOV = 70
end
self.OldZoomSwitch = ZoomSwitch
end
local NVGSwitch = self.Owner:KeyDown(IN_ZOOM)
if self.OldNVGSwitch ~= NVGSwitch then
if NVGSwitch and self:GetNWBool("NVG") == true then
self:SetNWBool("NVG",false)
self:EmitSound("sw/misc/nv_off.wav")
elseif NVGSwitch and self:GetNWBool("NVG") == false then
self:SetNWBool("NVG",true)
self:EmitSound("sw/misc/nv_on.wav")
end
self.OldNVGSwitch = NVGSwitch
end
end
end

View File

@@ -0,0 +1,64 @@
include("shared.lua")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function SWEP:PrimaryAttack()
if self.Owner:KeyDown(IN_ATTACK2) then
if IsValid(self:GetNWEntity("PairedObj")) then
if self:GetNWEntity("PairedObj").SWBombV3 and self:GetNWEntity("PairedObj").HaveGuidance then
local tr = self.Owner:GetEyeTrace()
self:GetNWEntity("PairedObj").GuidanceActive = true
self:GetNWEntity("PairedObj").target = tr.Entity
self:GetNWEntity("PairedObj").targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
self:SetNWVector("TarPos", tr.HitPos )
self:EmitSound("sw/misc/point.wav")
print(tr.HitPos)
end
if IsValid(self:GetNWEntity("PairedObj"):GetNWEntity("Missile")) then
if self:GetNWEntity("PairedObj"):GetNWEntity("Missile").SWBombV3 and self:GetNWEntity("PairedObj"):GetNWEntity("Missile").HaveGuidance then
local tr = self.Owner:GetEyeTrace()
self:SetNWEntity("Projectile",self:GetNWEntity("PairedObj"):GetNWEntity("Missile"))
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").GuidanceActive = true
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").LaserGuided = false
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").target = tr.Entity
self:GetNWEntity("PairedObj"):GetNWEntity("Missile").targetOffset = tr.Entity:WorldToLocal(tr.HitPos)
self:SetNWVector("TarPos", tr.HitPos )
self:EmitSound("sw/misc/point.wav")
print(tr.HitPos)
end
end
end
end
if self.Owner:KeyDown(IN_ATTACK2) then return end
local tr = self.Owner:GetEyeTrace()
if IsValid(tr.Entity) and tr.StartPos:DistToSqr(tr.HitPos) < self.MaxPairDistance then
if ((tr.Entity.LVS or tr.Entity.LFS) and tr.Entity.Pairable ) or (tr.Entity.SWBombV3 and tr.Entity.HaveGuidance) then
if !IsValid(self:GetNWEntity("PairedObj")) then
tr.Entity:SetNWBool("HaveDesignator",true)
self:SetNWEntity("PairedObj",tr.Entity)
self:SetNWBool("Paired",true)
self.Owner:PrintMessage(HUD_PRINTCENTER,"You have paired target designator with:"..self:GetNWEntity("PairedObj").PrintName)
else
return
end
end
end
end
function SWEP:SecondaryAttack()
end
function SWEP:CanReload(ct)
return self.NextReload <= ct
end
function SWEP:Reload()
local ct = CurTime()
if not self:CanReload(ct) then return end
self.NextReload = ct + 0.3
end
function SWEP:OnRemove()
if IsValid(self) and IsValid(self:GetNWEntity("PairedObj")) then
self:GetNWEntity("PairedObj"):SetNWBool("HaveDesignator",false)
self:SetNWEntity("PairedObj",nil)
self:SetNWBool("Paired",false)
end
end

View File

@@ -0,0 +1,98 @@
AddCSLuaFile()
SWEP.Base = "weapon_base"
SWEP.Spawnable = true
SWEP.AdminSpawnable = false
SWEP.MaxPairDistance = 500^2
SWEP.Category = "SW Weapons Factory"
SWEP.Author = "Shermann Wolf"
SWEP.Contact = "shermannwolf@gmail.com"
SWEP.Purpose = ""
SWEP.Instructions = "Right click on bomb/missile/aircraft to pair it with your laser pointer,and left click to point target for it"
SWEP.PrintName = "Laser target designator"
SWEP.WorldModel = "models/sw/shared/weapons/w_binoculars.mdl"
SWEP.ViewModel = "models/sw/shared/weapons/v_binoculars.mdl"
SWEP.TarPos = nil
SWEP.Primary = {
Ammo = "None",
ClipSize = -1,
DefaultClip = -1,
Automatic = false,
NextShot = 0,
FireRate = 0.00001
}
SWEP.Secondary = SWEP.Primary
SWEP.NextReload = 0
SWEP.DrawAmmo = false
SWEP.Zoom = {}
SWEP.Zoom.FOV = 70
SWEP.Zoom.Rate = 0.035
SWEP.Zoom.Val = 0
SWEP.UseHands = true
local pairs = pairs
local IsValid = IsValid
local CLIENT = CLIENT
local SERVER = SERVER
local SINGLEPLAYER = game.SinglePlayer()
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
return true
end
function SWEP:Initialize()
self:SetNWEntity("PairedObj",nil)
self:SetNWEntity("Projectile",nil)
self:SetNWBool("Paired",false)
self:SetHoldType("camera")
end
function SWEP:Holster(wep)
return true
end
function SWEP:DrawHUD()
surface.SetDrawColor(0,0,0,self.Zoom.Val*255)
surface.SetTexture(surface.GetTextureID("models/sw/shared/sights/binoculars"))
local X = ScrW()
local Y = ScrH()
surface.DrawTexturedRect(0,-(X-Y)/2,X,X)
end
function SWEP:CalcViewModelView(ViewModel,OldEyePos)
if self.Zoom.Val > 0.8 then
return Vector(0,0,0)
else
return OldEyePos - Vector(0,0,1.3)
end
end
function SWEP:Think()
local keydown = self.Owner:KeyDown(IN_ATTACK2)
self.Zoom.Val = math.Clamp(self.Zoom.Val + (keydown and 0.1 or -0.1),0,1)
if keydown and not self.IsZooming then
self.IsZooming = true
self.IsUnZooming = false
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
elseif !keydown and not self.IsUnZooming and self.IsZooming then
self.IsZooming = false
self.IsUnZooming = true
self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
end
end
function SWEP:CalcView(ply,pos,ang,fov)
fov = fov - (self.Zoom.Val*self.Zoom.FOV)
return pos,ang,fov
end
function SWEP:AdjustMouseSensitivity()
return self.Owner:KeyDown(IN_ATTACK2) and 0.1 or 1
end
function SWEP:CanPrimaryAttack(ct)
return self.Primary.NextShot <= ct
end
function SWEP:PrimaryAttack()
local ct = CurTime()
if not self:CanPrimaryAttack(ct) then return end
self.Primary.NextShot = ct + self.Primary.FireRate
end
function SWEP:CanSecondaryAttack(ct)
end
function SWEP:SecondaryAttack()
end
function SWEP:CanReload(ct)
end
function SWEP:Reload()
end

View File

@@ -0,0 +1,215 @@
AddCSLuaFile()
SWEP.Category = "[LVS]"
SWEP.Spawnable = false
SWEP.AdminSpawnable = false
SWEP.ViewModel = "models/weapons/c_fuelfillerlvs.mdl"
SWEP.WorldModel = "models/props_equipment/gas_pump_p13.mdl"
SWEP.UseHands = true
SWEP.HoldType = "slam"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.RangeToCap = 24
SWEP.HitDistance = 128
function SWEP:GetTank( entity )
if entity.lvsGasStationRefillMe then
return entity
end
if not entity.LVS or not entity.GetFuelTank then return NULL end
if not (entity:GetVehicleType() == "helicopter" or entity:GetVehicleType() == "plane") then return end
return entity:GetFuelTank()
end
function SWEP:GetCap( entity )
if entity.lvsGasStationRefillMe then
return entity
end
if not entity.LVS or not entity.GetFuelTank then return NULL end
if not (entity:GetVehicleType() == "helicopter" or entity:GetVehicleType() == "plane") then return end
local FuelTank = entity:GetFuelTank()
if not IsValid( FuelTank ) then return NULL end
return FuelTank:GetDoorHandler()
end
if CLIENT then
SWEP.PrintName = "Aircraft fuel Filler Pistol"
SWEP.Slot = 1
SWEP.SlotPos = 3
SWEP.DrawWeaponInfoBox = false
function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
end
function SWEP:DrawWorldModel()
local ply = self:GetOwner()
if not IsValid( ply ) then return end
local id = ply:LookupAttachment("anim_attachment_rh")
local attachment = ply:GetAttachment( id )
if not attachment then return end
local pos = attachment.Pos + attachment.Ang:Forward() * 6 + attachment.Ang:Right() * -1.5 + attachment.Ang:Up() * 2.2
local ang = attachment.Ang
ang:RotateAroundAxis(attachment.Ang:Up(), 20)
ang:RotateAroundAxis(attachment.Ang:Right(), -30)
ang:RotateAroundAxis(attachment.Ang:Forward(), 0)
self:SetRenderOrigin( pos )
self:SetRenderAngles( ang )
self:DrawModel()
end
local function DrawText( pos, text, col )
local data2D = pos:ToScreen()
if not data2D.visible then return end
local font = "TargetIDSmall"
local x = data2D.x
local y = data2D.y
draw.SimpleText( text, font, x + 1, y + 1, Color( 0, 0, 0, 120 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
draw.SimpleText( text, font, x + 2, y + 2, Color( 0, 0, 0, 50 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
draw.SimpleText( text, font, x, y, col or color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
function SWEP:DrawHUD()
local ply = self:GetOwner()
if not IsValid( ply ) then return end
local startpos = ply:GetShootPos()
local endpos = startpos + ply:GetAimVector() * self.HitDistance
local trace = util.TraceLine( {
start = startpos ,
endpos = endpos,
filter = ply,
mask = MASK_SHOT_HULL
} )
if not IsValid( trace.Entity ) then
trace = util.TraceHull( {
start = startpos ,
endpos = endpos,
filter = ply,
mins = Vector( -10, -10, -8 ),
maxs = Vector( 10, 10, 8 ),
mask = MASK_SHOT_HULL
} )
end
local FuelTank = self:GetTank( trace.Entity )
local FuelCap = self:GetCap( trace.Entity )
if not IsValid( FuelTank ) then return end
if not IsValid( FuelCap ) then
DrawText( trace.HitPos, math.Round(FuelTank:GetFuel() * 100,1).."%", Color(0,255,0,255) )
return
end
if FuelCap:IsOpen() then
if (trace.HitPos - FuelCap:GetPos()):Length() > self.RangeToCap then
DrawText( trace.HitPos, "Aim at Fuel Cap!", Color(255,255,0,255) )
else
DrawText( trace.HitPos, math.Round(FuelTank:GetFuel() * 100,1).."%", Color(0,255,0,255) )
end
return
end
local Key = input.LookupBinding( "+use" )
if not isstring( Key ) then Key = "[+use is not bound to a key]" end
DrawText( FuelCap:GetPos(), "Press "..Key.." to Open", Color(255,255,0,255) )
end
end
function SWEP:Initialize()
self:SetHoldType( self.HoldType )
end
function SWEP:PrimaryAttack()
self:SetNextPrimaryFire( CurTime() + 0.5 )
local ply = self:GetOwner()
if not IsValid( ply ) then return end
local startpos = ply:GetShootPos()
local endpos = startpos + ply:GetAimVector() * self.HitDistance
local trace = util.TraceLine( {
start = startpos ,
endpos = endpos,
filter = ply,
mask = MASK_SHOT_HULL
} )
if not IsValid( trace.Entity ) then
trace = util.TraceHull( {
start = startpos ,
endpos = endpos,
filter = ply,
mins = Vector( -10, -10, -8 ),
maxs = Vector( 10, 10, 8 ),
mask = MASK_SHOT_HULL
} )
end
self:Refuel( trace )
end
function SWEP:SecondaryAttack()
end
function SWEP:Refuel( trace )
local entity = trace.Entity
if CLIENT or not IsValid( entity ) then return end
local FuelCap = self:GetCap( entity )
local FuelTank = self:GetTank( entity )
if not IsValid( FuelTank ) or FuelTank:GetDestroyed() then return end
if FuelTank:GetBase():GetEngineActive() then
FuelTank:SetDestroyed(true)
end
if IsValid( FuelCap ) then
if not FuelCap:IsOpen() then return end
if (trace.HitPos - FuelCap:GetPos()):Length() > self.RangeToCap then return end
end
if FuelTank:GetFuel() ~= 1 then
FuelTank:SetFuel( math.min( FuelTank:GetFuel() + (entity.lvsGasStationFillSpeed or 0.05), 1 ) )
entity:OnRefueled()
end
end