(76e16f98e) Use outdoorsteering when far enough from the sub. Increase the wait until reachable time a bit.

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:43:38 +03:00
parent dc1dd454fd
commit 71d1738498
19 changed files with 214 additions and 134 deletions
@@ -1,7 +1,6 @@
using FarseerPhysics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using System;
using System.Linq;
using Barotrauma.Extensions;
namespace Barotrauma
{
@@ -46,7 +45,7 @@ namespace Barotrauma
{
this.Target = target;
this.repeat = repeat;
waitUntilPathUnreachable = 2.0f;
waitUntilPathUnreachable = 3.0f;
this.getDivingGearIfNeeded = getDivingGearIfNeeded;
CalculateCloseEnough();
}
@@ -115,9 +114,9 @@ namespace Barotrauma
Vector2 currTargetSimPos = Vector2.Zero;
currTargetSimPos = Target.SimPosition;
// Take the sub position into account in the sim pos
if (character.Submarine == null && Target.Submarine != null)
if (SteeringManager != PathSteering && character.Submarine == null && Target.Submarine != null)
{
//currTargetSimPos += Target.Submarine.SimPosition;
currTargetSimPos += Target.Submarine.SimPosition;
}
else if (character.Submarine != null && Target.Submarine == null)
{
@@ -132,6 +131,10 @@ namespace Barotrauma
}
}
character.AIController.SteeringManager.SteeringSeek(currTargetSimPos);
if (SteeringManager != PathSteering)
{
SteeringManager.SteeringAvoid(deltaTime, lookAheadDistance: 5, weight: 1, heading: VectorExtensions.Forward(character.AnimController.Collider.Rotation));
}
if (getDivingGearIfNeeded)
{
bool needsDivingGear = HumanAIController.NeedsDivingGear(targetHull);