]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Nukeops Preferred Species (#14327)
authorScribbles0 <91828755+Scribbles0@users.noreply.github.com>
Mon, 20 Mar 2023 00:48:05 +0000 (17:48 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Mar 2023 00:48:05 +0000 (17:48 -0700)
* nukeops PC species

* cleanup

* invalid species fallback

* cleanup

Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Content.Server/Station/Systems/StationSpawningSystem.cs

index 6e2b70cf71bdc65042307b3b51408510fefacb26..ced5715de12b7a5ed25055405c2946c7d738267b 100644 (file)
@@ -1,12 +1,11 @@
 using System.Linq;
 using Content.Server.Administration.Commands;
-using Content.Server.CharacterAppearance.Components;
 using Content.Server.Chat.Managers;
 using Content.Server.GameTicking.Rules.Components;
 using Content.Server.GameTicking.Rules.Configurations;
 using Content.Server.Ghost.Roles.Components;
 using Content.Server.Ghost.Roles.Events;
-using Content.Server.Humanoid.Systems;
+using Content.Server.Humanoid;
 using Content.Server.Mind.Components;
 using Content.Server.NPC.Systems;
 using Content.Server.Nuke;
@@ -32,6 +31,7 @@ using Robust.Shared.Player;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 using Robust.Shared.Utility;
+using Content.Shared.Humanoid.Prototypes;
 
 namespace Content.Server.GameTicking.Rules;
 
@@ -44,6 +44,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
     [Dependency] private readonly IMapManager _mapManager = default!;
     [Dependency] private readonly IPlayerManager _playerSystem = default!;
     [Dependency] private readonly FactionSystem _faction = default!;
+    [Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!;
     [Dependency] private readonly StationSpawningSystem _stationSpawningSystem = default!;
     [Dependency] private readonly StationSystem _stationSystem = default!;
     [Dependency] private readonly ShuttleSystem _shuttleSystem = default!;
@@ -51,7 +52,6 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
     [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
     [Dependency] private readonly GameTicker _ticker = default!;
     [Dependency] private readonly MapLoaderSystem _map = default!;
-    [Dependency] private readonly RandomHumanoidSystem _randomHumanoid = default!;
 
 
     private enum WinType
@@ -699,10 +699,14 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
     private void SetupOperativeEntity(EntityUid mob, string name, string gear, HumanoidCharacterProfile? profile)
     {
         MetaData(mob).EntityName = name;
-        EntityManager.EnsureComponent<RandomHumanoidAppearanceComponent>(mob);
         EntityManager.EnsureComponent<NukeOperativeComponent>(mob);
 
-        if(_startingGearPrototypes.TryGetValue(gear, out var gearPrototype))
+        if (profile != null)
+        {
+            _humanoidSystem.LoadProfile(mob, profile);
+        }
+
+        if (_startingGearPrototypes.TryGetValue(gear, out var gearPrototype))
             _stationSpawningSystem.EquipStartingGear(mob, gearPrototype, profile);
 
         _faction.RemoveFaction(mob, "NanoTrasen", false);
@@ -744,8 +748,13 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
 
             if (sessions.TryGetValue(i, out var session))
             {
-                var mob = _randomHumanoid.SpawnRandomHumanoid(_nukeopsRuleConfig.RandomHumanoidSettingsPrototype, _random.Pick(spawns), string.Empty);
                 var profile = _prefs.GetPreferences(session.UserId).SelectedCharacter as HumanoidCharacterProfile;
+                if (!_prototypeManager.TryIndex(profile?.Species ?? HumanoidAppearanceSystem.DefaultSpecies, out SpeciesPrototype? species))
+                {
+                    species = _prototypeManager.Index<SpeciesPrototype>(HumanoidAppearanceSystem.DefaultSpecies);
+                }
+
+                var mob = EntityManager.SpawnEntity(species.Prototype, _random.Pick(spawns));
                 SetupOperativeEntity(mob, spawnDetails.Name, spawnDetails.Gear, profile);
 
                 var newMind = new Mind.Mind(session.UserId)
index c8186223d18fedc45634d84fb7ab12fe01d79cde..cebbfa6a10bf031fd3d08fef12a7acc71343208c 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Server.Access.Systems;
+using Content.Server.Access.Systems;
 using Content.Server.DetailExaminable;
 using Content.Server.Hands.Components;
 using Content.Server.Hands.Systems;