@@ -452,8 +452,8 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
452
452
453
453
if Owner .Jetpack and Owner .Head and Owner .Head :IsAttached () then
454
454
if Owner .Jetpack .JetTimeLeft < AI .minBurstTime then
455
- AI .jump = false ; -- not enough fuel left, no point in jumping yet
456
455
if not AI .flying or Owner .Vel .Y > 4 then
456
+ AI .jump = false ; -- not enough fuel left, no point in jumping yet
457
457
AI .refuel = true ;
458
458
end
459
459
else
@@ -522,34 +522,42 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
522
522
end
523
523
524
524
-- predict jetpack movement...
525
- local jumpHeight = Owner .JumpHeight ;
525
+ local jetStrength = (AI .jetImpulseFactor / Owner .Mass );
526
+ local t = math.min (0.4 , Owner .Jetpack .JetTimeLeft * 0.001 );
527
+ local PixelVel = Owner .Vel * (GetPPM () * t );
528
+ local Accel = SceneMan .GlobalAcc * GetPPM ();
529
+
530
+ -- a burst use 10x more fuel
531
+ if Owner .Jetpack :CanTriggerBurst () then
532
+ t = math.max (math.min (0.4 , Owner .Jetpack .JetTimeLeft * 0.001 - TimerMan .AIDeltaTimeSecs * 10 ), TimerMan .AIDeltaTimeSecs );
533
+ end
526
534
527
535
-- when jumping (check four directions)
528
536
for k , Face in pairs (Facings ) do
529
- local JetAccel = Vector (- jumpHeight , 0 ):RadRotate (Owner .RotAngle + 1.375 * math.pi + Face .facing * 0.25 );
530
- local JumpPos = Owner .Head . Pos + JetAccel ;
537
+ local JetAccel = Vector (- jetStrength , 0 ):RadRotate (Owner .RotAngle + 1.375 * math.pi + Face .facing * 0.25 );
538
+ local JumpPos = Owner .Pos + PixelVel + ( Accel + JetAccel ) * ( t * t * 0.5 ) ;
531
539
532
- -- check for obstacles from the head
533
- Trace = SceneMan :ShortestDistance (Owner .Head .Pos , JumpPos , false );
534
- local obstDist = SceneMan :CastObstacleRay (Owner .Head .Pos , Trace , JumpPos , Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 3 );
535
- if obstDist < 0 then -- no obstacles: calculate the distance from the future pos to the wpt
536
- Facings [k ].range = SceneMan :ShortestDistance (Waypoint .Pos , JumpPos , false ).Magnitude ;
537
- else -- the ray hit terrain or start inside terrain: avoid
538
- Facings [k ].range = SceneMan :ShortestDistance (Waypoint .Pos , JumpPos , false ).Largest * 2 ;
540
+ -- a burst add a one time boost to acceleration
541
+ if Owner .Jetpack :CanTriggerBurst () then
542
+ JumpPos = JumpPos + Vector (- AI .jetBurstFactor , 0 ):AbsRotateTo (JetAccel );
539
543
end
544
+
545
+ -- check for obstacles from the head
546
+ Trace = SceneMan :ShortestDistance (Owner .Pos , JumpPos , false );
547
+ Facings [k ].range = SceneMan :ShortestDistance (Waypoint .Pos , JumpPos , false ).Magnitude ;
540
548
end
541
549
542
550
-- when falling or walking
543
- local FallPos = Owner .Head . Pos + PixelVel ;
551
+ local FallPos = Owner .Pos + PixelVel ;
544
552
if AI .flying then
545
553
FallPos = FallPos + Accel * (t * t * 0.5 );
546
554
end
547
555
548
556
-- check for obstacles when falling/walking
549
- local Trace = SceneMan :ShortestDistance (Owner .Head . Pos , FallPos , false );
550
- SceneMan :CastObstacleRay (Owner .Head . Pos , Trace , FallPos , Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 3 );
557
+ local Trace = SceneMan :ShortestDistance (Owner .Pos , FallPos , false );
558
+ SceneMan :CastObstacleRay (Owner .Pos , Trace , FallPos , Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 3 );
551
559
552
- local deltaToJump = 15 ;
560
+ local deltaToJump = 1 ;
553
561
if Owner .Jetpack .JetpackType == AEJetpack .JumpPack then
554
562
deltaToJump = deltaToJump * 1.4 ;
555
563
end
0 commit comments