Fix component generic usages where IComponent would not be valid (#19482)

This commit is contained in:
DrSmugleaf
2023-08-24 03:10:55 -07:00
committed by GitHub
parent e42148f433
commit 35107f7c2b
27 changed files with 38 additions and 38 deletions

View File

@@ -76,7 +76,7 @@ namespace Content.Server.Administration.Commands
public static bool SetOutfit(EntityUid target, string gear, IEntityManager entityManager, Action<EntityUid, EntityUid>? onEquipped = null)
{
if (!entityManager.TryGetComponent<InventoryComponent?>(target, out var inventoryComponent))
if (!entityManager.TryGetComponent(target, out InventoryComponent? inventoryComponent))
return false;
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
@@ -85,7 +85,7 @@ namespace Content.Server.Administration.Commands
HumanoidCharacterProfile? profile = null;
// Check if we are setting the outfit of a player to respect the preferences
if (entityManager.TryGetComponent<ActorComponent?>(target, out var actorComponent))
if (entityManager.TryGetComponent(target, out ActorComponent? actorComponent))
{
var userId = actorComponent.PlayerSession.UserId;
var preferencesManager = IoCManager.Resolve<IServerPreferencesManager>();
@@ -106,7 +106,7 @@ namespace Content.Server.Administration.Commands
}
var equipmentEntity = entityManager.SpawnEntity(gearStr, entityManager.GetComponent<TransformComponent>(target).Coordinates);
if (slot.Name == "id" &&
entityManager.TryGetComponent<PdaComponent?>(equipmentEntity, out var pdaComponent) &&
entityManager.TryGetComponent(equipmentEntity, out PdaComponent? pdaComponent) &&
entityManager.TryGetComponent<IdCardComponent>(pdaComponent.ContainedId, out var id))
{
id.FullName = entityManager.GetComponent<MetaDataComponent>(target).EntityName;