Reimplement anchor/unanchor delay (#11128)
This commit is contained in:
@@ -14,8 +14,8 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
||||
[UsedImplicitly]
|
||||
public sealed class AtmosUnsafeUnanchorSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -28,17 +28,18 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
||||
if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||
return;
|
||||
|
||||
if (_atmosphereSystem.GetContainingMixture(uid, true) is not {} environment)
|
||||
if (_atmosphere.GetContainingMixture(uid, true) is not {} environment)
|
||||
return;
|
||||
|
||||
foreach (var node in nodes.Nodes.Values)
|
||||
{
|
||||
if (node is not PipeNode pipe) continue;
|
||||
if (node is not PipeNode pipe)
|
||||
continue;
|
||||
|
||||
if ((pipe.Air.Pressure - environment.Pressure) > 2 * Atmospherics.OneAtmosphere)
|
||||
if (pipe.Air.Pressure - environment.Pressure > 2 * Atmospherics.OneAtmosphere)
|
||||
{
|
||||
args.Delay += 1.5f;
|
||||
_popupSystem.PopupCursor(Loc.GetString("comp-atmos-unsafe-unanchor-warning"),
|
||||
args.Delay += 2f;
|
||||
_popup.PopupEntity(Loc.GetString("comp-atmos-unsafe-unanchor-warning"), pipe.Owner,
|
||||
Filter.Entities(args.User), PopupType.MediumCaution);
|
||||
return; // Show the warning only once.
|
||||
}
|
||||
@@ -50,7 +51,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
||||
if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||
return;
|
||||
|
||||
if (_atmosphereSystem.GetContainingMixture(uid, true, true) is not {} environment)
|
||||
if (_atmosphere.GetContainingMixture(uid, true, true) is not {} environment)
|
||||
environment = GasMixture.SpaceGas;
|
||||
|
||||
var lost = 0f;
|
||||
@@ -58,7 +59,8 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
||||
|
||||
foreach (var node in nodes.Nodes.Values)
|
||||
{
|
||||
if (node is not PipeNode pipe) continue;
|
||||
if (node is not PipeNode pipe)
|
||||
continue;
|
||||
|
||||
var difference = pipe.Air.Pressure - environment.Pressure;
|
||||
lost += difference * environment.Volume / (environment.Temperature * Atmospherics.R);
|
||||
@@ -70,12 +72,13 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
||||
|
||||
foreach (var node in nodes.Nodes.Values)
|
||||
{
|
||||
if (node is not PipeNode pipe) continue;
|
||||
if (node is not PipeNode pipe)
|
||||
continue;
|
||||
|
||||
_atmosphereSystem.Merge(buffer, pipe.Air.Remove(sharedLoss));
|
||||
_atmosphere.Merge(buffer, pipe.Air.Remove(sharedLoss));
|
||||
}
|
||||
|
||||
_atmosphereSystem.Merge(environment, buffer);
|
||||
_atmosphere.Merge(environment, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user