(dc8407cf2) Properly remove reported targets when they are done. Fix get item completing when it shouldn't if the target item was supposed to be equipped.

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:16:54 +03:00
parent 265ec64540
commit 5d38344efc
22 changed files with 237 additions and 319 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,10 +214,19 @@ namespace Barotrauma
//}
}
protected virtual void OnCompleted()
{
if (Completed != null)
{
Completed();
Completed = null;
}
}
public virtual void Reset() { }
protected abstract void Act(float deltaTime);
public abstract bool IsCompleted();
public abstract bool IsDuplicate(AIObjective otherObjective);