Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Missile Boost and a few other missile tweaks #137

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lua/acf/shared/missiles/missile_asm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ACF_defineGunClass("ASM", {
sound = "acf_extra/airfx/rocket_fire2.wav",
soundDistance = " ",
soundNormal = " ",
effect = "Rocket Motor",
effect = "Rocket Motor ATGM",

reloadmul = 8,

Expand Down Expand Up @@ -85,6 +85,7 @@ ACF_defineGun("BGM-71E ASM", { --id
casing = 0.1, -- thickness of missile casing, cm
armour = 6, -- effective armour thickness of casing, in mm
propweight = 1.2, -- motor mass - motor casing
boostthrust = 20, --Initial velocity in m/s of rocket at launch, do not put past 20 as odd things happen past that
thrust = 10000, -- average thrust - kg*in/s^2
burnrate = 200, -- cm^3/s at average chamber pressure
starterpct = 0.2, -- percentage of the propellant consumed in the starter motor.
Expand Down
11 changes: 9 additions & 2 deletions lua/entities/acf_missile/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function ENT:CalcFlight()

if TargetPos then
local Dist = Pos:Distance(TargetPos)
TargetPos = TargetPos + (Vector(0,0,self.Gravity * Dist / 100000))
TargetPos = TargetPos + (Vector(0,0,self.Gravity / Speed * math.min(Dist/1200 , 2.5))) --Better Compensates for low speed flight
local LOS = (TargetPos - Pos):GetNormalized()
local LastLOS = self.LastLOS
local NewDir = Dir
Expand Down Expand Up @@ -382,6 +382,8 @@ function ENT:ConfigureFlight()
local Time = CurTime()
local noThrust = ACF_GetGunValue(self.BulletData, "nothrust")

self.boost = Round.boostthrust* 39.37 or 0

if noThrust then
self.MotorLength = 0
self.Motor = 0
Expand All @@ -403,7 +405,7 @@ function ENT:ConfigureFlight()
self.LastPos = self.CurPos
self.Hit = false
self.HitNorm = Vector(0,0,0)
self.FirstThink = true
self.FirstThink = true
self.MinArmingDelay = math.max(Round.armdelay or GunData.armdelay, GunData.armdelay)

local Mass = GunData.weight
Expand Down Expand Up @@ -536,7 +538,12 @@ function ENT:Think()
if self.FirstThink == true then
self.FirstThink = false
self.LastThink = CurTime() - self.ThinkDelay
if self.boost > 0 then
-- print(self.boost)
self.LastVel = self.Launcher.acfphysparent:GetVelocity() * self.ThinkDelay + self.Launcher:GetForward() * self.boost + Vector(0,0,-self.Gravity*0.2)
else
self.LastVel = self.Launcher.acfphysparent:GetVelocity() * self.ThinkDelay
end
end
self:CalcFlight()

Expand Down