Remove 700 usages of Component.Owner (#21100)

This commit is contained in:
DrSmugleaf
2023-10-19 12:34:31 -07:00
committed by GitHub
parent 5825ffb95c
commit f560f88eb5
261 changed files with 2291 additions and 2036 deletions

View File

@@ -1,4 +1,3 @@
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Access.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Inventory;
@@ -14,7 +13,7 @@ public abstract class SharedIdCardSystem : EntitySystem
/// Attempt to find an ID card on an entity. This will look in the entity itself, in the entity's hands, and
/// in the entity's inventory.
/// </summary>
public bool TryFindIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
public bool TryFindIdCard(EntityUid uid, out Entity<IdCardComponent> idCard)
{
// check held item?
if (TryComp(uid, out HandsComponent? hands) &&
@@ -39,17 +38,22 @@ public abstract class SharedIdCardSystem : EntitySystem
/// Attempt to get an id card component from an entity, either by getting it directly from the entity, or by
/// getting the contained id from a <see cref="PdaComponent"/>.
/// </summary>
public bool TryGetIdCard(EntityUid uid, [NotNullWhen(true)] out IdCardComponent? idCard)
public bool TryGetIdCard(EntityUid uid, out Entity<IdCardComponent> idCard)
{
if (TryComp(uid, out idCard))
return true;
if (TryComp(uid, out PdaComponent? pda)
&& TryComp(pda.ContainedId, out idCard))
if (TryComp(uid, out IdCardComponent? idCardComp))
{
idCard = (uid, idCardComp);
return true;
}
if (TryComp(uid, out PdaComponent? pda)
&& TryComp(pda.ContainedId, out idCardComp))
{
idCard = (pda.ContainedId.Value, idCardComp);
return true;
}
idCard = default;
return false;
}
}