Skip to content

Commit ce3a946

Browse files
authored
Merge branch 'master' into toys!
2 parents 4ebe969 + 0bd3b2f commit ce3a946

File tree

844 files changed

+234567
-13855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

844 files changed

+234567
-13855
lines changed
File renamed without changes.

Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ namespace Content.Client.Administration.UI.BanPanel;
2222
[GenerateTypedNameReferences]
2323
public sealed partial class BanPanel : DefaultWindow
2424
{
25-
public event Action<string?, (IPAddress, int)?, bool, byte[]?, bool, uint, string, NoteSeverity, int, string[]?, bool, bool>? BanSubmitted;
25+
public event Action<string?, (IPAddress, int)?, bool, ImmutableTypedHwid?, bool, uint, string, NoteSeverity, int, string[]?, bool, bool>? BanSubmitted;
2626
public event Action<string>? PlayerChanged;
2727
private string? PlayerUsername { get; set; }
2828
private (IPAddress, int)? IpAddress { get; set; }
29-
private byte[]? Hwid { get; set; }
29+
private ImmutableTypedHwid? Hwid { get; set; }
3030
private double TimeEntered { get; set; }
3131
private int statedRoundEntered { get; set; }
3232
private uint Multiplier { get; set; }
@@ -392,9 +392,8 @@ private void OnIpChanged()
392392
private void OnHwidChanged()
393393
{
394394
var hwidString = HwidLine.Text;
395-
var length = 3 * (hwidString.Length / 4) - hwidString.TakeLast(2).Count(c => c == '=');
396-
Hwid = new byte[length];
397-
if (HwidCheckbox.Pressed && !(string.IsNullOrEmpty(hwidString) && LastConnCheckbox.Pressed) && !Convert.TryFromBase64String(hwidString, Hwid, out _))
395+
ImmutableTypedHwid? hwid = null;
396+
if (HwidCheckbox.Pressed && !(string.IsNullOrEmpty(hwidString) && LastConnCheckbox.Pressed) && !ImmutableTypedHwid.TryParse(hwidString, out hwid))
398397
{
399398
ErrorLevel |= ErrorLevelEnum.Hwid;
400399
HwidLine.ModulateSelfOverride = Color.Red;
@@ -411,7 +410,7 @@ private void OnHwidChanged()
411410
Hwid = null;
412411
return;
413412
}
414-
Hwid = Convert.FromHexString(hwidString);
413+
Hwid = hwid;
415414
}
416415

417416
private void OnTypeChanged()

Content.Client/Administration/UI/Notes/NoteEdit.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<Label Name="ExpiryLabel" Text="{Loc admin-note-editor-expiry-label}" Visible="False" />
99
<HistoryLineEdit Name="ExpiryLineEdit" PlaceHolder="{Loc admin-note-editor-expiry-placeholder}"
1010
Visible="False" HorizontalExpand="True" />
11+
<OptionButton Name="ExpiryLengthDropdown" Visible="False" />
1112
</BoxContainer>
1213
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
1314
<OptionButton Name="TypeOption" HorizontalAlignment="Center" />

Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs

+51-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ public sealed partial class NoteEdit : FancyWindow
1717
[Dependency] private readonly IGameTiming _gameTiming = default!;
1818
[Dependency] private readonly IClientConsoleHost _console = default!;
1919

20+
private enum Multipliers
21+
{
22+
Minutes,
23+
Hours,
24+
Days,
25+
Weeks,
26+
Months,
27+
Years,
28+
Centuries
29+
}
30+
2031
public event Action<int, NoteType, string, NoteSeverity?, bool, DateTime?>? SubmitPressed;
2132

2233
public NoteEdit(SharedAdminNote? note, string playerName, bool canCreate, bool canEdit)
@@ -31,6 +42,20 @@ public NoteEdit(SharedAdminNote? note, string playerName, bool canCreate, bool c
3142

3243
ResetSubmitButton();
3344

45+
// It's weird to use minutes as the IDs, but it works and makes sense kind of :)
46+
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-minutes"), (int) Multipliers.Minutes);
47+
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-hours"), (int) Multipliers.Hours);
48+
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-days"), (int) Multipliers.Days);
49+
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-weeks"), (int) Multipliers.Weeks);
50+
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-months"), (int) Multipliers.Months);
51+
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-years"), (int) Multipliers.Years);
52+
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-centuries"), (int) Multipliers.Centuries);
53+
ExpiryLengthDropdown.OnItemSelected += OnLengthChanged;
54+
55+
ExpiryLengthDropdown.SelectId((int) Multipliers.Weeks);
56+
57+
ExpiryLineEdit.OnTextChanged += OnTextChanged;
58+
3459
TypeOption.AddItem(Loc.GetString("admin-note-editor-type-note"), (int) NoteType.Note);
3560
TypeOption.AddItem(Loc.GetString("admin-note-editor-type-message"), (int) NoteType.Message);
3661
TypeOption.AddItem(Loc.GetString("admin-note-editor-type-watchlist"), (int) NoteType.Watchlist);
@@ -134,6 +159,7 @@ private void OnTypeChanged(OptionButton.ItemSelectedEventArgs args)
134159
SecretCheckBox.Pressed = true; // SS220 Secret Default
135160
SeverityOption.Disabled = false;
136161
PermanentCheckBox.Pressed = true;
162+
SubmitButton.Disabled = true;
137163
UpdatePermanentCheckboxFields();
138164
break;
139165
case (int) NoteType.Message: // Message: these are shown to the player when they log on
@@ -172,8 +198,9 @@ private void UpdatePermanentCheckboxFields()
172198
{
173199
ExpiryLabel.Visible = !PermanentCheckBox.Pressed;
174200
ExpiryLineEdit.Visible = !PermanentCheckBox.Pressed;
201+
ExpiryLengthDropdown.Visible = !PermanentCheckBox.Pressed;
175202

176-
ExpiryLineEdit.Text = !PermanentCheckBox.Pressed ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
203+
ExpiryLineEdit.Text = !PermanentCheckBox.Pressed ? 1.ToString() : string.Empty;
177204
}
178205

179206
private void OnSecretPressed(BaseButton.ButtonEventArgs _)
@@ -187,6 +214,16 @@ private void OnSeverityChanged(OptionButton.ItemSelectedEventArgs args)
187214
SeverityOption.SelectId(args.Id);
188215
}
189216

217+
private void OnLengthChanged(OptionButton.ItemSelectedEventArgs args)
218+
{
219+
ExpiryLengthDropdown.SelectId(args.Id);
220+
}
221+
222+
private void OnTextChanged(HistoryLineEdit.LineEditEventArgs args)
223+
{
224+
ParseExpiryTime();
225+
}
226+
190227
private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs args)
191228
{
192229
if (!ParseExpiryTime())
@@ -263,13 +300,24 @@ private bool ParseExpiryTime()
263300
return true;
264301
}
265302

