import files from workshop

- WAC Community 3 (109977794)
- WAC Community 4 (128559085)
- WAC Community 6 (141486806)
- WAC Community 7 (162016658)
This commit is contained in:
edshot99 2024-01-25 16:15:14 -06:00
parent 27c180eed2
commit aa5304e024
12 changed files with 1195 additions and 0 deletions

View File

@ -0,0 +1,5 @@
include('shared.lua')
ENT.thirdPerson = {
distance = 680
}

View File

@ -0,0 +1,132 @@
include("shared.lua")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function ENT:SpawnFunction(ply, tr)
if (!tr.Hit) then return end
local ent=ents.Create(ClassName)
ent:SetPos(tr.HitPos+tr.HitNormal*10)
ent:Spawn()
ent:Activate()
ent.Owner=ply
return ent
end
ENT.Wheels={
{
mdl="models/BF2/helicopters/Mil Mi-28/mi28_w1.mdl",
pos=Vector(-98,-66,5),
friction=100,
mass=250,
},
{
mdl="models/BF2/helicopters/Mil Mi-28/mi28_w1.mdl",
pos=Vector(-98,-79,5),
friction=100,
mass=250
},
{
mdl="models/BF2/helicopters/Mil Mi-28/mi28_w1.mdl",
pos=Vector(-98,66,5),
friction=100,
mass=250,
},
{
mdl="models/BF2/helicopters/Mil Mi-28/mi28_w1.mdl",
pos=Vector(-98,79,5),
friction=100,
mass=250
},
{
mdl="models/BF2/helicopters/Mil Mi-28/mi28_w1.mdl",
pos=Vector(225,-6,5),
friction=100,
mass=250
},
{
mdl="models/BF2/helicopters/Mil Mi-28/mi28_w1.mdl",
pos=Vector(225,6,5),
friction=100,
mass=250
},
}
function ENT:addRotors()
self:base("wac_hc_base").addRotors(self)
self.topRotor2 = self:addEntity("prop_physics")
self.topRotor2:SetModel("models/props_junk/sawblade001a.mdl")
self.topRotor2:SetPos(self:LocalToWorld(self.TopRotor2.pos))
self.topRotor2:SetAngles(self:LocalToWorldAngles(self.TopRotor2.angles))
self.topRotor2:SetOwner(self.Owner)
self.topRotor2:SetNotSolid(true)
self.topRotor2:Spawn()
self.topRotor2.Phys = self.topRotor2:GetPhysicsObject()
self.topRotor2.Phys:EnableGravity(false)
self.topRotor2.Phys:SetMass(5)
self.topRotor2.Phys:EnableDrag(false)
self.topRotor2:SetNoDraw(true)
self.topRotor2.fHealth = 100
self.topRotor2.wac_ignore = true
if self.TopRotor2.model then
local e = self:addEntity("wac_hitdetector")
self:SetNWEntity("wac_air_rotor_main", e)
e:SetModel(self.TopRotor2.model)
e:SetPos(self.topRotor2:GetPos())
e:SetAngles(self.topRotor2:GetAngles())
e:Spawn()
e:SetNotSolid(true)
e:SetParent(self.topRotor2)
e.wac_ignore = true
local obb = e:OBBMaxs()
self.RotorWidth2 = (obb.x>obb.y and obb.x or obb.y)
self.RotorHeight2 = obb.z
self.topRotor2.vis = e
end
constraint.Axis(self.Entity, self.topRotor2, 0, 0, self.TopRotor2.pos, Vector(0,0,1), 0,0,0,1)
self:AddOnRemove(self.topRotor2)
end
function ENT:PhysicsUpdate(ph)
self:base("wac_hc_base").PhysicsUpdate(self,ph)
local vel = ph:GetVelocity()
local pos = self:GetPos()
local ri = self:GetRight()
local up = self:GetUp()
local fwd = self:GetForward()
local ang = self:GetAngles()
local dvel = vel:Length()
local lvel = self:WorldToLocal(pos+vel)
local pilot = self.passengers[1]
local hover = self:calcHover(ph,pos,vel,ang)
local rotateX = (self.controls.roll*1.5+hover.r)*self.rotorRpm
local rotateY = (self.controls.pitch+hover.p)*self.rotorRpm
local rotateZ = self.controls.yaw*1.5*self.rotorRpm
--local phm = (wac.aircraft.cvars.doubleTick:GetBool() and 2 or 1)
local phm = FrameTime()*66
if self.UsePhysRotor then
if self.topRotor2 and self.topRotor2.Phys and self.topRotor2.Phys:IsValid() then
if self.RotorBlurModel then
self.topRotor2.vis:SetColor(Color(255,255,255,math.Clamp(1.3-self.rotorRpm,0.1,1)*255))
end
-- top rotor physics
local rotor = {}
rotor.phys = self.topRotor2.Phys
rotor.angVel = rotor.phys:GetAngleVelocity()
rotor.upvel = self.topRotor2:WorldToLocal(self.topRotor2:GetVelocity()+self.topRotor2:GetPos()).z
rotor.brake =
math.Clamp(math.abs(rotor.angVel.z) - 2950, 0, 100)/10 -- RPM cap
+ math.pow(math.Clamp(1500 - math.abs(rotor.angVel.z), 0, 1500)/900, 3)
+ math.abs(rotor.angVel.z/10000)
- (rotor.upvel - self.rotorRpm)*self.controls.throttle/1000
rotor.targetAngVel =
Vector(0, 0, math.pow(self.engineRpm,2)*self.TopRotor2.dir*10)
- rotor.angVel*rotor.brake/200
rotor.phys:AddAngleVelocity(rotor.targetAngVel)
end
end
self.LastPhys = CurTime()
end

