diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs
index 878fcf5913..a240ee60db 100644
--- a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs
+++ b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs
@@ -136,8 +136,6 @@ namespace Content.Server.GameObjects.Components.Disposal
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalMailingUnitUiKey.Key);
- private DisposalMailingUnitBoundUserInterfaceState? _lastUiState;
-
///
/// Store the translated state.
///
@@ -376,34 +374,13 @@ namespace Content.Server.GameObjects.Components.Disposal
UpdateInterface();
}
- private DisposalMailingUnitBoundUserInterfaceState GetInterfaceState()
+ private void UpdateInterface()
{
string stateString;
- if (_locState.State != State)
- {
- stateString = Loc.GetString($"{State}");
- _locState = (State, stateString);
- }
- else
- {
- stateString = _locState.Localized;
- }
-
- return new DisposalMailingUnitBoundUserInterfaceState(Owner.Name, stateString, _pressure, Powered, Engaged, _tag, _targetList, _target);
- }
-
- private void UpdateInterface(bool checkEqual = true)
- {
- var state = GetInterfaceState();
-
- if (checkEqual && _lastUiState != null && _lastUiState.Equals(state))
- {
- return;
- }
-
- _lastUiState = state;
- UserInterface?.SetState((DisposalMailingUnitBoundUserInterfaceState) state.Clone());
+ stateString = Loc.GetString($"{State}");
+ var state = new DisposalUnitBoundUserInterfaceState(Owner.Name, stateString, _pressure, Powered, Engaged);
+ UserInterface?.SetState(state);
}
private bool PlayerCanUse(IEntity? player)
@@ -547,7 +524,10 @@ namespace Content.Server.GameObjects.Components.Disposal
}
}
- UpdateInterface();
+ if (_pressure < 1.0f || oldPressure < 1.0f && _pressure >= 1.0f)
+ {
+ UpdateInterface();
+ }
}
private void PowerStateChanged(PowerChangedMessage args)
@@ -592,6 +572,7 @@ namespace Content.Server.GameObjects.Components.Disposal
UpdateTargetList();
UpdateVisualState();
+ UpdateInterface();
}
public override void OnRemove()
@@ -654,7 +635,7 @@ namespace Content.Server.GameObjects.Components.Disposal
if (command == NET_CMD_RESPONSE && payload.TryGetValue(NET_TAG, out var tag))
{
_targetList.Add(tag);
- UpdateInterface(false);
+ UpdateInterface();
}
if (command == NET_CMD_REQUEST)
@@ -715,7 +696,7 @@ namespace Content.Server.GameObjects.Components.Disposal
if (IsValidInteraction(eventArgs))
{
UpdateTargetList();
- UpdateInterface(false);
+ UpdateInterface();
UserInterface?.Open(actor.playerSession);
return true;
}
diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs
index 63685958e1..90fa7fbc33 100644
--- a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs
+++ b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs
@@ -131,13 +131,6 @@ namespace Content.Server.GameObjects.Components.Disposal
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalUnitUiKey.Key);
- private DisposalUnitBoundUserInterfaceState? _lastUiState;
-
- ///
- /// Store the translated state.
- ///
- private (PressureState State, string Localized) _locState;
-
[DataField("air")]
public GasMixture Air { get; set; } = new GasMixture(Atmospherics.CellVolume);
@@ -328,33 +321,12 @@ namespace Content.Server.GameObjects.Components.Disposal
UpdateInterface();
}
- private DisposalUnitBoundUserInterfaceState GetInterfaceState()
+ private void UpdateInterface()
{
string stateString;
- if (_locState.State != State)
- {
- stateString = Loc.GetString($"{State}");
- _locState = (State, stateString);
- }
- else
- {
- stateString = _locState.Localized;
- }
-
- return new DisposalUnitBoundUserInterfaceState(Owner.Name, stateString, _pressure, Powered, Engaged);
- }
-
- private void UpdateInterface()
- {
- var state = GetInterfaceState();
-
- if (_lastUiState != null && _lastUiState.Equals(state))
- {
- return;
- }
-
- _lastUiState = state;
+ stateString = Loc.GetString($"{State}");
+ var state = new DisposalUnitBoundUserInterfaceState(Owner.Name, stateString, _pressure, Powered, Engaged);
UserInterface?.SetState(state);
}
@@ -488,7 +460,11 @@ namespace Content.Server.GameObjects.Components.Disposal
}
}
- UpdateInterface();
+ // TODO: Ideally we'd just send the start and end and client could lerp as the bandwidth would be way lower
+ if (_pressure < 1.0f || oldPressure < 1.0f && _pressure >= 1.0f)
+ {
+ UpdateInterface();
+ }
}
private void PowerStateChanged(PowerChangedMessage args)
@@ -531,6 +507,7 @@ namespace Content.Server.GameObjects.Components.Disposal
}
UpdateVisualState();
+ UpdateInterface();
}
public override void OnRemove()
diff --git a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs
index 4cd3f33715..de0e8f4556 100644
--- a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs
+++ b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs
@@ -21,7 +21,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
public const string NET_CMD_RESPONSE = "mailer_tag";
[Serializable, NetSerializable]
- public new enum UiButton
+ public new enum UiButton : byte
{
Eject,
Engage,