using Content.Shared.Random.Helpers; using Robust.Shared.Prototypes; namespace Content.Shared.EntityTable.EntitySelectors; /// /// Gets the spawns from one of the child selectors, based on the weight of the children /// public sealed partial class GroupSelector : EntityTableSelector { [DataField(required: true)] public List Children = new(); protected override IEnumerable GetSpawnsImplementation(System.Random rand, IEntityManager entMan, IPrototypeManager proto) { var children = new Dictionary(Children.Count); foreach (var child in Children) { children.Add(child, child.Weight); } var pick = SharedRandomExtensions.Pick(children, rand); return pick.GetSpawns(rand, entMan, proto); } }