Skip to content

Commit

Permalink
Only Use Roundstart Species for RandomHumanoid (#1624)
Browse files Browse the repository at this point in the history
it will no longer choose vox or lamia.
  • Loading branch information
sleepyyapril authored Jan 21, 2025
1 parent ef2587e commit c7784ce
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.Humanoid.Components;
using Content.Server.RandomMetadata;
using Content.Shared.Humanoid.Prototypes;
Expand All @@ -19,6 +20,8 @@ public sealed class RandomHumanoidSystem : EntitySystem

[Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!;

private HashSet<string> _notRoundStartSpecies = new();

/// <inheritdoc/>
public override void Initialize()
{
Expand All @@ -31,14 +34,26 @@ 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<SpeciesPrototype>()
.Where(x => !x.RoundStart)
.Select(x => x.Prototype.Id)
.ToHashSet();

_notRoundStartSpecies = speciesList;
}

public EntityUid SpawnRandomHumanoid(string prototypeId, EntityCoordinates coordinates, string name)
{
if (!_prototypeManager.TryIndex<RandomHumanoidSettingsPrototype>(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<SpeciesPrototype>(profile.Species);
var humanoid = EntityManager.CreateEntityUninitialized(speciesProto.Prototype, coordinates);

Expand Down

0 comments on commit c7784ce

Please sign in to comment.