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;
}
.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>())
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);
}
}
}