(439481a07) Set the random factor for initiative each time the objective changes and once per 5 secs when the idle is active. Change the formula. Fix the waiting after character has been unselected.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:30:06 +03:00
parent ca3b5ae04b
commit 348f21598e
9 changed files with 143 additions and 311 deletions
@@ -109,6 +109,7 @@ namespace Barotrauma
if (previousObjective != CurrentObjective)
{
CurrentObjective?.OnSelected();
GetObjective<AIObjectiveIdle>().SetRandom();
}
return CurrentObjective;
}
@@ -170,7 +171,16 @@ namespace Barotrauma
else
{
WaitTimer -= deltaTime;
character.AIController?.SteeringManager?.Reset();
if (character.AIController is HumanAIController humanAI && humanAI.SteeringManager != null)
{
if (!character.AnimController.InWater &&
!character.IsClimbing &&
!humanAI.UnsafeHulls.Contains(character.CurrentHull) &&
!AIObjectiveIdle.IsForbidden(character.CurrentHull))
{
humanAI.SteeringManager.Reset();
}
}
}
}
}