Add viewer parameter to Identity.Entity (#35861)

* Add viewer parameter to Identity.Entity

* Docs
This commit is contained in:
Tayrtahn
2025-03-16 17:07:46 -04:00
committed by GitHub
parent 4b9d9da074
commit 04b9088c85

View File

@@ -49,11 +49,17 @@ public static class Identity
/// This is an extension method because of its simplicity, and if it was any harder to call it might not
/// be used enough for loc.
/// </summary>
public static EntityUid Entity(EntityUid uid, IEntityManager ent)
/// <param name="viewer">
/// If this entity can see through identities, this method will always return the actual target entity.
/// </param>
public static EntityUid Entity(EntityUid uid, IEntityManager ent, EntityUid? viewer = null)
{
if (!ent.TryGetComponent<IdentityComponent>(uid, out var identity))
return uid;
if (viewer != null && CanSeeThroughIdentity(uid, viewer.Value, ent))
return uid;
return identity.IdentityEntitySlot.ContainedEntity ?? uid;
}