]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix Bureaucratic Error event affecting fewer jobs than intended (#14921)
authorjjtParadox <jjtParadox@gmail.com>
Tue, 28 Mar 2023 11:58:13 +0000 (06:58 -0500)
committerGitHub <noreply@github.com>
Tue, 28 Mar 2023 11:58:13 +0000 (06:58 -0500)
Content.Server/StationEvents/Events/BureaucraticError.cs

index 3343fe83e08e7d6f3b2419518e3c129c5577410c..a96eae51b533265f8458eb5375b0798a62e524bd 100644 (file)
@@ -41,13 +41,14 @@ public sealed class BureaucraticError : StationEventSystem
             var lower = (int) (jobList.Count * Math.Min(1.0f, 0.20 * mod));
             var upper = (int) (jobList.Count * Math.Min(1.0f, 0.30 * mod));
             // Changing every role is maybe a bit too chaotic so instead change 20-30% of them.
-            for (var i = 0; i < RobustRandom.Next(lower, upper); i++)
+            var num = RobustRandom.Next(lower, upper);
+            for (var i = 0; i < num; i++)
             {
                 var chosenJob = RobustRandom.PickAndTake(jobList);
                 if (_stationJobs.IsJobUnlimited(chosenStation, chosenJob))
                     continue;
 
-                _stationJobs.TryAdjustJobSlot(chosenStation, chosenJob, RobustRandom.Next(-3, 6));
+                _stationJobs.TryAdjustJobSlot(chosenStation, chosenJob, RobustRandom.Next(-3, 6), clamp: true);
             }
         }
     }