266-
if (string.IsNullOrWhiteSpace(ExpiryLineEdit.Text) || !DateTime.TryParse(ExpiryLineEdit.Text, out var result) || DateTime.UtcNow > result)
303+
if (string.IsNullOrWhiteSpace(ExpiryLineEdit.Text) || !uint.TryParse(ExpiryLineEdit.Text, out var inputInt))
267304
{
268305
ExpiryLineEdit.ModulateSelfOverride = Color.Red;
269306
return false;
270307
}
271308

272-
ExpiryTime = result.ToUniversalTime();
309+
var mult = ExpiryLengthDropdown.SelectedId switch
310+
{
311+
(int) Multipliers.Minutes => TimeSpan.FromMinutes(1).TotalMinutes,
312+
(int) Multipliers.Hours => TimeSpan.FromHours(1).TotalMinutes,
313+
(int) Multipliers.Days => TimeSpan.FromDays(1).TotalMinutes,
314+
(int) Multipliers.Weeks => TimeSpan.FromDays(7).TotalMinutes,
315+
(int) Multipliers.Months => TimeSpan.FromDays(30).TotalMinutes,
316+
(int) Multipliers.Years => TimeSpan.FromDays(365).TotalMinutes,
317+
(int) Multipliers.Centuries => TimeSpan.FromDays(36525).TotalMinutes,
318+
_ => throw new ArgumentOutOfRangeException(nameof(ExpiryLengthDropdown.SelectedId), "Multiplier out of range :(")
319+
};
320+
ExpiryTime = DateTime.UtcNow.AddMinutes(inputInt * mult);
273321
ExpiryLineEdit.ModulateSelfOverride = null;
274322
return true;
275323
}

Content.Client/Administration/UI/Tabs/RoundTab/RoundTab.xaml.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Content.Shared.CCVar;
2+
using Content.Shared.SS220.CCVars;
23
using Robust.Client.AutoGenerated;
34
using Robust.Client.UserInterface;
45
using Robust.Client.UserInterface.Controls;
@@ -16,7 +17,7 @@ public RoundTab()
1617
RobustXamlLoader.Load(this);
1718
IoCManager.InjectDependencies(this);
1819

19-
_config.OnValueChanged(CCVars.DelayEnabled, StateChanged, true);
20+
_config.OnValueChanged(CCVars220.DelayEnabled, StateChanged, true);
2021
Delay.OnPressed += ButtonClicked;
2122
}
2223

