Fix AI not shutting down their operator (#1176)

Was banging my head against the wall for this because I R dumb.
It only ever popped up when large numbers of AI were spawned in.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-06-22 00:00:05 +10:00
committed by GitHub
parent 99a5e06b98
commit b1d3f0403a
2 changed files with 7 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ namespace Content.Server.AI.Operators
{
public abstract class AiOperator
{
public bool HasStartup => _hasStartup;
private bool _hasStartup = false;
private bool _hasShutdown = false;

View File

@@ -152,6 +152,12 @@ namespace Content.Server.AI.Utility.AiLogic
{
return;
}
var currentOp = CurrentAction?.ActionOperators.Peek();
if (currentOp != null && currentOp.HasStartup)
{
currentOp.Shutdown(Outcome.Failed);
}
CurrentAction = action;
action.SetupOperators(_blackboard);