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;

View File

@@ -19,7 +19,7 @@ public sealed partial class AdminVerbSystem
// All antag verbs have names so invokeverb works.
private void AddAntagVerbs(GetVerbsEvent<Verb> args)
{
if (!EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
var player = actor.PlayerSession;

View File

@@ -80,7 +80,7 @@ public sealed partial class AdminVerbSystem
// All smite verbs have names so invokeverb works.
private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
{
if (!EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
var player = actor.PlayerSession;

View File

@@ -57,7 +57,7 @@ public sealed partial class AdminVerbSystem
private void AddTricksVerbs(GetVerbsEvent<Verb> args)
{
if (!EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
var player = actor.PlayerSession;

View File

@@ -79,7 +79,7 @@ namespace Content.Server.Administration.Systems
private void AddAdminVerbs(GetVerbsEvent<Verb> args)
{
if (!EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
var player = actor.PlayerSession;
@@ -215,7 +215,7 @@ namespace Content.Server.Administration.Systems
private void AddDebugVerbs(GetVerbsEvent<Verb> args)
{
if (!EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
var player = actor.PlayerSession;
@@ -349,7 +349,7 @@ namespace Content.Server.Administration.Systems
// Get Disposal tube direction verb
if (_groupController.CanCommand(player, "tubeconnections") &&
EntityManager.TryGetComponent<DisposalTubeComponent?>(args.Target, out var tube))
EntityManager.TryGetComponent(args.Target, out DisposalTubeComponent? tube))
{
Verb verb = new()
{
@@ -376,7 +376,7 @@ namespace Content.Server.Administration.Systems
}
if (_groupController.CanAdminMenu(player) &&
EntityManager.TryGetComponent<ConfigurationComponent?>(args.Target, out var config))
EntityManager.TryGetComponent(args.Target, out ConfigurationComponent? config))
{
Verb verb = new()
{