var profile = args.Session != null
? _prefs.GetPreferences(args.Session.UserId).SelectedCharacter as HumanoidCharacterProfile
: HumanoidCharacterProfile.RandomWithSpecies();
- if (profile?.Species is not {} speciesId || !_proto.TryIndex<SpeciesPrototype>(speciesId, out var species))
+
+ SpeciesPrototype? species;
+ if (ent.Comp.SpeciesOverride != null)
+ {
+ species = _proto.Index(ent.Comp.SpeciesOverride.Value);
+ }
+ else if (profile?.Species is not { } speciesId || !_proto.TryIndex(speciesId, out species))
+ {
species = _proto.Index<SpeciesPrototype>(SharedHumanoidAppearanceSystem.DefaultSpecies);
+ }
args.Entity = Spawn(species.Prototype);
- _humanoid.LoadProfile(args.Entity.Value, profile);
+ _humanoid.LoadProfile(args.Entity.Value, profile?.WithSpecies(species.ID));
}
}
+using Content.Shared.Humanoid.Prototypes;
+using Robust.Shared.Prototypes;
+
namespace Content.Server.GameTicking.Rules.Components;
/// <summary>
/// Makes this rules antags spawn a humanoid, either from the player's profile or a random one.
/// </summary>
[RegisterComponent]
-public sealed partial class AntagLoadProfileRuleComponent : Component;
+public sealed partial class AntagLoadProfileRuleComponent : Component
+{
+ /// <summary>
+ /// If specified, the profile loaded will be made into this species.
+ /// </summary>
+ [DataField]
+ public ProtoId<SpeciesPrototype>? SpeciesOverride;
+}