Make all nukies humans (#29693)

This commit is contained in:
Nemanja
2024-07-03 22:29:26 -04:00
committed by GitHub
parent 223ade9b3f
commit 3e3e050aaf
3 changed files with 22 additions and 3 deletions

View File

@@ -30,10 +30,18 @@ public sealed class AntagLoadProfileRuleSystem : GameRuleSystem<AntagLoadProfile
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));
}
}

View File

@@ -1,7 +1,17 @@
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;
}

View File

@@ -81,6 +81,7 @@
- type: RuleGrids
- type: AntagSelection
- type: AntagLoadProfileRule
speciesOverride: Human
- type: entity
parent: BaseNukeopsRule