]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Don't double-dip survival intensity scaling (#25570)
authorKara <lunarautomaton6@gmail.com>
Sun, 25 Feb 2024 22:04:51 +0000 (15:04 -0700)
committerGitHub <noreply@github.com>
Sun, 25 Feb 2024 22:04:51 +0000 (14:04 -0800)
Content.Server/StationEvents/Events/AnomalySpawnRule.cs
Content.Server/StationEvents/Events/BluespaceArtifactRule.cs
Content.Server/StationEvents/Events/BureaucraticErrorRule.cs
Content.Server/StationEvents/Events/GasLeakRule.cs
Content.Server/StationEvents/Events/MeteorSwarmRule.cs
Content.Server/StationEvents/Events/RandomSentienceRule.cs
Content.Server/StationEvents/Events/StationEventSystem.cs
Content.Server/StationEvents/Events/VentClogRule.cs
Content.Server/StationEvents/RampingStationEventSchedulerSystem.cs

index a59af52f6d553f47412ec7e5204897ee1dc9d280..48a3b900c44307b65784b3c0eb322409f06daf77 100644 (file)
@@ -33,7 +33,7 @@ public sealed class AnomalySpawnRule : StationEventSystem<AnomalySpawnRuleCompon
         if (grid is null)
             return;
 
