using JetBrains.Annotations; namespace Content.Shared.Body; public sealed partial class BodySystem { /// /// Returns a list of organs with a given component in the body. /// This is only provided to ease migration from the older BodySystem and should not be used in new code. /// /// The body to query. /// The set of organs with the given component. /// The component to test for. /// Whether any organs were returned. [Obsolete("Use an event-relay based approach instead")] [PublicAPI] public bool TryGetOrgansWithComponent(Entity ent, out List> organs) where TComp : Component { organs = new(); if (!_bodyQuery.Resolve(ent, ref ent.Comp)) return false; foreach (var organ in ent.Comp.Organs?.ContainedEntities ?? []) { if (TryComp(organ, out var comp)) organs.Add((organ, comp)); } return organs.Count != 0; } }