View File

@ -0,0 +1,135 @@
if not wac then return end
ENT.Base = "wac_hc_base"
ENT.Type = "anim"
ENT.PrintName = "MV-22 Osprey"
ENT.Author = "SentryGunMan"
ENT.Category = wac.aircraft.spawnCategoryC
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.Model = "models/sentry/osprey.mdl"
ENT.EngineForce = 26
ENT.Weight = 47500
ENT.SmokePos = Vector(30,0,130)
ENT.FirePos = Vector(30,280,60)
ENT.TopRotor = {
dir = -1,
pos = Vector(9,278.5,236),
model = "models/sentry/osprey_prop.mdl"
}
ENT.TopRotor2 = {
dir = 1,
pos = Vector(9,-278.5,236),
angles = Angle(0,0,0),
model = "models/sentry/osprey_prop.mdl"
}
ENT.BackRotor = {
dir = 1,
pos = Vector(0,0,38),
model = "models/props_junk/PopCan01a.mdl"
}
ENT.Seats = {
{
pos=Vector(165, 24, 68),
exit=Vector(160,70,40),
},
{
pos=Vector(165, -24, 68),
exit=Vector(160,-70,40),
weapons={"GAU-17"}
},
{
pos=Vector(25, 28, 60),
exit=Vector(-320,0,10),
ang=Angle(0,-90,0),
},
{
pos=Vector(0, 28, 60),
exit=Vector(-320,0,10),
ang=Angle(0,-90,0),
},
{
pos=Vector(105, 28, 60),
exit=Vector(-320,0,10),
ang=Angle(0,-90,0),
},
{
pos=Vector(65, -28, 60),
exit=Vector(-320,0,10),
ang=Angle(0,90,0),
},
{
pos=Vector(-40, -28, 60),
exit=Vector(-320,0,10),
ang=Angle(0,90,0),
},
{
pos=Vector(-80, -28, 60),
exit=Vector(-320,0,10),
ang=Angle(0,90,0),
},
}
ENT.Weapons = {
["GAU-17"] = {
class = "wac_pod_aimedgun",
info = {
ShootPos = Vector(-15,10,18),
ShootOffset = Vector(30, 0, 0),
}
},
}
ENT.WeaponAttachments={
gunMount1 = {
model = "models/sentry/osprey_gun1.mdl",
pos = Vector(-15,0,25),
restrictPitch = true
},
gunMount2 = {
model = "models/sentry/osprey_gun2.mdl",
pos = Vector(-15,10,18),
},
gun = {
model = "models/sentry/osprey_barrel.mdl",
pos = Vector(-15,10,18),
},
radar1 = {
model = "models/props_junk/PopCan01a.mdl",
pos = Vector(60,0,25),
restrictPitch = true
},
}
ENT.Camera = {
model = "models/props_junk/PopCan01a.mdl",
pos = Vector(60,0,25),
offset = Vector(-1,0,0),
viewPos = Vector(10, 0, -10),
maxAng = Angle(45, 90, 0),
minAng = Angle(-2, -90, 0),
seat = 2
}
ENT.Sounds={
Start="WAC/mv22/start.wav",
Blades="WAC/mv22/external.wav",
Engine="WAC/mv22/internal.wav",
MissileAlert="HelicopterVehicle/MissileNearby.mp3",
MissileShoot="HelicopterVehicle/MissileShoot.mp3",
MinorAlarm="WAC/Heli/fire_alarm_tank.wav",
LowHealth="WAC/Heli/fire_alarm.wav",
CrashAlarm="WAC/Heli/FireSmoke.wav"
}
function ENT:DrawWeaponSelection() end

View File

@ -0,0 +1,6 @@
include('shared.lua')
ENT.thirdPerson = {
distance = 800
}

View File

