Setting the side port output on a gas mixer now behaves as intended (#11363)

This commit is contained in:
Mervill
2022-09-16 14:34:17 -07:00
committed by GitHub
parent 149aacf187
commit c1578ea4a7

View File

@@ -1,4 +1,4 @@
using System; using System;
using Content.Client.Atmos.EntitySystems; using Content.Client.Atmos.EntitySystems;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Binary.Components; using Content.Shared.Atmos.Piping.Binary.Components;
@@ -57,10 +57,12 @@ namespace Content.Client.Atmos.UI
private void OnMixerSetPercentagePressed(string value) private void OnMixerSetPercentagePressed(string value)
{ {
// We don't need to send both nodes because it's just 1.0f - node // We don't need to send both nodes because it's just 100.0f - node
float node = float.TryParse(value, out var parsed) ? parsed : 1.0f; float node = float.TryParse(value, out var parsed) ? parsed : 1.0f;
if(_window is not null) node = _window.NodeOneLastEdited ? node : 1.0f - node; node = Math.Clamp(node, 0, 100);
if (_window is not null) node = _window.NodeOneLastEdited ? node : 100.0f - node;
SendMessage(new GasMixerChangeNodePercentageMessage(node)); SendMessage(new GasMixerChangeNodePercentageMessage(node));
} }