diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs index fda3a82772..17628450b9 100644 --- a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs @@ -5,7 +5,9 @@ using JetBrains.Annotations; using Robust.Server.Player; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.ViewVariables; namespace Content.Server.Ghost.Roles.Components @@ -31,7 +33,7 @@ namespace Content.Server.Ghost.Roles.Components [CanBeNull] [ViewVariables(VVAccess.ReadWrite)] - [DataField("prototype")] + [DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer))] public string? Prototype { get; private set; } public override bool Take(IPlayerSession session) diff --git a/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs b/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs index 9c0083849d..cdb54d44ed 100644 --- a/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs @@ -1,11 +1,8 @@ -using System; using Content.Server.Mind.Commands; using Content.Server.Mind.Components; -using Content.Server.Players; using Robust.Server.Player; using Robust.Shared.GameObjects; using Robust.Shared.IoC; -using Robust.Shared.Utility; namespace Content.Server.Ghost.Roles.Components { diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index 9977e490d2..bfea1999e3 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -50,7 +50,6 @@ namespace Content.Server.Ghost.Roles SubscribeLocalEvent(OnPlayerAttached); SubscribeLocalEvent(OnMindRemoved); SubscribeLocalEvent(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); } diff --git a/Resources/Prototypes/Entities/Mobs/Player/human.yml b/Resources/Prototypes/Entities/Mobs/Player/human.yml index 97706e30f7..0fea50040f 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/human.yml @@ -34,7 +34,7 @@ sprite: Markers/jobs.rsi state: centcom - type: GhostRoleMobSpawner - prototype: HumanMob_CentcomOfficial + prototype: MobHumanCentcomOfficial deleteOnSpawn: true makeSentient: false name: centcom official