]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
lube 1984 (#15996)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Fri, 12 May 2023 18:37:08 +0000 (18:37 +0000)
committerGitHub <noreply@github.com>
Fri, 12 May 2023 18:37:08 +0000 (14:37 -0400)
Content.Server/StationEvents/Components/VentClogRuleComponent.cs
Content.Server/StationEvents/Events/VentClogRule.cs

index 79f49933752fa39f0c65ff2dfb4c880326132c08..b18687f9ed5567f7e76247b018d94bf772e9a0e2 100644 (file)
@@ -1,14 +1,62 @@
 using Content.Server.StationEvents.Events;
+using Content.Shared.Chemistry.Reagent;
+using Robust.Shared.Audio;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
 
 namespace Content.Server.StationEvents.Components;
 
 [RegisterComponent, Access(typeof(VentClogRule))]
 public sealed class VentClogRuleComponent : Component
 {
-    [DataField("safeishVentChemicals")]
+    /// <summary>
+    /// Somewhat safe chemicals to put in foam that probably won't instantly kill you.
+    /// There is a small chance of using any reagent, ignoring this.
+    /// </summary>
+    [DataField("safeishVentChemicals", customTypeSerializer: typeof(PrototypeIdListSerializer<ReagentPrototype>))]
     public readonly IReadOnlyList<string> SafeishVentChemicals = new[]
     {
         "Water", "Blood", "Slime", "SpaceDrugs", "SpaceCleaner", "Nutriment", "Sugar", "SpaceLube", "Ephedrine", "Ale", "Beer"
     };
 
+    /// <summary>
+    /// Sound played when foam is being created.
+    /// </summary>
+    [DataField("sound")]
+    public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Effects/extinguish.ogg");
+
+    /// <summary>
+    /// The standard reagent quantity to put in the foam, modfied by event severity.
+    /// </summary>
+    [DataField("reagentQuantity"), ViewVariables(VVAccess.ReadWrite)]
+    public int ReagentQuantity = 200;
+
+    /// <summary>
+    /// The standard spreading of the foam, not modfied by event severity.
+    /// </summary>
+    [DataField("spread"), ViewVariables(VVAccess.ReadWrite)]
+    public int Spread = 20;
+
+    /// <summary>
+    /// How long the foam lasts for
+    /// </summary>
+    [DataField("time"), ViewVariables(VVAccess.ReadWrite)]
+    public float Time = 20f;
+
+    /// <summary>
+    /// Reagents that gets the weak numbers used instead of regular ones.
+    /// </summary>
+    [DataField("weakReagents", customTypeSerializer: typeof(PrototypeIdListSerializer<ReagentPrototype>))]
+    public IReadOnlyList<string> WeakReagents = new[] { "SpaceLube" };
+
+    /// <summary>
+    /// Quantity of weak reagents to put in the foam.
+    /// </summary>
+    [DataField("weakReagentQuantity"), ViewVariables(VVAccess.ReadWrite)]
+    public int WeakReagentQuantity = 60;
+
+    /// <summary>
+    /// Spread of the foam for weak reagents.
+    /// </summary>
+    [DataField("weakSpread"), ViewVariables(VVAccess.ReadWrite)]
+    public int WeakSpread = 2;
 }
index c209337aec51f7189f290724d372000b0742ff6e..dd4a67d85e89ebfbe03da192a163b6c1f257d3e8 100644 (file)
@@ -31,8 +31,7 @@ public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent>
             .Where(x => !x.Abstract)
             .Select(x => x.ID).ToList();
 
-        // This is gross, but not much can be done until event refactor, which needs Dynamic.
-        var sound = new SoundPathSpecifier("/Audio/Effects/extinguish.ogg");
+        // 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>())
@@ -47,20 +46,18 @@ public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent>
             if (!RobustRandom.Prob(Math.Min(0.33f * mod, 1.0f)))
                 continue;
 
-            if (RobustRandom.Prob(Math.Min(0.05f * mod, 1.0f)))
-            {
-                solution.AddReagent(RobustRandom.Pick(allReagents), 200);
-            }
-            else
-            {
-                solution.AddReagent(RobustRandom.Pick(component.SafeishVentChemicals), 200);
-            }
+            var pickAny = RobustRandom.Prob(Math.Min(0.05f * mod, 1.0f));
+            var reagent = RobustRandom.Pick(pickAny ? allReagents : component.SafeishVentChemicals);
+
+            var weak = component.WeakReagents.Contains(reagent);
+            var quantity = (weak ? component.WeakReagentQuantity : component.ReagentQuantity) * mod;
+            solution.AddReagent(reagent, quantity);
 
             var foamEnt = Spawn("Foam", transform.Coordinates);
             var smoke = EnsureComp<SmokeComponent>(foamEnt);
-            smoke.SpreadAmount = 20;
-            _smoke.Start(foamEnt, smoke, solution, 20f);
-            Audio.PlayPvs(sound, transform.Coordinates);
+            smoke.SpreadAmount = weak ? component.WeakSpread : component.Spread;
+            _smoke.Start(foamEnt, smoke, solution, component.Time);
+            Audio.PlayPvs(component.Sound, transform.Coordinates);
         }
     }
 }