using Content.Server.Atmos.Components;
using Content.Shared.Atmos.Components;
namespace Content.Server.Atmos.Piping.Components;
///
/// Component for atmos devices which are updated in line with atmos, as part of a
///
[RegisterComponent]
public sealed partial class AtmosDeviceComponent : Component
{
///
/// If true, this device must be anchored before it will receive any AtmosDeviceUpdateEvents.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public bool RequireAnchored = true;
///
/// If true, update even when there is no grid atmosphere. Normally, atmos devices only
/// update when inside a grid atmosphere, because they work with gases in the environment
/// and won't do anything useful if there is no environment. This is useful for devices
/// like gas canisters whose contents can still react if the canister itself is not inside
/// a grid atmosphere.
///
[DataField]
public bool JoinSystem = false;
///
/// If non-null, the grid that this device is part of.
///
[ViewVariables]
public EntityUid? JoinedGrid = null;
///
/// Indicates that a device is not on a grid atmosphere but still being updated.
///
[ViewVariables]
public bool JoinedSystem = false;
[ViewVariables]
public TimeSpan LastProcess = TimeSpan.Zero;
}
///
/// Raised directed on an atmos device as part of the atmos update loop when the device should do processing.
/// Use this for atmos devices instead of .
///
[ByRefEvent]
public readonly struct AtmosDeviceUpdateEvent(float dt, Entity? grid, Entity? map)
{
///
/// Time elapsed since last update, in seconds. Multiply values used in the update handler
/// by this number to make them tickrate-invariant. Use this number instead of AtmosphereSystem.AtmosTime.
///
public readonly float dt = dt;
///
/// The grid that this device is currently on.
///
public readonly Entity? Grid = grid == null
? null
: (grid.Value, grid.Value, grid.Value);
///
/// The map that the device & grid is on.
///
public readonly Entity? Map = map;
}