Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user