mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-02 17:17:25 +00:00
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA * fix the tests I broke * Remove methods that the client shouldn't be calling. Hamburger. * light cleanup for now * review * whoop * docs updates and misc changes --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using Content.Server.Atmos.EntitySystems;
|
|
using Content.Server.Atmos.Piping.Unary.Components;
|
|
using Content.Server.NodeContainer.EntitySystems;
|
|
using Content.Server.NodeContainer.Nodes;
|
|
using Content.Shared.Atmos;
|
|
using Content.Shared.Atmos.Components;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class GasPassiveVentSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
|
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<GasPassiveVentComponent, AtmosDeviceUpdateEvent>(OnPassiveVentUpdated);
|
|
}
|
|
|
|
private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, ref AtmosDeviceUpdateEvent args)
|
|
{
|
|
var environment = _atmosphereSystem.GetContainingMixture(uid, args.Grid, args.Map, true, true);
|
|
|
|
if (environment == null)
|
|
return;
|
|
|
|
if (!_nodeContainer.TryGetNode(uid, vent.InletName, out PipeNode? inlet))
|
|
return;
|
|
|
|
var inletAir = inlet.Air.RemoveRatio(1f);
|
|
var envAir = environment.RemoveRatio(1f);
|
|
|
|
var mergeAir = new GasMixture(inletAir.Volume + envAir.Volume);
|
|
_atmosphereSystem.Merge(mergeAir, inletAir);
|
|
_atmosphereSystem.Merge(mergeAir, envAir);
|
|
|
|
_atmosphereSystem.Merge(inlet.Air, mergeAir.RemoveVolume(inletAir.Volume));
|
|
_atmosphereSystem.Merge(environment, mergeAir);
|
|
}
|
|
}
|
|
}
|