Some manual GetComponentOrNull inlines

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:09:45 +01:00
parent a5b57c8e10
commit 61be228ad0
10 changed files with 48 additions and 25 deletions

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Access.Systems;
@@ -135,6 +136,9 @@ namespace Content.Server.Access.Components
{
var targetIdComponent = IoCManager.Resolve<IEntityManager>().GetComponent<IdCardComponent>(targetIdEntity.Uid);
var targetAccessComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(targetIdEntity.Uid);
var name = string.Empty;
if(PrivilegedIdSlot.Item != null)
name = PrivilegedIdSlot.Item.Name;
newState = new IdCardConsoleBoundUserInterfaceState(
PrivilegedIdSlot.HasItem,
PrivilegedIdIsAuthorized(),
@@ -142,7 +146,7 @@ namespace Content.Server.Access.Components
targetIdComponent.FullName,
targetIdComponent.JobTitle,
targetAccessComponent.Tags.ToArray(),
PrivilegedIdSlot.Item?.Name ?? string.Empty,
name,
targetIdEntity.Name);
}
UserInterface?.SetState(newState);