@ -0,0 +1,130 @@
include("shared.lua")
AddCSLuaFile("shared.lua")
function ENT:PhysicsUpdate(ph)
self:base("wac_hc_base").PhysicsUpdate(self,ph)
if self.rotorRpm > 0.6 and self.rotorRpm < 0.79 and IsValid(self.TopRotorModel) then
self.TopRotorModel:SetBodygroup(1,1)
elseif self.rotorRpm > 0.8 and IsValid(self.TopRotorModel) then
self.TopRotorModel:SetBodygroup(1,2)
elseif self.rotorRpm < 0.4 and IsValid(self.TopRotorModel) then
self.TopRotorModel:SetBodygroup(1,0)
end
if self.rotorRpm > 0.6 and self.rotorRpm < 0.79 and IsValid(self.BackRotor) then
self.BackRotor:SetBodygroup(1,1)
elseif self.rotorRpm > 0.8 and IsValid(self.BackRotor) then
self.BackRotor:SetBodygroup(1,2)
elseif self.rotorRpm < 0.4 and IsValid(self.BackRotor) then
self.BackRotor:SetBodygroup(1,0)
end
end
ENT.Wheels={
{
mdl="models/sentry/s64_fw.mdl",
pos=Vector(206,0,16),
friction=100,
mass=1550,
},
{
mdl="models/sentry/s64_rw.mdl",
pos=Vector(-52.5,-101.5,7),
friction=100,
mass=1550
},
{
mdl="models/sentry/s64_rw.mdl",
pos=Vector(-52.5,101.5,7),
friction=100,
mass=1550,
},
}
function ENT:AddStuff()
local e1=self:addEntity("prop_physics")
e1:SetModel("models/sentry/s64_hook.mdl")
e1:SetPos(self:GetPos()+Vector(0,0,110))
e1:Spawn()
e1:Activate()
e1:GetPhysicsObject():SetMass(200)
e1.wac_ignore=true
self:AddOnRemove(e1)
self.WinchL=10
self.Grabber=e1
self.Winch=constraint.Rope(self, self.Grabber, 0, 0, Vector(-20,0,102), Vector(0,0,0), 0, 0, 0, 3, "cable/cable2", false)
self.WinchMovingS = CreateSound(self, "vehicles/Crane/crane_extend_loop1.wav")
self.WinchMovingS:ChangeVolume(0.5,0)
self.WinchMovingS:Stop()
end
function ENT:SetWinch(ply)
if self.Winch then
self.Winch:Remove()
self.Winch=nil
end
self.winchcontroller=ply
if ply==NULL then
self.Winch=constraint.Rope(self, self.Grabber, 0, 0, Vector(-20,0,102), Vector(0,0,0), 0, 0, 0, 3, "cable/cable2", false)
else
self.Winch=constraint.Winch( ply, self, self.Grabber, 0, 0, Vector(-20,0,102), Vector(0,0,0), 3, KEY_S, KEY_W, 50, 50, "cable/cable2", false )
end
end
function ENT:Think()
self:base("wac_hc_base").Think(self)
local seat=self.seats[3]
if not IsValid(seat) or not seat:IsVehicle() then return end
local ply=seat:GetPassenger(0)
if ply:IsPlayer() then
if (ply:KeyDown(IN_FORWARD) or ply:KeyDown(IN_BACK)) and not self.WinchMovingS:IsPlaying() then
self.WinchMovingS:Play()
elseif not ply:KeyDown(IN_FORWARD) and not ply:KeyDown(IN_BACK) and self.WinchMovingS:IsPlaying() then
self.WinchMovingS:Stop()
self:EmitSound("vehicles/Crane/crane_extend_stop.wav", 100, 50)
end
if CurTime()>self.grabcooldown and ply:KeyDown(IN_ATTACK) then
if IsValid(self.Grabber) and not self.GrabberC then
local trace=util.QuickTrace(self.Grabber:GetPos(),self.Grabber:GetUp()*-65,{self.Grabber, self})
if not (IsValid(trace.Entity) and not (trace.Entity:GetClass()=="worldspawn") and not (trace.Entity:GetClass()=="prop_static")) then
trace=util.QuickTrace(self.Grabber:GetPos()+Vector(0,-45,-60),self.Grabber:GetRight()*80,{self.Grabber, self})
end
if IsValid(trace.Entity) and not (trace.Entity:GetClass()=="worldspawn") and not (trace.Entity:GetClass()=="prop_static") then
self.GrabberC=constraint.Weld(self.Grabber, trace.Entity, 0, 0, 0, true)
self.GrabberN=constraint.NoCollide(self.Grabber, trace.Entity, 0, 0)
self:EmitSound("vehicles/Crane/crane_magnet_switchon.wav", 100, 50)
self.grabcooldown=CurTime()+1
end
elseif IsValid(self.Grabber) and self.GrabberC and self.GrabberN then
self.GrabberC:Remove()
self.GrabberC=nil
self.GrabberN:Remove()
self.GrabberN=nil
self:EmitSound("vehicles/Crane/crane_magnet_switchon.wav", 100, 50)
self.grabcooldown=CurTime()+1
end
end
end
if not (self.winchcontroller==ply) then
self:SetWinch(ply)
end
end
function ENT:SpawnFunction(ply, tr)
if (!tr.Hit) then return end
local ent=ents.Create(ClassName)
ent:SetPos(tr.HitPos+tr.HitNormal*10)
ent:Spawn()
ent:Activate()
ent.Owner=ply
self.Sounds=table.Copy(sndt)
ent:AddStuff()
return ent
end

