Make any mind added remove ghost role (#6127)

This commit is contained in:
metalgearsloth
2022-01-12 18:25:05 +11:00
committed by GitHub
parent 3bc38196a2
commit ec9550c2e0
2 changed files with 7 additions and 5 deletions

View File

@@ -48,6 +48,7 @@ namespace Content.Server.Ghost.Roles
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset); SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached); SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindRemovedMessage>(OnMindRemoved); SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindRemovedMessage>(OnMindRemoved);
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MobStateChangedEvent>(OnMobStateChanged); SubscribeLocalEvent<GhostTakeoverAvailableComponent, MobStateChangedEvent>(OnMobStateChanged);
_playerManager.PlayerStatusChanged += PlayerStatusChanged; _playerManager.PlayerStatusChanged += PlayerStatusChanged;
@@ -228,6 +229,12 @@ namespace Content.Server.Ghost.Roles
CloseEui(message.Player); CloseEui(message.Player);
} }
private void OnMindAdded(EntityUid uid, GhostTakeoverAvailableComponent component, MindAddedMessage args)
{
component.Taken = true;
UnregisterGhostRole(component);
}
private void OnMindRemoved(EntityUid uid, GhostRoleComponent component, MindRemovedMessage args) private void OnMindRemoved(EntityUid uid, GhostRoleComponent component, MindRemovedMessage args)
{ {
// Avoid re-registering it for duplicate entries and potential exceptions. // Avoid re-registering it for duplicate entries and potential exceptions.

View File

@@ -4,11 +4,6 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Ghost.Roles namespace Content.Shared.Ghost.Roles
{ {
public abstract class SharedGhostRoleSystem : EntitySystem
{
}
[Serializable, NetSerializable] [Serializable, NetSerializable]
public class GhostRole public class GhostRole
{ {