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

@@ -8,6 +8,7 @@ using Content.Shared.Inventory;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using System.Diagnostics.CodeAnalysis;
using Robust.Shared.IoC;
namespace Content.Server.Access.Systems
{
@@ -21,7 +22,7 @@ namespace Content.Server.Access.Systems
private void OnInit(EntityUid uid, IdCardComponent id, ComponentInit args)
{
id.OriginalOwnerName ??= id.Owner.Name;
id.OriginalOwnerName ??= IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner.Uid).EntityName;
UpdateEntityName(uid, id);
}
@@ -66,19 +67,20 @@ namespace Content.Server.Access.Systems
if (string.IsNullOrWhiteSpace(id.FullName) && string.IsNullOrWhiteSpace(id.JobTitle))
{
id.Owner.Name = id.OriginalOwnerName;
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner.Uid).EntityName = id.OriginalOwnerName;
return;
}
var jobSuffix = string.IsNullOrWhiteSpace(id.JobTitle) ? string.Empty : $" ({id.JobTitle})";
id.Owner.Name = string.IsNullOrWhiteSpace(id.FullName)
var val = string.IsNullOrWhiteSpace(id.FullName)
? Loc.GetString("access-id-card-component-owner-name-job-title-text",
("originalOwnerName", id.OriginalOwnerName),
("jobSuffix", jobSuffix))
("originalOwnerName", id.OriginalOwnerName),
("jobSuffix", jobSuffix))
: Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
("fullName", id.FullName),
("jobSuffix", jobSuffix));
("fullName", id.FullName),
("jobSuffix", jobSuffix));
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner.Uid).EntityName = val;
}
/// <summary>