From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Thu, 4 Jul 2024 02:29:26 +0000 (-0400) Subject: Make all nukies humans (#29693) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3e3e050aafb93daa1eb017ee06b5e2a15fb3d315;p=space-station-14.git Make all nukies humans (#29693) --- diff --git a/Content.Server/GameTicking/Rules/AntagLoadProfileRuleSystem.cs b/Content.Server/GameTicking/Rules/AntagLoadProfileRuleSystem.cs index fd3fb6cd65..b93904c685 100644 --- a/Content.Server/GameTicking/Rules/AntagLoadProfileRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/AntagLoadProfileRuleSystem.cs @@ -30,10 +30,18 @@ public sealed class AntagLoadProfileRuleSystem : GameRuleSystem(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(SharedHumanoidAppearanceSystem.DefaultSpecies); + } args.Entity = Spawn(species.Prototype); - _humanoid.LoadProfile(args.Entity.Value, profile); + _humanoid.LoadProfile(args.Entity.Value, profile?.WithSpecies(species.ID)); } } diff --git a/Content.Server/GameTicking/Rules/Components/AntagLoadProfileRuleCOmponent.cs b/Content.Server/GameTicking/Rules/Components/AntagLoadProfileRuleCOmponent.cs index 5e58fd14fc..0816902ad4 100644 --- a/Content.Server/GameTicking/Rules/Components/AntagLoadProfileRuleCOmponent.cs +++ b/Content.Server/GameTicking/Rules/Components/AntagLoadProfileRuleCOmponent.cs @@ -1,7 +1,17 @@ +using Content.Shared.Humanoid.Prototypes; +using Robust.Shared.Prototypes; + namespace Content.Server.GameTicking.Rules.Components; /// /// Makes this rules antags spawn a humanoid, either from the player's profile or a random one. /// [RegisterComponent] -public sealed partial class AntagLoadProfileRuleComponent : Component; +public sealed partial class AntagLoadProfileRuleComponent : Component +{ + /// + /// If specified, the profile loaded will be made into this species. + /// + [DataField] + public ProtoId? SpeciesOverride; +} diff --git a/Resources/Prototypes/GameRules/roundstart.yml b/Resources/Prototypes/GameRules/roundstart.yml index a7b749a35f..da198a25d0 100644 --- a/Resources/Prototypes/GameRules/roundstart.yml +++ b/Resources/Prototypes/GameRules/roundstart.yml @@ -81,6 +81,7 @@ - type: RuleGrids - type: AntagSelection - type: AntagLoadProfileRule + speciesOverride: Human - type: entity parent: BaseNukeopsRule