]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Species are now picked at random in the developer environment! (#37057)
authorbeck-thompson <107373427+beck-thompson@users.noreply.github.com>
Fri, 2 May 2025 04:09:23 +0000 (21:09 -0700)
committerGitHub <noreply@github.com>
Fri, 2 May 2025 04:09:23 +0000 (14:09 +1000)
* Various changes to random species in dev

* This should be split

Content.Server/Station/Systems/StationSpawningSystem.cs
Content.Shared/CCVar/CCVars.Ic.cs
Resources/ConfigPresets/Build/development.toml

index 70176ea071e5f827ea7e8650ea94e96e342d5d74..16400039b919851e393327381d0e4a157b8a9f48 100644 (file)
@@ -140,8 +140,29 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
         if (_randomizeCharacters)
         {
             var weightId = _configurationManager.GetCVar(CCVars.ICRandomSpeciesWeights);
-            var weights = _prototypeManager.Index<WeightedRandomSpeciesPrototype>(weightId);
-            speciesId = weights.Pick(_random);
+
+            // If blank, choose a round start species.
+            if (string.IsNullOrEmpty(weightId))
+            {
+                var roundStart = new List<ProtoId<SpeciesPrototype>>();
+
+                var speciesPrototypes = _prototypeManager.EnumeratePrototypes<SpeciesPrototype>();
+                foreach (var proto in speciesPrototypes)
+                {
+                    if (proto.RoundStart)
+                        roundStart.Add(proto.ID);
+                }
+
+                if (roundStart.Count == 0)
+                    speciesId = SharedHumanoidAppearanceSystem.DefaultSpecies;
+                else
+                    speciesId = _random.Pick(roundStart);
+            }
+            else
+            {
+                var weights = _prototypeManager.Index<WeightedRandomSpeciesPrototype>(weightId);
+                speciesId = weights.Pick(_random);
+            }
         }
         else if (profile != null)
         {
index 54ab69b3faa7417c581bffc80989f43053925a9b..b835a8f20e9b1dbab3bbb7fa87989f661137a99a 100644 (file)
@@ -36,6 +36,7 @@ public sealed partial class CCVars
 
     /// <summary>
     ///     A weighted random prototype used to determine the species selected for random characters.
+    ///     If blank, will use a round start species picked at random.
     /// </summary>
     public static readonly CVarDef<string> ICRandomSpeciesWeights =
         CVarDef.Create("ic.random_species_weights", "SpeciesWeights", CVar.SERVER);
index 4465ea8ee039f22715decf5496dcd4db2c2dd44b..710885a8b42add6f9dbc95ac02bdcf14b58982bf 100644 (file)
@@ -37,3 +37,7 @@ preload_grids = false
 
 [admin]
 see_own_notes = true
+
+[ic]
+random_characters = true
+random_species_weights = ""