Skip to content

Commit

Permalink
MasterMergeMomentumMore
Browse files Browse the repository at this point in the history
  • Loading branch information
Alwayswannahunt committed Dec 2, 2024
2 parents 74a16c6 + 0bd3b2f commit 16e8a60
Show file tree
Hide file tree
Showing 712 changed files with 232,909 additions and 13,440 deletions.
File renamed without changes.
11 changes: 5 additions & 6 deletions Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ namespace Content.Client.Administration.UI.BanPanel;
[GenerateTypedNameReferences]
public sealed partial class BanPanel : DefaultWindow
{
public event Action<string?, (IPAddress, int)?, bool, byte[]?, bool, uint, string, NoteSeverity, int, string[]?, bool, bool>? BanSubmitted;
public event Action<string?, (IPAddress, int)?, bool, ImmutableTypedHwid?, bool, uint, string, NoteSeverity, int, string[]?, bool, bool>? BanSubmitted;
public event Action<string>? PlayerChanged;
private string? PlayerUsername { get; set; }
private (IPAddress, int)? IpAddress { get; set; }
private byte[]? Hwid { get; set; }
private ImmutableTypedHwid? Hwid { get; set; }
private double TimeEntered { get; set; }
private int statedRoundEntered { get; set; }
private uint Multiplier { get; set; }
Expand Down Expand Up @@ -392,9 +392,8 @@ private void OnIpChanged()
private void OnHwidChanged()
{
var hwidString = HwidLine.Text;
var length = 3 * (hwidString.Length / 4) - hwidString.TakeLast(2).Count(c => c == '=');
Hwid = new byte[length];
if (HwidCheckbox.Pressed && !(string.IsNullOrEmpty(hwidString) && LastConnCheckbox.Pressed) && !Convert.TryFromBase64String(hwidString, Hwid, out _))
ImmutableTypedHwid? hwid = null;
if (HwidCheckbox.Pressed && !(string.IsNullOrEmpty(hwidString) && LastConnCheckbox.Pressed) && !ImmutableTypedHwid.TryParse(hwidString, out hwid))
{
ErrorLevel |= ErrorLevelEnum.Hwid;
HwidLine.ModulateSelfOverride = Color.Red;
Expand All @@ -411,7 +410,7 @@ private void OnHwidChanged()
Hwid = null;
return;
}
Hwid = Convert.FromHexString(hwidString);
Hwid = hwid;
}

private void OnTypeChanged()
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Administration/UI/Notes/NoteEdit.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Label Name="ExpiryLabel" Text="{Loc admin-note-editor-expiry-label}" Visible="False" />
<HistoryLineEdit Name="ExpiryLineEdit" PlaceHolder="{Loc admin-note-editor-expiry-placeholder}"
Visible="False" HorizontalExpand="True" />
<OptionButton Name="ExpiryLengthDropdown" Visible="False" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<OptionButton Name="TypeOption" HorizontalAlignment="Center" />
Expand Down
54 changes: 51 additions & 3 deletions Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ public sealed partial class NoteEdit : FancyWindow
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IClientConsoleHost _console = default!;

private enum Multipliers
{
Minutes,
Hours,
Days,
Weeks,
Months,
Years,
Centuries
}

public event Action<int, NoteType, string, NoteSeverity?, bool, DateTime?>? SubmitPressed;

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

ResetSubmitButton();

// It's weird to use minutes as the IDs, but it works and makes sense kind of :)
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-minutes"), (int) Multipliers.Minutes);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-hours"), (int) Multipliers.Hours);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-days"), (int) Multipliers.Days);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-weeks"), (int) Multipliers.Weeks);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-months"), (int) Multipliers.Months);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-years"), (int) Multipliers.Years);
ExpiryLengthDropdown.AddItem(Loc.GetString("admin-note-button-centuries"), (int) Multipliers.Centuries);
ExpiryLengthDropdown.OnItemSelected += OnLengthChanged;

ExpiryLengthDropdown.SelectId((int) Multipliers.Weeks);

ExpiryLineEdit.OnTextChanged += OnTextChanged;