View File

@ -0,0 +1,66 @@
if not wac then return end
ENT.Base = "wac_hc_base"
ENT.Type = "anim"
ENT.Author = "SentryGunMan & Dr. Matt"
ENT.Category = wac.aircraft.spawnCategoryC
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.PrintName = "S-64 Skycrane"
ENT.Weight = 47000
ENT.Model = "models/sentry/s64.mdl"
ENT.SmokePos = Vector(0,0,190)
ENT.FirePos = Vector(0,0,190)
ENT.TopRotor = {
dir = -1,
pos = Vector(0,0,210),
model = "models/sentry/s64_top.mdl"
}
ENT.BackRotor = {
dir = -1,
pos = Vector(-469.7,28.5,198),
model = "models/sentry/s64_back.mdl"
}
function ENT:Initialize()
self:base("wac_hc_base").Initialize(self)
self.winchcontroller=NULL
self.grabcooldown=0
end
ENT.Seats = {
{
pos=Vector(210,18,85),
exit=Vector(240,80,13),
},
{
pos=Vector(210,-18,85),
exit=Vector(140,-80,13),
},
{
pos=Vector(187,18,69),
ang=Angle(0,-180,0),
exit=Vector(187,100,13),
},
{
pos=Vector(177,-25,75),
ang=Angle(0,90,0),
exit=Vector(177,-90,13),
},
}
ENT.Sounds={
Start="WAC/S-64/start.wav",
Blades="^WAC/S-64/external.wav",
Engine="WAC/S-64/internal.wav",
MissileAlert="WAC/Heli/heatseeker_track_warning.wav",
MissileShoot="HelicopterVehicle/MissileShoot.mp3",
MinorAlarm="WAC/Heli/fire_alarm_tank.wav",
LowHealth="WAC/Heli/fire_alarm.wav",
CrashAlarm="WAC/Heli/laser_warning.wav"
}
function ENT:DrawWeaponSelection() end

View File

@ -0,0 +1,82 @@
include("shared.lua")
AddCSLuaFile("shared.lua")
function ENT:SpawnFunction(ply, tr)
if (!tr.Hit) then return end
local ent=ents.Create(ClassName)
ent:SetPos(tr.HitPos+tr.HitNormal*10)
ent:Spawn()
ent:Activate()
ent:SetSkin(math.random(0,4))
ent.Owner=ply
return ent
end
ENT.Aerodynamics = {
Rotation = {
Front = Vector(0, -1, 0),
Right = Vector(0, 0, 60), -- Rotate towards flying direction
Top = Vector(0, 0, 0)
},
Lift = {
Front = Vector(0, 0, 13.25), -- Go up when flying forward
Right = Vector(0, 0, 0),
Top = Vector(0, 0, -0.25)
},
Rail = Vector(1, 5, 20),
Drag = {
Directional = Vector(0.01, 0.01, 0.01),
Angular = Vector(0.03, 0.05, 0.05)
}
}
function ENT:PhysicsUpdate(ph)
self:base("wac_pl_base").PhysicsUpdate(self,ph)
if self.rotorRpm > 0.8 and self.rotorRpm < 0.89 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,1)
elseif self.rotorRpm > 0.9 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,2)
elseif self.rotorRpm < 0.8 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,0)
end
local geardown,t1=self:LookupSequence("geardown")
local gearup,t2=self:LookupSequence("gearup")
local trace=util.QuickTrace(self:LocalToWorld(Vector(0,0,62)), self:LocalToWorld(Vector(0,0,50)), {self, self.wheels[1], self.wheels[2], self.wheels[3], self.rotor})
local phys=self:GetPhysicsObject()
if IsValid(phys) and not self.disabled then
if self.controls.throttle>0.9 and self.rotorRpm>0.8 and phys:GetVelocity():Length() > 1200 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() != gearup then
self:ResetSequence(gearup)
self:SetPlaybackRate(1.0)
self:SetBodygroup(1,1)
for i=1,3 do
self.wheels[i]:SetRenderMode(RENDERMODE_TRANSALPHA)
self.wheels[i]:SetColor(Color(255,255,255,0))
self.wheels[i]:SetSolid(SOLID_NONE)
end
elseif self.controls.throttle<0.6 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() == gearup then
self:ResetSequence(geardown)
self:SetPlaybackRate(1.0)
geardown,time1=self:LookupSequence("gearup")
timer.Simple(time1,function()
if self.wheels then
for i=1,3 do
self.wheels[i]:SetRenderMode(RENDERMODE_NORMAL)
self.wheels[i]:SetColor(Color(255,255,255,255))
self.wheels[i]:SetSolid(SOLID_VPHYSICS)
end
self:SetBodygroup(1,0)
end
end)
end
end
end
function ENT:addRotors()
self:base("wac_pl_base").addRotors(self)
self.rotorModel.TouchFunc=nil
end