@@ -28,7 +29,7 @@ private void StateChanged(bool value)
2829
// Extra check
2930
private void ButtonClicked(BaseButton.ButtonEventArgs args)
3031
{
31-
Delay.Pressed = _config.GetCVar(CCVars.DelayEnabled);
32+
Delay.Pressed = _config.GetCVar(CCVars220.DelayEnabled);
3233
}
3334

3435
protected override void Dispose(bool disposing)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using Robust.Shared.GameObjects;
2-
31
namespace Content.Client.Atmos.Components;
42

53
[RegisterComponent]
6-
public sealed partial class PipeColorVisualsComponent : Component
7-
{
8-
}
4+
public sealed partial class PipeColorVisualsComponent : Component;

Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<BoxContainer xmlns="https://spacestation14.io"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:s="clr-namespace:Content.Client.Stylesheets"
43
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
54
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
65
Orientation="Vertical" HorizontalExpand ="True" Margin="0 0 0 3">
@@ -62,7 +61,7 @@
6261
</PanelContainer>
6362
</BoxContainer>
6463

65-
<!-- If the alarm is inactive, this is label is diplayed instead -->
64+
<!-- If the alarm is inactive, this is label is displayed instead -->
6665
<Label Name="NoDataLabel" Text="{Loc 'atmos-alerts-window-no-data-available'}" HorizontalAlignment="Center" Margin="0 15" FontColorOverride="#a9a9a9" ReservesSpace="False" Visible="False"></Label>
6766

