Inline Name

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:25:51 +01:00
parent 61be228ad0
commit ee4ff9cfe8
97 changed files with 237 additions and 177 deletions

View File

@@ -274,13 +274,21 @@ namespace Content.Server.GameTicking
}
// Finish
var antag = mind.AllRoles.Any(role => role.Antagonist);
var playerIcName = string.Empty;
if (mind.CharacterName != null)
playerIcName = mind.CharacterName;
else if (mind.CurrentEntity != null)
playerIcName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mind.CurrentEntity.Uid).EntityName;
var playerEndRoundInfo = new RoundEndMessageEvent.RoundEndPlayerInfo()
{
// Note that contentPlayerData?.Name sticks around after the player is disconnected.
// This is as opposed to ply?.Name which doesn't.
PlayerOOCName = contentPlayerData?.Name ?? "(IMPOSSIBLE: REGISTERED MIND WITH NO OWNER)",
// Character name takes precedence over current entity name
PlayerICName = mind.CharacterName ?? mind.CurrentEntity?.Name,
PlayerICName = playerIcName,
Role = antag
? mind.AllRoles.First(role => role.Antagonist).Name
: mind.AllRoles.FirstOrDefault()?.Name ?? Loc.GetString("game-ticker-unknown-role"),

View File

@@ -190,7 +190,7 @@ namespace Content.Server.GameTicking
newMind.AddRole(new ObserverRole(newMind));
var mob = SpawnObserverMob();
mob.Name = name;
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mob.Uid).EntityName = name;
var ghost = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(mob.Uid);
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
newMind.TransferTo(mob.Uid);
@@ -214,7 +214,7 @@ namespace Content.Server.GameTicking
if (profile != null)
{
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(entity.Uid, profile);
entity.Name = profile.Name;
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityName = profile.Name;
}
return entity;

View File

@@ -78,9 +78,9 @@ namespace Content.Server.GameTicking.Presets
// If all else fails, it'll default to the default entity prototype name, "observer".
// However, that should rarely happen.
if(!string.IsNullOrWhiteSpace(mind.CharacterName))
ghost.Name = mind.CharacterName;
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(ghost.Uid).EntityName = mind.CharacterName;
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
ghost.Name = mind.Session.Name;
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(ghost.Uid).EntityName = mind.Session.Name;
var ghostComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost.Uid);

View File

@@ -111,12 +111,12 @@ namespace Content.Server.GameTicking.Presets
_entityManager.EntitySysManager.GetEntitySystem<UplinkSystem>()
.AddUplink(mind.OwnedEntity, uplinkAccount, newPDA);
_allOriginalNames[uplinkAccount] = mind.OwnedEntity.Name;
_allOriginalNames[uplinkAccount] = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mind.OwnedEntity.Uid).EntityName;
// The PDA needs to be marked with the correct owner.
var pda = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(newPDA.Uid);
_entityManager.EntitySysManager.GetEntitySystem<PDASystem>()
.SetOwner(pda, mind.OwnedEntity.Name);
.SetOwner(pda, IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mind.OwnedEntity.Uid).EntityName);
IoCManager.Resolve<IEntityManager>().AddComponent<TraitorDeathMatchReliableOwnerTagComponent>(newPDA).UserId = mind.UserId;
}