diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs index 6946b8e682..bfbcb1a73a 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs @@ -39,6 +39,21 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems SubscribeLocalEvent(OnTransferRateChangeMessage); SubscribeLocalEvent(OnSelectGasMessage); SubscribeLocalEvent(OnToggleStatusMessage); + + SubscribeLocalEvent(OnAnchorChanged); + } + + private void OnAnchorChanged(EntityUid uid, GasFilterComponent component, ref AnchorStateChangedEvent args) + { + if (args.Anchored) + return; + + component.Enabled = false; + if (TryComp(uid, out AppearanceComponent? appearance)) + appearance.SetData(FilterVisuals.Enabled, false); + + DirtyUI(uid, component); + _userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key); } private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, AtmosDeviceUpdateEvent args) diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index 708168239f..0c6da97641 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -33,6 +33,20 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems SubscribeLocalEvent(OnOutputPressureChangeMessage); SubscribeLocalEvent(OnChangeNodePercentageMessage); SubscribeLocalEvent(OnToggleStatusMessage); + + SubscribeLocalEvent(OnAnchorChanged); + } + + private void OnAnchorChanged(EntityUid uid, GasMixerComponent component, ref AnchorStateChangedEvent args) + { + if (args.Anchored) + return; + + component.Enabled = false; + + DirtyUI(uid, component); + UpdateAppearance(uid, component); + _userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key); } private void OnInit(EntityUid uid, GasMixerComponent component, ComponentInit args)