From: Tayrtahn Date: Sun, 16 Mar 2025 21:07:46 +0000 (-0400) Subject: Add viewer parameter to Identity.Entity (#35861) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=04b9088c8505d3a850217e6ef0a084d3cd29ce3a;p=space-station-14.git Add viewer parameter to Identity.Entity (#35861) * Add viewer parameter to Identity.Entity * Docs --- diff --git a/Content.Shared/IdentityManagement/Identity.cs b/Content.Shared/IdentityManagement/Identity.cs index cdb3c81ada..836adfcdf8 100644 --- a/Content.Shared/IdentityManagement/Identity.cs +++ b/Content.Shared/IdentityManagement/Identity.cs @@ -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. /// - public static EntityUid Entity(EntityUid uid, IEntityManager ent) + /// + /// If this entity can see through identities, this method will always return the actual target entity. + /// + public static EntityUid Entity(EntityUid uid, IEntityManager ent, EntityUid? viewer = null) { if (!ent.TryGetComponent(uid, out var identity)) return uid; + if (viewer != null && CanSeeThroughIdentity(uid, viewer.Value, ent)) + return uid; + return identity.IdentityEntitySlot.ContainedEntity ?? uid; }