Remember the first entity a Mind controls for the endround screen (#16950)

This commit is contained in:
Tom Leys
2023-08-01 10:46:06 +12:00
committed by GitHub
parent a9e1f05d15
commit 66ed63dd90
3 changed files with 10 additions and 2 deletions

View File

@@ -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"),

View File

@@ -48,6 +48,12 @@ namespace Content.Server.Mind
[ViewVariables, Access(typeof(MindSystem))]
public NetUserId? OriginalOwnerUserId { get; set; }
/// <summary>
/// Entity UID for the first entity that this mind controlled. Used for round end.
/// Might be relevant if the player has ghosted since.
/// </summary>
[ViewVariables] public EntityUid? OriginalOwnedEntity;
[ViewVariables]
public bool IsVisitingEntity => VisitingEntity != null;

View File

@@ -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)