using Content.Server.Anomaly.Components; using Content.Server.Chemistry.Containers.EntitySystems; using Content.Server.Fluids.EntitySystems; using Content.Shared.Anomaly.Components; namespace Content.Server.Anomaly.Effects; /// /// This component allows the anomaly to create puddles from SolutionContainer. /// public sealed class PuddleCreateAnomalySystem : EntitySystem { [Dependency] private readonly PuddleSystem _puddle = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!; public override void Initialize() { SubscribeLocalEvent(OnPulse); SubscribeLocalEvent(OnSupercritical, before: new[] { typeof(InjectionAnomalySystem) }); } private void OnPulse(Entity entity, ref AnomalyPulseEvent args) { if (!_solutionContainer.TryGetSolution(entity.Owner, entity.Comp.Solution, out var sol, out _)) return; var xform = Transform(entity.Owner); var puddleSol = _solutionContainer.SplitSolution(sol.Value, entity.Comp.MaxPuddleSize * args.Severity); _puddle.TrySplashSpillAt(entity.Owner, xform.Coordinates, puddleSol, out _); } private void OnSupercritical(Entity entity, ref AnomalySupercriticalEvent args) { if (!_solutionContainer.TryGetSolution(entity.Owner, entity.Comp.Solution, out _, out var sol)) return; var xform = Transform(entity.Owner); _puddle.TrySpillAt(xform.Coordinates, sol, out _); } }