Add atmos tick time to atmos device update event (#18781)

This commit is contained in:
Kevin Zheng
2023-08-07 10:36:43 -07:00
committed by GitHub
parent e64e613a62
commit 57bf21cb6a
4 changed files with 45 additions and 34 deletions

View File

@@ -7,32 +7,50 @@ namespace Content.Server.Atmos.Piping.Components
public sealed class AtmosDeviceComponent : Component
{
/// <summary>
/// Whether this device requires being anchored to join an atmosphere.
/// If true, this device must be anchored before it will receive any AtmosDeviceUpdateEvents.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("requireAnchored")]
public bool RequireAnchored { get; private set; } = true;
/// <summary>
/// Whether this device will join an entity system to process when not in a grid.
/// 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.
/// </summary>
[DataField("joinSystem")]
public bool JoinSystem { get; } = false;
/// <summary>
/// Whether we have joined an entity system to process.
/// If non-null, the grid that this device is part of.
/// </summary>
public EntityUid? JoinedGrid { get; set; }
/// <summary>
/// Indicates that a device is not on a grid atmosphere but still being updated.
/// </summary>
[ViewVariables]
public bool JoinedSystem { get; set; } = false;
[ViewVariables]
public TimeSpan LastProcess { get; set; } = TimeSpan.Zero;
public EntityUid? JoinedGrid { get; set; }
}
public sealed class AtmosDeviceUpdateEvent : EntityEventArgs
{}
{
/// <summary>
/// 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.
/// </summary>
public float dt;
public AtmosDeviceUpdateEvent(float dt)
{
this.dt = dt;
}
}
public sealed class AtmosDeviceEnabledEvent : EntityEventArgs
{}