From 55665766cffc544c03b5602ae1d15a9c0df1472d Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:43:20 +1200 Subject: [PATCH] Fix gas tank bug (#10197) * Fix gas tank bug * avoid partial connects * Revert "avoid partial connects" This reverts commit 598a871442b74bfe05948e3df8ed47722315722d. --- Content.Server/Atmos/EntitySystems/GasTankSystem.cs | 11 ++++++++--- Content.Server/Body/Systems/InternalsSystem.cs | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index 97e3bf56b4..4a411d349f 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -213,13 +213,17 @@ namespace Content.Server.Atmos.EntitySystems UpdateUserInterface(component); } - public void DisconnectFromInternals(GasTankComponent component, EntityUid? owner = null) + public void DisconnectFromInternals(GasTankComponent component) { - if (!component.IsConnected) return; + if (component.User == null) + return; + + var internals = GetInternalsComponent(component); component.User = null; + _actions.SetToggled(component.ToggleAction, false); - _internals.DisconnectTank(GetInternalsComponent(component, owner)); + _internals.DisconnectTank(internals); component.DisconnectStream?.Stop(); if (component.DisconnectSound != null) @@ -230,6 +234,7 @@ namespace Content.Server.Atmos.EntitySystems private InternalsComponent? GetInternalsComponent(GasTankComponent component, EntityUid? owner = null) { + owner ??= component.User; if (Deleted(component.Owner)) return null; if (owner != null) return CompOrNull(owner.Value); return _containers.TryGetContainingContainer(component.Owner, out var container) diff --git a/Content.Server/Body/Systems/InternalsSystem.cs b/Content.Server/Body/Systems/InternalsSystem.cs index 86825b4500..6a98395be0 100644 --- a/Content.Server/Body/Systems/InternalsSystem.cs +++ b/Content.Server/Body/Systems/InternalsSystem.cs @@ -1,4 +1,4 @@ -using Content.Server.Atmos.Components; +using Content.Server.Atmos.Components; using Content.Server.Atmos.EntitySystems; using Content.Server.Body.Components; using Content.Server.Hands.Systems; @@ -79,7 +79,7 @@ public sealed class InternalsSystem : EntitySystem if (TryComp(component.GasTankEntity, out GasTankComponent? tank)) { - _gasTank.DisconnectFromInternals(tank, component.Owner); + _gasTank.DisconnectFromInternals(tank); } component.GasTankEntity = null; @@ -93,7 +93,7 @@ public sealed class InternalsSystem : EntitySystem if (TryComp(component.GasTankEntity, out GasTankComponent? tank)) { - _gasTank.DisconnectFromInternals(tank, component.Owner); + _gasTank.DisconnectFromInternals(tank); } component.GasTankEntity = tankEntity;