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

@@ -22,9 +22,9 @@ namespace Content.Server.AI.Operators.Combat.Melee
_burstTime = burstTime;
}
public override bool TryStartup()
public override bool Startup()
{
if (!base.TryStartup())
if (!base.Startup())
{
return true;
}
@@ -51,13 +51,17 @@ namespace Content.Server.AI.Operators.Combat.Melee
return true;
}
public override void Shutdown(Outcome outcome)
public override bool Shutdown(Outcome outcome)
{
base.Shutdown(outcome);
if (!base.Shutdown(outcome))
return false;
if (_owner.TryGetComponent(out CombatModeComponent combatModeComponent))
{
combatModeComponent.IsInCombatMode = false;
}
return true;
}
public override Outcome Execute(float frameTime)