]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make all nukies humans (#29693)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Thu, 4 Jul 2024 02:29:26 +0000 (22:29 -0400)
committerGitHub <noreply@github.com>
Thu, 4 Jul 2024 02:29:26 +0000 (12:29 +1000)
Content.Server/GameTicking/Rules/AntagLoadProfileRuleSystem.cs
Content.Server/GameTicking/Rules/Components/AntagLoadProfileRuleCOmponent.cs
Resources/Prototypes/GameRules/roundstart.yml

index fd3fb6cd655eedb84b66618899217971b993db2d..b93904c685f82e6354540b57e651fcace320d54a 100644 (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));
     }
 }
index 5e58fd14fc040b14e71d40ce0d53a75f11d5fd75..0816902ad43b68809ccd829f65077acf18b20ee7 100644 (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;
+}
index a7b749a35f9fd67e12c0579707f6edd7b437298c..da198a25d09872bfd3d43881073a0e9b8ad219b9 100644 (file)
@@ -81,6 +81,7 @@
   - type: RuleGrids
   - type: AntagSelection
   - type: AntagLoadProfileRule
+    speciesOverride: Human
 
 - type: entity
   parent: BaseNukeopsRule