View File

@ -0,0 +1,126 @@
if not wac then return end
if SERVER then AddCSLuaFile('shared.lua') end
ENT.Base = "wac_pl_base"
ENT.Type = "anim"
ENT.Category = wac.aircraft.spawnCategoryC
ENT.PrintName = "F-16C Falcon"
ENT.Author = "SentryGunMan"
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.Model = "models/sentry/f16.mdl"
ENT.RotorPhModel = "models/props_junk/sawblade001a.mdl"
ENT.RotorModel = "models/props_junk/PopCan01a.mdl"
ENT.rotorPos = Vector(0,0,74)
ENT.TopRotorDir = 1.0
ENT.AutomaticFrameAdvance = true
ENT.EngineForce = 600
ENT.Weight = 12000
ENT.SeatSwitcherPos = Vector(0,0,0)
ENT.AngBrakeMul = 0.02
ENT.SmokePos = Vector(-235,0,68)
ENT.FirePos = Vector(-235,0,68)
if CLIENT then
ENT.thirdPerson = {
distance = 550
}
end
ENT.Agility = {
Thrust = 15
}
ENT.Wheels={
{
mdl="models/sentry/f16_bw.mdl",
pos=Vector(-66,45.3,12),
friction=10,
mass=600,
},
{
mdl="models/sentry/f16_bw.mdl",
pos=Vector(-66,-45.3,12),
friction=10,
mass=600,
},
{
mdl="models/sentry/f16_fw.mdl",
pos=Vector(86.2,0,10.9),
friction=10,
mass=1200,
},
}
ENT.Seats = {
{
pos=Vector(130,0,70),
exit=Vector(130,70,20),
weapons={"M61 Vulcan", "Hydra 70"}
}
}
ENT.Weapons = {
["M61 Vulcan"] = {
class = "wac_pod_gatling",
info = {
Pods = {
Vector(100,40,80.75),
Vector(100,-40,80.75)
},
Sounds = {
shoot = "WAC/f16/gun.wav",
stop = "WAC/f16/gun_stop.wav"
}
}
},
["Hydra 70"] = {
class = "wac_pod_hydra",
info = {
Sequential = true,
Pods = {
Vector(-31.54,155.64,56.31),
Vector(-31.54,-155.64,56.31)
}
}
},
}
ENT.Sounds={
Start="WAC/f16/Start.wav",
Blades="WAC/f16/external.wav",
Engine="WAC/f16/internal.wav",
MissileAlert="HelicopterVehicle/MissileNearby.mp3",
MissileShoot="HelicopterVehicle/MissileShoot.mp3",
MinorAlarm="HelicopterVehicle/MinorAlarm.mp3",
LowHealth="HelicopterVehicle/LowHealth.mp3",
CrashAlarm="HelicopterVehicle/CrashAlarm.mp3"
}
// heatwave
if CLIENT then
local cureffect=0
function ENT:Think()
self:base("wac_pl_base").Think(self)
local throttle = self:GetNWFloat("up", 0)
local active = self:GetNWBool("active", false)
local v=LocalPlayer():GetVehicle()
if IsValid(v) then
local ent=v:GetNWEntity("wac_aircraft")
if ent==self and active and throttle > 0.2 and CurTime()>cureffect then
cureffect=CurTime()+0.02
local ed=EffectData()
ed:SetEntity(self)
ed:SetOrigin(Vector(-270,0,68)) // offset
ed:SetMagnitude(throttle)
ed:SetRadius(25)
util.Effect("wac_heatwave", ed)
end
end
end
end
function ENT:DrawWeaponSelection() end

View File