TypeOption.AddItem(Loc.GetString("admin-note-editor-type-note"), (int) NoteType.Note);
TypeOption.AddItem(Loc.GetString("admin-note-editor-type-message"), (int) NoteType.Message);
TypeOption.AddItem(Loc.GetString("admin-note-editor-type-watchlist"), (int) NoteType.Watchlist);
Expand Down Expand Up @@ -134,6 +159,7 @@ private void OnTypeChanged(OptionButton.ItemSelectedEventArgs args)
SecretCheckBox.Pressed = true; // SS220 Secret Default
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
Expand Down Expand Up @@ -172,8 +198,9 @@ private void UpdatePermanentCheckboxFields()
{
ExpiryLabel.Visible = !PermanentCheckBox.Pressed;
ExpiryLineEdit.Visible = !PermanentCheckBox.Pressed;
ExpiryLengthDropdown.Visible = !PermanentCheckBox.Pressed;

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

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

private void OnLengthChanged(OptionButton.ItemSelectedEventArgs args)
{
ExpiryLengthDropdown.SelectId(args.Id);
}

private void OnTextChanged(HistoryLineEdit.LineEditEventArgs args)
{
ParseExpiryTime();
}

private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs args)
{
if (!ParseExpiryTime())
Expand Down Expand Up @@ -263,13 +300,24 @@ private bool ParseExpiryTime()
return true;
}

if (string.IsNullOrWhiteSpace(ExpiryLineEdit.Text) || !DateTime.TryParse(ExpiryLineEdit.Text, out var result) || DateTime.UtcNow > result)
if (string.IsNullOrWhiteSpace(ExpiryLineEdit.Text) || !uint.TryParse(ExpiryLineEdit.Text, out var inputInt))
{
ExpiryLineEdit.ModulateSelfOverride = Color.Red;
return false;
}

ExpiryTime = result.ToUniversalTime();
var mult = ExpiryLengthDropdown.SelectedId switch
{
(int) Multipliers.Minutes => TimeSpan.FromMinutes(1).TotalMinutes,
(int) Multipliers.Hours => TimeSpan.FromHours(1).TotalMinutes,
(int) Multipliers.Days => TimeSpan.FromDays(1).TotalMinutes,
(int) Multipliers.Weeks => TimeSpan.FromDays(7).TotalMinutes,
(int) Multipliers.Months => TimeSpan.FromDays(30).TotalMinutes,
(int) Multipliers.Years => TimeSpan.FromDays(365).TotalMinutes,
(int) Multipliers.Centuries => TimeSpan.FromDays(36525).TotalMinutes,
_ => throw new ArgumentOutOfRangeException(nameof(ExpiryLengthDropdown.SelectedId), "Multiplier out of range :(")
};
ExpiryTime = DateTime.UtcNow.AddMinutes(inputInt * mult);
ExpiryLineEdit.ModulateSelfOverride = null;
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.CCVar;
using Content.Shared.SS220.CCVars;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
Expand All @@ -16,7 +17,7 @@ public RoundTab()
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

_config.OnValueChanged(CCVars.DelayEnabled, StateChanged, true);
_config.OnValueChanged(CCVars220.DelayEnabled, StateChanged, true);
Delay.OnPressed += ButtonClicked;
}

Expand All @@ -28,7 +29,7 @@ private void StateChanged(bool value)
// Extra check
private void ButtonClicked(BaseButton.ButtonEventArgs args)
{
Delay.Pressed = _config.GetCVar(CCVars.DelayEnabled);
Delay.Pressed = _config.GetCVar(CCVars220.DelayEnabled);
}

protected override void Dispose(bool disposing)
Expand Down
6 changes: 1 addition & 5 deletions Content.Client/Atmos/Components/PipeColorVisualsComponent.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Robust.Shared.GameObjects;

namespace Content.Client.Atmos.Components;

[RegisterComponent]
public sealed partial class PipeColorVisualsComponent : Component
{
}
public sealed partial class PipeColorVisualsComponent : Component;
3 changes: 1 addition & 2 deletions Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:Content.Client.Stylesheets"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Orientation="Vertical" HorizontalExpand ="True" Margin="0 0 0 3">
Expand Down Expand Up @@ -62,7 +61,7 @@
</PanelContainer>
</BoxContainer>

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

