Fix gas tank bug (#10197)

* Fix gas tank bug

* avoid partial connects

* Revert "avoid partial connects"

This reverts commit 598a871442b74bfe05948e3df8ed47722315722d.
This commit is contained in:
Leon Friedrich
2022-08-01 19:43:20 +12:00
committed by GitHub
parent 8dbb3d7517
commit 55665766cf
2 changed files with 11 additions and 6 deletions

View File

@@ -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<InternalsComponent>(owner.Value);
return _containers.TryGetContainingContainer(component.Owner, out var container)