CatStation/Content.Shared/EntityTable/EntitySelectors/AllSelector.cs
Whatstone f339f58945
Replace all uses of System.Random with IRobustRandom, resolve all System.Random warnings. (#32)
* Remove all uses of System.Random

* Use IRobustRandom in BinomialNumberSelector.Get

* Remove remaining ToolRefinableSystem S.Random inst
2026-06-16 23:38:37 +00:00

49 lines
1.5 KiB
C#

using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Shared.EntityTable.EntitySelectors;
/// <summary>
/// Gets spawns from all of the child selectors
/// </summary>
public sealed partial class AllSelector : EntityTableSelector
{
[DataField(required: true)]
public List<EntityTableSelector> Children;
protected override IEnumerable<EntProtoId> GetSpawnsImplementation(IRobustRandom rand,
IEntityManager entMan,
IPrototypeManager proto,
EntityTableContext ctx)
{
foreach (var child in Children)
{
foreach (var spawn in child.GetSpawns(rand, entMan, proto, ctx))
{
yield return spawn;
}
}
}
protected override IEnumerable<(EntProtoId spawn, double)> ListSpawnsImplementation(IEntityManager entMan, IPrototypeManager proto, EntityTableContext ctx)
{
foreach (var child in Children)
{
foreach (var (spawn, prob) in child.ListSpawns(entMan, proto, ctx))
{
yield return (spawn, prob);
}
}
}
protected override IEnumerable<(EntProtoId spawn, double)> AverageSpawnsImplementation(IEntityManager entMan, IPrototypeManager proto, EntityTableContext ctx)
{
foreach (var child in Children)
{
foreach (var (spawn, prob) in child.AverageSpawns(entMan, proto, ctx))
{
yield return (spawn, prob);
}
}
}
}