From c7784ce45462d4515e94df7b51ec1c432d51eee4 Mon Sep 17 00:00:00 2001 From: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com> Date: Tue, 21 Jan 2025 00:34:33 -0400 Subject: [PATCH] Only Use Roundstart Species for RandomHumanoid (#1624) it will no longer choose vox or lamia. --- .../Humanoid/Systems/RandomHumanoidSystem.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs b/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs index 872df8eae89..ada65fe6e7a 100644 --- a/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs +++ b/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs @@ -1,3 +1,4 @@ +using System.Linq; using Content.Server.Humanoid.Components; using Content.Server.RandomMetadata; using Content.Shared.Humanoid.Prototypes; @@ -19,6 +20,8 @@ public sealed class RandomHumanoidSystem : EntitySystem [Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!; + private HashSet _notRoundStartSpecies = new(); + /// public override void Initialize() { @@ -31,6 +34,13 @@ private void OnMapInit(EntityUid uid, RandomHumanoidSpawnerComponent component, QueueDel(uid); if (component.SettingsPrototypeId != null) SpawnRandomHumanoid(component.SettingsPrototypeId, Transform(uid).Coordinates, MetaData(uid).EntityName); + + var speciesList = _prototypeManager.EnumeratePrototypes() + .Where(x => !x.RoundStart) + .Select(x => x.Prototype.Id) + .ToHashSet(); + + _notRoundStartSpecies = speciesList; } public EntityUid SpawnRandomHumanoid(string prototypeId, EntityCoordinates coordinates, string name) @@ -38,7 +48,12 @@ public EntityUid SpawnRandomHumanoid(string prototypeId, EntityCoordinates coord if (!_prototypeManager.TryIndex(prototypeId, out var prototype)) throw new ArgumentException("Could not get random humanoid settings"); - var profile = HumanoidCharacterProfile.Random(prototype.SpeciesBlacklist); + var blacklist = prototype.SpeciesBlacklist; + + if (!prototype.SpeciesBlacklist.Any()) + blacklist = _notRoundStartSpecies; + + var profile = HumanoidCharacterProfile.Random(blacklist); var speciesProto = _prototypeManager.Index(profile.Species); var humanoid = EntityManager.CreateEntityUninitialized(speciesProto.Prototype, coordinates);