Add shutdown and clean up GhostSystem

This commit is contained in:
ShadowCommander
2021-04-03 00:52:27 -07:00
parent 500c26be40
commit c4895af81a

View File

@@ -1,10 +1,7 @@
#nullable enable
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Observer; using Content.Server.GameObjects.Components.Observer;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using System;
namespace Content.Server.GameObjects.EntitySystems namespace Content.Server.GameObjects.EntitySystems
{ {
@@ -19,6 +16,14 @@ namespace Content.Server.GameObjects.EntitySystems
SubscribeLocalEvent<GhostComponent, MindUnvisitedMessage>(OnMindUnvisitedMessage); SubscribeLocalEvent<GhostComponent, MindUnvisitedMessage>(OnMindUnvisitedMessage);
} }
public override void Shutdown()
{
base.Shutdown();
UnsubscribeLocalEvent<GhostComponent, MindRemovedMessage>(OnMindRemovedMessage);
UnsubscribeLocalEvent<GhostComponent, MindUnvisitedMessage>(OnMindUnvisitedMessage);
}
private void OnMindRemovedMessage(EntityUid uid, GhostComponent component, MindRemovedMessage args) private void OnMindRemovedMessage(EntityUid uid, GhostComponent component, MindRemovedMessage args)
{ {
if (!EntityManager.TryGetEntity(uid, out var entity)) if (!EntityManager.TryGetEntity(uid, out var entity))