(18eb9f712) Fix bots stealing items if they happen to target them before somebody equips them.

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:19:10 +03:00
parent df89114850
commit e8ee3f9d18
27 changed files with 338 additions and 421 deletions
@@ -71,6 +71,7 @@ namespace Barotrauma
#if DEBUG
DebugConsole.NewMessage($"Removing subobjective {subObjective.DebugTag} of {DebugTag}, because it is completed.");
#endif
subObjective.OnCompleted();
subObjectives.Remove(subObjective);
}
else if (!subObjective.CanBeCompleted)
@@ -93,9 +94,9 @@ namespace Barotrauma
bool wasCompleted = IsCompleted();
Act(deltaTime);
if (!wasCompleted && IsCompleted())
if (IsCompleted())
{
Completed?.Invoke();
OnCompleted();
}
}
@@ -213,6 +214,15 @@ namespace Barotrauma
//}
}
protected virtual void OnCompleted()
{
if (Completed != null)
{
Completed();
Completed = null;
}
}
public virtual void Reset() { }
protected abstract void Act(float deltaTime);