Convert atmos device events to ref events (#22843)
This commit is contained in:
@@ -25,7 +25,7 @@ public sealed class AirFilterSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<AirFilterComponent, AtmosDeviceUpdateEvent>(OnFilterUpdate);
|
SubscribeLocalEvent<AirFilterComponent, AtmosDeviceUpdateEvent>(OnFilterUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnIntakeUpdate(EntityUid uid, AirIntakeComponent intake, AtmosDeviceUpdateEvent args)
|
private void OnIntakeUpdate(EntityUid uid, AirIntakeComponent intake, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!GetAir(uid, out var air))
|
if (!GetAir(uid, out var air))
|
||||||
return;
|
return;
|
||||||
@@ -51,7 +51,7 @@ public sealed class AirFilterSystem : EntitySystem
|
|||||||
_atmosphere.Merge(air, environment.Remove(transferMoles));
|
_atmosphere.Merge(air, environment.Remove(transferMoles));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFilterUpdate(EntityUid uid, AirFilterComponent filter, AtmosDeviceUpdateEvent args)
|
private void OnFilterUpdate(EntityUid uid, AirFilterComponent filter, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!GetAir(uid, out var air))
|
if (!GetAir(uid, out var air))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -406,9 +406,10 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
var time = _gameTiming.CurTime;
|
var time = _gameTiming.CurTime;
|
||||||
var number = 0;
|
var number = 0;
|
||||||
|
var ev = new AtmosDeviceUpdateEvent(RealAtmosTime());
|
||||||
while (atmosphere.CurrentRunAtmosDevices.TryDequeue(out var device))
|
while (atmosphere.CurrentRunAtmosDevices.TryDequeue(out var device))
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(device, new AtmosDeviceUpdateEvent(RealAtmosTime()));
|
RaiseLocalEvent(device, ref ev);
|
||||||
device.Comp.LastProcess = time;
|
device.Comp.LastProcess = time;
|
||||||
|
|
||||||
if (number++ < LagCheckIterations)
|
if (number++ < LagCheckIterations)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public sealed class HeatExchangerSystem : EntitySystem
|
|||||||
tileLoss = val;
|
tileLoss = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAtmosUpdate(EntityUid uid, HeatExchangerComponent comp, AtmosDeviceUpdateEvent args)
|
private void OnAtmosUpdate(EntityUid uid, HeatExchangerComponent comp, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!TryComp(uid, out NodeContainerComponent? nodeContainer)
|
if (!TryComp(uid, out NodeContainerComponent? nodeContainer)
|
||||||
|| !TryComp(uid, out AtmosDeviceComponent? device)
|
|| !TryComp(uid, out AtmosDeviceComponent? device)
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ public sealed class AirAlarmSystem : EntitySystem
|
|||||||
_ui.TryCloseAll(uid, SharedAirAlarmInterfaceKey.Key);
|
_ui.TryCloseAll(uid, SharedAirAlarmInterfaceKey.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAtmosUpdate(EntityUid uid, AirAlarmComponent alarm, AtmosDeviceUpdateEvent args)
|
private void OnAtmosUpdate(EntityUid uid, AirAlarmComponent alarm, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
alarm.CurrentModeUpdater?.Update(uid);
|
alarm.CurrentModeUpdater?.Update(uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<AtmosMonitorComponent, AtmosDeviceEnabledEvent>(OnAtmosDeviceEnterAtmosphere);
|
SubscribeLocalEvent<AtmosMonitorComponent, AtmosDeviceEnabledEvent>(OnAtmosDeviceEnterAtmosphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAtmosDeviceLeaveAtmosphere(EntityUid uid, AtmosMonitorComponent atmosMonitor, AtmosDeviceDisabledEvent args)
|
private void OnAtmosDeviceLeaveAtmosphere(EntityUid uid, AtmosMonitorComponent atmosMonitor, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
atmosMonitor.TileGas = null;
|
atmosMonitor.TileGas = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAtmosDeviceEnterAtmosphere(EntityUid uid, AtmosMonitorComponent atmosMonitor, AtmosDeviceEnabledEvent args)
|
private void OnAtmosDeviceEnterAtmosphere(EntityUid uid, AtmosMonitorComponent atmosMonitor, ref AtmosDeviceEnabledEvent args)
|
||||||
{
|
{
|
||||||
atmosMonitor.TileGas = _atmosphereSystem.GetContainingMixture(uid, true);
|
atmosMonitor.TileGas = _atmosphereSystem.GetContainingMixture(uid, true);
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAtmosUpdate(EntityUid uid, AtmosMonitorComponent component, AtmosDeviceUpdateEvent args)
|
private void OnAtmosUpdate(EntityUid uid, AtmosMonitorComponent component, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!this.IsPowered(uid, EntityManager))
|
if (!this.IsPowered(uid, EntityManager))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasPassiveGateComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<GasPassiveGateComponent, ExaminedEvent>(OnExamined);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPassiveGateUpdated(EntityUid uid, GasPassiveGateComponent gate, AtmosDeviceUpdateEvent args)
|
private void OnPassiveGateUpdated(EntityUid uid, GasPassiveGateComponent gate, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
|
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceUpdateEvent args)
|
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!pump.Enabled
|
if (!pump.Enabled
|
||||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||||
@@ -94,7 +94,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceDisabledEvent args)
|
private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent pump, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
pump.Enabled = false;
|
pump.Enabled = false;
|
||||||
UpdateAppearance(uid, pump);
|
UpdateAppearance(uid, pump);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasRecyclerComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
SubscribeLocalEvent<GasRecyclerComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnabled(EntityUid uid, GasRecyclerComponent comp, AtmosDeviceEnabledEvent args)
|
private void OnEnabled(EntityUid uid, GasRecyclerComponent comp, ref AtmosDeviceEnabledEvent args)
|
||||||
{
|
{
|
||||||
UpdateAppearance(uid, comp);
|
UpdateAppearance(uid, comp);
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
return alpha * (float)Math.Sqrt(inlet.Pressure - outlet.Pressure);
|
return alpha * (float)Math.Sqrt(inlet.Pressure - outlet.Pressure);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisabled(EntityUid uid, GasRecyclerComponent comp, AtmosDeviceDisabledEvent args)
|
private void OnDisabled(EntityUid uid, GasRecyclerComponent comp, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
comp.Reacting = false;
|
comp.Reacting = false;
|
||||||
UpdateAppearance(uid, comp);
|
UpdateAppearance(uid, comp);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
args.PushMarkup(str);
|
args.PushMarkup(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnVolumePumpUpdated(EntityUid uid, GasVolumePumpComponent pump, AtmosDeviceUpdateEvent args)
|
private void OnVolumePumpUpdated(EntityUid uid, GasVolumePumpComponent pump, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!pump.Enabled
|
if (!pump.Enabled
|
||||||
|| !TryComp(uid, out NodeContainerComponent? nodeContainer)
|
|| !TryComp(uid, out NodeContainerComponent? nodeContainer)
|
||||||
@@ -125,7 +125,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
_ambientSoundSystem.SetAmbience(uid, removed.TotalMoles > 0f);
|
_ambientSoundSystem.SetAmbience(uid, removed.TotalMoles > 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnVolumePumpLeaveAtmosphere(EntityUid uid, GasVolumePumpComponent pump, AtmosDeviceDisabledEvent args)
|
private void OnVolumePumpLeaveAtmosphere(EntityUid uid, GasVolumePumpComponent pump, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
pump.Enabled = false;
|
pump.Enabled = false;
|
||||||
UpdateAppearance(uid, pump);
|
UpdateAppearance(uid, pump);
|
||||||
|
|||||||
@@ -1,60 +1,73 @@
|
|||||||
namespace Content.Server.Atmos.Piping.Components
|
using Content.Server.Atmos.Components;
|
||||||
|
|
||||||
|
namespace Content.Server.Atmos.Piping.Components;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Component for atmos devices which are updated in line with atmos, as part of a <see cref="GridAtmosphereComponent"/>
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class AtmosDeviceComponent : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds itself to a <see cref="IAtmosphereComponent"/> to be updated by.
|
/// If true, this device must be anchored before it will receive any AtmosDeviceUpdateEvents.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public sealed partial class AtmosDeviceComponent : Component
|
[DataField]
|
||||||
{
|
public bool RequireAnchored = true;
|
||||||
/// <summary>
|
|
||||||
/// 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>
|
/// <summary>
|
||||||
/// If true, update even when there is no grid atmosphere. Normally, atmos devices only
|
/// 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
|
/// 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
|
/// 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
|
/// like gas canisters whose contents can still react if the canister itself is not inside
|
||||||
/// a grid atmosphere.
|
/// a grid atmosphere.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("joinSystem")]
|
[DataField]
|
||||||
public bool JoinSystem { get; private set; } = false;
|
public bool JoinSystem = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If non-null, the grid that this device is part of.
|
/// If non-null, the grid that this device is part of.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityUid? JoinedGrid { get; set; }
|
[DataField]
|
||||||
|
public EntityUid? JoinedGrid = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates that a device is not on a grid atmosphere but still being updated.
|
/// Indicates that a device is not on a grid atmosphere but still being updated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool JoinedSystem { get; set; } = false;
|
public bool JoinedSystem = false;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public TimeSpan LastProcess { get; set; } = TimeSpan.Zero;
|
public TimeSpan LastProcess = TimeSpan.Zero;
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
{}
|
|
||||||
|
|
||||||
public sealed class AtmosDeviceDisabledEvent : EntityEventArgs
|
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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 <see cref="EntitySystem.Update"/>.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public readonly struct AtmosDeviceUpdateEvent
|
||||||
|
{
|
||||||
|
/// <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 readonly float dt;
|
||||||
|
|
||||||
|
public AtmosDeviceUpdateEvent(float dt)
|
||||||
|
{
|
||||||
|
this.dt = dt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on an atmos device when it is enabled.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct AtmosDeviceEnabledEvent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised directed on an atmos device when it is enabled.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public record struct AtmosDeviceDisabledEvent;
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
// Set of atmos devices that are off-grid but have JoinSystem set.
|
// Set of atmos devices that are off-grid but have JoinSystem set.
|
||||||
private readonly HashSet<Entity<AtmosDeviceComponent>> _joinedDevices = new();
|
private readonly HashSet<Entity<AtmosDeviceComponent>> _joinedDevices = new();
|
||||||
|
|
||||||
|
private static AtmosDeviceDisabledEvent _disabledEv = new();
|
||||||
|
private static AtmosDeviceEnabledEvent _enabledEv = new();
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -45,7 +48,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
component.LastProcess = _gameTiming.CurTime;
|
component.LastProcess = _gameTiming.CurTime;
|
||||||
RaiseLocalEvent(ent, new AtmosDeviceEnabledEvent());
|
RaiseLocalEvent(ent, ref _enabledEv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LeaveAtmosphere(Entity<AtmosDeviceComponent> ent)
|
public void LeaveAtmosphere(Entity<AtmosDeviceComponent> ent)
|
||||||
@@ -66,7 +69,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
component.LastProcess = TimeSpan.Zero;
|
component.LastProcess = TimeSpan.Zero;
|
||||||
RaiseLocalEvent(ent, new AtmosDeviceDisabledEvent());
|
RaiseLocalEvent(ent, ref _disabledEv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RejoinAtmosphere(Entity<AtmosDeviceComponent> component)
|
public void RejoinAtmosphere(Entity<AtmosDeviceComponent> component)
|
||||||
@@ -116,9 +119,10 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
_timer -= _atmosphereSystem.AtmosTime;
|
_timer -= _atmosphereSystem.AtmosTime;
|
||||||
|
|
||||||
var time = _gameTiming.CurTime;
|
var time = _gameTiming.CurTime;
|
||||||
|
var ev = new AtmosDeviceUpdateEvent(_atmosphereSystem.AtmosTime);
|
||||||
foreach (var device in _joinedDevices)
|
foreach (var device in _joinedDevices)
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(device, new AtmosDeviceUpdateEvent(_atmosphereSystem.AtmosTime));
|
RaiseLocalEvent(device, ref ev);
|
||||||
device.Comp.LastProcess = time;
|
device.Comp.LastProcess = time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
UpdateAppearance(uid, filter);
|
UpdateAppearance(uid, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, AtmosDeviceUpdateEvent args)
|
private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!filter.Enabled
|
if (!filter.Enabled
|
||||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||||
@@ -90,7 +90,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
_atmosphereSystem.Merge(outletNode.Air, removed);
|
_atmosphereSystem.Merge(outletNode.Air, removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFilterLeaveAtmosphere(EntityUid uid, GasFilterComponent filter, AtmosDeviceDisabledEvent args)
|
private void OnFilterLeaveAtmosphere(EntityUid uid, GasFilterComponent filter, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
filter.Enabled = false;
|
filter.Enabled = false;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
UpdateAppearance(uid, mixer);
|
UpdateAppearance(uid, mixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMixerUpdated(EntityUid uid, GasMixerComponent mixer, AtmosDeviceUpdateEvent args)
|
private void OnMixerUpdated(EntityUid uid, GasMixerComponent mixer, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
// TODO ATMOS: Cache total moles since it's expensive.
|
// TODO ATMOS: Cache total moles since it's expensive.
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
_ambientSoundSystem.SetAmbience(uid, true);
|
_ambientSoundSystem.SetAmbience(uid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMixerLeaveAtmosphere(EntityUid uid, GasMixerComponent mixer, AtmosDeviceDisabledEvent args)
|
private void OnMixerLeaveAtmosphere(EntityUid uid, GasMixerComponent mixer, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
mixer.Enabled = false;
|
mixer.Enabled = false;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
UpdateAppearance(uid, comp);
|
UpdateAppearance(uid, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUpdate(EntityUid uid, PressureControlledValveComponent comp, AtmosDeviceUpdateEvent args)
|
private void OnUpdate(EntityUid uid, PressureControlledValveComponent comp, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||||
|| !EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device)
|
|| !EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device)
|
||||||
@@ -79,7 +79,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
_atmosphereSystem.Merge(outletNode.Air, removed);
|
_atmosphereSystem.Merge(outletNode.Air, removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFilterLeaveAtmosphere(EntityUid uid, PressureControlledValveComponent comp, AtmosDeviceDisabledEvent args)
|
private void OnFilterLeaveAtmosphere(EntityUid uid, PressureControlledValveComponent comp, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
comp.Enabled = false;
|
comp.Enabled = false;
|
||||||
UpdateAppearance(uid, comp);
|
UpdateAppearance(uid, comp);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public sealed class GasCanisterSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnCanisterChangeReleaseValve(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleaseValveMessage args)
|
private void OnCanisterChangeReleaseValve(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleaseValveMessage args)
|
||||||
{
|
{
|
||||||
var impact = LogImpact.High;
|
var impact = LogImpact.High;
|
||||||
// filling a jetpack with plasma is less important than filling a room with it
|
// filling a jetpack with plasma is less important than filling a room with it
|
||||||
impact = canister.GasTankSlot.HasItem ? LogImpact.Medium : LogImpact.High;
|
impact = canister.GasTankSlot.HasItem ? LogImpact.Medium : LogImpact.High;
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ public sealed class GasCanisterSystem : EntitySystem
|
|||||||
DirtyUI(uid, canister);
|
DirtyUI(uid, canister);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCanisterUpdated(EntityUid uid, GasCanisterComponent canister, AtmosDeviceUpdateEvent args)
|
private void OnCanisterUpdated(EntityUid uid, GasCanisterComponent canister, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
_atmos.React(canister.Air, canister);
|
_atmos.React(canister.Air, canister);
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ public sealed class GasCanisterSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
MixContainerWithPipeNet(canister.Air, net.Air);
|
MixContainerWithPipeNet(canister.Air, net.Air);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release valve is open, release gas.
|
// Release valve is open, release gas.
|
||||||
if (canister.ReleaseValve)
|
if (canister.ReleaseValve)
|
||||||
{
|
{
|
||||||
@@ -250,9 +250,9 @@ public sealed class GasCanisterSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Preventing inserting a tank since if its locked you cant remove it.
|
// Preventing inserting a tank since if its locked you cant remove it.
|
||||||
if (!CheckLocked(uid, component, args.User.Value))
|
if (!CheckLocked(uid, component, args.User.Value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
args.Cancelled = true;
|
args.Cancelled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public sealed class GasCondenserSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<GasCondenserComponent, AtmosDeviceUpdateEvent>(OnCondenserUpdated);
|
SubscribeLocalEvent<GasCondenserComponent, AtmosDeviceUpdateEvent>(OnCondenserUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCondenserUpdated(EntityUid uid, GasCondenserComponent component, AtmosDeviceUpdateEvent args)
|
private void OnCondenserUpdated(EntityUid uid, GasCondenserComponent component, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!(_power.IsPowered(uid) && TryComp<ApcPowerReceiverComponent>(uid, out var receiver))
|
if (!(_power.IsPowered(uid) && TryComp<ApcPowerReceiverComponent>(uid, out var receiver))
|
||||||
|| !TryComp<NodeContainerComponent>(uid, out var nodeContainer)
|
|| !TryComp<NodeContainerComponent>(uid, out var nodeContainer)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
_appearance.SetData(uid, OutletInjectorVisuals.Enabled, component.Enabled, appearance);
|
_appearance.SetData(uid, OutletInjectorVisuals.Enabled, component.Enabled, appearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnOutletInjectorUpdated(EntityUid uid, GasOutletInjectorComponent injector, AtmosDeviceUpdateEvent args)
|
private void OnOutletInjectorUpdated(EntityUid uid, GasOutletInjectorComponent injector, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!injector.Enabled)
|
if (!injector.Enabled)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasPassiveVentComponent, AtmosDeviceUpdateEvent>(OnPassiveVentUpdated);
|
SubscribeLocalEvent<GasPassiveVentComponent, AtmosDeviceUpdateEvent>(OnPassiveVentUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, AtmosDeviceUpdateEvent args)
|
private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var environment = _atmosphereSystem.GetContainingMixture(uid, true, true);
|
var environment = _atmosphereSystem.GetContainingMixture(uid, true, true);
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasThermoMachineComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
SubscribeLocalEvent<GasThermoMachineComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args)
|
private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!(_power.IsPowered(uid) && TryComp<ApcPowerReceiverComponent>(uid, out var receiver))
|
if (!(_power.IsPowered(uid) && TryComp<ApcPowerReceiverComponent>(uid, out var receiver))
|
||||||
|| !TryComp<NodeContainerComponent>(uid, out var nodeContainer)
|
|| !TryComp<NodeContainerComponent>(uid, out var nodeContainer)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasVentPumpComponent, WeldableChangedEvent>(OnWeldChanged);
|
SubscribeLocalEvent<GasVentPumpComponent, WeldableChangedEvent>(OnWeldChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, AtmosDeviceUpdateEvent args)
|
private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
//Bingo waz here
|
//Bingo waz here
|
||||||
if (_weldable.IsWelded(uid))
|
if (_weldable.IsWelded(uid))
|
||||||
@@ -165,12 +165,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGasVentPumpLeaveAtmosphere(EntityUid uid, GasVentPumpComponent component, AtmosDeviceDisabledEvent args)
|
private void OnGasVentPumpLeaveAtmosphere(EntityUid uid, GasVentPumpComponent component, ref AtmosDeviceDisabledEvent args)
|
||||||
{
|
{
|
||||||
UpdateState(uid, component);
|
UpdateState(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGasVentPumpEnterAtmosphere(EntityUid uid, GasVentPumpComponent component, AtmosDeviceEnabledEvent args)
|
private void OnGasVentPumpEnterAtmosphere(EntityUid uid, GasVentPumpComponent component, ref AtmosDeviceEnabledEvent args)
|
||||||
{
|
{
|
||||||
UpdateState(uid, component);
|
UpdateState(uid, component);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
SubscribeLocalEvent<GasVentScrubberComponent, WeldableChangedEvent>(OnWeldChanged);
|
SubscribeLocalEvent<GasVentScrubberComponent, WeldableChangedEvent>(OnWeldChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrubber, AtmosDeviceUpdateEvent args)
|
private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrubber, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (_weldable.IsWelded(uid))
|
if (_weldable.IsWelded(uid))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Content.Server.Atmos.Portable
|
|||||||
return component.Air.Pressure >= component.MaxPressure;
|
return component.Air.Pressure >= component.MaxPressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeviceUpdated(EntityUid uid, PortableScrubberComponent component, AtmosDeviceUpdateEvent args)
|
private void OnDeviceUpdated(EntityUid uid, PortableScrubberComponent component, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!TryComp(uid, out AtmosDeviceComponent? device))
|
if (!TryComp(uid, out AtmosDeviceComponent? device))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
|
|||||||
|
|
||||||
#region Atmos handler
|
#region Atmos handler
|
||||||
|
|
||||||
private void OnCryoPodUpdateAtmosphere(EntityUid uid, CryoPodComponent cryoPod, AtmosDeviceUpdateEvent args)
|
private void OnCryoPodUpdateAtmosphere(EntityUid uid, CryoPodComponent cryoPod, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
if (!TryComp(uid, out NodeContainerComponent? nodeContainer))
|
if (!TryComp(uid, out NodeContainerComponent? nodeContainer))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public sealed class TegSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GeneratorUpdate(EntityUid uid, TegGeneratorComponent component, AtmosDeviceUpdateEvent args)
|
private void GeneratorUpdate(EntityUid uid, TegGeneratorComponent component, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var tegGroup = GetNodeGroup(uid);
|
var tegGroup = GetNodeGroup(uid);
|
||||||
if (tegGroup is not { IsFullyBuilt: true })
|
if (tegGroup is not { IsFullyBuilt: true })
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public sealed class GasPowerReceiverSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<GasPowerReceiverComponent, AtmosDeviceUpdateEvent>(OnDeviceUpdated);
|
SubscribeLocalEvent<GasPowerReceiverComponent, AtmosDeviceUpdateEvent>(OnDeviceUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDeviceUpdated(EntityUid uid, GasPowerReceiverComponent component, AtmosDeviceUpdateEvent args)
|
private void OnDeviceUpdated(EntityUid uid, GasPowerReceiverComponent component, ref AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var timeDelta = args.dt;
|
var timeDelta = args.dt;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user