-        var amountToSpawn = Math.Max(1, (int) MathF.Round(GetSeverityModifier() / 2));
+        var amountToSpawn = 1;
         for (var i = 0; i < amountToSpawn; i++)
         {
             _anomaly.SpawnOnRandomGridLocation(grid.Value, component.AnomalySpawnerPrototype);
index 306b735b847ea99f81f2360119f51b7015638b62..0eed77f15436305cb988dfab10fb6dbd0f8018c1 100644 (file)
@@ -19,7 +19,7 @@ public sealed class BluespaceArtifactRule : StationEventSystem<BluespaceArtifact
     {
         base.Started(uid, component, gameRule, args);
 
-        var amountToSpawn = Math.Max(1, (int) MathF.Round(GetSeverityModifier() / 1.5f));
+        var amountToSpawn = 1;
         for (var i = 0; i < amountToSpawn; i++)
         {
             if (!TryFindRandomTile(out _, out _, out _, out var coords))
index b82546a55ba011170fb9569660aa91ffbf5b7a13..249a14a9b8a090b51340edd74313562ac8e7a167 100644 (file)
@@ -25,11 +25,9 @@ public sealed class BureaucraticErrorRule : StationEventSystem<BureaucraticError
         if (jobList.Count == 0)
             return;
 
-        var mod = GetSeverityModifier();
-
         // Low chance to completely change up the late-join landscape by closing all positions except infinite slots.
         // Lower chance than the /tg/ equivalent of this event.
-        if (RobustRandom.Prob(Math.Min(0.25f * MathF.Sqrt(mod), 1.0f)))
+        if (RobustRandom.Prob(0.25f))
         {
             var chosenJob = RobustRandom.PickAndTake(jobList);
             _stationJobs.MakeJobUnlimited(chosenStation.Value, chosenJob); // INFINITE chaos.
@@ -42,8 +40,8 @@ public sealed class BureaucraticErrorRule : StationEventSystem<BureaucraticError
         }
         else
         {
-            var lower = (int) (jobList.Count * Math.Min(1.0f, 0.20 * mod));
-            var upper = (int) (jobList.Count * Math.Min(1.0f, 0.30 * mod));
+            var lower = (int) (jobList.Count * 0.20);
+            var upper = (int) (jobList.Count * 0.30);
             // Changing every role is maybe a bit too chaotic so instead change 20-30% of them.
             var num = RobustRandom.Next(lower, upper);
             for (var i = 0; i < num; i++)
index b10db0e5b709560137ad93812b79c7fd00212992..68544e416c3011a020e95f93c6e7f069c4f24a0b 100644 (file)
@@ -19,8 +19,6 @@ namespace Content.Server.StationEvents.Events
             if (!TryComp<StationEventComponent>(uid, out var stationEvent))
                 return;
 
-            var mod = MathF.Sqrt(GetSeverityModifier());
-
             // Essentially we'll pick out a target amount of gas to leak, then a rate to leak it at, then work out the duration from there.
             if (TryFindRandomTile(out component.TargetTile, out var target, out component.TargetGrid, out component.TargetCoords))
             {
@@ -29,7 +27,7 @@ namespace Content.Server.StationEvents.Events
 
                 component.LeakGas = RobustRandom.Pick(component.LeakableGases);
                 // Was 50-50 on using normal distribution.
-                var totalGas = RobustRandom.Next(component.MinimumGas, component.MaximumGas) * mod;
+                var totalGas = RobustRandom.Next(component.MinimumGas, component.MaximumGas);
                 var startAfter = stationEvent.StartDelay;
                 component.MolesPerSecond = RobustRandom.Next(component.MinimumMolesPerSecond, component.MaximumMolesPerSecond);
 
index ef84d0a9aefa9a93591c103388f21143d5871ce9..192a620c9fcc1764f8c3cdb7ddd8d947f6c87fc5 100644 (file)
@@ -17,8 +17,7 @@ namespace Content.Server.StationEvents.Events
         {
             base.Started(uid, component, gameRule, args);
 
-            var mod = Math.Sqrt(GetSeverityModifier());
-            component.WaveCounter = (int) (RobustRandom.Next(component.MinimumWaves, component.MaximumWaves) * mod);
+            component.WaveCounter = RobustRandom.Next(component.MinimumWaves, component.MaximumWaves);
         }
 
         protected override void ActiveTick(EntityUid uid, MeteorSwarmRuleComponent component, GameRuleComponent gameRule, float frameTime)
@@ -29,8 +28,6 @@ namespace Content.Server.StationEvents.Events
                 return;
             }
 
-            var mod = GetSeverityModifier();
-
             component.Cooldown -= frameTime;
 
             if (component.Cooldown > 0f)
@@ -38,7 +35,7 @@ namespace Content.Server.StationEvents.Events
 
             component.WaveCounter--;
 
-            component.Cooldown += (component.MaximumCooldown - component.MinimumCooldown) * RobustRandom.NextFloat() / mod + component.MinimumCooldown;
+            component.Cooldown += (component.MaximumCooldown - component.MinimumCooldown) * RobustRandom.NextFloat() + component.MinimumCooldown;
 
             Box2? playableArea = null;
             var mapId = GameTicker.DefaultMap;
index d90361fe9629f174075f0244e128d7a72b47e7d9..4b7606d01f9c63da588781d6bec31da313d263b7 100644 (file)
@@ -11,7 +11,6 @@ public sealed class RandomSentienceRule : StationEventSystem<RandomSentienceRule
     {
         HashSet<EntityUid> stationsToNotify = new();
 
-        var mod = GetSeverityModifier();
         var targetList = new List<Entity<SentienceTargetComponent>>();
         var query = EntityQueryEnumerator<SentienceTargetComponent>();
         while (query.MoveNext(out var targetUid, out var target))
@@ -21,7 +20,7 @@ public sealed class RandomSentienceRule : StationEventSystem<RandomSentienceRule
 
         RobustRandom.Shuffle(targetList);
 
-        var toMakeSentient = (int) (RobustRandom.Next(2, 5) * Math.Sqrt(mod));
+        var toMakeSentient = RobustRandom.Next(2, 5);
         var groups = new HashSet<string>();
 
         foreach (var target in targetList)
index 221beccee735877ec045e9288775cc286aaaa460..a4f6bc70dfa828f6f779af37b22e8f5cb0ce5cac 100644 (file)
@@ -134,25 +134,5 @@ public abstract partial class StationEventSystem<T> : GameRuleSystem<T> where T
         GameTicker.EndGameRule(uid, component);
     }
 
-    public float GetSeverityModifier()
-    {
-        var ev = new GetSeverityModifierEvent();
-        RaiseLocalEvent(ev);
-        return ev.Modifier;
-    }
-
     #endregion
 }
-
-/// <summary>
-///     Raised broadcast to determine what the severity modifier should be for an event, some positive number that can be multiplied with various things.
-///     Handled by usually other game rules (like the ramping scheduler).
-///     Most events should try and make use of this if possible.
-/// </summary>
-public sealed class GetSeverityModifierEvent : EntityEventArgs
-{
-    /// <summary>
-    ///     Should be multiplied/added to rather than set, for commutativity.
-    /// </summary>
-    public float Modifier = 1.0f;
-}
index f378aec3fb9a6771045f30aa085e6c0973dc6612..e263a5f4f69efb95215feb20b40afa8ffcef2108 100644 (file)
@@ -28,9 +28,6 @@ public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent>
             .Where(x => !x.Abstract)
             .Select(x => x.ID).ToList();
 
-        // TODO: This is gross, but not much can be done until event refactor, which needs Dynamic.
-        var mod = (float) Math.Sqrt(GetSeverityModifier());
-
         foreach (var (_, transform) in EntityManager.EntityQuery<GasVentPumpComponent, TransformComponent>())
         {
             if (CompOrNull<StationMemberComponent>(transform.GridUid)?.Station != chosenStation)
@@ -40,14 +37,14 @@ public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent>
 
             var solution = new Solution();
 
-            if (!RobustRandom.Prob(Math.Min(0.33f * mod, 1.0f)))
+            if (!RobustRandom.Prob(0.33f))
                 continue;
 
-            var pickAny = RobustRandom.Prob(Math.Min(0.05f * mod, 1.0f));
+            var pickAny = RobustRandom.Prob(0.05f);
             var reagent = RobustRandom.Pick(pickAny ? allReagents : component.SafeishVentChemicals);
 
             var weak = component.WeakReagents.Contains(reagent);
-            var quantity = (weak ? component.WeakReagentQuantity : component.ReagentQuantity) * mod;
+            var quantity = weak ? component.WeakReagentQuantity : component.ReagentQuantity;
             solution.AddReagent(reagent, quantity);
 
             var foamEnt = Spawn("Foam", transform.Coordinates);
index 5c972df52e1b96db6f2b1149b1480ab3c0bc5680..ef3b5cf18a7ebf09558860ab9b28a5cfaf6776fb 100644 (file)
@@ -25,13 +25,6 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
         return component.MaxChaos / component.EndTime * roundTime + component.StartingChaos;
     }
 
-    public override void Initialize()
-    {
-        base.Initialize();
-
-        SubscribeLocalEvent<GetSeverityModifierEvent>(OnGetSeverityModifier);
-    }
-
     protected override void Started(EntityUid uid, RampingStationEventSchedulerComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
     {
         base.Started(uid, component, gameRule, args);
@@ -73,19 +66,6 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
         }
     }
 
-    private void OnGetSeverityModifier(GetSeverityModifierEvent ev)
-    {
-        var query = EntityQueryEnumerator<RampingStationEventSchedulerComponent, GameRuleComponent>();
-        while (query.MoveNext(out var uid, out var scheduler, out var gameRule))
-        {
-            if (!GameTicker.IsGameRuleActive(uid, gameRule))
-                return;
-
-            ev.Modifier *= GetChaosModifier(uid, scheduler);
-            Logger.Info($"Ramping set modifier to {ev.Modifier}");
-        }
-    }
-
     private void PickNextEventTime(EntityUid uid, RampingStationEventSchedulerComponent component)
     {
         var mod = GetChaosModifier(uid, component);