@ -0,0 +1,76 @@
include("shared.lua")
AddCSLuaFile("shared.lua")
function ENT:SpawnFunction(ply, tr)
if (!tr.Hit) then return end
local ent=ents.Create(ClassName)
ent:SetPos(tr.HitPos+tr.HitNormal*10)
ent:Spawn()
ent:Activate()
ent:SetSkin(math.random(0,2))
ent.Owner=ply
return ent
end
ENT.Aerodynamics = {
Rotation = {
Front = Vector(0, -3.5, 0),
Right = Vector(0, 0, 70), -- Rotate towards flying direction
Top = Vector(0, 0, 0)
},
Lift = {
Front = Vector(0, 0, 13.25), -- Go up when flying forward
Right = Vector(0, 0, 0),
Top = Vector(0, 0, -0.25)
},
Rail = Vector(1, 5, 20),
Drag = {
Directional = Vector(0.01, 0.01, 0.01),
Angular = Vector(0.05, 0.1, 0.1)
}
}
function ENT:PhysicsUpdate(ph)
self:base("wac_pl_base").PhysicsUpdate(self,ph)
if self.rotorRpm > 0.8 and self.rotorRpm < 0.89 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,1)
elseif self.rotorRpm > 0.9 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,2)
elseif self.rotorRpm < 0.8 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,0)
end
local geardown,t1=self:LookupSequence("geardown")
local gearup,t2=self:LookupSequence("gearup")
local trace=util.QuickTrace(self:LocalToWorld(Vector(0,0,62)), self:LocalToWorld(Vector(0,0,50)), {self, self.wheels[1], self.wheels[2], self.wheels[3], self.rotor})
local phys=self:GetPhysicsObject()
if IsValid(phys) and not self.disabled then
if self.controls.throttle>0.9 and self.rotorRpm>0.8 and phys:GetVelocity():Length() > 1200 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() != gearup then
self:ResetSequence(gearup)
self:SetPlaybackRate(1.0)
self:SetBodygroup(1,1)
for i=1,3 do
self.wheels[i]:SetRenderMode(RENDERMODE_TRANSALPHA)
self.wheels[i]:SetColor(Color(255,255,255,0))
self.wheels[i]:SetSolid(SOLID_NONE)
end
elseif self.controls.throttle<0.6 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() == gearup then
self:ResetSequence(geardown)
self:SetPlaybackRate(1.0)
geardown,time1=self:LookupSequence("gearup")
timer.Simple(time1,function()
if self.wheels then
for i=1,3 do
self.wheels[i]:SetRenderMode(RENDERMODE_NORMAL)
self.wheels[i]:SetColor(Color(255,255,255,255))
self.wheels[i]:SetSolid(SOLID_VPHYSICS)
end
self:SetBodygroup(1,0)
end
end)
end
end
end

View File

@ -0,0 +1,134 @@
if not wac then return end
if SERVER then AddCSLuaFile('shared.lua') end
ENT.Base = "wac_pl_base"
ENT.Type = "anim"
ENT.Category = wac.aircraft.spawnCategoryC
ENT.PrintName = "F-4 Phantom II"
ENT.Author = "SentryGunMan"
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.Model = "models/sentry/f4.mdl"
ENT.RotorPhModel = "models/props_junk/sawblade001a.mdl"
ENT.RotorModel = "models/props_junk/PopCan01a.mdl"
ENT.rotorPos = Vector(0,0,74)
ENT.TopRotorDir = 1.0
ENT.AutomaticFrameAdvance = true
ENT.EngineForce = 500
ENT.Weight = 18825
ENT.SeatSwitcherPos = Vector(0,0,0)
ENT.AngBrakeMul = 0.02
ENT.SmokePos = Vector(-155,24,65)
ENT.FirePos = Vector(-155,24,65)
if CLIENT then
ENT.thirdPerson = {
distance = 550
}
end
ENT.Agility = {
Thrust = 10
}
ENT.Wheels={
{
mdl="models/sentry/f4_bw.mdl",
pos=Vector(-43,96,14),
friction=10,
mass=600,
},
{
mdl="models/sentry/f4_bw.mdl",
pos=Vector(-43,-96,14),
friction=10,
mass=600,
},
{
mdl="models/sentry/f4_fw.mdl",
pos=Vector(217.25,0,12),
friction=10,
mass=1200,
},
}
ENT.Seats = {
{
pos=Vector(178,0,75.5),
exit=Vector(178,100,40),
weapons={"M61 Vulcan"},
},
{
pos=Vector(123, 0, 85),
exit=Vector(123,100,40),
weapons={"Bomb"}
},
}
ENT.Weapons = {
["M61 Vulcan"] = {
class = "wac_pod_gatling",
info = {
Pods = {
Vector(107,0,35),
Vector(107,0,35),
},
Sounds = {
shoot = "WAC/f4/gun.wav",
stop = "WAC/f4/gun_stop.wav"
}
}
},
["Bomb"] = {
class = "wac_pod_bomb",
info = {
Pods = {
Vector(40,75,20),
Vector(40,-75,20),
Vector(40,60,40),
Vector(40,90,40),
Vector(40,-60,40),
Vector(40,-90,40),
},
model="models/props_phx/ww2bomb.mdl",
}
}
}
ENT.Sounds={
Start="WAC/f4/Start.wav",
Blades="WAC/f4/external.wav",
Engine="WAC/f4/internal.wav",
MissileAlert="HelicopterVehicle/MissileNearby.mp3",
MissileShoot="HelicopterVehicle/MissileShoot.mp3",
MinorAlarm="HelicopterVehicle/MinorAlarm.mp3",
LowHealth="HelicopterVehicle/LowHealth.mp3",
CrashAlarm="HelicopterVehicle/CrashAlarm.mp3"
}
// heatwave
if CLIENT then
local cureffect=0
function ENT:Think()
self:base("wac_pl_base").Think(self)
local throttle = self:GetNWFloat("up", 0)
local active = self:GetNWBool("active", false)
local v=LocalPlayer():GetVehicle()
if IsValid(v) then
local ent=v:GetNWEntity("wac_aircraft")
if ent==self and active and throttle > 0.2 and CurTime()>cureffect then
cureffect=CurTime()+0.02
local ed=EffectData()
ed:SetEntity(self)
ed:SetOrigin(Vector(-155,0,65)) // offset
ed:SetMagnitude(throttle)
ed:SetRadius(30)
util.Effect("wac_heatwave", ed)
end
end
end
end
//function ENT:DrawWeaponSelection() end

