Fix ghost role exceptions (#6106)

This commit is contained in:
metalgearsloth
2022-01-11 14:12:19 +11:00
committed by GitHub
parent a666da6797
commit 6f7cd29fb5
4 changed files with 7 additions and 7 deletions

View File

@@ -50,7 +50,6 @@ namespace Content.Server.Ghost.Roles
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindRemovedMessage>(OnMindRemoved);
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MobStateChangedEvent>(OnMobStateChanged);
_playerManager.PlayerStatusChanged += PlayerStatusChanged;
}
@@ -231,8 +230,10 @@ namespace Content.Server.Ghost.Roles
private void OnMindRemoved(EntityUid uid, GhostRoleComponent component, MindRemovedMessage args)
{
if (!component.ReregisterOnGhost)
// Avoid re-registering it for duplicate entries and potential exceptions.
if (!component.ReregisterOnGhost || component.LifeStage > ComponentLifeStage.Running)
return;
component.Taken = false;
RegisterGhostRole(component);
}