This commit is contained in:
deltanedas
2023-05-12 18:37:08 +00:00
committed by GitHub
parent e1c2b4850a
commit 76645a460c
2 changed files with 59 additions and 14 deletions

View 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);
}
}
}