View File

@ -0,0 +1,122 @@
include("shared.lua")
AddCSLuaFile("shared.lua")
function ENT:SpawnFunction(ply, tr)
if (!tr.Hit) then return end
local ent=ents.Create(ClassName)
ent:SetPos(tr.HitPos+tr.HitNormal*60)
ent:Spawn()
ent:Activate()
ent.Owner=ply
ent:SetSkin(math.random(0,4))
ent:SetBodygroup(4,1)
self.Sounds=table.Copy(sndt)
return ent
end
ENT.AutomaticFrameAdvance = true // needed for gear anims
ENT.Aerodynamics = {
Rotation = {
Front = Vector(0, -1, 0),
Right = Vector(0, 0, 60), -- Rotate towards flying direction
Top = Vector(0, 0, 0)
},
Lift = {
Front = Vector(0, 0, 13.25), -- Go up when flying forward
Right = Vector(0, 0, 0),
Top = Vector(0, 0, -0.25)
},
Rail = Vector(1, 5, 20),
Drag = {
Directional = Vector(0.01, 0.01, 0.01),
Angular = Vector(0.03, 0.05, 0.05)
}
}
function ENT:PhysicsUpdate(ph)
self:base("wac_pl_base").PhysicsUpdate(self,ph)
if not IsValid(self) or not IsValid(self:GetPhysicsObject()) then return end
if self.rotorRpm > 0.5 and self.rotorRpm < 0.89 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,2)
elseif self.rotorRpm > 0.9 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,2)
elseif self.rotorRpm < 0.8 and IsValid(self.rotorModel) then
self.rotorModel:SetBodygroup(1,1)
end
local geardown,t1=self:LookupSequence("geardown")
local gearup,t2=self:LookupSequence("gearup")
local trace=util.QuickTrace(self:LocalToWorld(Vector(0,0,62)), self:LocalToWorld(Vector(0,0,50)), {self, self.Wheels[1], self.Wheels[2], self.Wheels[3], self.TopRotor})
local phys=self:GetPhysicsObject()
if IsValid(phys) and not self.disabled then
if self.controls.throttle>0.9 and self.rotorRpm>0.8 and phys:GetVelocity():Length() > 1299 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() != gearup then
self:ResetSequence(gearup)
self:SetPlaybackRate(1.0)
self:SetBodygroup(2,1)
for i=1,3 do
self.wheels[i]:SetRenderMode(RENDERMODE_TRANSALPHA)
self.wheels[i]:SetColor(Color(255,255,255,0))
self.wheels[i]:SetSolid(SOLID_NONE)
end
elseif self.controls.throttle<0.6 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() == gearup then
self:ResetSequence(geardown)
self:SetPlaybackRate(1.0)
timer.Simple(t1,function()
if self.wheels then
for i=1,3 do
self.wheels[i]:SetRenderMode(RENDERMODE_NORMAL)
self.wheels[i]:SetColor(Color(255,255,255,255))
self.wheels[i]:SetSolid(SOLID_VPHYSICS)
end
self:SetBodygroup(2,0)
end
end)
end
end
local phys=self:GetPhysicsObject()
if IsValid(phys) and not self.disabled then
if phys:GetVelocity():Length() > 850 then
self:SetBodygroup(2,1)
else
self:SetBodygroup(2,0)
end
end
if self.disabled and not self.backgib then
self:KillBackRotor()
self:SetBodygroup(5,1)
self:SetBodygroup(4,0)
self.backgib = ents.Create("prop_physics")
self.backgib:SetModel("models/chippy/f86/wing.mdl")
self.backgib:SetSkin(self:GetSkin())
self.backgib:SetPos(self:LocalToWorld(Vector(0,25,25)))
self.backgib:SetAngles(self:GetAngles())
self.backgib:Spawn()
self.backgib:Activate()
self.backgib:GetPhysicsObject():AddVelocity(self:GetVelocity()+self:GetRight()*500)
self.backgib:GetPhysicsObject():AddAngleVelocity(self:GetPhysicsObject():GetAngleVelocity())
local fire = ents.Create("env_fire_trail")
fire:SetPos(self.backgib:LocalToWorld(Vector(0,-50,0)))
fire:Spawn()
fire:SetParent(self.backgib)
self.backgib.fire=fire
constraint.NoCollide(self,self.backgib,0,0)
for k,v in pairs(self.Wheels) do
if IsValid(v) then
constraint.NoCollide(self,v,0,0)
end
end
self:AddOnRemove(self.backgib)
self:AddOnRemove(self.backgib.fire)
end
if self.active then
self:SetBodygroup(3,0)
else
self:SetBodygroup(3,1)
end
end

View File