6867
<!-- Silencing progress bar -->

Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ public void UpdateEntry(AtmosAlertsComputerEntry entry, bool isFocus, AtmosAlert
136136
GasGridContainer.RemoveAllChildren();
137137

138138
var gasData = focusData.Value.GasData.Where(g => g.Key != Gas.Oxygen);
139+
var keyValuePairs = gasData.ToList();
139140

140-
if (gasData.Count() == 0)
141+
if (keyValuePairs.Count == 0)
141142
{
142143
// No other gases
143144
var gasLabel = new Label()
@@ -158,13 +159,11 @@ public void UpdateEntry(AtmosAlertsComputerEntry entry, bool isFocus, AtmosAlert
158159
else
159160
{
160161
// Add an entry for each gas
161-
foreach ((var gas, (var mol, var percent, var alert)) in gasData)
162+
foreach ((var gas, (var mol, var percent, var alert)) in keyValuePairs)
162163
{
163-
var gasPercent = (FixedPoint2)0f;
164-
gasPercent = percent * 100f;
164+
FixedPoint2 gasPercent = percent * 100f;
165165

166-
if (!_gasShorthands.TryGetValue(gas, out var gasShorthand))
167-
gasShorthand = "X";
166+
var gasShorthand = _gasShorthands.GetValueOrDefault(gas, "X");
168167

169168
var gasLabel = new Label()
170169
{

Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs

-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ protected override void Open()
1414
_menu = new AtmosAlertsComputerWindow(this, Owner);
1515
_menu.OpenCentered();
1616
_menu.OnClose += Close;
17-
18-
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
1917
}
2018

2119
protected override void UpdateState(BoundUserInterfaceState state)
@@ -24,9 +22,6 @@ protected override void UpdateState(BoundUserInterfaceState state)
2422

2523
var castState = (AtmosAlertsComputerBoundInterfaceState) state;
2624

27-
if (castState == null)
28-
return;
29-
3025
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
3126
_menu?.UpdateUI(xform?.Coordinates, castState.AirAlarms, castState.FireAlarms, castState.FocusData);
3227
}

Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<controls:FancyWindow xmlns="https://spacestation14.io"
22
xmlns:ui="clr-namespace:Content.Client.Pinpointer.UI"
33
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
4-
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
54
Title="{Loc 'atmos-alerts-window-title'}"
65
Resizable="False"
76
SetSize="1120 750"

Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
using Content.Shared.Atmos.Piping;
55
using JetBrains.Annotations;
66
using Robust.Client.GameObjects;
7-
using Robust.Client.ResourceManagement;
8-
using Robust.Shared.Serialization.TypeSerializers.Implementations;
97

108
namespace Content.Client.Atmos.EntitySystems;
119

@@ -19,7 +17,7 @@ public override void Initialize()
1917
base.Initialize();
2018

2119
SubscribeLocalEvent<PipeAppearanceComponent, ComponentInit>(OnInit);
22-
SubscribeLocalEvent<PipeAppearanceComponent, AppearanceChangeEvent>(OnAppearanceChanged, after: new[] { typeof(SubFloorHideSystem) });
20+
SubscribeLocalEvent<PipeAppearanceComponent, AppearanceChangeEvent>(OnAppearanceChanged, after: [typeof(SubFloorHideSystem)]);
2321
}
2422

2523
private void OnInit(EntityUid uid, PipeAppearanceComponent component, ComponentInit args)
@@ -84,7 +82,8 @@ private void OnAppearanceChanged(EntityUid uid, PipeAppearanceComponent componen
8482

8583
layer.Visible &= visible;
8684

87-
if (!visible) continue;
85+
if (!visible)
86+
continue;
8887

8988
layer.Color = color;
9089
}

Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
using System.Collections.Generic;
21
using Content.Shared.Atmos.Monitor;
32
using Content.Shared.Power;
43
using Robust.Client.GameObjects;
54
using Robust.Client.Graphics;
6-
using Robust.Shared.GameObjects;
7-
using Robust.Shared.IoC;
8-
using Robust.Shared.Maths;
9-
using Robust.Shared.Serialization.Manager.Attributes;
105

116
namespace Content.Client.Atmos.Monitor;
127

@@ -27,7 +22,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC
2722
{
2823
foreach (var visLayer in component.HideOnDepowered)
2924
{
30-
if (args.Sprite.LayerMapTryGet(visLayer, out int powerVisibilityLayer))
25+
if (args.Sprite.LayerMapTryGet(visLayer, out var powerVisibilityLayer))
3126
args.Sprite.LayerSetVisible(powerVisibilityLayer, powered);
3227
}
3328
}
@@ -36,7 +31,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC
3631
{
3732
foreach (var (setLayer, powerState) in component.SetOnDepowered)
3833
{
39-
if (args.Sprite.LayerMapTryGet(setLayer, out int setStateLayer))
34+
if (args.Sprite.LayerMapTryGet(setLayer, out var setStateLayer))
4035
args.Sprite.LayerSetState(setStateLayer, new RSI.StateId(powerState));
4136
}
4237
}

Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
using Content.Shared.Atmos;
22
using Content.Shared.Atmos.Monitor;
33
using Content.Shared.Atmos.Monitor.Components;
4-
using Robust.Client.GameObjects;
54
using Robust.Client.UserInterface;
6-
using Robust.Shared.GameObjects;
7-
using Robust.Shared.IoC;
8-
using Robust.Shared.Log;
95

106
namespace Content.Client.Atmos.Monitor.UI;
117

@@ -78,6 +74,7 @@ protected override void Dispose(bool disposing)
7874
{
7975
base.Dispose(disposing);
8076

81-
if (disposing) _window?.Dispose();
77+
if (disposing)
78+
_window?.Dispose();
8279
}
8380
}

Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs

+8-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Content.Shared.Atmos.Piping.Unary.Components;
99
using Content.Shared.Temperature;
1010
using Robust.Client.AutoGenerated;
11-
using Robust.Client.GameObjects;
1211
using Robust.Client.UserInterface.Controls;
1312
using Robust.Client.UserInterface.XAML;
1413

@@ -59,7 +58,7 @@ public AirAlarmWindow()
5958
AirAlarmMode.Fill => "air-alarm-ui-mode-fill",
6059
AirAlarmMode.Panic => "air-alarm-ui-mode-panic",
6160
AirAlarmMode.None => "air-alarm-ui-mode-none",
62-
_ => "error"
61+
_ => "error",
6362
};
6463
_modes.AddItem(Loc.GetString(text));
6564
}
@@ -70,7 +69,7 @@ public AirAlarmWindow()
7069
AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id);
7170
};
7271

73-
_autoMode.OnToggled += args =>
72+
_autoMode.OnToggled += _ =>
7473
{
7574
AutoModeChanged!.Invoke(_autoMode.Pressed);
7675
};
@@ -176,22 +175,18 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
176175

177176
public static Color ColorForThreshold(float amount, AtmosAlarmThreshold threshold)
178177
{
179-
threshold.CheckThreshold(amount, out AtmosAlarmType curAlarm);
178+
threshold.CheckThreshold(amount, out var curAlarm);
180179
return ColorForAlarm(curAlarm);
181180
}
182181

183182
public static Color ColorForAlarm(AtmosAlarmType curAlarm)
184183
{
185-
if(curAlarm == AtmosAlarmType.Danger)
184+
return curAlarm switch
186185
{
187-
return StyleNano.DangerousRedFore;
188-
}
189-
else if(curAlarm == AtmosAlarmType.Warning)
190-
{
191-
return StyleNano.ConcerningOrangeFore;
192-
}
193-
194-
return StyleNano.GoodGreenFore;
186+
AtmosAlarmType.Danger => StyleNano.DangerousRedFore,
187+
AtmosAlarmType.Warning => StyleNano.ConcerningOrangeFore,
188+
_ => StyleNano.GoodGreenFore,
189+
};
195190
}
196191

197192

0 commit comments

Comments
 (0)