(d82a5d3f3) Use the wait delay for all objectives that are not orders (instead of just idle).
This commit is contained in:
@@ -115,17 +115,20 @@ namespace Barotrauma
|
||||
|
||||
public virtual void Update(float deltaTime)
|
||||
{
|
||||
var subObjective = objectiveManager.CurrentObjective?.CurrentSubObjective;
|
||||
if (objectiveManager.CurrentOrder == this)
|
||||
{
|
||||
Priority = AIObjectiveManager.OrderPriority;
|
||||
}
|
||||
else if (objectiveManager.CurrentObjective == this || subObjective == this)
|
||||
else if (objectiveManager.WaitTimer <= 0)
|
||||
{
|
||||
Priority += Devotion * PriorityModifier * deltaTime;
|
||||
var subObjective = objectiveManager.CurrentObjective?.CurrentSubObjective;
|
||||
if ((objectiveManager.CurrentObjective == this || subObjective == this))
|
||||
{
|
||||
Priority += Devotion * PriorityModifier * deltaTime;
|
||||
}
|
||||
Priority = MathHelper.Clamp(Priority, 0, 100);
|
||||
subObjectives.ForEach(so => so.Update(deltaTime));
|
||||
}
|
||||
Priority = MathHelper.Clamp(Priority, 0, 100);
|
||||
subObjectives.ForEach(so => so.Update(deltaTime));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
bool currentHullForbidden = IsForbidden(character.CurrentHull);
|
||||
if (!currentHullForbidden && !character.AnimController.InWater && !character.IsClimbing && HumanAIController.ObjectiveManager.WaitTimer > 0)
|
||||
if (!currentHullForbidden && !character.AnimController.InWater && !character.IsClimbing)
|
||||
{
|
||||
SteeringManager.Reset();
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Barotrauma
|
||||
private Character character;
|
||||
|
||||
/// <summary>
|
||||
/// When set above zero, the character will stand still doing nothing until the timer runs out. Only affects idling.
|
||||
/// When set above zero, the character will stand still doing nothing until the timer runs out. Does not affect orders.
|
||||
/// </summary>
|
||||
public float WaitTimer;
|
||||
|
||||
@@ -157,8 +157,22 @@ namespace Barotrauma
|
||||
|
||||
public void DoCurrentObjective(float deltaTime)
|
||||
{
|
||||
if (WaitTimer > 0.0f) { WaitTimer -= deltaTime; }
|
||||
CurrentObjective?.TryComplete(deltaTime);
|
||||
if (WaitTimer <= 0)
|
||||
{
|
||||
CurrentObjective?.TryComplete(deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CurrentOrder != null)
|
||||
{
|
||||
CurrentOrder.TryComplete(deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitTimer -= deltaTime;
|
||||
character.AIController?.SteeringManager?.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetOrder(AIObjective objective)
|
||||
|
||||
Reference in New Issue
Block a user