(f825eae18) Fix follow objective not keeping the distance.
This commit is contained in:
@@ -159,7 +159,6 @@ namespace Barotrauma
|
||||
// First check the distance
|
||||
// Then the custom condition
|
||||
// And finally check if can interact (heaviest)
|
||||
if (repeat) { return false; }
|
||||
if (isCompleted) { return true; }
|
||||
if (Target == null)
|
||||
{
|
||||
@@ -167,7 +166,16 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
bool closeEnough = Vector2.DistanceSquared(Target.WorldPosition, character.WorldPosition) < CloseEnough * CloseEnough;
|
||||
if (closeEnough)
|
||||
if (repeat)
|
||||
{
|
||||
if (closeEnough)
|
||||
{
|
||||
character.AIController.SteeringManager.Reset();
|
||||
character.AnimController.TargetDir = Target.WorldPosition.X > character.WorldPosition.X ? Direction.Right : Direction.Left;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (closeEnough)
|
||||
{
|
||||
if (customCondition == null || customCondition())
|
||||
{
|
||||
@@ -175,7 +183,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (character.CanInteractWith(item, out _, checkLinked: false)) { isCompleted = true; }
|
||||
}
|
||||
else if (Target is Character targetCharacter && !FollowControlledCharacter)
|
||||
else if (Target is Character targetCharacter)
|
||||
{
|
||||
if (character.CanInteractWith(targetCharacter, CloseEnough)) { isCompleted = true; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user