make vent clog event only affect single station vents (#13703)

This commit is contained in:
Slava0135 2023-01-28 17:06:40 +03:00 committed by GitHub
parent d6f2bfb589
commit 274be663b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Chemistry.ReactionEffects;
using Content.Server.Station.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using JetBrains.Annotations;
@ -23,6 +24,10 @@ public sealed class VentClog : StationEventSystem
{
base.Started();
if (StationSystem.Stations.Count == 0)
return;
var chosenStation = RobustRandom.Pick(StationSystem.Stations.ToList());
// TODO: "safe random" for chems. Right now this includes admin chemicals.
var allReagents = PrototypeManager.EnumeratePrototypes<ReagentPrototype>()
.Where(x => !x.Abstract)
@ -34,6 +39,10 @@ public sealed class VentClog : StationEventSystem
foreach (var (_, transform) in EntityManager.EntityQuery<GasVentPumpComponent, TransformComponent>())
{
if (CompOrNull<StationMemberComponent>(transform.GridUid)?.Station != chosenStation)
{
continue;
}
var solution = new Solution();
if (!RobustRandom.Prob(Math.Min(0.33f * mod, 1.0f)))