Gas tank minor opts (#7424)
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
private int _integrity = 3;
|
private int _integrity = 3;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? _userInterface;
|
[ViewVariables] public BoundUserInterface? UserInterface;
|
||||||
|
|
||||||
[DataField("ruptureSound")] private SoundSpecifier _ruptureSound = new SoundPathSpecifier("Audio/Effects/spray.ogg");
|
[DataField("ruptureSound")] private SoundSpecifier _ruptureSound = new SoundPathSpecifier("Audio/Effects/spray.ogg");
|
||||||
|
|
||||||
@@ -84,10 +84,10 @@ namespace Content.Server.Atmos.Components
|
|||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_userInterface = Owner.GetUIOrNull(SharedGasTankUiKey.Key);
|
UserInterface = Owner.GetUIOrNull(SharedGasTankUiKey.Key);
|
||||||
if (_userInterface != null)
|
if (UserInterface != null)
|
||||||
{
|
{
|
||||||
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
public void UpdateUserInterface(bool initialUpdate = false)
|
public void UpdateUserInterface(bool initialUpdate = false)
|
||||||
{
|
{
|
||||||
var internals = GetInternalsComponent();
|
var internals = GetInternalsComponent();
|
||||||
_userInterface?.SetState(
|
UserInterface?.SetState(
|
||||||
new GasTankBoundUserInterfaceState
|
new GasTankBoundUserInterfaceState
|
||||||
{
|
{
|
||||||
TankPressure = Air?.Pressure ?? 0,
|
TankPressure = Air?.Pressure ?? 0,
|
||||||
@@ -205,16 +205,17 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
public void AssumeAir(GasMixture giver)
|
public void AssumeAir(GasMixture giver)
|
||||||
{
|
{
|
||||||
EntitySystem.Get<AtmosphereSystem>().Merge(Air, giver);
|
var atmos = EntitySystem.Get<AtmosphereSystem>();
|
||||||
CheckStatus();
|
atmos.Merge(Air, giver);
|
||||||
|
CheckStatus(atmos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckStatus()
|
public void CheckStatus(AtmosphereSystem? atmosphereSystem=null)
|
||||||
{
|
{
|
||||||
if (Air == null)
|
if (Air == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
atmosphereSystem ??= EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
var pressure = Air.Pressure;
|
var pressure = Air.Pressure;
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,12 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
foreach (var gasTank in EntityManager.EntityQuery<GasTankComponent>())
|
foreach (var gasTank in EntityManager.EntityQuery<GasTankComponent>())
|
||||||
{
|
{
|
||||||
_atmosphereSystem.React(gasTank.Air, gasTank);
|
_atmosphereSystem.React(gasTank.Air, gasTank);
|
||||||
gasTank.CheckStatus();
|
gasTank.CheckStatus(_atmosphereSystem);
|
||||||
gasTank.UpdateUserInterface();
|
|
||||||
|
if (gasTank.UserInterface != null && gasTank.UserInterface.SubscribedSessions.Count > 0)
|
||||||
|
{
|
||||||
|
gasTank.UpdateUserInterface();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user