From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Fri, 12 May 2023 18:37:08 +0000 (+0000) Subject: lube 1984 (#15996) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=76645a460c1cd6b2de1bb0762816c7bc4badea7b;p=space-station-14.git lube 1984 (#15996) --- diff --git a/Content.Server/StationEvents/Components/VentClogRuleComponent.cs b/Content.Server/StationEvents/Components/VentClogRuleComponent.cs index 79f4993375..b18687f9ed 100644 --- a/Content.Server/StationEvents/Components/VentClogRuleComponent.cs +++ b/Content.Server/StationEvents/Components/VentClogRuleComponent.cs @@ -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")] + /// + /// 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. + /// + [DataField("safeishVentChemicals", customTypeSerializer: typeof(PrototypeIdListSerializer))] public readonly IReadOnlyList SafeishVentChemicals = new[] { "Water", "Blood", "Slime", "SpaceDrugs", "SpaceCleaner", "Nutriment", "Sugar", "SpaceLube", "Ephedrine", "Ale", "Beer" }; + /// + /// Sound played when foam is being created. + /// + [DataField("sound")] + public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Effects/extinguish.ogg"); + + /// + /// The standard reagent quantity to put in the foam, modfied by event severity. + /// + [DataField("reagentQuantity"), ViewVariables(VVAccess.ReadWrite)] + public int ReagentQuantity = 200; + + /// + /// The standard spreading of the foam, not modfied by event severity. + /// + [DataField("spread"), ViewVariables(VVAccess.ReadWrite)] + public int Spread = 20; + + /// + /// How long the foam lasts for + /// + [DataField("time"), ViewVariables(VVAccess.ReadWrite)] + public float Time = 20f; + + /// + /// Reagents that gets the weak numbers used instead of regular ones. + /// + [DataField("weakReagents", customTypeSerializer: typeof(PrototypeIdListSerializer))] + public IReadOnlyList WeakReagents = new[] { "SpaceLube" }; + + /// + /// Quantity of weak reagents to put in the foam. + /// + [DataField("weakReagentQuantity"), ViewVariables(VVAccess.ReadWrite)] + public int WeakReagentQuantity = 60; + + /// + /// Spread of the foam for weak reagents. + /// + [DataField("weakSpread"), ViewVariables(VVAccess.ReadWrite)] + public int WeakSpread = 2; } diff --git a/Content.Server/StationEvents/Events/VentClogRule.cs b/Content.Server/StationEvents/Events/VentClogRule.cs index c209337aec..dd4a67d85e 100644 --- a/Content.Server/StationEvents/Events/VentClogRule.cs +++ b/Content.Server/StationEvents/Events/VentClogRule.cs @@ -31,8 +31,7 @@ public sealed class VentClogRule : StationEventSystem .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()) @@ -47,20 +46,18 @@ public sealed class VentClogRule : StationEventSystem 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(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); } } }