@ -0,0 +1,181 @@
if not wac then return end
if SERVER then AddCSLuaFile() end
ENT.Base = "wac_pl_base"
ENT.Type = "anim"
ENT.Category = wac.aircraft.spawnCategoryC
ENT.PrintName = "F-86F Sabre"
ENT.Author = "Chippy"
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.Model = "models/chippy/f86/body.mdl"
ENT.EngineForce = 480
ENT.Weight = 6400
ENT.SeatSwitcherPos = Vector(0,0,0)
ENT.AngBrakeMul = 0.0127
ENT.SmokePos = Vector(-230,1,23)
ENT.FirePos = Vector(50,-40,1)
ENT.rotorPos = Vector(0,0,0)
if CLIENT then
ENT.thirdPerson = {
distance = 360
}
end
ENT.Wheels={
{
mdl="models/chippy/f86/bwheel1.mdl",
pos=Vector(-30,-47,-40),
friction=0,
mass=900,
},
{
mdl="models/chippy/f86/bwheel2.mdl",
pos=Vector(-30,47,-40),
friction=0,
mass=900,
},
{
mdl="models/chippy/f86/fwheel.mdl",
pos=Vector(136,-2,-37.8),
friction=0,
mass=700,
},
}
ENT.Agility = {
Thrust = 15
}
ENT.Seats = {
{
pos=Vector(60,-0.2,20.6),
exit=Vector(3.5,60,100),
weapons={"M3 Browning"},
}
}
ENT.Weapons = {
["M3 Browning"] = {
class = "wac_pod_gatling",
info = {
Pods = {
Vector(140,20,28),
Vector(140,20,20),
Vector(140,20,11),
Vector(140,-20,28),
Vector(140,-20,20),
Vector(140,-20,11),
},
FireRate = 500,
Sequential = true,
Sounds = {
shoot = "wac/f86/shoot_start.wav",
stop = "wac/f86/shoot_end.wav",
},
}
}
}
ENT.Sounds={
Start="wac/f86/start.wav",
Blades="wac/f86/external.wav",
Engine="wac/f86/internal.wav",
MissileAlert="",
MissileShoot="",
MinorAlarm="",
LowHealth="",
CrashAlarm="",
}
//hud
local function DrawLine(v1,v2)
surface.DrawLine(v1.y,v1.z,v2.y,v2.z)
end
local mHorizon0 = Material("WeltEnSTurm/WAC/Helicopter/hud_line_0")
local HudCol = Color(70,199,50,150)
local Black = Color(0,0,0,200)
local mat = {
Material("WeltEnSTurm/WAC/Helicopter/hud_line_0"),
Material("WeltEnSTurm/WAC/Helicopter/hud_line_high"),
Material("WeltEnSTurm/WAC/Helicopter/hud_line_low"),
}
local function getspaces(n)
if n<10 then
n=" "..n
elseif n<100 then
n=" "..n
elseif n<1000 then
n=" "..n
end
return n
end
function ENT:DrawPilotHud()
local pos = self:GetPos()
local ang = self:GetAngles()
ang:RotateAroundAxis(self:GetRight(), 90)
ang:RotateAroundAxis(self:GetForward(), 90)
local uptm = self.SmoothVal
local upm = self.SmoothUp
local spos=self.Seats[1].pos
cam.Start3D2D(self:LocalToWorld(Vector(30,3.75,37.75)+spos), ang,0.015)
surface.SetDrawColor(HudCol)
surface.DrawRect(234, 247, 10, 4)
surface.DrawRect(254, 247, 10, 4)
surface.DrawRect(247, 234, 4, 10)
surface.DrawRect(247, 254, 4, 10)
local a=self:GetAngles()
a.y=0
local up=a:Up()
up.x=0
up=up:GetNormal()
local size=180
local dist=10
local step=12
for p=-180,180,step do
if a.p+p>-size/dist and a.p+p<size/dist then
if p==0 then
surface.SetMaterial(mat[1])
elseif p>0 then
surface.SetMaterial(mat[2])
else
surface.SetMaterial(mat[3])
end
surface.DrawTexturedRectRotated(250+up.y*(a.p+p)*dist,250-up.z*(a.p+p)*dist,300,300,a.r)
end
end
surface.SetTextColor(HudCol)
surface.SetFont("wac_heli_small")
surface.SetTextPos(30, 410)
surface.DrawText("SPD "..math.floor(self:GetVelocity():Length()*0.1) .."kn")
surface.SetTextPos(30, 445)
local tr=util.QuickTrace(pos+self:GetUp()*10,Vector(0,0,-999999),self.Entity)
surface.DrawText("ALT "..math.ceil((pos.z-tr.HitPos.z)*0.01905).."m")
if self:GetNWInt("seat_1_actwep") == 1 and self.weapons["Hydra 70"] then
surface.SetTextPos(300,445)
local n = self.weapons["Hydra 70"]:GetAmmo()
surface.DrawText("Hydra 70" .. getspaces(n))
end
cam.End3D2D()
end
function ENT:DrawWeaponSelection() end