Autopilot can avoid other subs, characters won't go outside in idle state
This commit is contained in:
@@ -33,12 +33,6 @@ namespace Barotrauma
|
||||
get { return currentTarget; }
|
||||
}
|
||||
|
||||
public bool HasOutdoorsNodes
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public IndoorsSteeringManager(ISteerable host, bool canOpenDoors)
|
||||
: base(host)
|
||||
{
|
||||
@@ -87,8 +81,6 @@ namespace Barotrauma
|
||||
|
||||
currentPath = pathFinder.FindPath(pos, target);
|
||||
|
||||
HasOutdoorsNodes = currentPath.Nodes.Find(n => n.CurrentHull == null) != null;
|
||||
|
||||
findPathTimer = Rand.Range(1.0f,1.2f);
|
||||
|
||||
return DiffToCurrentNode();
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Barotrauma
|
||||
{
|
||||
indoorsSteering.SteeringWander();
|
||||
}
|
||||
else if (getDivingGearIfNeeded && indoorsSteering.CurrentPath != null && indoorsSteering.HasOutdoorsNodes)
|
||||
else if (getDivingGearIfNeeded && indoorsSteering.CurrentPath != null && indoorsSteering.CurrentPath.HasOutdoorsNodes)
|
||||
{
|
||||
AddSubObjective(new AIObjectiveFindDivingGear(character, true));
|
||||
}
|
||||
|
||||
@@ -54,9 +54,12 @@ namespace Barotrauma
|
||||
newTargetTimer -= deltaTime;
|
||||
|
||||
|
||||
//wander randomly if reached the end of the path or the target is unreachable
|
||||
//wander randomly
|
||||
// - if reached the end of the path
|
||||
// - if the target is unreachable
|
||||
// - if the path requires going outside
|
||||
if (pathSteering==null || (pathSteering.CurrentPath != null &&
|
||||
(pathSteering.CurrentPath.NextNode == null || pathSteering.CurrentPath.Unreachable)))
|
||||
(pathSteering.CurrentPath.NextNode == null || pathSteering.CurrentPath.Unreachable || pathSteering.CurrentPath.HasOutdoorsNodes)))
|
||||
{
|
||||
//steer away from edges of the hull
|
||||
if (character.AnimController.CurrentHull!=null)
|
||||
|
||||
@@ -25,6 +25,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (node == null) return;
|
||||
nodes.Add(node);
|
||||
|
||||
if (node.CurrentHull == null) HasOutdoorsNodes = true;
|
||||
}
|
||||
|
||||
public bool HasOutdoorsNodes
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public int CurrentIndex
|
||||
|
||||
Reference in New Issue
Block a user