(e3f599b5d) Go to objective checks the path access only once per second. Add notes.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:37:29 +03:00
parent 6f9690eeaf
commit c060c90cba
13 changed files with 291 additions and 267 deletions
@@ -8,6 +8,9 @@ namespace Barotrauma
{
public override string DebugTag => "go to";
const float checkAccessInterval = 1;
private float accessCheckTimer;
private AIObjectiveFindDivingGear findDivingGear;
private Vector2 targetPos;
private bool repeat;
@@ -153,10 +156,18 @@ namespace Barotrauma
abandon = true;
return;
}
if (insideSteering && !PathSteering.HasAccessToPath(PathSteering.CurrentPath))
if (accessCheckTimer <= 0)
{
abandon = true;
return;
accessCheckTimer = checkAccessInterval;
if (insideSteering && !PathSteering.HasAccessToPath(PathSteering.CurrentPath))
{
abandon = true;
return;
}
}
else
{
accessCheckTimer -= deltaTime;
}
character.AIController.SteeringManager.SteeringSeek(currTargetPos);
if (getDivingGearIfNeeded)