Skip to content

Commit

Permalink
Make all nukies humans (space-wizards#29693)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmoGarbage404 authored Jul 4, 2024
1 parent 223ade9 commit 3e3e050
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Content.Server/GameTicking/Rules/AntagLoadProfileRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ private void OnSelectEntity(Entity<AntagLoadProfileRuleComponent> ent, ref Antag
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));
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
1 change: 1 addition & 0 deletions Resources/Prototypes/GameRules/roundstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
- type: RuleGrids
- type: AntagSelection
- type: AntagLoadProfileRule
speciesOverride: Human

- type: entity
parent: BaseNukeopsRule
Expand Down

0 comments on commit 3e3e050

Please sign in to comment.