using Content.Server.Atmos.EntitySystems;
using Content.Server.Xenoarchaeology.Artifact.XAT.Components;
using Content.Shared.Xenoarchaeology.Artifact.Components;
using Content.Shared.Xenoarchaeology.Artifact.XAT;
namespace Content.Server.Xenoarchaeology.Artifact.XAT;
///
/// System for checking if pressure-related xeno artifact node should be triggered.
///
public sealed class XATPressureSystem : BaseQueryUpdateXATSystem
{
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
///
protected override void UpdateXAT(Entity artifact, Entity node, float frameTime)
{
var xform = Transform(artifact);
if (_atmosphere.GetTileMixture((artifact, xform)) is not { } mixture)
return;
var pressure = mixture.Pressure;
if (pressure >= node.Comp1.MaxPressureThreshold || pressure <= node.Comp1.MinPressureThreshold)
{
Trigger(artifact, node);
}
}
}