Gas tank minor opts (#7424)

This commit is contained in:
mirrorcult
2022-04-04 22:08:41 -07:00
committed by GitHub
parent 0123dc4c82
commit d1c980fe41
2 changed files with 16 additions and 11 deletions

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Components
private int _integrity = 3;
[ViewVariables] private BoundUserInterface? _userInterface;
[ViewVariables] public BoundUserInterface? UserInterface;
[DataField("ruptureSound")] private SoundSpecifier _ruptureSound = new SoundPathSpecifier("Audio/Effects/spray.ogg");
@@ -84,10 +84,10 @@ namespace Content.Server.Atmos.Components
protected override void Initialize()
{
base.Initialize();
_userInterface = Owner.GetUIOrNull(SharedGasTankUiKey.Key);
if (_userInterface != null)
UserInterface = Owner.GetUIOrNull(SharedGasTankUiKey.Key);
if (UserInterface != null)
{
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
}
}
@@ -160,7 +160,7 @@ namespace Content.Server.Atmos.Components
public void UpdateUserInterface(bool initialUpdate = false)
{
var internals = GetInternalsComponent();
_userInterface?.SetState(
UserInterface?.SetState(
new GasTankBoundUserInterfaceState
{
TankPressure = Air?.Pressure ?? 0,
@@ -205,16 +205,17 @@ namespace Content.Server.Atmos.Components
public void AssumeAir(GasMixture giver)
{
EntitySystem.Get<AtmosphereSystem>().Merge(Air, giver);
CheckStatus();
var atmos = EntitySystem.Get<AtmosphereSystem>();
atmos.Merge(Air, giver);
CheckStatus(atmos);
}
public void CheckStatus()
public void CheckStatus(AtmosphereSystem? atmosphereSystem=null)
{
if (Air == null)
return;
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
atmosphereSystem ??= EntitySystem.Get<AtmosphereSystem>();
var pressure = Air.Pressure;