Files
ss14-wl/Content.Server/Trigger/Systems/ReleaseGasOnTriggerSystem.cs
Pieter-Jan BriersandGitHub 5168b5f3d4 IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

49 lines
1.7 KiB
C#

using Content.Server.Atmos.EntitySystems;
using Content.Shared.Trigger.Components.Effects;
using Content.Shared.Trigger.Systems;
using Robust.Shared.Timing;
namespace Content.Server.Trigger.Systems;
public sealed partial class ReleaseGasOnTriggerSystem : SharedReleaseGasOnTriggerSystem
{
[Dependency] private AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private SharedAppearanceSystem _appearance = default!;
[Dependency] private IGameTiming _timing = default!;
public override void Update(float frameTime)
{
base.Update(frameTime);
var curTime = _timing.CurTime;
var query = EntityQueryEnumerator<ReleaseGasOnTriggerComponent>();
while (query.MoveNext(out var uid, out var comp))
{
if (!comp.Active || comp.NextReleaseTime > curTime)
continue;
var giverGasMix = comp.Air.Remove(comp.StartingTotalMoles * comp.RemoveFraction);
var environment = _atmosphereSystem.GetContainingMixture(uid, false, true);
if (environment == null)
{
_appearance.SetData(uid, ReleaseGasOnTriggerVisuals.Key, false);
RemCompDeferred<ReleaseGasOnTriggerComponent>(uid);
continue;
}
_atmosphereSystem.Merge(environment, giverGasMix);
comp.NextReleaseTime += comp.ReleaseInterval;
if (comp.PressureLimit != 0 && environment.Pressure >= comp.PressureLimit ||
comp.Air.TotalMoles <= 0)
{
_appearance.SetData(uid, ReleaseGasOnTriggerVisuals.Key, false);
RemCompDeferred<ReleaseGasOnTriggerComponent>(uid);
}
}
}
}