diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index fff054bcd7..4883d8e3c0 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -343,7 +343,7 @@ namespace Content.Server.GameTicking PlayerOOCName = contentPlayerData?.Name ?? "(IMPOSSIBLE: REGISTERED MIND WITH NO OWNER)", // Character name takes precedence over current entity name PlayerICName = playerIcName, - PlayerEntityUid = mind.OwnedEntity, + PlayerEntityUid = mind.OriginalOwnedEntity, Role = antag ? mind.AllRoles.First(role => role.Antagonist).Name : mind.AllRoles.FirstOrDefault()?.Name ?? Loc.GetString("game-ticker-unknown-role"), diff --git a/Content.Server/Mind/Mind.cs b/Content.Server/Mind/Mind.cs index e219624ac7..844d1ee17c 100644 --- a/Content.Server/Mind/Mind.cs +++ b/Content.Server/Mind/Mind.cs @@ -48,6 +48,12 @@ namespace Content.Server.Mind [ViewVariables, Access(typeof(MindSystem))] public NetUserId? OriginalOwnerUserId { get; set; } + /// + /// Entity UID for the first entity that this mind controlled. Used for round end. + /// Might be relevant if the player has ghosted since. + /// + [ViewVariables] public EntityUid? OriginalOwnedEntity; + [ViewVariables] public bool IsVisitingEntity => VisitingEntity != null; diff --git a/Content.Server/Mind/MindSystem.cs b/Content.Server/Mind/MindSystem.cs index 2c04aa21f0..99ec003c9c 100644 --- a/Content.Server/Mind/MindSystem.cs +++ b/Content.Server/Mind/MindSystem.cs @@ -413,8 +413,10 @@ public sealed class MindSystem : EntitySystem InternalEjectMind(oldEntity.Value, oldComp); SetOwnedEntity(mind, entity, component); - if (mind.OwnedComponent != null) + if (mind.OwnedComponent != null){ InternalAssignMind(mind.OwnedEntity!.Value, mind, mind.OwnedComponent); + mind.OriginalOwnedEntity ??= mind.OwnedEntity; + } // Don't do the full deletion cleanup if we're transferring to our VisitingEntity if (alreadyAttached)