Fix NPC shutdown crash (#2971)

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2021-01-11 01:24:03 +11:00
committed by GitHub
parent 7bfdf30268
commit d403a7fab4
10 changed files with 67 additions and 49 deletions

View File

@@ -21,9 +21,9 @@ namespace Content.Server.AI.Operators.Inventory
_owner = owner;
}
public override bool TryStartup()
public override bool Startup()
{
if (!base.TryStartup())
if (!base.Startup())
{
return true;
}
@@ -40,12 +40,15 @@ namespace Content.Server.AI.Operators.Inventory
return _target != null;
}
public override void Shutdown(Outcome outcome)
public override bool Shutdown(Outcome outcome)
{
base.Shutdown(outcome);
if (!base.Shutdown(outcome))
return false;
var blackboard = UtilityAiHelpers.GetBlackboard(_owner);
blackboard?.GetState<LastOpenedStorageState>().SetValue(null);
return true;
}
public override Outcome Execute(float frameTime)