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:
@@ -5,6 +5,7 @@ namespace Content.Server.AI.Operators
|
|||||||
{
|
{
|
||||||
public abstract class AiOperator
|
public abstract class AiOperator
|
||||||
{
|
{
|
||||||
|
public bool HasStartup => _hasStartup;
|
||||||
private bool _hasStartup = false;
|
private bool _hasStartup = false;
|
||||||
private bool _hasShutdown = false;
|
private bool _hasShutdown = false;
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,12 @@ namespace Content.Server.AI.Utility.AiLogic
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentOp = CurrentAction?.ActionOperators.Peek();
|
||||||
|
if (currentOp != null && currentOp.HasStartup)
|
||||||
|
{
|
||||||
|
currentOp.Shutdown(Outcome.Failed);
|
||||||
|
}
|
||||||
|
|
||||||
CurrentAction = action;
|
CurrentAction = action;
|
||||||
action.SetupOperators(_blackboard);
|
action.SetupOperators(_blackboard);
|
||||||
|
|||||||
Reference in New Issue
Block a user