Disable mixer and filter on unanchor (#6577)
This commit is contained in:
@@ -39,6 +39,21 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
SubscribeLocalEvent<GasFilterComponent, GasFilterChangeRateMessage>(OnTransferRateChangeMessage);
|
||||
SubscribeLocalEvent<GasFilterComponent, GasFilterSelectGasMessage>(OnSelectGasMessage);
|
||||
SubscribeLocalEvent<GasFilterComponent, GasFilterToggleStatusMessage>(OnToggleStatusMessage);
|
||||
|
||||
SubscribeLocalEvent<GasFilterComponent, AnchorStateChangedEvent>(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)
|
||||
|
||||
@@ -33,6 +33,20 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
SubscribeLocalEvent<GasMixerComponent, GasMixerChangeOutputPressureMessage>(OnOutputPressureChangeMessage);
|
||||
SubscribeLocalEvent<GasMixerComponent, GasMixerChangeNodePercentageMessage>(OnChangeNodePercentageMessage);
|
||||
SubscribeLocalEvent<GasMixerComponent, GasMixerToggleStatusMessage>(OnToggleStatusMessage);
|
||||
|
||||
SubscribeLocalEvent<GasMixerComponent, AnchorStateChangedEvent>(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)
|
||||
|
||||
Reference in New Issue
Block a user