Make all nukies humans (#29693)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
- type: RuleGrids
|
||||
- type: AntagSelection
|
||||
- type: AntagLoadProfileRule
|
||||
speciesOverride: Human
|
||||
|
||||
- type: entity
|
||||
parent: BaseNukeopsRule
|
||||
|
||||
Reference in New Issue
Block a user