Inline Name
This commit is contained in:
@@ -122,6 +122,7 @@ namespace Content.Server.Access.Components
|
||||
// this could be prettier
|
||||
if (targetIdEntity == null)
|
||||
{
|
||||
IEntity? tempQualifier = PrivilegedIdSlot.Item;
|
||||
newState = new IdCardConsoleBoundUserInterfaceState(
|
||||
PrivilegedIdSlot.HasItem,
|
||||
PrivilegedIdIsAuthorized(),
|
||||
@@ -129,7 +130,7 @@ namespace Content.Server.Access.Components
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
PrivilegedIdSlot.Item?.Name ?? string.Empty,
|
||||
(tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(tempQualifier.Uid).EntityName : null) ?? string.Empty,
|
||||
string.Empty);
|
||||
}
|
||||
else
|
||||
@@ -138,7 +139,7 @@ namespace Content.Server.Access.Components
|
||||
var targetAccessComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(targetIdEntity.Uid);
|
||||
var name = string.Empty;
|
||||
if(PrivilegedIdSlot.Item != null)
|
||||
name = PrivilegedIdSlot.Item.Name;
|
||||
name = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(PrivilegedIdSlot.Item.Uid).EntityName;
|
||||
newState = new IdCardConsoleBoundUserInterfaceState(
|
||||
PrivilegedIdSlot.HasItem,
|
||||
PrivilegedIdIsAuthorized(),
|
||||
@@ -147,7 +148,7 @@ namespace Content.Server.Access.Components
|
||||
targetIdComponent.JobTitle,
|
||||
targetAccessComponent.Tags.ToArray(),
|
||||
name,
|
||||
targetIdEntity.Name);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(targetIdEntity.Uid).EntityName);
|
||||
}
|
||||
UserInterface?.SetState(newState);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user