Skip to content

Commit a553c09

Browse files
authored
Merge pull request #162 from cortex-command-community/jetpack-enhancements
Jetpack Enhancements
2 parents c6032b3 + fac0568 commit a553c09

File tree

34 files changed

+103
-99
lines changed

34 files changed

+103
-99
lines changed

Data/Base.rte/AI/HumanBehaviors.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
12611261

12621262
if AI.refuel and Owner.Jetpack then
12631263
-- if jetpack is full or we are falling we can stop refuelling
1264-
if Owner.JetTimeLeft > Owner.JetTimeTotal * 0.98 or (AI.flying and Owner.Vel.Y < -3 and Owner.JetTimeLeft > AI.minBurstTime*2) then
1264+
if Owner.Jetpack.JetTimeLeft > Owner.Jetpack.JetTimeTotal * 0.98 or (AI.flying and Owner.Vel.Y < -3 and Owner.Jetpack.JetTimeLeft > AI.minBurstTime*2) then
12651265
AI.refuel = false;
12661266
elseif not AI.flying then
12671267
AI.jump = false;
@@ -1279,7 +1279,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
12791279
WptList = nil; -- update the path
12801280
elseif StuckTimer:IsPastSimTimeLimit() then -- dislodge
12811281
if AI.jump then
1282-
if Owner.Jetpack and Owner.JetTimeLeft < AI.minBurstTime then -- out of fuel
1282+
if Owner.Jetpack and Owner.Jetpack.JetTimeLeft < AI.minBurstTime then -- out of fuel
12831283
AI.jump = false;
12841284
AI.refuel = true;
12851285
nextLatMove = Actor.LAT_STILL;
@@ -1306,7 +1306,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
13061306
end
13071307

13081308
-- refuelling done
1309-
if AI.refuel and Owner.Jetpack and Owner.JetTimeLeft >= Owner.JetTimeTotal * 0.99 then
1309+
if AI.refuel and Owner.Jetpack and Owner.Jetpack.JetTimeLeft >= Owner.Jetpack.JetTimeTotal * 0.99 then
13101310
AI.jump = true;
13111311
end
13121312
end
@@ -1761,7 +1761,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17611761
end
17621762

17631763
if Owner.Jetpack and Owner.Head and Owner.Head:IsAttached() then
1764-
if Owner.JetTimeLeft < AI.minBurstTime then
1764+
if Owner.Jetpack.JetTimeLeft < AI.minBurstTime then
17651765
AI.jump = false; -- not enough fuel left, no point in jumping yet
17661766
if not AI.flying or Owner.Vel.Y > 1 then
17671767
AI.refuel = true;
@@ -1773,13 +1773,13 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17731773
if AI.flying then
17741774
-- predict jetpack movement when jumping and there is a target (check one direction)
17751775
local jetStrength = AI.jetImpulseFactor / Owner.Mass;
1776-
local t = math.min(0.4, Owner.JetTimeLeft*0.001);
1776+
local t = math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001);
17771777
local PixelVel = Owner.Vel * (GetPPM() * t);
17781778
local Accel = SceneMan.GlobalAcc * GetPPM();
17791779

