diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs
index a00b58f54f9..57c861bd20f 100644
--- a/Content.Client/Actions/ActionsSystem.cs
+++ b/Content.Client/Actions/ActionsSystem.cs
@@ -259,13 +259,13 @@ public void UnlinkAllActions()
public void LinkAllActions(ActionsComponent? actions = null)
{
- if (_playerManager.LocalEntity is not { } user ||
- !Resolve(user, ref actions, false))
- {
- return;
- }
+ if (_playerManager.LocalEntity is not { } user ||
+ !Resolve(user, ref actions, false))
+ {
+ return;
+ }
- LinkActions?.Invoke(actions);
+ LinkActions?.Invoke(actions);
}
public override void Shutdown()
diff --git a/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs b/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
index c8e3afeb22c..a412e47396b 100644
--- a/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
+++ b/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
@@ -159,7 +159,6 @@ private void OnTypeChanged(OptionButton.ItemSelectedEventArgs args)
SecretCheckBox.Pressed = false;
SeverityOption.Disabled = false;
PermanentCheckBox.Pressed = true;
- SubmitButton.Disabled = true;
UpdatePermanentCheckboxFields();
break;
case (int) NoteType.Message: // Message: these are shown to the player when they log on
diff --git a/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs b/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs
index 9b24b1adc25..355b10cb4a4 100644
--- a/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs
+++ b/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs
@@ -1,4 +1,8 @@
+using Robust.Shared.GameObjects;
+
namespace Content.Client.Atmos.Components;
[RegisterComponent]
-public sealed partial class PipeColorVisualsComponent : Component;
+public sealed partial class PipeColorVisualsComponent : Component
+{
+}
diff --git a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml
index 3dbe14e6b6d..6bdfb3989f9 100644
--- a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml
+++ b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml
@@ -1,5 +1,6 @@
@@ -61,7 +62,7 @@
-
+
diff --git a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs
index e533ef2dce0..79bb66560e3 100644
--- a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs
+++ b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs
@@ -136,9 +136,8 @@ public void UpdateEntry(AtmosAlertsComputerEntry entry, bool isFocus, AtmosAlert
GasGridContainer.RemoveAllChildren();
var gasData = focusData.Value.GasData.Where(g => g.Key != Gas.Oxygen);
- var keyValuePairs = gasData.ToList();
- if (keyValuePairs.Count == 0)
+ if (gasData.Count() == 0)
{
// No other gases
var gasLabel = new Label()
@@ -159,11 +158,13 @@ public void UpdateEntry(AtmosAlertsComputerEntry entry, bool isFocus, AtmosAlert
else
{
// Add an entry for each gas
- foreach ((var gas, (var mol, var percent, var alert)) in keyValuePairs)
+ foreach ((var gas, (var mol, var percent, var alert)) in gasData)
{
- FixedPoint2 gasPercent = percent * 100f;
+ var gasPercent = (FixedPoint2)0f;
+ gasPercent = percent * 100f;
- var gasShorthand = _gasShorthands.GetValueOrDefault(gas, "X");
+ if (!_gasShorthands.TryGetValue(gas, out var gasShorthand))
+ gasShorthand = "X";
var gasLabel = new Label()
{
diff --git a/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs b/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs
index 6f0e7f80da1..08cae979b9b 100644
--- a/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs
+++ b/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs
@@ -14,6 +14,8 @@ protected override void Open()
_menu = new AtmosAlertsComputerWindow(this, Owner);
_menu.OpenCentered();
_menu.OnClose += Close;
+
+ EntMan.TryGetComponent(Owner, out var xform);
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -22,6 +24,9 @@ protected override void UpdateState(BoundUserInterfaceState state)
var castState = (AtmosAlertsComputerBoundInterfaceState) state;
+ if (castState == null)
+ return;
+
EntMan.TryGetComponent(Owner, out var xform);
_menu?.UpdateUI(xform?.Coordinates, castState.AirAlarms, castState.FireAlarms, castState.FocusData);
}
diff --git a/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml b/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml
index e5ede1b92e3..8824a776ee6 100644
--- a/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml
+++ b/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml
@@ -1,6 +1,7 @@
(OnInit);
- SubscribeLocalEvent(OnAppearanceChanged, after: [typeof(SubFloorHideSystem)]);
+ SubscribeLocalEvent(OnAppearanceChanged, after: new[] { typeof(SubFloorHideSystem) });
}
private void OnInit(EntityUid uid, PipeAppearanceComponent component, ComponentInit args)
@@ -82,8 +84,7 @@ private void OnAppearanceChanged(EntityUid uid, PipeAppearanceComponent componen
layer.Visible &= visible;
- if (!visible)
- continue;
+ if (!visible) continue;
layer.Color = color;
}
diff --git a/Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs b/Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs
deleted file mode 100644
index 54e16bc8621..00000000000
--- a/Content.Client/Atmos/EntitySystems/GasPressurePumpSystem.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Content.Client.Atmos.UI;
-using Content.Shared.Atmos.Components;
-using Content.Shared.Atmos.EntitySystems;
-using Content.Shared.Atmos.Piping.Binary.Components;
-
-namespace Content.Client.Atmos.EntitySystems;
-
-public sealed class GasPressurePumpSystem : SharedGasPressurePumpSystem
-{
- public override void Initialize()
- {
- base.Initialize();
- SubscribeLocalEvent(OnPumpUpdate);
- }
-
- private void OnPumpUpdate(Entity ent, ref AfterAutoHandleStateEvent args)
- {
- if (UserInterfaceSystem.TryGetOpenUi(ent.Owner, GasPressurePumpUiKey.Key, out var bui))
- {
- bui.Update();
- }
- }
-}
diff --git a/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs b/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs
index 18ca2234752..019f25f376b 100644
--- a/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs
+++ b/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs
@@ -1,7 +1,12 @@
+using System.Collections.Generic;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Power;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
+using Robust.Shared.GameObjects;
+using Robust.Shared.IoC;
+using Robust.Shared.Maths;
+using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Client.Atmos.Monitor;
@@ -22,7 +27,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC
{
foreach (var visLayer in component.HideOnDepowered)
{
- if (args.Sprite.LayerMapTryGet(visLayer, out var powerVisibilityLayer))
+ if (args.Sprite.LayerMapTryGet(visLayer, out int powerVisibilityLayer))
args.Sprite.LayerSetVisible(powerVisibilityLayer, powered);
}
}
@@ -31,7 +36,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC
{
foreach (var (setLayer, powerState) in component.SetOnDepowered)
{
- if (args.Sprite.LayerMapTryGet(setLayer, out var setStateLayer))
+ if (args.Sprite.LayerMapTryGet(setLayer, out int setStateLayer))
args.Sprite.LayerSetState(setStateLayer, new RSI.StateId(powerState));
}
}
diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs
index 650f96eec97..d9e94e373b4 100644
--- a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs
+++ b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs
@@ -1,7 +1,11 @@
using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Monitor.Components;
+using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
+using Robust.Shared.GameObjects;
+using Robust.Shared.IoC;
+using Robust.Shared.Log;
namespace Content.Client.Atmos.Monitor.UI;
@@ -74,7 +78,6 @@ protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
- if (disposing)
- _window?.Dispose();
+ if (disposing) _window?.Dispose();
}
}
diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
index 65164983865..e1425ac491b 100644
--- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
+++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
@@ -8,6 +8,7 @@
using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Temperature;
using Robust.Client.AutoGenerated;
+using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
@@ -58,7 +59,7 @@ public AirAlarmWindow()
AirAlarmMode.Fill => "air-alarm-ui-mode-fill",
AirAlarmMode.Panic => "air-alarm-ui-mode-panic",
AirAlarmMode.None => "air-alarm-ui-mode-none",
- _ => "error",
+ _ => "error"
};
_modes.AddItem(Loc.GetString(text));
}
@@ -69,7 +70,7 @@ public AirAlarmWindow()
AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id);
};
- _autoMode.OnToggled += _ =>
+ _autoMode.OnToggled += args =>
{
AutoModeChanged!.Invoke(_autoMode.Pressed);
};
@@ -175,18 +176,22 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
public static Color ColorForThreshold(float amount, AtmosAlarmThreshold threshold)
{
- threshold.CheckThreshold(amount, out var curAlarm);
+ threshold.CheckThreshold(amount, out AtmosAlarmType curAlarm);
return ColorForAlarm(curAlarm);
}
public static Color ColorForAlarm(AtmosAlarmType curAlarm)
{
- return curAlarm switch
+ if(curAlarm == AtmosAlarmType.Danger)
{
- AtmosAlarmType.Danger => StyleNano.DangerousRedFore,
- AtmosAlarmType.Warning => StyleNano.ConcerningOrangeFore,
- _ => StyleNano.GoodGreenFore,
- };
+ return StyleNano.DangerousRedFore;
+ }
+ else if(curAlarm == AtmosAlarmType.Warning)
+ {
+ return StyleNano.ConcerningOrangeFore;
+ }
+
+ return StyleNano.GoodGreenFore;
}
diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs
index 2cd51d6fc7f..17b03b84684 100644
--- a/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs
+++ b/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs
@@ -1,8 +1,12 @@
+using System;
+using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Localization;
namespace Content.Client.Atmos.Monitor.UI.Widgets;
@@ -21,7 +25,7 @@ public sealed partial class PumpControl : BoxContainer
private OptionButton _pressureCheck => CPressureCheck;
private FloatSpinBox _externalBound => CExternalBound;
private FloatSpinBox _internalBound => CInternalBound;
- private Button _copySettings => CCopySettings;
+ private Button _copySettings => CCopySettings;
public PumpControl(GasVentPumpData data, string address)
{
@@ -82,7 +86,7 @@ public PumpControl(GasVentPumpData data, string address)
_data.PressureChecks = (VentPressureBound) args.Id;
PumpDataChanged?.Invoke(_address, _data);
};
-
+
_copySettings.OnPressed += _ =>
{
PumpDataCopied?.Invoke(_data);
diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs
index c16ff688c93..f2241bcd8da 100644
--- a/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs
+++ b/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs
@@ -1,9 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Localization;
namespace Content.Client.Atmos.Monitor.UI.Widgets;
@@ -21,7 +27,7 @@ public sealed partial class ScrubberControl : BoxContainer
private OptionButton _pumpDirection => CPumpDirection;
private FloatSpinBox _volumeRate => CVolumeRate;
private CheckBox _wideNet => CWideNet;
- private Button _copySettings => CCopySettings;
+ private Button _copySettings => CCopySettings;
private GridContainer _gases => CGasContainer;
private Dictionary _gasControls = new();
@@ -71,7 +77,7 @@ public ScrubberControl(GasVentScrubberData data, string address)
_data.PumpDirection = (ScrubberPumpDirection) args.Id;
ScrubberDataChanged?.Invoke(_address, _data);
};
-
+
_copySettings.OnPressed += _ =>
{
ScrubberDataCopied?.Invoke(_data);
diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml.cs
index 9e60b6cea62..da602cd7479 100644
--- a/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml.cs
+++ b/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml.cs
@@ -43,8 +43,7 @@ public SensorInfo(AtmosSensorData data, string address)
var label = new RichTextLabel();
var fractionGas = amount / data.TotalMoles;
- label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator",
- ("gas", $"{gas}"),
+ label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator", ("gas", $"{gas}"),
("color", AirAlarmWindow.ColorForThreshold(fractionGas, data.GasThresholds[gas])),
("amount", $"{amount:0.####}"),
("percentage", $"{(100 * fractionGas):0.##}")));
@@ -54,9 +53,9 @@ public SensorInfo(AtmosSensorData data, string address)
var threshold = data.GasThresholds[gas];
var gasThresholdControl = new ThresholdControl(Loc.GetString($"air-alarm-ui-thresholds-gas-title", ("gas", $"{gas}")), threshold, AtmosMonitorThresholdType.Gas, gas, 100);
gasThresholdControl.Margin = new Thickness(20, 2, 2, 2);
- gasThresholdControl.ThresholdDataChanged += (type, alarmThreshold, arg3) =>
+ gasThresholdControl.ThresholdDataChanged += (type, threshold, arg3) =>
{
- OnThresholdUpdate!(_address, type, alarmThreshold, arg3);
+ OnThresholdUpdate!(_address, type, threshold, arg3);
};
_gasThresholds.Add(gas, gasThresholdControl);
@@ -65,8 +64,7 @@ public SensorInfo(AtmosSensorData data, string address)
_pressureThreshold = new ThresholdControl(Loc.GetString("air-alarm-ui-thresholds-pressure-title"), data.PressureThreshold, AtmosMonitorThresholdType.Pressure);
PressureThresholdContainer.AddChild(_pressureThreshold);
- _temperatureThreshold = new ThresholdControl(Loc.GetString("air-alarm-ui-thresholds-temperature-title"),
- data.TemperatureThreshold,
+ _temperatureThreshold = new ThresholdControl(Loc.GetString("air-alarm-ui-thresholds-temperature-title"), data.TemperatureThreshold,
AtmosMonitorThresholdType.Temperature);
TemperatureThresholdContainer.AddChild(_temperatureThreshold);
@@ -105,8 +103,7 @@ public void ChangeData(AtmosSensorData data)
}
var fractionGas = amount / data.TotalMoles;
- label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator",
- ("gas", $"{gas}"),
+ label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator", ("gas", $"{gas}"),
("color", AirAlarmWindow.ColorForThreshold(fractionGas, data.GasThresholds[gas])),
("amount", $"{amount:0.####}"),
("percentage", $"{(100 * fractionGas):0.##}")));
diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs
index 55f7c008987..3612d84de4c 100644
--- a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs
+++ b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs
@@ -1,4 +1,7 @@
+using Content.Client.Message;
+using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
+using Content.Shared.Temperature;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdControl.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdControl.xaml.cs
index 651620f3e25..78c73fa573a 100644
--- a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdControl.xaml.cs
+++ b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdControl.xaml.cs
@@ -1,8 +1,12 @@
+using System;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
+using Content.Shared.Atmos.Monitor.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Localization;
// holy FUCK
// this technically works because some of this you can *not* do in XAML but holy FUCK
@@ -111,38 +115,29 @@ public ThresholdControl(string name, AtmosAlarmThreshold threshold, AtmosMonitor
_enabled.Pressed = !_threshold.Ignore;
}
- private string LabelForBound(string boundType) //, DebugMessage)> state) =>
{
if (_system.TileData.TryGetValue(uid, out var data))
diff --git a/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs b/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs
index 0c07eec4025..220fdbe875c 100644
--- a/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs
+++ b/Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs
@@ -1,63 +1,65 @@
using Content.Shared.Atmos;
-using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping.Binary.Components;
-using Content.Shared.IdentityManagement;
using Content.Shared.Localizations;
using JetBrains.Annotations;
+using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
-namespace Content.Client.Atmos.UI;
-
-///
-/// Initializes a and updates it when new server messages are received.
-///
-[UsedImplicitly]
-public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface
+namespace Content.Client.Atmos.UI
{
- [ViewVariables]
- private const float MaxPressure = Atmospherics.MaxOutputPressure;
-
- [ViewVariables]
- private GasPressurePumpWindow? _window;
-
- public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
+ ///
+ /// Initializes a and updates it when new server messages are received.
+ ///
+ [UsedImplicitly]
+ public sealed class GasPressurePumpBoundUserInterface : BoundUserInterface
{
- }
+ [ViewVariables]
+ private const float MaxPressure = Atmospherics.MaxOutputPressure;
- protected override void Open()
- {
- base.Open();
+ [ViewVariables]
+ private GasPressurePumpWindow? _window;
- _window = this.CreateWindow();
+ public GasPressurePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
+ {
+ }
- _window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed;
- _window.PumpOutputPressureChanged += OnPumpOutputPressurePressed;
- Update();
- }
+ protected override void Open()
+ {
+ base.Open();
- public void Update()
- {
- if (_window == null)
- return;
+ _window = this.CreateWindow();
- _window.Title = Identity.Name(Owner, EntMan);
+ _window.ToggleStatusButtonPressed += OnToggleStatusButtonPressed;
+ _window.PumpOutputPressureChanged += OnPumpOutputPressurePressed;
+ }
- if (!EntMan.TryGetComponent(Owner, out GasPressurePumpComponent? pump))
- return;
+ private void OnToggleStatusButtonPressed()
+ {
+ if (_window is null) return;
+ SendMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus));
+ }
- _window.SetPumpStatus(pump.Enabled);
- _window.MaxPressure = pump.MaxTargetPressure;
- _window.SetOutputPressure(pump.TargetPressure);
- }
+ private void OnPumpOutputPressurePressed(string value)
+ {
+ var pressure = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f;
+ if (pressure > MaxPressure) pressure = MaxPressure;
- private void OnToggleStatusButtonPressed()
- {
- if (_window is null) return;
- SendPredictedMessage(new GasPressurePumpToggleStatusMessage(_window.PumpStatus));
- }
+ SendMessage(new GasPressurePumpChangeOutputPressureMessage(pressure));
+ }
- private void OnPumpOutputPressurePressed(float value)
- {
- SendPredictedMessage(new GasPressurePumpChangeOutputPressureMessage(value));
+ ///
+ /// Update the UI state based on server-sent info
+ ///
+ ///
+ protected override void UpdateState(BoundUserInterfaceState state)
+ {
+ base.UpdateState(state);
+ if (_window == null || state is not GasPressurePumpBoundUserInterfaceState cast)
+ return;
+
+ _window.Title = (cast.PumpLabel);
+ _window.SetPumpStatus(cast.Enabled);
+ _window.SetOutputPressure(cast.OutputPressure);
+ }
}
}
diff --git a/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml b/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml
index f2c2c7cec50..a0896a7b41e 100644
--- a/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml
+++ b/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml
@@ -1,18 +1,22 @@
-
+ MinSize="200 120" Title="Pressure Pump">
-
+
+
-
-
-
+
-
+
+
+
+
+
+
+
-
+
diff --git a/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml.cs b/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml.cs
index aa86a1aa03b..b5ffcd10721 100644
--- a/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml.cs
+++ b/Content.Client/Atmos/UI/GasPressurePumpWindow.xaml.cs
@@ -1,8 +1,14 @@
-using Content.Client.UserInterface.Controls;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using Content.Client.Atmos.EntitySystems;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Prototypes;
using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Localization;
namespace Content.Client.Atmos.UI
{
@@ -10,25 +16,12 @@ namespace Content.Client.Atmos.UI
/// Client-side UI used to control a gas pressure pump.
///
[GenerateTypedNameReferences]
- public sealed partial class GasPressurePumpWindow : FancyWindow
+ public sealed partial class GasPressurePumpWindow : DefaultWindow
{
public bool PumpStatus = true;
public event Action? ToggleStatusButtonPressed;
- public event Action? PumpOutputPressureChanged;
-
- public float MaxPressure
- {
- get => _maxPressure;
- set
- {
- _maxPressure = value;
-
- PumpPressureOutputInput.Value = MathF.Min(value, PumpPressureOutputInput.Value);
- }
- }
-
- private float _maxPressure = Atmospherics.MaxOutputPressure;
+ public event Action? PumpOutputPressureChanged;
public GasPressurePumpWindow()
{
@@ -37,25 +30,23 @@ public GasPressurePumpWindow()
ToggleStatusButton.OnPressed += _ => SetPumpStatus(!PumpStatus);
ToggleStatusButton.OnPressed += _ => ToggleStatusButtonPressed?.Invoke();
- PumpPressureOutputInput.OnValueChanged += _ => SetOutputPressureButton.Disabled = false;
-
+ PumpPressureOutputInput.OnTextChanged += _ => SetOutputPressureButton.Disabled = false;
SetOutputPressureButton.OnPressed += _ =>
{
- PumpPressureOutputInput.Value = Math.Clamp(PumpPressureOutputInput.Value, 0f, _maxPressure);
- PumpOutputPressureChanged?.Invoke(PumpPressureOutputInput.Value);
+ PumpOutputPressureChanged?.Invoke(PumpPressureOutputInput.Text ??= "");
SetOutputPressureButton.Disabled = true;
};
SetMaxPressureButton.OnPressed += _ =>
{
- PumpPressureOutputInput.Value = _maxPressure;
+ PumpPressureOutputInput.Text = Atmospherics.MaxOutputPressure.ToString(CultureInfo.CurrentCulture);
SetOutputPressureButton.Disabled = false;
};
}
public void SetOutputPressure(float pressure)
{
- PumpPressureOutputInput.Value = pressure;
+ PumpPressureOutputInput.Text = pressure.ToString(CultureInfo.CurrentCulture);
}
public void SetPumpStatus(bool enabled)
diff --git a/Content.Client/Clothing/FlippableClothingVisualizerSystem.cs b/Content.Client/Clothing/FlippableClothingVisualizerSystem.cs
index 1f09ae9eebb..2c3afb0324f 100644
--- a/Content.Client/Clothing/FlippableClothingVisualizerSystem.cs
+++ b/Content.Client/Clothing/FlippableClothingVisualizerSystem.cs
@@ -7,7 +7,7 @@
namespace Content.Client.Clothing;
-public sealed class FlippableClothingVisualizerSystem : VisualizerSystem
+public sealed class FlippableClothingVisualizerSystem : VisualizerSystem
{
[Dependency] private readonly SharedItemSystem _itemSys = default!;
diff --git a/Content.Client/Construction/UI/ConstructionMenu.xaml b/Content.Client/Construction/UI/ConstructionMenu.xaml
index a934967a533..6e4438cf6fd 100644
--- a/Content.Client/Construction/UI/ConstructionMenu.xaml
+++ b/Content.Client/Construction/UI/ConstructionMenu.xaml
@@ -1,20 +1,15 @@
-
+
-
-
-
-
-
-
-
-
+
+
diff --git a/Content.Client/Construction/UI/ConstructionMenu.xaml.cs b/Content.Client/Construction/UI/ConstructionMenu.xaml.cs
index 9ab8a156005..f0cb8148762 100644
--- a/Content.Client/Construction/UI/ConstructionMenu.xaml.cs
+++ b/Content.Client/Construction/UI/ConstructionMenu.xaml.cs
@@ -25,16 +25,11 @@ public interface IConstructionMenuView : IDisposable
OptionButton OptionCategories { get; }
bool EraseButtonPressed { get; set; }
- bool GridViewButtonPressed { get; set; }
bool BuildButtonPressed { get; set; }
ItemList Recipes { get; }
ItemList RecipeStepList { get; }
-
- ScrollContainer RecipesGridScrollContainer { get; }
- GridContainer RecipesGrid { get; }
-
event EventHandler<(string search, string catagory)> PopulateRecipes;
event EventHandler RecipeSelected;
event EventHandler RecipeFavorited;
@@ -77,16 +72,9 @@ public bool EraseButtonPressed
set => EraseButton.Pressed = value;
}
- public bool GridViewButtonPressed
- {
- get => MenuGridViewButton.Pressed;
- set => MenuGridViewButton.Pressed = value;
- }
-
public ConstructionMenu()
{
- SetSize = new Vector2(560, 450);
- MinSize = new Vector2(560, 320);
+ SetSize = MinSize = new Vector2(720, 320);
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
@@ -114,9 +102,6 @@ public ConstructionMenu()
EraseButton.OnToggled += args => EraseButtonToggled?.Invoke(this, args.Pressed);
FavoriteButton.OnPressed += args => RecipeFavorited?.Invoke(this, EventArgs.Empty);
-
- MenuGridViewButton.OnPressed += _ =>
- PopulateRecipes?.Invoke(this, (SearchBar.Text, Categories[OptionCategories.SelectedId]));
}
public event EventHandler? ClearAllGhosts;
diff --git a/Content.Client/Construction/UI/ConstructionMenuPresenter.cs b/Content.Client/Construction/UI/ConstructionMenuPresenter.cs
index d35e8fbe769..c315cdedb2c 100644
--- a/Content.Client/Construction/UI/ConstructionMenuPresenter.cs
+++ b/Content.Client/Construction/UI/ConstructionMenuPresenter.cs
@@ -1,8 +1,7 @@
using System.Linq;
-using System.Numerics;
-using Content.Client.Stylesheets;
using Content.Client.UserInterface.Systems.MenuBar.Widgets;
using Content.Shared.Construction.Prototypes;
+using Content.Shared.Tag;
using Content.Shared.Whitelist;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
@@ -12,6 +11,7 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.Utility;
using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BaseButton;
@@ -33,12 +33,10 @@ internal sealed class ConstructionMenuPresenter : IDisposable
private readonly IConstructionMenuView _constructionView;
private readonly EntityWhitelistSystem _whitelistSystem;
- private readonly SpriteSystem _spriteSystem;
private ConstructionSystem? _constructionSystem;
private ConstructionPrototype? _selected;
private List _favoritedRecipes = [];
- private Dictionary _recipeButtons = new();
private string _selectedCategory = string.Empty;
private string _favoriteCatName = "construction-category-favorites";
private string _forAllCategoryName = "construction-category-all";
@@ -87,7 +85,6 @@ public ConstructionMenuPresenter()
IoCManager.InjectDependencies(this);
_constructionView = new ConstructionMenu();
_whitelistSystem = _entManager.System();
- _spriteSystem = _entManager.System();
// This is required so that if we load after the system is initialized, we can bind to it immediately
if (_systemManager.TryGetEntitySystem(out var constructionSystem))
@@ -153,24 +150,12 @@ private void OnViewRecipeSelected(object? sender, ItemList.Item? item)
PopulateInfo(_selected);
}
- private void OnGridViewRecipeSelected(object? sender, ConstructionPrototype? recipe)
- {
- if (recipe is null)
- {
- _selected = null;
- _constructionView.ClearRecipeInfo();
- return;
- }
-
- _selected = recipe;
- if (_placementManager.IsActive && !_placementManager.Eraser) UpdateGhostPlacement();
- PopulateInfo(_selected);
- }
-
private void OnViewPopulateRecipes(object? sender, (string search, string catagory) args)
{
var (search, category) = args;
+ var recipesList = _constructionView.Recipes;
+ recipesList.Clear();
var recipes = new List();
var isEmptyCategory = string.IsNullOrEmpty(category) || category == _forAllCategoryName;
@@ -216,73 +201,12 @@ private void OnViewPopulateRecipes(object? sender, (string search, string catago
recipes.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.InvariantCulture));
- var recipesList = _constructionView.Recipes;
- recipesList.Clear();
-
- var recipesGrid = _constructionView.RecipesGrid;
- recipesGrid.RemoveAllChildren();
-
- _constructionView.RecipesGridScrollContainer.Visible = _constructionView.GridViewButtonPressed;
- _constructionView.Recipes.Visible = !_constructionView.GridViewButtonPressed;
-
- if (_constructionView.GridViewButtonPressed)
- {
- foreach (var recipe in recipes)
- {
- var itemButton = new TextureButton
- {
- TextureNormal = _spriteSystem.Frame0(recipe.Icon),
- VerticalAlignment = Control.VAlignment.Center,
- Name = recipe.Name,
- ToolTip = recipe.Name,
- Scale = new Vector2(1.35f),
- ToggleMode = true,
- };
- var itemButtonPanelContainer = new PanelContainer
- {
- PanelOverride = new StyleBoxFlat { BackgroundColor = StyleNano.ButtonColorDefault },
- Children = { itemButton },
- };
-
- itemButton.OnToggled += buttonToggledEventArgs =>
- {
- SelectGridButton(itemButton, buttonToggledEventArgs.Pressed);
-
- if (buttonToggledEventArgs.Pressed &&
- _selected != null &&
- _recipeButtons.TryGetValue(_selected.Name, out var oldButton))
- {
- oldButton.Pressed = false;
- SelectGridButton(oldButton, false);
- }
-
- OnGridViewRecipeSelected(this, buttonToggledEventArgs.Pressed ? recipe : null);
- };
-
- recipesGrid.AddChild(itemButtonPanelContainer);
- _recipeButtons[recipe.Name] = itemButton;
- var isCurrentButtonSelected = _selected == recipe;
- itemButton.Pressed = isCurrentButtonSelected;
- SelectGridButton(itemButton, isCurrentButtonSelected);
- }
- }
- else
+ foreach (var recipe in recipes)
{
- foreach (var recipe in recipes)
- {
- recipesList.Add(GetItem(recipe, recipesList));
- }
+ recipesList.Add(GetItem(recipe, recipesList));
}
- }
-
- private void SelectGridButton(TextureButton button, bool select)
- {
- if (button.Parent is not PanelContainer buttonPanel)
- return;
- button.Modulate = select ? Color.Green : Color.White;
- var buttonColor = select ? StyleNano.ButtonColorDefault : Color.Transparent;
- buttonPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = buttonColor };
+ // There is apparently no way to set which
}
private void PopulateCategories(string? selectCategory = null)
@@ -333,10 +257,11 @@ private void PopulateCategories(string? selectCategory = null)
private void PopulateInfo(ConstructionPrototype prototype)
{
+ var spriteSys = _systemManager.GetEntitySystem();
_constructionView.ClearRecipeInfo();
_constructionView.SetRecipeInfo(
- prototype.Name, prototype.Description, _spriteSystem.Frame0(prototype.Icon),
+ prototype.Name, prototype.Description, spriteSys.Frame0(prototype.Icon),
prototype.Type != ConstructionType.Item,
!_favoritedRecipes.Contains(prototype));
@@ -349,6 +274,7 @@ private void GenerateStepList(ConstructionPrototype prototype, ItemList stepList
if (_constructionSystem?.GetGuide(prototype) is not { } guide)
return;
+ var spriteSys = _systemManager.GetEntitySystem();
foreach (var entry in guide.Entries)
{
@@ -364,20 +290,20 @@ private void GenerateStepList(ConstructionPrototype prototype, ItemList stepList
// The padding needs to be applied regardless of text length... (See PadLeft documentation)
text = text.PadLeft(text.Length + entry.Padding);
- var icon = entry.Icon != null ? _spriteSystem.Frame0(entry.Icon) : Texture.Transparent;
+ var icon = entry.Icon != null ? spriteSys.Frame0(entry.Icon) : Texture.Transparent;
stepList.AddItem(text, icon, false);
}
}
- private ItemList.Item GetItem(ConstructionPrototype recipe, ItemList itemList)
+ private static ItemList.Item GetItem(ConstructionPrototype recipe, ItemList itemList)
{
return new(itemList)
{
Metadata = recipe,
Text = recipe.Name,
- Icon = _spriteSystem.Frame0(recipe.Icon),
+ Icon = recipe.Icon.Frame0(),
TooltipEnabled = true,
- TooltipText = recipe.Description,
+ TooltipText = recipe.Description
};
}
diff --git a/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs b/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs
index 44501767dd4..e5be0b1811f 100644
--- a/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs
+++ b/Content.Client/Crayon/UI/CrayonBoundUserInterface.cs
@@ -31,7 +31,7 @@ protected override void Open()
private void PopulateCrayons()
{
var crayonDecals = _protoManager.EnumeratePrototypes().Where(x => x.Tags.Contains("crayon"));
- _menu?.Populate(crayonDecals.ToList());
+ _menu?.Populate(crayonDecals);
}
public override void OnProtoReload(PrototypesReloadedEventArgs args)
@@ -44,16 +44,6 @@ public override void OnProtoReload(PrototypesReloadedEventArgs args)
PopulateCrayons();
}
- protected override void ReceiveMessage(BoundUserInterfaceMessage message)
- {
- base.ReceiveMessage(message);
-
- if (_menu is null || message is not CrayonUsedMessage crayonMessage)
- return;
-
- _menu.AdvanceState(crayonMessage.DrawnDecal);
- }
-
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
diff --git a/Content.Client/Crayon/UI/CrayonWindow.xaml b/Content.Client/Crayon/UI/CrayonWindow.xaml
index 7acb22551b7..7729318ae7f 100644
--- a/Content.Client/Crayon/UI/CrayonWindow.xaml
+++ b/Content.Client/Crayon/UI/CrayonWindow.xaml
@@ -1,13 +1,14 @@
+ MinSize="250 300"
+ SetSize="250 300">
-
+
-
-
+
+
+
diff --git a/Content.Client/Crayon/UI/CrayonWindow.xaml.cs b/Content.Client/Crayon/UI/CrayonWindow.xaml.cs
index 88475562c67..6ef282d219a 100644
--- a/Content.Client/Crayon/UI/CrayonWindow.xaml.cs
+++ b/Content.Client/Crayon/UI/CrayonWindow.xaml.cs
@@ -1,10 +1,8 @@
using System.Collections.Generic;
-using System.Linq;
using Content.Client.Stylesheets;
using Content.Shared.Crayon;
using Content.Shared.Decals;
using Robust.Client.AutoGenerated;
-using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
@@ -20,12 +18,7 @@ namespace Content.Client.Crayon.UI
[GenerateTypedNameReferences]
public sealed partial class CrayonWindow : DefaultWindow
{
- [Dependency] private readonly IEntitySystemManager _entitySystem = default!;
- private readonly SpriteSystem _spriteSystem = default!;
-
- private Dictionary>? _decals;
- private List? _allDecals;
- private string? _autoSelected;
+ private Dictionary? _decals;
private string? _selected;
private Color _color;
@@ -35,10 +28,8 @@ public sealed partial class CrayonWindow : DefaultWindow
public CrayonWindow()
{
RobustXamlLoader.Load(this);
- IoCManager.InjectDependencies(this);
- _spriteSystem = _entitySystem.GetEntitySystem();
- Search.OnTextChanged += SearchChanged;
+ Search.OnTextChanged += _ => RefreshList();
ColorSelector.OnColorChanged += SelectColor;
}
@@ -53,94 +44,51 @@ private void SelectColor(Color color)
private void RefreshList()
{
// Clear
- Grids.DisposeAllChildren();
-
- if (_decals == null || _allDecals == null)
+ Grid.DisposeAllChildren();
+ if (_decals == null)
return;
var filter = Search.Text;
- var comma = filter.IndexOf(',');
- var first = (comma == -1 ? filter : filter[..comma]).Trim();
-
- var names = _decals.Keys.ToList();
- names.Sort((a, b) => a == "random" ? 1 : b == "random" ? -1 : a.CompareTo(b));
-
- if (_autoSelected != null && first != _autoSelected && _allDecals.Contains(first))
- {
- _selected = first;
- _autoSelected = _selected;
- OnSelected?.Invoke(_selected);
- }
-
- foreach (var categoryName in names)
+ foreach (var (decal, tex) in _decals)
{
- var locName = Loc.GetString("crayon-category-" + categoryName);
- var category = _decals[categoryName].Where(d => locName.Contains(first) || d.Name.Contains(first)).ToList();
-
- if (category.Count == 0)
+ if (!decal.Contains(filter))
continue;
- var label = new Label
+ var button = new TextureButton()
{
- Text = locName
+ TextureNormal = tex,
+ Name = decal,
+ ToolTip = decal,
+ Modulate = _color,
};
-
- var grid = new GridContainer
+ button.OnPressed += ButtonOnPressed;
+ if (_selected == decal)
{
- Columns = 6,
- Margin = new Thickness(0, 0, 0, 16)
- };
-
- Grids.AddChild(label);
- Grids.AddChild(grid);
-
- foreach (var (name, texture) in category)
- {
- var button = new TextureButton()
+ var panelContainer = new PanelContainer()
{
- TextureNormal = texture,
- Name = name,
- ToolTip = name,
- Modulate = _color,
- Scale = new System.Numerics.Vector2(2, 2)
- };
- button.OnPressed += ButtonOnPressed;
-
- if (_selected == name)
- {
- var panelContainer = new PanelContainer()
+ PanelOverride = new StyleBoxFlat()
{
- PanelOverride = new StyleBoxFlat()
- {
- BackgroundColor = StyleNano.ButtonColorDefault,
- },
- Children =
- {
- button,
- },
- };
- grid.AddChild(panelContainer);
- }
- else
- {
- grid.AddChild(button);
- }
+ BackgroundColor = StyleNano.ButtonColorDefault,
+ },
+ Children =
+ {
+ button,
+ },
+ };
+ Grid.AddChild(panelContainer);
+ }
+ else
+ {
+ Grid.AddChild(button);
}
}
}
- private void SearchChanged(LineEdit.LineEditEventArgs obj)
- {
- _autoSelected = ""; // Placeholder to kick off the auto-select in refreshlist()
- RefreshList();
- }
-
private void ButtonOnPressed(ButtonEventArgs obj)
{
if (obj.Button.Name == null) return;
_selected = obj.Button.Name;
- _autoSelected = null;
OnSelected?.Invoke(_selected);
RefreshList();
}
@@ -159,38 +107,12 @@ public void UpdateState(CrayonBoundUserInterfaceState state)
RefreshList();
}
- public void AdvanceState(string drawnDecal)
+ public void Populate(IEnumerable prototypes)
{
- var filter = Search.Text;
- if (!filter.Contains(',') || !filter.Contains(drawnDecal))
- return;
-
- var first = filter[..filter.IndexOf(',')].Trim();
-
- if (first.Equals(drawnDecal, StringComparison.InvariantCultureIgnoreCase))
- {
- Search.Text = filter[(filter.IndexOf(',') + 1)..].Trim();
- _autoSelected = first;
- }
-
- RefreshList();
- }
-
- public void Populate(List prototypes)
- {
- _decals = [];
- _allDecals = [];
-
- prototypes.Sort((a, b) => a.ID.CompareTo(b.ID));
-
+ _decals = new Dictionary();
foreach (var decalPrototype in prototypes)
{
- var category = "random";
- if (decalPrototype.Tags.Count > 1 && decalPrototype.Tags[1].StartsWith("crayon-"))
- category = decalPrototype.Tags[1].Replace("crayon-", "");
- var list = _decals.GetOrNew(category);
- list.Add((decalPrototype.ID, _spriteSystem.Frame0(decalPrototype.Sprite)));
- _allDecals.Add(decalPrototype.ID);
+ _decals.Add(decalPrototype.ID, decalPrototype.Sprite.Frame0());
}
RefreshList();
diff --git a/Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs b/Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs
deleted file mode 100644
index b95c0d585d7..00000000000
--- a/Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using Content.Shared.Electrocution;
-using Robust.Client.GameObjects;
-using Robust.Client.Player;
-using Robust.Shared.Player;
-
-namespace Content.Client.Electrocution;
-
-///
-/// Shows the Electrocution HUD to entities with the ShowElectrocutionHUDComponent.
-///
-public sealed class ElectrocutionHUDVisualizerSystem : VisualizerSystem
-{
- [Dependency] private readonly IPlayerManager _playerMan = default!;
-
- public override void Initialize()
- {
- base.Initialize();
-
- SubscribeLocalEvent(OnInit);
- SubscribeLocalEvent(OnShutdown);
- SubscribeLocalEvent(OnPlayerAttached);
- SubscribeLocalEvent(OnPlayerDetached);
- }
-
- private void OnPlayerAttached(Entity ent, ref LocalPlayerAttachedEvent args)
- {
- ShowHUD();
- }
-
- private void OnPlayerDetached(Entity ent, ref LocalPlayerDetachedEvent args)
- {
- RemoveHUD();
- }
-
- private void OnInit(Entity ent, ref ComponentInit args)
- {
- if (_playerMan.LocalEntity == ent)
- {
- ShowHUD();
- }
- }
-
- private void OnShutdown(Entity ent, ref ComponentShutdown args)
- {
- if (_playerMan.LocalEntity == ent)
- {
- RemoveHUD();
- }
- }
-
- // Show the HUD to the client.
- // We have to look for all current entities that can be electrified and toggle the HUD layer on if they are.
- private void ShowHUD()
- {
- var electrifiedQuery = AllEntityQuery();
- while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
- {
- if (!AppearanceSystem.TryGetData(uid, ElectrifiedVisuals.IsElectrified, out var electrified, appearanceComp))
- continue;
-
- if (electrified)
- spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, true);
- else
- spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
- }
- }
-
- // Remove the HUD from the client.
- // Find all current entities that can be electrified and hide the HUD layer.
- private void RemoveHUD()
- {
- var electrifiedQuery = AllEntityQuery();
- while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
- {
-
- spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
- }
- }
-
- // Toggle the HUD layer if an entity becomes (de-)electrified
- protected override void OnAppearanceChange(EntityUid uid, ElectrocutionHUDVisualsComponent comp, ref AppearanceChangeEvent args)
- {
- if (args.Sprite == null)
- return;
-
- if (!AppearanceSystem.TryGetData(uid, ElectrifiedVisuals.IsElectrified, out var electrified, args.Component))
- return;
-
- var player = _playerMan.LocalEntity;
- if (electrified && HasComp(player))
- args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, true);
- else
- args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, false);
- }
-}
diff --git a/Content.Client/Eui/BaseEui.cs b/Content.Client/Eui/BaseEui.cs
index c11ba5a9b69..7f86ded7e48 100644
--- a/Content.Client/Eui/BaseEui.cs
+++ b/Content.Client/Eui/BaseEui.cs
@@ -55,7 +55,7 @@ public virtual void HandleMessage(EuiMessageBase msg)
///
protected void SendMessage(EuiMessageBase msg)
{
- var netMsg = new MsgEuiMessage();
+ var netMsg = _netManager.CreateNetMessage();
netMsg.Id = Id;
netMsg.Message = msg;
diff --git a/Content.Client/Info/LinkBanner.cs b/Content.Client/Info/LinkBanner.cs
index 7366a8f8565..a30aa413761 100644
--- a/Content.Client/Info/LinkBanner.cs
+++ b/Content.Client/Info/LinkBanner.cs
@@ -34,7 +34,6 @@ public LinkBanner()
AddInfoButton("server-info-website-button", CCVars.InfoLinksWebsite);
AddInfoButton("server-info-wiki-button", CCVars.InfoLinksWiki);
AddInfoButton("server-info-forum-button", CCVars.InfoLinksForum);
- AddInfoButton("server-info-telegram-button", CCVars.InfoLinksTelegram);
var guidebookController = UserInterfaceManager.GetUIController();
var guidebookButton = new Button() { Text = Loc.GetString("server-info-guidebook-button") };
diff --git a/Content.Client/Inventory/StrippableBoundUserInterface.cs b/Content.Client/Inventory/StrippableBoundUserInterface.cs
index 90e52d72837..2ce07758c96 100644
--- a/Content.Client/Inventory/StrippableBoundUserInterface.cs
+++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs
@@ -17,7 +17,6 @@
using Content.Shared.Strip.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
-using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
@@ -30,13 +29,10 @@ namespace Content.Client.Inventory
[UsedImplicitly]
public sealed class StrippableBoundUserInterface : BoundUserInterface
{
- [Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IUserInterfaceManager _ui = default!;
-
private readonly ExamineSystem _examine;
private readonly InventorySystem _inv;
private readonly SharedCuffableSystem _cuffable;
- private readonly StrippableSystem _strippable;
[ViewVariables]
private const int ButtonSeparation = 4;
@@ -55,8 +51,6 @@ public StrippableBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, u
_examine = EntMan.System();
_inv = EntMan.System();
_cuffable = EntMan.System();
- _strippable = EntMan.System();
-
_virtualHiddenEntity = EntMan.SpawnEntity(HiddenPocketEntityId, MapCoordinates.Nullspace);
}
@@ -191,15 +185,9 @@ private void SlotPressed(GUIBoundKeyEventArgs ev, SlotControl slot)
return;
if (ev.Function == ContentKeyFunctions.ExamineEntity)
- {
_examine.DoExamine(slot.Entity.Value);
- ev.Handle();
- }
else if (ev.Function == EngineKeyFunctions.UseSecondary)
- {
_ui.GetUIController().OpenVerbMenu(slot.Entity.Value);
- ev.Handle();
- }
}
private void AddInventoryButton(EntityUid invUid, string slotId, InventoryComponent inv)
@@ -210,8 +198,7 @@ private void AddInventoryButton(EntityUid invUid, string slotId, InventoryCompon
var entity = container.ContainedEntity;
// If this is a full pocket, obscure the real entity
- // this does not work for modified clients because they are still sent the real entity
- if (entity != null && _strippable.IsStripHidden(slotDef, _player.LocalEntity))
+ if (entity != null && slotDef.StripHidden)
entity = _virtualHiddenEntity;
var button = new SlotButton(new SlotData(slotDef, container));
diff --git a/Content.Client/Light/HandheldLightSystem.cs b/Content.Client/Light/HandheldLightSystem.cs
index d25b28756f8..ddd99c7c483 100644
--- a/Content.Client/Light/HandheldLightSystem.cs
+++ b/Content.Client/Light/HandheldLightSystem.cs
@@ -21,22 +21,6 @@ public override void Initialize()
SubscribeLocalEvent(OnAppearanceChange);
}
- ///
- /// TODO: Not properly predicted yet. Don't call this function if you want a the actual return value!
- ///
- public override bool TurnOff(Entity ent, bool makeNoise = true)
- {
- return true;
- }
-
- ///
- /// TODO: Not properly predicted yet. Don't call this function if you want a the actual return value!
- ///
- public override bool TurnOn(EntityUid user, Entity uid)
- {
- return true;
- }
-
private void OnAppearanceChange(EntityUid uid, HandheldLightComponent? component, ref AppearanceChangeEvent args)
{
if (!Resolve(uid, ref component))
diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs
index 1361ca57cd2..1aabc4ff381 100644
--- a/Content.Client/Lobby/LobbyState.cs
+++ b/Content.Client/Lobby/LobbyState.cs
@@ -116,7 +116,7 @@ public override void FrameUpdate(FrameEventArgs e)
return;
}
- Lobby!.StationTime.Text = Loc.GetString("lobby-state-player-status-round-not-started");
+ Lobby!.StationTime.Text = Loc.GetString("lobby-state-player-status-round-not-started");
string text;
if (_gameTicker.Paused)
@@ -136,10 +136,6 @@ public override void FrameUpdate(FrameEventArgs e)
{
text = Loc.GetString(seconds < -5 ? "lobby-state-right-now-question" : "lobby-state-right-now-confirmation");
}
- else if (difference.TotalHours >= 1)
- {
- text = $"{Math.Floor(difference.TotalHours)}:{difference.Minutes:D2}:{difference.Seconds:D2}";
- }
else
{
text = $"{difference.Minutes}:{difference.Seconds:D2}";
diff --git a/Content.Client/Lobby/LobbyUIController.cs b/Content.Client/Lobby/LobbyUIController.cs
index 50a25519988..3cf98c98aba 100644
--- a/Content.Client/Lobby/LobbyUIController.cs
+++ b/Content.Client/Lobby/LobbyUIController.cs
@@ -279,7 +279,7 @@ private void OpenSavePanel()
_profileEditor.OnOpenGuidebook += _guide.OpenHelp;
- _characterSetup = new CharacterSetupGui(_profileEditor);
+ _characterSetup = new CharacterSetupGui(EntityManager, _prototypeManager, _resourceCache, _preferencesManager, _profileEditor);
_characterSetup.CloseButton.OnPressed += _ =>
{
diff --git a/Content.Client/Lobby/UI/CharacterSetupGui.xaml b/Content.Client/Lobby/UI/CharacterSetupGui.xaml
index c463987a1fe..f83be265884 100644
--- a/Content.Client/Lobby/UI/CharacterSetupGui.xaml
+++ b/Content.Client/Lobby/UI/CharacterSetupGui.xaml
@@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:style="clr-namespace:Content.Client.Stylesheets"
- xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
VerticalExpand="True">
@@ -11,15 +10,10 @@
-
-
diff --git a/Content.Client/Lobby/UI/CharacterSetupGui.xaml.cs b/Content.Client/Lobby/UI/CharacterSetupGui.xaml.cs
index 45799161324..777725b9eda 100644
--- a/Content.Client/Lobby/UI/CharacterSetupGui.xaml.cs
+++ b/Content.Client/Lobby/UI/CharacterSetupGui.xaml.cs
@@ -1,7 +1,6 @@
using Content.Client.Info;
using Content.Client.Info.PlaytimeStats;
using Content.Client.Resources;
-using Content.Shared.CCVar;
using Content.Shared.Preferences;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
@@ -9,7 +8,6 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
-using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
namespace Content.Client.Lobby.UI
@@ -20,23 +18,28 @@ namespace Content.Client.Lobby.UI
[GenerateTypedNameReferences]
public sealed partial class CharacterSetupGui : Control
{
- [Dependency] private readonly IClientPreferencesManager _preferencesManager = default!;
- [Dependency] private readonly IEntityManager _entManager = default!;
- [Dependency] private readonly IPrototypeManager _protomanager = default!;
- [Dependency] private readonly IResourceCache _resourceCache = default!;
- [Dependency] private readonly IConfigurationManager _cfg = default!;
+ private readonly IClientPreferencesManager _preferencesManager;
+ private readonly IEntityManager _entManager;
+ private readonly IPrototypeManager _protomanager;
private readonly Button _createNewCharacterButton;
public event Action? SelectCharacter;
public event Action? DeleteCharacter;
- public CharacterSetupGui(HumanoidProfileEditor profileEditor)
+ public CharacterSetupGui(
+ IEntityManager entManager,
+ IPrototypeManager protoManager,
+ IResourceCache resourceCache,
+ IClientPreferencesManager preferencesManager,
+ HumanoidProfileEditor profileEditor)
{
RobustXamlLoader.Load(this);
- IoCManager.InjectDependencies(this);
+ _preferencesManager = preferencesManager;
+ _entManager = entManager;
+ _protomanager = protoManager;
- var panelTex = _resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
+ var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
var back = new StyleBoxTexture
{
Texture = panelTex,
@@ -53,7 +56,7 @@ public CharacterSetupGui(HumanoidProfileEditor profileEditor)
_createNewCharacterButton.OnPressed += args =>
{
- _preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random());
+ preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random());
ReloadCharacterPickers();
args.Event.Handle();
};
@@ -62,8 +65,6 @@ public CharacterSetupGui(HumanoidProfileEditor profileEditor)
RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open();
StatsButton.OnPressed += _ => new PlaytimeStatsWindow().OpenCentered();
-
- _cfg.OnValueChanged(CCVars.SeeOwnNotes, p => AdminRemarksButton.Visible = p, true);
}
///
diff --git a/Content.Client/Lobby/UI/LobbyGui.xaml.cs b/Content.Client/Lobby/UI/LobbyGui.xaml.cs
index 6471edb6f37..81230130a1d 100644
--- a/Content.Client/Lobby/UI/LobbyGui.xaml.cs
+++ b/Content.Client/Lobby/UI/LobbyGui.xaml.cs
@@ -2,6 +2,7 @@
using Content.Client.UserInterface.Systems.EscapeMenu;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
+using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
diff --git a/Content.Client/Overlays/StencilOverlay.Weather.cs b/Content.Client/Overlays/StencilOverlay.Weather.cs
index ad69522dfda..bc514548036 100644
--- a/Content.Client/Overlays/StencilOverlay.Weather.cs
+++ b/Content.Client/Overlays/StencilOverlay.Weather.cs
@@ -35,7 +35,7 @@ private void DrawWeather(in OverlayDrawArgs args, WeatherPrototype weatherProto,
var matty = Matrix3x2.Multiply(matrix, invMatrix);
worldHandle.SetTransform(matty);
- foreach (var tile in _map.GetTilesIntersecting(grid.Owner, grid, worldAABB))
+ foreach (var tile in grid.Comp.GetTilesIntersecting(worldAABB))
{
// Ignored tiles for stencil
if (_weather.CanWeatherAffect(grid.Owner, grid, tile))
diff --git a/Content.Client/Overlays/StencilOverlay.cs b/Content.Client/Overlays/StencilOverlay.cs
index eb5c27156ed..78b1c4d2b15 100644
--- a/Content.Client/Overlays/StencilOverlay.cs
+++ b/Content.Client/Overlays/StencilOverlay.cs
@@ -24,7 +24,6 @@ public sealed partial class StencilOverlay : Overlay
[Dependency] private readonly IPrototypeManager _protoManager = default!;
private readonly ParallaxSystem _parallax;
private readonly SharedTransformSystem _transform;
- private readonly SharedMapSystem _map;
private readonly SpriteSystem _sprite;
private readonly WeatherSystem _weather;
@@ -34,12 +33,11 @@ public sealed partial class StencilOverlay : Overlay
private readonly ShaderInstance _shader;
- public StencilOverlay(ParallaxSystem parallax, SharedTransformSystem transform, SharedMapSystem map, SpriteSystem sprite, WeatherSystem weather)
+ public StencilOverlay(ParallaxSystem parallax, SharedTransformSystem transform, SpriteSystem sprite, WeatherSystem weather)
{
ZIndex = ParallaxSystem.ParallaxZIndex + 1;
_parallax = parallax;
_transform = transform;
- _map = map;
_sprite = sprite;
_weather = weather;
IoCManager.InjectDependencies(this);
diff --git a/Content.Client/Overlays/StencilOverlaySystem.cs b/Content.Client/Overlays/StencilOverlaySystem.cs
index 364ec0fddbf..c8a9553cfdd 100644
--- a/Content.Client/Overlays/StencilOverlaySystem.cs
+++ b/Content.Client/Overlays/StencilOverlaySystem.cs
@@ -10,14 +10,13 @@ public sealed class StencilOverlaySystem : EntitySystem
[Dependency] private readonly IOverlayManager _overlay = default!;
[Dependency] private readonly ParallaxSystem _parallax = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
- [Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly SpriteSystem _sprite = default!;
[Dependency] private readonly WeatherSystem _weather = default!;
public override void Initialize()
{
base.Initialize();
- _overlay.AddOverlay(new StencilOverlay(_parallax, _transform, _map, _sprite, _weather));
+ _overlay.AddOverlay(new StencilOverlay(_parallax, _transform, _sprite, _weather));
}
public override void Shutdown()
diff --git a/Content.Client/Sandbox/SandboxSystem.cs b/Content.Client/Sandbox/SandboxSystem.cs
index abc717642c8..8a4c93fa354 100644
--- a/Content.Client/Sandbox/SandboxSystem.cs
+++ b/Content.Client/Sandbox/SandboxSystem.cs
@@ -110,7 +110,7 @@ public bool Copy(ICommonSession? session, EntityCoordinates coords, EntityUid ui
}
// Try copy tile.
-
+
if (!_map.TryFindGridAt(_transform.ToMapCoordinates(coords), out var gridUid, out var grid) || !_mapSystem.TryGetTileRef(gridUid, grid, coords, out var tileRef))
return false;
@@ -157,5 +157,10 @@ public void ShowBb()
{
_consoleHost.ExecuteCommand("physics shapes");
}
+
+ public void MachineLinking()
+ {
+ _consoleHost.ExecuteCommand("signallink");
+ }
}
}
diff --git a/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs b/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs
index a5411005391..b50d8fa6b21 100644
--- a/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs
+++ b/Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs
@@ -116,7 +116,7 @@ protected void DrawCircles(DrawingHandleScreen handle)
}
}
- protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 gridToView, Entity grid, Color color, float alpha = 0.01f)
+ protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 matrix, Entity grid, Color color, float alpha = 0.01f)
{
var rator = Maps.GetAllTilesEnumerator(grid.Owner, grid.Comp);
var minimapScale = MinimapScale;
@@ -264,7 +264,7 @@ protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 gridToView, Entity
Extensions.EnsureLength(ref _allVertices, totalData);
_drawJob.MidPoint = midpoint;
- _drawJob.Matrix = gridToView;
+ _drawJob.Matrix = matrix;
_drawJob.MinimapScale = minimapScale;
_drawJob.Vertices = gridData.Vertices;
_drawJob.ScaledVertices = _allVertices;
@@ -286,7 +286,7 @@ protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 gridToView, Entity
private record struct GridDrawJob : IParallelRobustJob
{
- public int BatchSize => 64;
+ public int BatchSize => 16;
public float MinimapScale;
public Vector2 MidPoint;
@@ -297,7 +297,12 @@ private record struct GridDrawJob : IParallelRobustJob
public void Execute(int index)
{
- ScaledVertices[index] = Vector2.Transform(Vertices[index], Matrix);
+ var vert = Vertices[index];
+ var adjustedVert = Vector2.Transform(vert, Matrix);
+ adjustedVert = adjustedVert with { Y = -adjustedVert.Y };
+
+ var scaledVert = ScalePosition(adjustedVert, MinimapScale, MidPoint);
+ ScaledVertices[index] = scaledVert;
}
}
}
diff --git a/Content.Client/Shuttles/UI/NavScreen.xaml.cs b/Content.Client/Shuttles/UI/NavScreen.xaml.cs
index 7236714ef29..91d95aaa042 100644
--- a/Content.Client/Shuttles/UI/NavScreen.xaml.cs
+++ b/Content.Client/Shuttles/UI/NavScreen.xaml.cs
@@ -15,7 +15,6 @@ public sealed partial class NavScreen : BoxContainer
[Dependency] private readonly IEntityManager _entManager = default!;
private SharedTransformSystem _xformSystem;
- private EntityUid? _consoleEntity; // Entity of controlling console
private EntityUid? _shuttleEntity;
public NavScreen()
@@ -36,12 +35,6 @@ public void SetShuttle(EntityUid? shuttle)
_shuttleEntity = shuttle;
}
- public void SetConsole(EntityUid? console)
- {
- _consoleEntity = console;
- NavRadar.SetConsole(console);
- }
-
private void OnIFFTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowIFF ^= true;
diff --git a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs
index d0e6f9ebf7b..a4b42fb672c 100644
--- a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs
+++ b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs
@@ -138,7 +138,6 @@ public void UpdateState(EntityUid owner, ShuttleBoundUserInterfaceState cState)
{
var coordinates = _entManager.GetCoordinates(cState.NavState.Coordinates);
NavContainer.SetShuttle(coordinates?.EntityId);
- NavContainer.SetConsole(owner);
MapContainer.SetShuttle(coordinates?.EntityId);
MapContainer.SetConsole(owner);
diff --git a/Content.Client/Shuttles/UI/ShuttleDockControl.xaml.cs b/Content.Client/Shuttles/UI/ShuttleDockControl.xaml.cs
index 2b575b48059..61ae0699266 100644
--- a/Content.Client/Shuttles/UI/ShuttleDockControl.xaml.cs
+++ b/Content.Client/Shuttles/UI/ShuttleDockControl.xaml.cs
@@ -107,19 +107,16 @@ protected override void Draw(DrawingHandleScreen handle)
DrawCircles(handle);
var gridNent = EntManager.GetNetEntity(GridEntity);
var mapPos = _xformSystem.ToMapCoordinates(_coordinates.Value);
- var ourGridToWorld = _xformSystem.GetWorldMatrix(GridEntity.Value);
- var selectedDockToOurGrid = Matrix3Helpers.CreateTransform(_coordinates.Value.Position, Angle.Zero);
- var selectedDockToWorld = Matrix3x2.Multiply(selectedDockToOurGrid, ourGridToWorld);
+ var ourGridMatrix = _xformSystem.GetWorldMatrix(GridEntity.Value);
+ var dockMatrix = Matrix3Helpers.CreateTransform(_coordinates.Value.Position, Angle.Zero);
+ var worldFromDock = Matrix3x2.Multiply(dockMatrix, ourGridMatrix);
- Box2 viewBoundsWorld = Matrix3Helpers.TransformBox(selectedDockToWorld, new Box2(-WorldRangeVector, WorldRangeVector));
-
- Matrix3x2.Invert(selectedDockToWorld, out var worldToSelectedDock);
- var selectedDockToView = Matrix3x2.CreateScale(new Vector2(MinimapScale, -MinimapScale)) * Matrix3x2.CreateTranslation(MidPointVector);
+ Matrix3x2.Invert(worldFromDock, out var offsetMatrix);
// Draw nearby grids
var controlBounds = PixelSizeBox;
_grids.Clear();
- _mapManager.FindGridsIntersecting(gridXform.MapID, viewBoundsWorld, ref _grids);
+ _mapManager.FindGridsIntersecting(gridXform.MapID, new Box2(mapPos.Position - WorldRangeVector, mapPos.Position + WorldRangeVector), ref _grids);
// offset the dotted-line position to the bounds.
Vector2? viewedDockPos = _viewedState != null ? MidPointVector : null;
@@ -139,11 +136,11 @@ protected override void Draw(DrawingHandleScreen handle)
if (grid.Owner != GridEntity && !_shuttles.CanDraw(grid.Owner, iffComp: iffComp))
continue;
- var curGridToWorld = _xformSystem.GetWorldMatrix(grid.Owner);
- var curGridToView = curGridToWorld * worldToSelectedDock * selectedDockToView;
+ var gridMatrix = _xformSystem.GetWorldMatrix(grid.Owner);
+ var matty = Matrix3x2.Multiply(gridMatrix, offsetMatrix);
var color = _shuttles.GetIFFColor(grid.Owner, grid.Owner == GridEntity, component: iffComp);
- DrawGrid(handle, curGridToView, grid, color);
+ DrawGrid(handle, matty, grid, color);
// Draw any docks on that grid
if (!DockState.Docks.TryGetValue(EntManager.GetNetEntity(grid), out var gridDocks))
@@ -154,24 +151,23 @@ protected override void Draw(DrawingHandleScreen handle)
if (ViewedDock == dock.Entity)
continue;
+ var position = Vector2.Transform(dock.Coordinates.Position, matty);
+
var otherDockRotation = Matrix3Helpers.CreateRotation(dock.Angle);
+ var scaledPos = ScalePosition(position with {Y = -position.Y});
- // This box is the AABB of all the vertices we draw below.
- var dockRenderBoundsLocal = new Box2(-0.5f, -0.7f, 0.5f, 0.5f);
- var currentDockToCurGrid = Matrix3Helpers.CreateTransform(dock.Coordinates.Position, dock.Angle);
- var currentDockToWorld = Matrix3x2.Multiply(currentDockToCurGrid, curGridToWorld);
- var dockRenderBoundsWorld = Matrix3Helpers.TransformBox(currentDockToWorld, dockRenderBoundsLocal);
- if (!viewBoundsWorld.Intersects(dockRenderBoundsWorld))
+ if (!controlBounds.Contains(scaledPos.Floored()))
continue;
+ // Draw the dock's collision
var collisionBL = Vector2.Transform(dock.Coordinates.Position +
- Vector2.Transform(new Vector2(-0.2f, -0.7f), otherDockRotation), curGridToView);
+ Vector2.Transform(new Vector2(-0.2f, -0.7f), otherDockRotation), matty);
var collisionBR = Vector2.Transform(dock.Coordinates.Position +
- Vector2.Transform(new Vector2(0.2f, -0.7f), otherDockRotation), curGridToView);
+ Vector2.Transform(new Vector2(0.2f, -0.7f), otherDockRotation), matty);
var collisionTR = Vector2.Transform(dock.Coordinates.Position +
- Vector2.Transform(new Vector2(0.2f, -0.5f), otherDockRotation), curGridToView);
+ Vector2.Transform(new Vector2(0.2f, -0.5f), otherDockRotation), matty);
var collisionTL = Vector2.Transform(dock.Coordinates.Position +
- Vector2.Transform(new Vector2(-0.2f, -0.5f), otherDockRotation), curGridToView);
+ Vector2.Transform(new Vector2(-0.2f, -0.5f), otherDockRotation), matty);
var verts = new[]
{
@@ -185,6 +181,13 @@ protected override void Draw(DrawingHandleScreen handle)
collisionBL,
};
+ for (var i = 0; i < verts.Length; i++)
+ {
+ var vert = verts[i];
+ vert.Y = -vert.Y;
+ verts[i] = ScalePosition(vert);
+ }
+
var collisionCenter = verts[0] + verts[1] + verts[3] + verts[5];
var otherDockConnection = Color.ToSrgb(Color.Pink);
@@ -192,10 +195,10 @@ protected override void Draw(DrawingHandleScreen handle)
handle.DrawPrimitives(DrawPrimitiveTopology.LineList, verts, otherDockConnection);
// Draw the dock itself
- var dockBL = Vector2.Transform(dock.Coordinates.Position + new Vector2(-0.5f, -0.5f), curGridToView);
- var dockBR = Vector2.Transform(dock.Coordinates.Position + new Vector2(0.5f, -0.5f), curGridToView);
- var dockTR = Vector2.Transform(dock.Coordinates.Position + new Vector2(0.5f, 0.5f), curGridToView);
- var dockTL = Vector2.Transform(dock.Coordinates.Position + new Vector2(-0.5f, 0.5f), curGridToView);
+ var dockBL = Vector2.Transform(dock.Coordinates.Position + new Vector2(-0.5f, -0.5f), matty);
+ var dockBR = Vector2.Transform(dock.Coordinates.Position + new Vector2(0.5f, -0.5f), matty);
+ var dockTR = Vector2.Transform(dock.Coordinates.Position + new Vector2(0.5f, 0.5f), matty);
+ var dockTL = Vector2.Transform(dock.Coordinates.Position + new Vector2(-0.5f, 0.5f), matty);
verts = new[]
{
@@ -209,6 +212,13 @@ protected override void Draw(DrawingHandleScreen handle)
dockBL
};
+ for (var i = 0; i < verts.Length; i++)
+ {
+ var vert = verts[i];
+ vert.Y = -vert.Y;
+ verts[i] = ScalePosition(vert);
+ }
+
Color otherDockColor;
if (HighlightedDock == dock.Entity)
@@ -243,11 +253,9 @@ protected override void Draw(DrawingHandleScreen handle)
collisionCenter /= 4;
var range = viewedDockPos.Value - collisionCenter;
- var maxRange = SharedDockingSystem.DockingHiglightRange * MinimapScale;
- var maxRangeSq = maxRange * maxRange;
- if (range.LengthSquared() < maxRangeSq)
+ if (range.Length() < SharedDockingSystem.DockingHiglightRange * MinimapScale)
{
- if (dock.GridDockedWith == null)
+ if (_viewedState?.GridDockedWith == null)
{
var coordsOne = EntManager.GetCoordinates(_viewedState!.Coordinates);
var coordsTwo = EntManager.GetCoordinates(dock.Coordinates);
@@ -257,11 +265,10 @@ protected override void Draw(DrawingHandleScreen handle)
var rotA = _xformSystem.GetWorldRotation(coordsOne.EntityId) + _viewedState!.Angle;
var rotB = _xformSystem.GetWorldRotation(coordsTwo.EntityId) + dock.Angle;
- var distanceSq = (mapOne.Position - mapTwo.Position).LengthSquared();
+ var distance = (mapOne.Position - mapTwo.Position).Length();
var inAlignment = _dockSystem.InAlignment(mapOne, rotA, mapTwo, rotB);
- var maxDockDistSq = SharedDockingSystem.DockRange * SharedDockingSystem.DockRange;
- var canDock = distanceSq < maxDockDistSq && inAlignment;
+ var canDock = distance < SharedDockingSystem.DockRange && inAlignment;
if (dockButton != null)
dockButton.Disabled = !canDock || !canDockChange;
@@ -290,8 +297,7 @@ protected override void Draw(DrawingHandleScreen handle)
{
// Because it's being layed out top-down we have to arrange for first frame.
container.Arrange(PixelRect);
- var dockPositionInView = Vector2.Transform(dock.Coordinates.Position, curGridToView);
- var containerPos = dockPositionInView / UIScale - container.DesiredSize / 2 - new Vector2(0f, 0.75f) * MinimapScale;
+ var containerPos = scaledPos / UIScale - container.DesiredSize / 2 - new Vector2(0f, 0.75f) * MinimapScale;
SetPosition(container, containerPos);
}
diff --git a/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs b/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
index 805608c9a53..2674343e059 100644
--- a/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
+++ b/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
@@ -29,11 +29,6 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl
///
private EntityCoordinates? _coordinates;
- ///
- /// Entity of controlling console
- ///
- private EntityUid? _consoleEntity;
-
private Angle? _rotation;
private Dictionary> _docks = new();
@@ -62,11 +57,6 @@ public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
_rotation = angle;
}
- public void SetConsole(EntityUid? consoleEntity)
- {
- _consoleEntity = consoleEntity;
- }
-
protected override void KeyBindUp(GUIBoundKeyEventArgs args)
{
base.KeyBindUp(args);
@@ -149,35 +139,40 @@ protected override void Draw(DrawingHandleScreen handle)
}
var mapPos = _transform.ToMapCoordinates(_coordinates.Value);
- var posMatrix = Matrix3Helpers.CreateTransform(_coordinates.Value.Position, _rotation.Value);
+ var offset = _coordinates.Value.Position;
+ var posMatrix = Matrix3Helpers.CreateTransform(offset, _rotation.Value);
var ourEntRot = RotateWithEntity ? _transform.GetWorldRotation(xform) : _rotation.Value;
var ourEntMatrix = Matrix3Helpers.CreateTransform(_transform.GetWorldPosition(xform), ourEntRot);
- var shuttleToWorld = Matrix3x2.Multiply(posMatrix, ourEntMatrix);
- Matrix3x2.Invert(shuttleToWorld, out var worldToShuttle);
- var shuttleToView = Matrix3x2.CreateScale(new Vector2(MinimapScale, -MinimapScale)) * Matrix3x2.CreateTranslation(MidPointVector);
+ var ourWorldMatrix = Matrix3x2.Multiply(posMatrix, ourEntMatrix);
+ Matrix3x2.Invert(ourWorldMatrix, out var ourWorldMatrixInvert);
// Draw our grid in detail
var ourGridId = xform.GridUid;
if (EntManager.TryGetComponent(ourGridId, out var ourGrid) &&
fixturesQuery.HasComponent(ourGridId.Value))
{
- var ourGridToWorld = _transform.GetWorldMatrix(ourGridId.Value);
- var ourGridToShuttle = Matrix3x2.Multiply(ourGridToWorld, worldToShuttle);
- var ourGridToView = ourGridToShuttle * shuttleToView;
+ var ourGridMatrix = _transform.GetWorldMatrix(ourGridId.Value);
+ var matrix = Matrix3x2.Multiply(ourGridMatrix, ourWorldMatrixInvert);
var color = _shuttles.GetIFFColor(ourGridId.Value, self: true);
- DrawGrid(handle, ourGridToView, (ourGridId.Value, ourGrid), color);
- DrawDocks(handle, ourGridId.Value, ourGridToView);
+ DrawGrid(handle, matrix, (ourGridId.Value, ourGrid), color);
+ DrawDocks(handle, ourGridId.Value, matrix);
}
+ var invertedPosition = _coordinates.Value.Position - offset;
+ invertedPosition.Y = -invertedPosition.Y;
+ // Don't need to transform the InvWorldMatrix again as it's already offset to its position.
+
// Draw radar position on the station
+ var radarPos = invertedPosition;
const float radarVertRadius = 2f;
+
var radarPosVerts = new Vector2[]
{
- ScalePosition(new Vector2(0f, -radarVertRadius)),
- ScalePosition(new Vector2(radarVertRadius / 2f, 0f)),
- ScalePosition(new Vector2(0f, radarVertRadius)),
- ScalePosition(new Vector2(radarVertRadius / -2f, 0f)),
+ ScalePosition(radarPos + new Vector2(0f, -radarVertRadius)),
+ ScalePosition(radarPos + new Vector2(radarVertRadius / 2f, 0f)),
+ ScalePosition(radarPos + new Vector2(0f, radarVertRadius)),
+ ScalePosition(radarPos + new Vector2(radarVertRadius / -2f, 0f)),
};
handle.DrawPrimitives(DrawPrimitiveTopology.TriangleFan, radarPosVerts, Color.Lime);
@@ -202,8 +197,8 @@ protected override void Draw(DrawingHandleScreen handle)
if (!_shuttles.CanDraw(gUid, gridBody, iff))
continue;
- var curGridToWorld = _transform.GetWorldMatrix(gUid);
- var curGridToView = curGridToWorld * worldToShuttle * shuttleToView;
+ var gridMatrix = _transform.GetWorldMatrix(gUid);
+ var matty = Matrix3x2.Multiply(gridMatrix, ourWorldMatrixInvert);
var labelColor = _shuttles.GetIFFColor(grid, self: false, iff);
var coordColor = new Color(labelColor.R * 0.8f, labelColor.G * 0.8f, labelColor.B * 0.8f, 0.5f);
@@ -218,7 +213,8 @@ protected override void Draw(DrawingHandleScreen handle)
{
var gridBounds = grid.Comp.LocalAABB;
- var gridCentre = Vector2.Transform(gridBody.LocalCenter, curGridToView);
+ var gridCentre = Vector2.Transform(gridBody.LocalCenter, matty);
+ gridCentre.Y = -gridCentre.Y;
var distance = gridCentre.Length();
var labelText = Loc.GetString("shuttle-console-iff-label", ("name", labelName),
@@ -234,8 +230,9 @@ protected override void Draw(DrawingHandleScreen handle)
// y-offset the control to always render below the grid (vertically)
var yOffset = Math.Max(gridBounds.Height, gridBounds.Width) * MinimapScale / 1.8f;
- // The actual position in the UI.
- var gridScaledPosition = gridCentre - new Vector2(0, -yOffset);
+ // The actual position in the UI. We centre the label by offsetting the matrix position
+ // by half the label's width, plus the y-offset
+ var gridScaledPosition = ScalePosition(gridCentre) - new Vector2(0, -yOffset);
// Normalize the grid position if it exceeds the viewport bounds
// normalizing it instead of clamping it preserves the direction of the vector and prevents corner-hugging
@@ -267,32 +264,18 @@ protected override void Draw(DrawingHandleScreen handle)
}
// Detailed view
- var gridAABB = curGridToWorld.TransformBox(grid.Comp.LocalAABB);
+ var gridAABB = gridMatrix.TransformBox(grid.Comp.LocalAABB);
// Skip drawing if it's out of range.
if (!gridAABB.Intersects(viewAABB))
continue;
- DrawGrid(handle, curGridToView, grid, labelColor);
- DrawDocks(handle, gUid, curGridToView);
+ DrawGrid(handle, matty, grid, labelColor);
+ DrawDocks(handle, gUid, matty);
}
-
- // If we've set the controlling console, and it's on a different grid
- // to the shuttle itself, then draw an additional marker to help the
- // player determine where they are relative to the shuttle.
- if (_consoleEntity != null && xformQuery.TryGetComponent(_consoleEntity, out var consoleXform))
- {
- if (consoleXform.ParentUid != _coordinates.Value.EntityId)
- {
- var consolePositionWorld = _transform.GetWorldPosition((EntityUid)_consoleEntity);
- var p = Vector2.Transform(consolePositionWorld, worldToShuttle * shuttleToView);
- handle.DrawCircle(p, 5, Color.ToSrgb(Color.Cyan), true);
- }
- }
-
}
- private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3x2 gridToView)
+ private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3x2 matrix)
{
if (!ShowDocks)
return;
@@ -300,32 +283,33 @@ private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3x2 grid
const float DockScale = 0.6f;
var nent = EntManager.GetNetEntity(uid);
- const float sqrt2 = 1.41421356f;
- const float dockRadius = DockScale * sqrt2;
- // Worst-case bounds used to cull a dock:
- Box2 viewBounds = new Box2(-dockRadius, -dockRadius, Size.X + dockRadius, Size.Y + dockRadius);
if (_docks.TryGetValue(nent, out var docks))
{
foreach (var state in docks)
{
var position = state.Coordinates.Position;
+ var uiPosition = Vector2.Transform(position, matrix);
- var positionInView = Vector2.Transform(position, gridToView);
- if (!viewBounds.Contains(positionInView))
- {
+ if (uiPosition.Length() > (WorldRange * 2f) - DockScale)
continue;
- }
var color = Color.ToSrgb(Color.Magenta);
var verts = new[]
{
- Vector2.Transform(position + new Vector2(-DockScale, -DockScale), gridToView),
- Vector2.Transform(position + new Vector2(DockScale, -DockScale), gridToView),
- Vector2.Transform(position + new Vector2(DockScale, DockScale), gridToView),
- Vector2.Transform(position + new Vector2(-DockScale, DockScale), gridToView),
+ Vector2.Transform(position + new Vector2(-DockScale, -DockScale), matrix),
+ Vector2.Transform(position + new Vector2(DockScale, -DockScale), matrix),
+ Vector2.Transform(position + new Vector2(DockScale, DockScale), matrix),
+ Vector2.Transform(position + new Vector2(-DockScale, DockScale), matrix),
};
+ for (var i = 0; i < verts.Length; i++)
+ {
+ var vert = verts[i];
+ vert.Y = -vert.Y;
+ verts[i] = ScalePosition(vert);
+ }
+
handle.DrawPrimitives(DrawPrimitiveTopology.TriangleFan, verts, color.WithAlpha(0.8f));
handle.DrawPrimitives(DrawPrimitiveTopology.LineStrip, verts, color);
}
diff --git a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs
index bb0dba2f57d..4e412df8581 100644
--- a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs
+++ b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs
@@ -9,7 +9,6 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
-using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Client.Silicons.Laws.Ui;
@@ -19,13 +18,8 @@ public sealed partial class LawDisplay : Control
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
- [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly EntityManager _entityManager = default!;
- private static readonly TimeSpan PressCooldown = TimeSpan.FromSeconds(3);
-
- private readonly Dictionary