<!-- Silencing progress bar -->
Expand Down
11 changes: 5 additions & 6 deletions Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ 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 (gasData.Count() == 0)
if (keyValuePairs.Count == 0)
{
// No other gases
var gasLabel = new Label()
Expand All @@ -158,13 +159,11 @@ 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 gasData)
foreach ((var gas, (var mol, var percent, var alert)) in keyValuePairs)
{
var gasPercent = (FixedPoint2)0f;
gasPercent = percent * 100f;
FixedPoint2 gasPercent = percent * 100f;

if (!_gasShorthands.TryGetValue(gas, out var gasShorthand))
gasShorthand = "X";
var gasShorthand = _gasShorthands.GetValueOrDefault(gas, "X");

var gasLabel = new Label()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ protected override void Open()
_menu = new AtmosAlertsComputerWindow(this, Owner);
_menu.OpenCentered();
_menu.OnClose += Close;

EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
}

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

var castState = (AtmosAlertsComputerBoundInterfaceState) state;

if (castState == null)
return;

EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
_menu?.UpdateUI(xform?.Coordinates, castState.AirAlarms, castState.FireAlarms, castState.FocusData);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.Pinpointer.UI"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'atmos-alerts-window-title'}"
Resizable="False"
SetSize="1120 750"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using Content.Shared.Atmos.Piping;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
using Robust.Shared.Serialization.TypeSerializers.Implementations;

namespace Content.Client.Atmos.EntitySystems;

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

SubscribeLocalEvent<PipeAppearanceComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<PipeAppearanceComponent, AppearanceChangeEvent>(OnAppearanceChanged, after: new[] { typeof(SubFloorHideSystem) });
SubscribeLocalEvent<PipeAppearanceComponent, AppearanceChangeEvent>(OnAppearanceChanged, after: [typeof(SubFloorHideSystem)]);
}

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

layer.Visible &= visible;

if (!visible) continue;
if (!visible)
continue;

layer.Color = color;
}
Expand Down
9 changes: 2 additions & 7 deletions Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
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;

Expand All @@ -27,7 +22,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC
{
foreach (var visLayer in component.HideOnDepowered)
{
if (args.Sprite.LayerMapTryGet(visLayer, out int powerVisibilityLayer))
if (args.Sprite.LayerMapTryGet(visLayer, out var powerVisibilityLayer))
args.Sprite.LayerSetVisible(powerVisibilityLayer, powered);
}
}
Expand All @@ -36,7 +31,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC
{
foreach (var (setLayer, powerState) in component.SetOnDepowered)
{
if (args.Sprite.LayerMapTryGet(setLayer, out int setStateLayer))
if (args.Sprite.LayerMapTryGet(setLayer, out var setStateLayer))
args.Sprite.LayerSetState(setStateLayer, new RSI.StateId(powerState));
}
}
Expand Down
7 changes: 2 additions & 5 deletions Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
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;

Expand Down Expand Up @@ -78,6 +74,7 @@ protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (disposing) _window?.Dispose();
if (disposing)
_window?.Dispose();
}
}
21 changes: 8 additions & 13 deletions Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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;

Expand Down Expand Up @@ -59,7 +58,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));
}
Expand All @@ -70,7 +69,7 @@ public AirAlarmWindow()
AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id);
};

_autoMode.OnToggled += args =>
_autoMode.OnToggled += _ =>
{
AutoModeChanged!.Invoke(_autoMode.Pressed);
};
Expand Down Expand Up @@ -176,22 +175,18 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)

public static Color ColorForThreshold(float amount, AtmosAlarmThreshold threshold)
{
threshold.CheckThreshold(amount, out AtmosAlarmType curAlarm);
threshold.CheckThreshold(amount, out var curAlarm);
return ColorForAlarm(curAlarm);
}

public static Color ColorForAlarm(AtmosAlarmType curAlarm)
{
if(curAlarm == AtmosAlarmType.Danger)
return curAlarm switch
{
return StyleNano.DangerousRedFore;
}
else if(curAlarm == AtmosAlarmType.Warning)
{
return StyleNano.ConcerningOrangeFore;
}

return StyleNano.GoodGreenFore;
AtmosAlarmType.Danger => StyleNano.DangerousRedFore,
AtmosAlarmType.Warning => StyleNano.ConcerningOrangeFore,
_ => StyleNano.GoodGreenFore,
};
}


Expand Down
Loading

0 comments on commit 16e8a60

Please sign in to comment.