17801780
-- a burst use 10x more fuel
17811781
if Owner.Jetpack:CanTriggerBurst() then
1782-
t = math.max(math.min(0.4, Owner.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
1782+
t = math.max(math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
17831783
end
17841784

17851785
-- test jumping
@@ -1833,13 +1833,13 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
18331833

18341834
-- predict jetpack movement...
18351835
local jetStrength = AI.jetImpulseFactor / Owner.Mass;
1836-
local t = math.min(0.4, Owner.JetTimeLeft*0.001);
1836+
local t = math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001);
18371837
local PixelVel = Owner.Vel * (GetPPM() * t);
18381838
local Accel = SceneMan.GlobalAcc * GetPPM();
18391839

18401840
-- a burst use 10x more fuel
18411841
if Owner.Jetpack:CanTriggerBurst() then
1842-
t = math.max(math.min(0.4, Owner.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
1842+
t = math.max(math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
18431843
end
18441844

18451845
-- when jumping (check four directions)

Data/Base.rte/AI/NativeHumanAI.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ function NativeHumanAI:Create(Owner)
5151
-- the native AI assume the jetpack cannot be destroyed
5252
if Owner.Jetpack then
5353
if not Members.isPlayerOwned then
54-
Owner.Jetpack.Throttle = Owner.Jetpack.Throttle + 0.15 -- increase jetpack strength slightly to compensate for AI ineptitude
54+
Owner.Jetpack.JetTimeTotal = Owner.Jetpack.JetTimeTotal * 1.2; -- increase jetpack fuel to compensate for extra fuel spend
5555
end
5656

57-
Members.jetImpulseFactor = Owner.Jetpack:EstimateImpulse(false) * GetPPM() / TimerMan.DeltaTimeSecs;
58-
Members.jetBurstFactor = (Owner.Jetpack:EstimateImpulse(true) * GetPPM() / TimerMan.DeltaTimeSecs - Members.jetImpulseFactor) * math.pow(TimerMan.DeltaTimeSecs, 2) * 0.5;
59-
Members.minBurstTime = math.min(Owner.Jetpack.BurstSpacing*2, Owner.JetTimeTotal*0.99); -- in milliseconds
57+
Members.minBurstTime = math.min(Owner.Jetpack.BurstSpacing*2, Owner.Jetpack.JetTimeTotal*0.99); -- in milliseconds
6058
end
6159

6260
setmetatable(Members, self);
@@ -67,6 +65,12 @@ end
6765
function NativeHumanAI:Update(Owner)
6866
self.Ctrl = Owner:GetController();
6967

68+
-- Our jetpack might have thrust balancing enabled, so update for our current mass
69+
if Owner.Jetpack then
70+
Members.jetImpulseFactor = Owner.Jetpack:EstimateImpulse(false) * GetPPM() / TimerMan.DeltaTimeSecs;
71+
Members.jetBurstFactor = (Owner.Jetpack:EstimateImpulse(true) * GetPPM() / TimerMan.DeltaTimeSecs - Members.jetImpulseFactor) * math.pow(TimerMan.DeltaTimeSecs, 2) * 0.5;
72+
end
73+
7074
if self.isPlayerOwned then
7175
if self.PlayerInterferedTimer:IsPastSimTimeLimit() then
7276
-- Tell the coroutines to abort to avoid memory leaks
@@ -580,7 +584,7 @@ function NativeHumanAI:Update(Owner)
580584
if (not self.jump and Owner.Vel.Y > 18) then
581585
self.jump = true;
582586
end
583-
if self.jump and Owner.JetTimeLeft > TimerMan.AIDeltaTimeMS then
587+
if self.jump and Owner.Jetpack.JetTimeLeft > TimerMan.AIDeltaTimeMS then
584588
if self.jumpState == AHuman.PREJUMP then
585589
self.jumpState = AHuman.UPJUMP;
586590
elseif self.jumpState ~= AHuman.UPJUMP then -- the jetpack is off

Data/Base.rte/Actors/Brains/Brainbot/Brainbot.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,14 @@ AddActor = AHuman
636636
X = 1
637637
Y = -5
638638
LookToAimRatio = 0.2
639-
Jetpack = AEmitter
639+
Jetpack = AEJetpack
640640
CopyOf = Jetpack Robot
641641
ParentOffset = Vector
642642
X = -4
643643
Y = 6
644644
DrawAfterParent = 0
645-
JumpTime = 2.5
646-
JumpReplenishRate = 1.5
645+
JumpTime = 2.5
646+
JumpReplenishRate = 1.5
647647
FGArm = Arm
648648
CopyOf = Brainbot Arm FG
649649
ParentOffset = Vector

Data/Base.rte/Actors/Infantry/GreenDummy/GreenDummy.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,15 +664,15 @@ AddActor = AHuman
664664
ParentOffset = Vector
665665
X = -1
666666
Y = -13
667-
Jetpack = AEmitter
667+
Jetpack = AEJetpack
668668
CopyOf = Jetpack
669669
ParentOffset = Vector
670670
X = -6
671671
Y = -1
672672
ParticlesPerMinute = 8400
673-
JumpTime = 1.5
674-
JumpReplenishRate = 1.5
675-
JumpAngleRange = 0.2
673+
JumpTime = 1.5
674+
JumpReplenishRate = 1.5
675+
JumpAngleRange = 0.2
676676
FGArm = Arm
677677
CopyOf = Green Dummy Arm FG
678678
ParentOffset = Vector

Data/Base.rte/Actors/Mecha/AIBox/AIBox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ AddActor = ACrab
234234
ParentOffset = Vector
235235
X = 0
236236
Y = -5
237-
Jetpack = AEmitter
237+
Jetpack = AEJetpack
238238
CopyOf = Jump Light
239239
BurstSpacing = 1100
240240
ParentOffset = Vector
241241
X = 0
242242
Y = 0
243243
DrawAfterParent = 0
244-
JumpTime = 1
244+
JumpTime = 1
245245
LFGLeg = Leg
246246
CopyOf = AI Box Leg FG
247247
ParentOffset = Vector

Data/Base.rte/Actors/Mecha/Medic/MedicDrone.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ AddActor = ACrab
232232
ParentOffset = Vector
233233
X = 0
234234
Y = -3
235-
Jetpack = AEmitter
235+
Jetpack = AEJetpack
236236
CopyOf = Jump Light
237237
BurstSpacing = 1100
238238
ParentOffset = Vector
239239
X = 0
240240
Y = 0
241241
DrawAfterParent = 0
242-
JumpTime = 1
242+
JumpTime = 1
243243
LFGLeg = Leg
244244
CopyOf = Medic Drone Leg FG
245245
ParentOffset = Vector

Data/Base.rte/Actors/Shared.ini

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ AddLimbPath = LimbPath
437437
// Jetpacks
438438

439439

440-
AddEffect = AEmitter
440+
AddEffect = AEJetpack
441441
PresetName = Jetpack Nozzle
442442
Mass = 0
443443
HitsMOs = 0
@@ -518,7 +518,7 @@ AddEffect = AEmitter
518518
FlashOnlyOnBurst = 0
519519

520520

521-
AddEffect = AEmitter
521+
AddEffect = AEJetpack
522522
CopyOf = Jetpack Nozzle
523523
PresetName = Jumpjet
524524
AddEmission = Emission
@@ -539,7 +539,7 @@ AddEffect = AEmitter
539539
BurstSpacing = 900
540540

541541

542-
AddEffect = AEmitter
542+
AddEffect = AEJetpack
543543
PresetName = Jump Light
544544
Mass = 0
545545
HitsMOs = 0
@@ -569,7 +569,7 @@ AddEffect = AEmitter
569569
LoudnessOnEmit = 0.1
570570

571571

572-
AddEffect = AEmitter
572+
AddEffect = AEJetpack
573573
PresetName = Jetpack
574574
Mass = 1
575575
HitsMOs = 0
@@ -648,7 +648,7 @@ AddEffect = AEmitter
648648
FlashOnlyOnBurst = 0
649649

650650

651-
AddEffect = AEmitter
651+
AddEffect = AEJetpack
652652
CopyOf = Jetpack
653653
PresetName = Jetpack Robot
654654
AddEmission = Emission
@@ -661,7 +661,7 @@ AddEffect = AEmitter
661661
BurstSize = 5
662662

663663

664-
AddEffect = AEmitter
664+
AddEffect = AEJetpack
665665
CopyOf = Jetpack
666666
PresetName = Jetpack Heavy
667667
AddEmission = Emission
@@ -677,7 +677,7 @@ AddEffect = AEmitter
677677
BurstSpacing = 160
678678

679679

680-
AddEffect = AEmitter
680+
AddEffect = AEJetpack
681681
CopyOf = Jetpack
682682
PresetName = Jetpack Extra Heavy
683683
AddEmission = Emission

Data/Base.rte/Actors/Wildlife/Jumper/Jumper.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ AddActor = AHuman
229229
ParentOffset = Vector
230230
X = -2
231231
Y = -3
232-
Jetpack = AEmitter
232+
Jetpack = AEJetpack
233233
CopyOf = Jump Light
234234
PresetName = Jumper Hop
235235
BurstSize = 6
@@ -238,7 +238,7 @@ AddActor = AHuman
238238
X = 0
239239
Y = 0
240240
DrawAfterParent = 0
241-
JumpTime = 0.1
241+
JumpTime = 0.1
242242
HandGroup = AtomGroup
243243
CopyOf = Human Hand
244244
FGFootGroup = AtomGroup

Data/Base.rte/Actors/Wildlife/MegaCrab/MegaCrab.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ AddEffect = ACrab
146146
Perceptiveness = 0
147147
CharHeight = 50
148148
HUDVisible = 0
149-
Jetpack = AEmitter
149+
Jetpack = AEJetpack
150150
CopyOf = Jump Light
151-
JumpTime = 1
151+
JumpTime = 1
152152
LFGLeg = Leg
153153
CopyOf = Big Crab Leg FG A
154154
ParentOffset = Vector

Data/Base.rte/Scripts/Global/BiggerJetpacks.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ function BiggerJetpacksScript:BuffJetpack(actor)
2121
end
2222
if actor.Jetpack then
2323
actor:SetNumberValue("BiggerJetpacksScript", 1);
24-
actor.JetTimeTotal = actor.JetTimeTotal * self.multiplier + 100;
24+
actor.Jetpack.JetTimeTotal = actor.Jetpack.JetTimeTotal * self.multiplier + 100;
2525
end
2626
end

0 commit comments

Comments
 (0)