Species are now picked at random in the developer environment! (#37057)

* Various changes to random species in dev

* This should be split
This commit is contained in:
beck-thompson
2025-05-01 21:09:23 -07:00
committed by GitHub
parent bb547eb03b
commit 1fbc845126
3 changed files with 28 additions and 2 deletions

View File

@@ -140,8 +140,29 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
if (_randomizeCharacters)
{
var weightId = _configurationManager.GetCVar(CCVars.ICRandomSpeciesWeights);
var weights = _prototypeManager.Index<WeightedRandomSpeciesPrototype>(weightId);
speciesId = weights.Pick(_random);
// If blank, choose a round start species.
if (string.IsNullOrEmpty(weightId))
{
var roundStart = new List<ProtoId<SpeciesPrototype>>();
var speciesPrototypes = _prototypeManager.EnumeratePrototypes<SpeciesPrototype>();
foreach (var proto in speciesPrototypes)
{
if (proto.RoundStart)
roundStart.Add(proto.ID);
}
if (roundStart.Count == 0)
speciesId = SharedHumanoidAppearanceSystem.DefaultSpecies;
else
speciesId = _random.Pick(roundStart);
}
else
{
var weights = _prototypeManager.Index<WeightedRandomSpeciesPrototype>(weightId);
speciesId = weights.Pick(_random);
}
}
else if (profile != null)
{