mirror of
https://github.com/SpaxscE/simfphys_armed.git
synced 2025-03-04 03:13:26 -05:00
armed apc and some test weapons
This commit is contained in:
parent
8c45e89ad2
commit
bff58efa53
10
addon.json
Normal file
10
addon.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"title" : "simfphys armed vehicles",
|
||||
"type" : "vehicle",
|
||||
"tags" : [ "fun", "build" ],
|
||||
"ignore" : [
|
||||
"*.psd",
|
||||
"*.vcproj",
|
||||
"*.svn*"
|
||||
]
|
||||
}
|
344
lua/autorun/simfphys_spawnlist_armed.lua
Normal file
344
lua/autorun/simfphys_spawnlist_armed.lua
Normal file
@ -0,0 +1,344 @@
|
||||
local light_table = {
|
||||
L_HeadLampPos = Vector(20.15,133,21),
|
||||
L_HeadLampAng = Angle(15,90,0),
|
||||
R_HeadLampPos = Vector(-54.51,133,21),
|
||||
R_HeadLampAng = Angle(15,90,0),
|
||||
|
||||
L_RearLampPos = Vector(-62.74,-161,27),
|
||||
L_RearLampAng = Angle(40,-90,0),
|
||||
R_RearLampPos = Vector(28.33,-161,27),
|
||||
R_RearLampAng = Angle(40,-90,0),
|
||||
|
||||
Headlight_sprites = {
|
||||
Vector(29.15,133,21),
|
||||
Vector(-63.66,133,21),
|
||||
},
|
||||
Headlamp_sprites = {
|
||||
Vector(20.15,133,21),
|
||||
Vector(-54.51,133,21),
|
||||
},
|
||||
Rearlight_sprites = {
|
||||
Vector(-62.74,-161,27),
|
||||
Vector(28.33,-161,27)
|
||||
},
|
||||
Brakelight_sprites = {
|
||||
Vector(-62.74,-161,27),
|
||||
Vector(28.33,-161,27)
|
||||
}
|
||||
}
|
||||
list.Set( "simfphys_lights", "conapc_armed", light_table)
|
||||
|
||||
local V = {
|
||||
Name = "HL2 APC",
|
||||
Model = "models/apc/apc.mdl",
|
||||
Class = "gmod_sent_vehicle_fphysics_base",
|
||||
Category = "Armed Vehicles",
|
||||
SpawnOffset = Vector(0,0,60),
|
||||
|
||||
Members = {
|
||||
Mass = 4800,
|
||||
|
||||
LightsTable = "conapc_armed",
|
||||
|
||||
FrontWheelRadius = 32,
|
||||
RearWheelRadius = 32,
|
||||
|
||||
SeatOffset = Vector(375,-13,-58),
|
||||
SeatPitch = 0,
|
||||
|
||||
CustomMassCenter = Vector(0,0,-12),
|
||||
|
||||
PassengerSeats = {
|
||||
},
|
||||
|
||||
Attachments = {
|
||||
{
|
||||
model = "models/hunter/plates/plate075x105.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
pos = Vector(0.04-18,57.5-15,16.74),
|
||||
ang = Angle(90,-90,0),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
pos = Vector(-25.08-18,91.34-15,29.46),
|
||||
ang = Angle(4.2,-109.19,68.43),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(-24.63-18,77.76-15,8.65),
|
||||
ang = Angle(24.05,-12.81,-1.87),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(24.63-18,77.76-15,8.65),
|
||||
ang = Angle(24.05,-167.19,1.87),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(-30.17-18,61.36-15,32.79),
|
||||
ang = Angle(-1.21,-92.38,-130.2),
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(30.17-18,61.36-15,32.79),
|
||||
ang = Angle(-1.21,-87.62,130.2),
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(-18,72.92-15,40.54),
|
||||
ang = Angle(0,-180,0.79),
|
||||
model = "models/hunter/plates/plate1x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(25.08-18,91.34-15,29.46),
|
||||
ang = Angle(4.2,-70.81,-68.43),
|
||||
model = "models/hunter/plates/plate025x05.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(-29.63-18,79.02-15,19.28),
|
||||
ang = Angle(90,-18,0),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(29.63-18,79.02-15,19.28),
|
||||
ang = Angle(90,-162,0),
|
||||
model = "models/hunter/plates/plate05x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(-18,75.33-15,5.91),
|
||||
ang = Angle(0,0,0),
|
||||
model = "models/hunter/plates/plate1x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(-18,98.02-15,35.74),
|
||||
ang = Angle(63,90,0),
|
||||
model = "models/hunter/plates/plate025x025.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
},
|
||||
{
|
||||
pos = Vector(-18,100.55-15,7.41),
|
||||
ang = Angle(90,-90,0),
|
||||
model = "models/hunter/plates/plate1x1.mdl",
|
||||
material = "lights/white",
|
||||
color = Color(0,0,0,255),
|
||||
nosolid = true
|
||||
}
|
||||
},
|
||||
|
||||
Weapons = true,
|
||||
LimitView = true,
|
||||
--[[
|
||||
Weapons = {
|
||||
{
|
||||
weaponname = "simfphys_apcturret",
|
||||
pos = Vector(5,-35,0),
|
||||
ang = Angle(0,0,0),
|
||||
follow_eyeangles = false,
|
||||
attachment = "muzzle",
|
||||
}
|
||||
},
|
||||
]]--
|
||||
|
||||
FrontHeight = 22,
|
||||
FrontConstant = 50000,
|
||||
FrontDamping = 4000,
|
||||
FrontRelativeDamping = 4000,
|
||||
|
||||
RearHeight = 22,
|
||||
RearConstant = 50000,
|
||||
RearDamping = 4000,
|
||||
RearRelativeDamping = 4000,
|
||||
|
||||
FastSteeringAngle = 10,
|
||||
SteeringFadeFastSpeed = 535,
|
||||
|
||||
TurnSpeed = 8,
|
||||
|
||||
MaxGrip = 140,
|
||||
Efficiency = 1.25,
|
||||
GripOffset = -14,
|
||||
BrakePower = 120,
|
||||
|
||||
IdleRPM = 750,
|
||||
LimitRPM = 5500,
|
||||
PeakTorque = 180,
|
||||
PowerbandStart = 1000,
|
||||
PowerbandEnd = 4500,
|
||||
Turbocharged = false,
|
||||
Supercharged = false,
|
||||
|
||||
PowerBias = 0,
|
||||
|
||||
EngineSoundPreset = 0,
|
||||
|
||||
Sound_Idle = "simulated_vehicles/misc/Nanjing_loop.wav",
|
||||
Sound_IdlePitch = 1,
|
||||
|
||||
Sound_Mid = "simulated_vehicles/misc/m50.wav",
|
||||
Sound_MidPitch = 1,
|
||||
Sound_MidVolume = 1,
|
||||
Sound_MidFadeOutRPMpercent = 58,
|
||||
Sound_MidFadeOutRate = 0.476,
|
||||
|
||||
Sound_High = "simulated_vehicles/misc/v8high2.wav",
|
||||
Sound_HighPitch = 1,
|
||||
Sound_HighVolume = 0.75,
|
||||
Sound_HighFadeInRPMpercent = 58,
|
||||
Sound_HighFadeInRate = 0.19,
|
||||
|
||||
Sound_Throttle = "",
|
||||
Sound_ThrottlePitch = 0,
|
||||
Sound_ThrottleVolume = 0,
|
||||
|
||||
DifferentialGear = 0.27,
|
||||
Gears = {-0.09,0,0.09,0.18,0.28,0.35}
|
||||
}
|
||||
}
|
||||
list.Set( "simfphys_vehicles", "sim_fphys_conscriptapc_armed", V )
|
||||
|
||||
if (!armedAPCSTable) then -- lets make sure we dont ruin all the spawned vehicles when reloading this luafile
|
||||
armedAPCSTable = {}
|
||||
end
|
||||
|
||||
hook.Add("PlayerSpawnedVehicle","simfphys_armedvehicles", function( ply, vehicle )
|
||||
if (vehicle:GetModel( ) == "models/apc/apc.mdl") then
|
||||
timer.Simple( 0.2, function()
|
||||
if (!IsValid(vehicle)) then return end
|
||||
if (vehicle:GetClass() == "gmod_sent_vehicle_fphysics_base" and vehicle.Weapons == true) then
|
||||
table.insert(armedAPCSTable, vehicle)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
local function HandleAPCWeapons( vehicle )
|
||||
local curtime = CurTime()
|
||||
local pod = vehicle:GetDriverSeat()
|
||||
local ply = pod:GetDriver()
|
||||
|
||||
if (!IsValid(ply)) then return end
|
||||
|
||||
local tr = util.TraceLine( {
|
||||
start = ply:EyePos(),
|
||||
endpos = ply:EyePos() + ply:EyeAngles():Forward() * 10000,
|
||||
filter = {vehicle}
|
||||
} )
|
||||
local Aimpos = tr.HitPos
|
||||
|
||||
local ID = vehicle:LookupAttachment( "muzzle" )
|
||||
local Attachment = vehicle:GetAttachment( ID )
|
||||
|
||||
vehicle.wOldPos = vehicle.wOldPos or Vector(0,0,0)
|
||||
local deltapos = vehicle:GetPos() - vehicle.wOldPos
|
||||
vehicle.wOldPos = vehicle:GetPos()
|
||||
|
||||
local a_forward = Attachment.Ang:Forward()
|
||||
local a_right = Attachment.Ang:Right()
|
||||
local a_up = Attachment.Ang:Up()
|
||||
|
||||
local shootOrigin = Attachment.Pos + a_forward * 50 + a_right * 0 + a_up * 7 + deltapos * engine.TickInterval()
|
||||
|
||||
local Aimang = (Aimpos - shootOrigin):Angle()
|
||||
|
||||
local Angles = vehicle:WorldToLocalAngles( Aimang - Angle(0,90,0) )
|
||||
Angles:Normalize()
|
||||
Angles.y = (Angles.y / 180) * 120
|
||||
|
||||
vehicle.sm_pp_yaw = vehicle.sm_pp_yaw and (vehicle.sm_pp_yaw + (Angles.y - vehicle.sm_pp_yaw) * 0.1) or 0
|
||||
vehicle:SetPoseParameter("vehicle_weapon_yaw", vehicle.sm_pp_yaw )
|
||||
--vehicle:SetPoseParameter("vehicle_weapon_pitch", Angles.p )
|
||||
|
||||
local fire = ply:KeyDown( IN_ATTACK )
|
||||
|
||||
if (!fire) then return end
|
||||
|
||||
vehicle.NextShoot = vehicle.NextShoot or 0
|
||||
if ( vehicle.NextShoot > curtime ) then return end
|
||||
|
||||
vehicle.NextShoot = curtime + 0.4
|
||||
|
||||
vehicle:EmitSound("simulated_vehicles/weapons/apc_fire"..math.Round(math.random(1,4),0)..".wav")
|
||||
|
||||
local bullet = {}
|
||||
bullet.Num = 1
|
||||
bullet.Src = shootOrigin
|
||||
bullet.Dir = Aimang:Forward()
|
||||
bullet.Spread = Vector(0.03,0.03,0)
|
||||
bullet.Tracer = 0
|
||||
bullet.Force = 10
|
||||
bullet.Damage = 80
|
||||
bullet.HullSize = 20
|
||||
bullet.Callback = function(att, tr, dmginfo)
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( tr.HitPos )
|
||||
util.Effect( "helicoptermegabomb", effectdata, true, true )
|
||||
|
||||
util.BlastDamage( vehicle, ply, tr.HitPos, 150,80 )
|
||||
|
||||
util.Decal("scorch", tr.HitPos - tr.HitNormal, tr.HitPos + tr.HitNormal)
|
||||
|
||||
sound.Play( Sound( "ambient/explosions/explode_1.wav" ), tr.HitPos, 75, 200, 1 )
|
||||
end
|
||||
bullet.Attacker = ply
|
||||
vehicle:FireBullets( bullet )
|
||||
|
||||
if (vehicle.swapMuzzle) then
|
||||
vehicle.swapMuzzle = false
|
||||
else
|
||||
vehicle.swapMuzzle = true
|
||||
end
|
||||
local s_Pos = vehicle.swapMuzzle and -2 or 2
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( shootOrigin + a_up * s_Pos )
|
||||
effectdata:SetAngles( Attachment.Ang )
|
||||
effectdata:SetScale( 1.5 )
|
||||
util.Effect( "MuzzleEffect", effectdata, true, true )
|
||||
|
||||
vehicle:GetPhysicsObject():ApplyForceOffset( -Aimang:Forward() * 120000, shootOrigin )
|
||||
end
|
||||
|
||||
hook.Add("Think", "simfphys_weaponhandler", function()
|
||||
if (armedAPCSTable) then
|
||||
for k, v in pairs(armedAPCSTable) do
|
||||
if (IsValid(v)) then
|
||||
HandleAPCWeapons( v )
|
||||
else
|
||||
armedAPCSTable[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
88
lua/entities/simfphys_apcturret/init.lua
Normal file
88
lua/entities/simfphys_apcturret/init.lua
Normal file
@ -0,0 +1,88 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include('shared.lua')
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
|
||||
if ( !tr.Hit ) then return end
|
||||
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal * 20 )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/weapons/w_smg1.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
|
||||
self.OldPos = Vector(0,0,0)
|
||||
self.Left = true
|
||||
end
|
||||
|
||||
|
||||
function ENT:Think()
|
||||
local Fire = self:GetFire()
|
||||
local Attacker = self:GetAttacker()
|
||||
if (Fire == true and IsValid(Attacker)) then
|
||||
self.NextShoot = self.NextShoot or 0
|
||||
if ( self.NextShoot < CurTime() ) then
|
||||
self:FireWeapon(Attacker)
|
||||
self.NextShoot = CurTime() + 0.4
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:FireWeapon(ply)
|
||||
self:EmitSound("simulated_vehicles/weapons/apc_fire"..math.Round(math.random(1,4),0)..".wav")
|
||||
|
||||
local deltapos = self:GetPos() - self.OldPos
|
||||
self.OldPos = self:GetPos()
|
||||
|
||||
if (self.Left) then
|
||||
self.Left = false
|
||||
else
|
||||
self.Left = true
|
||||
end
|
||||
local Switchpos = self.Left and -2 or 2
|
||||
|
||||
local shootOrigin = self:LocalToWorld( Vector(15,0,2.2 + Switchpos) ) + deltapos * engine.TickInterval()
|
||||
local shootAngles = ply:EyeAngles() - Angle(10,0,0)
|
||||
|
||||
local bullet = {}
|
||||
bullet.Num = 1
|
||||
bullet.Src = shootOrigin
|
||||
bullet.Dir = shootAngles:Forward()
|
||||
bullet.Spread = Vector(0.03,0.03,0)
|
||||
bullet.Tracer = 0
|
||||
bullet.Force = 10
|
||||
bullet.Damage = 80
|
||||
bullet.HullSize = 20
|
||||
bullet.Callback = function(att, tr, dmginfo)
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( tr.HitPos )
|
||||
util.Effect( "helicoptermegabomb", effectdata, true, true )
|
||||
|
||||
util.BlastDamage( self, ply, tr.HitPos, 150,80 )
|
||||
|
||||
util.Decal("scorch", tr.HitPos - tr.HitNormal, tr.HitPos + tr.HitNormal)
|
||||
|
||||
sound.Play( Sound( "ambient/explosions/explode_1.wav" ), tr.HitPos, 75, 200, 1 )
|
||||
end
|
||||
bullet.Attacker = ply
|
||||
self:FireBullets( bullet )
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( shootOrigin )
|
||||
effectdata:SetAngles( shootAngles )
|
||||
effectdata:SetScale( math.random(1.5,3) )
|
||||
util.Effect( "MuzzleEffect", effectdata, true, true )
|
||||
end
|
16
lua/entities/simfphys_apcturret/shared.lua
Normal file
16
lua/entities/simfphys_apcturret/shared.lua
Normal file
@ -0,0 +1,16 @@
|
||||
ENT.Type = "anim"
|
||||
|
||||
|
||||
ENT.PrintName = "simfphys apcturret"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Category = "Fun + Games"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminOnly = false
|
||||
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool",0, "Fire" )
|
||||
self:NetworkVar( "Entity",0, "Attacker" )
|
||||
end
|
72
lua/entities/simfphys_ar2/init.lua
Normal file
72
lua/entities/simfphys_ar2/init.lua
Normal file
@ -0,0 +1,72 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include('shared.lua')
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
|
||||
if ( !tr.Hit ) then return end
|
||||
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal * 20 )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/weapons/w_smg1.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
end
|
||||
|
||||
|
||||
function ENT:Think()
|
||||
local Fire = self:GetFire()
|
||||
local Attacker = self:GetAttacker()
|
||||
if (Fire == true and IsValid(Attacker)) then
|
||||
self.NextShoot = self.NextShoot or 0
|
||||
if ( self.NextShoot < CurTime() ) then
|
||||
self:FireWeapon(Attacker)
|
||||
self.NextShoot = CurTime() + 0.125
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:FireWeapon(ply)
|
||||
self:EmitSound("Weapon_AR2.Single")
|
||||
|
||||
local shootOrigin = self:GetPos() + self:GetVelocity() * engine.TickInterval()
|
||||
local shootAngles = self:GetAngles()
|
||||
|
||||
local bullet = {}
|
||||
bullet.Num = 1
|
||||
bullet.Src = shootOrigin
|
||||
bullet.Dir = shootAngles:Forward()
|
||||
bullet.Spread = Vector(0.03,0.03,0)
|
||||
bullet.Tracer = 1
|
||||
bullet.TracerName = "AirboatGunHeavyTracer"
|
||||
bullet.Force = 3
|
||||
bullet.Damage = 20
|
||||
bullet.HullSize = 10
|
||||
bullet.Callback = function(att, tr, dmginfo)
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( tr.HitPos + tr.HitNormal * 2 )
|
||||
effectdata:SetNormal( tr.HitNormal )
|
||||
util.Effect( "AR2Impact", effectdata, true, true )
|
||||
end
|
||||
bullet.Attacker = ply
|
||||
self:FireBullets( bullet )
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( shootOrigin )
|
||||
effectdata:SetAngles(shootAngles )
|
||||
effectdata:SetEntity( self )
|
||||
effectdata:SetAttachment( self:LookupAttachment("muzzle") )
|
||||
util.Effect( "AirboatMuzzleFlash", effectdata, true, true )
|
||||
end
|
16
lua/entities/simfphys_ar2/shared.lua
Normal file
16
lua/entities/simfphys_ar2/shared.lua
Normal file
@ -0,0 +1,16 @@
|
||||
ENT.Type = "anim"
|
||||
|
||||
|
||||
ENT.PrintName = "simfphys ar2"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Category = "Fun + Games"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminOnly = false
|
||||
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool",0, "Fire" )
|
||||
self:NetworkVar( "Entity",0, "Attacker" )
|
||||
end
|
52
lua/entities/simfphys_rpg/init.lua
Normal file
52
lua/entities/simfphys_rpg/init.lua
Normal file
@ -0,0 +1,52 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include('shared.lua')
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
|
||||
if ( !tr.Hit ) then return end
|
||||
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal * 20 )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/weapons/w_smg1.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
end
|
||||
|
||||
|
||||
function ENT:Think()
|
||||
local Fire = self:GetFire()
|
||||
local Attacker = self:GetAttacker()
|
||||
if (Fire == true and IsValid(Attacker)) then
|
||||
self.NextShoot = self.NextShoot or 0
|
||||
if ( self.NextShoot < CurTime() ) then
|
||||
self:FireWeapon(Attacker)
|
||||
self.NextShoot = CurTime() + 1
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:FireWeapon(ply)
|
||||
if (!IsValid(self.Rocket)) then
|
||||
self:EmitSound("PropAPC.FireCannon")
|
||||
self.Rocket = ents.Create( "rpg_missile" )
|
||||
self.Rocket:SetPos( self:LocalToWorld( Vector(0,0,25) ) )
|
||||
self.Rocket:SetAngles( self:GetAngles() )
|
||||
self.Rocket:SetOwner( ply )
|
||||
self.Rocket:SetSaveValue( "m_flDamage", 150 )
|
||||
self.Rocket:Spawn()
|
||||
self.Rocket:Activate()
|
||||
end
|
||||
end
|
16
lua/entities/simfphys_rpg/shared.lua
Normal file
16
lua/entities/simfphys_rpg/shared.lua
Normal file
@ -0,0 +1,16 @@
|
||||
ENT.Type = "anim"
|
||||
|
||||
|
||||
ENT.PrintName = "simfphys rpg"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Category = "Fun + Games"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminOnly = false
|
||||
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool",0, "Fire" )
|
||||
self:NetworkVar( "Entity",0, "Attacker" )
|
||||
end
|
125
lua/entities/simfphys_tau/init.lua
Normal file
125
lua/entities/simfphys_tau/init.lua
Normal file
@ -0,0 +1,125 @@
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include('shared.lua')
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
|
||||
if ( !tr.Hit ) then return end
|
||||
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( tr.HitPos + tr.HitNormal * 20 )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/weapons/w_smg1.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
|
||||
self.OldPos = Vector(0,0,0)
|
||||
end
|
||||
|
||||
|
||||
function ENT:Think()
|
||||
local Fire = self:GetFire()
|
||||
local Attacker = self:GetAttacker()
|
||||
if (Fire == true and IsValid(Attacker)) then
|
||||
self.NextShoot = self.NextShoot or 0
|
||||
if ( self.NextShoot < CurTime() ) then
|
||||
self:FireWeapon(Attacker)
|
||||
self.NextShoot = CurTime() + 0.22
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:FireWeapon(ply)
|
||||
self:EmitSound("simulated_vehicles/weapons/tau_fire"..math.Round(math.random(1,4),0)..".wav")
|
||||
|
||||
local deltapos = self:GetPos() - self.OldPos
|
||||
self.OldPos = self:GetPos()
|
||||
|
||||
local shootOrigin = self:LocalToWorld( Vector(0,0,3) ) + deltapos * engine.TickInterval()
|
||||
local shootAngles = self:GetAngles()
|
||||
|
||||
local bullet = {}
|
||||
bullet.Num = 1
|
||||
bullet.Src = shootOrigin
|
||||
bullet.Dir = shootAngles:Forward()
|
||||
bullet.Spread = Vector(0.01,0.01,0)
|
||||
bullet.Tracer = 0
|
||||
bullet.Force = 10
|
||||
bullet.Damage = 12
|
||||
bullet.HullSize = 1
|
||||
bullet.Callback = function(att, tr, dmginfo)
|
||||
|
||||
local effect = ents.Create("env_spark")
|
||||
effect:SetKeyValue("targetname", "target")
|
||||
effect:SetPos( tr.HitPos + tr.HitNormal * 2 )
|
||||
effect:SetAngles( tr.HitNormal:Angle() )
|
||||
effect:Spawn()
|
||||
effect:SetKeyValue("spawnflags","128")
|
||||
effect:SetKeyValue("Magnitude",5)
|
||||
effect:SetKeyValue("TrailLength",3)
|
||||
effect:Fire( "SparkOnce" )
|
||||
effect:Fire("kill","",0.21)
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( tr.HitPos )
|
||||
effectdata:SetStart( shootOrigin )
|
||||
effectdata:SetAttachment( 1 )
|
||||
effectdata:SetEntity( self )
|
||||
effectdata:SetScale( 6000 )
|
||||
effectdata:SetMagnitude( 30 )
|
||||
util.Effect( "arctaucannon", effectdata )
|
||||
|
||||
local laser1 = ents.Create("env_laser")
|
||||
laser1:SetKeyValue("renderamt", "200")
|
||||
laser1:SetKeyValue("rendercolor", "255 255 150")
|
||||
laser1:SetKeyValue("texture", "sprites/laserbeam.spr")
|
||||
laser1:SetKeyValue("TextureScroll", "14")
|
||||
laser1:SetKeyValue("targetname", "laser1" )
|
||||
laser1:SetKeyValue("renderfx", "2")
|
||||
laser1:SetKeyValue("width", "0.5")
|
||||
laser1:SetKeyValue("dissolvetype", "None")
|
||||
laser1:SetKeyValue("EndSprite", "")
|
||||
laser1:SetKeyValue("LaserTarget", "target")
|
||||
laser1:SetKeyValue("TouchType", "-1")
|
||||
laser1:SetKeyValue("NoiseAmplitude", "2")
|
||||
laser1:Spawn()
|
||||
laser1:Fire("SetParent",self,0)
|
||||
laser1:Fire("TurnOn", "", 0.01)
|
||||
laser1:Fire("kill", "", 0.12)
|
||||
laser1:SetPos(shootOrigin)
|
||||
|
||||
local laser2 = ents.Create("env_laser")
|
||||
laser2:SetKeyValue("renderamt", "200")
|
||||
laser2:SetKeyValue("rendercolor", "255 145 "..math.random(0,16))
|
||||
laser2:SetKeyValue("texture", "sprites/laserbeam.spr")
|
||||
laser2:SetKeyValue("TextureScroll", "14")
|
||||
laser2:SetKeyValue("targetname", "laser2" )
|
||||
laser2:SetKeyValue("renderfx", "2")
|
||||
laser2:SetKeyValue("width", "1")
|
||||
laser2:SetKeyValue("dissolvetype", "None")
|
||||
laser2:SetKeyValue("EndSprite", "")
|
||||
laser2:SetKeyValue("LaserTarget", "target")
|
||||
laser2:SetKeyValue("TouchType", "-1")
|
||||
laser2:SetKeyValue("NoiseAmplitude", "0")
|
||||
laser2:Spawn()
|
||||
laser2:Fire("SetParent",self,0)
|
||||
laser2:Fire("TurnOn", "", 0.01)
|
||||
laser2:Fire("kill", "", 0.12)
|
||||
laser2:SetPos(shootOrigin)
|
||||
|
||||
util.Decal("fadingscorch", tr.HitPos - tr.HitNormal, tr.HitPos + tr.HitNormal)
|
||||
end
|
||||
bullet.Attacker = ply
|
||||
self:FireBullets( bullet )
|
||||
end
|
15
lua/entities/simfphys_tau/shared.lua
Normal file
15
lua/entities/simfphys_tau/shared.lua
Normal file
@ -0,0 +1,15 @@
|
||||
ENT.Type = "anim"
|
||||
|
||||
|
||||
ENT.PrintName = "simfphys tau"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Category = "Fun + Games"
|
||||
|
||||
ENT.Spawnable = false
|
||||
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar( "Bool",0, "Fire" )
|
||||
self:NetworkVar( "Entity",0, "Attacker" )
|
||||
end
|
10
materials/models/apc/apc001.vmt
Normal file
10
materials/models/apc/apc001.vmt
Normal file
@ -0,0 +1,10 @@
|
||||
"VertexLitGeneric"
|
||||
{
|
||||
"$basetexture" "Models/props_vehicles/Apc001"
|
||||
"$surfaceprop" "solidmetal"
|
||||
"$envmap" "env_cubemap"
|
||||
"$basealphaenvmapmask" 1
|
||||
"$envmaptint" "[ .75 .75 .75]"
|
||||
"$envmapsaturation" 1
|
||||
"$envmapcontrast" 1
|
||||
}
|
BIN
materials/models/apc/apc001.vtf
Normal file
BIN
materials/models/apc/apc001.vtf
Normal file
Binary file not shown.
5
materials/models/apc/apc_tire001.vmt
Normal file
5
materials/models/apc/apc_tire001.vmt
Normal file
@ -0,0 +1,5 @@
|
||||
"VertexLitGeneric"
|
||||
{
|
||||
"$basetexture" "Models/props_vehicles/Apc_Tire001"
|
||||
"$surfaceprop" "rubber"
|
||||
}
|
BIN
materials/models/apc/apc_tire001.vtf
Normal file
BIN
materials/models/apc/apc_tire001.vtf
Normal file
Binary file not shown.
BIN
models/apc/apc.dx80.vtx
Normal file
BIN
models/apc/apc.dx80.vtx
Normal file
Binary file not shown.
BIN
models/apc/apc.dx90.vtx
Normal file
BIN
models/apc/apc.dx90.vtx
Normal file
Binary file not shown.
BIN
models/apc/apc.mdl
Normal file
BIN
models/apc/apc.mdl
Normal file
Binary file not shown.
BIN
models/apc/apc.phy
Normal file
BIN
models/apc/apc.phy
Normal file
Binary file not shown.
BIN
models/apc/apc.sw.vtx
Normal file
BIN
models/apc/apc.sw.vtx
Normal file
Binary file not shown.
BIN
models/apc/apc.vvd
Normal file
BIN
models/apc/apc.vvd
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/apc_fire1.wav
Normal file
BIN
sound/simulated_vehicles/weapons/apc_fire1.wav
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/apc_fire2.wav
Normal file
BIN
sound/simulated_vehicles/weapons/apc_fire2.wav
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/apc_fire3.wav
Normal file
BIN
sound/simulated_vehicles/weapons/apc_fire3.wav
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/apc_fire4.wav
Normal file
BIN
sound/simulated_vehicles/weapons/apc_fire4.wav
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/tau_fire1.wav
Normal file
BIN
sound/simulated_vehicles/weapons/tau_fire1.wav
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/tau_fire2.wav
Normal file
BIN
sound/simulated_vehicles/weapons/tau_fire2.wav
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/tau_fire3.wav
Normal file
BIN
sound/simulated_vehicles/weapons/tau_fire3.wav
Normal file
Binary file not shown.
BIN
sound/simulated_vehicles/weapons/tau_fire4.wav
Normal file
BIN
sound/simulated_vehicles/weapons/tau_fire4.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user