Skip to content

Commit

Permalink
Merge branch 'SerbiaStrong-220:master' into silent-boots
Browse files Browse the repository at this point in the history
  • Loading branch information
lexaSvarshik authored Oct 28, 2024
2 parents 4610941 + a0228ef commit b5931fb
Show file tree
Hide file tree
Showing 260 changed files with 9,089 additions and 3,871 deletions.
8 changes: 6 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"Changes: Sprites":
"Changes: Sprites":
- changed-files:
- any-glob-to-any-file: '**/*.rsi/*.png'

Expand All @@ -23,6 +23,10 @@
"Changes: Prototypes":
- changed-files:
# Equiv to any-glob-to-all as long as this has one matcher. If ALL changed files are not C# files, then apply label.
- all-globs-to-all-files:
- all-globs-to-any-file:
- "Resources/Prototypes/**/*.yml"
- '!Resources/Prototypes/Maps/**/*.yml'

"Changes: C#":
- changed-files:
- any-glob-to-any-file: '**/*.cs'
22 changes: 19 additions & 3 deletions Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ public void UpdateState(IdCardConsoleBoundUserInterfaceState state)

FullNameLabel.Modulate = interfaceEnabled ? Color.White : Color.Gray;
FullNameLineEdit.Editable = interfaceEnabled;

//ss220 format name fix start
FullNameLineEdit.Text = FullNameLineEdit.Text
.Replace('[', '(')
.Replace(']', ')');
//ss220 format name fix end

if (!fullNameDirty)
{
FullNameLineEdit.Text = state.TargetIdFullName ?? string.Empty;
Expand All @@ -159,6 +166,13 @@ public void UpdateState(IdCardConsoleBoundUserInterfaceState state)

JobTitleLabel.Modulate = interfaceEnabled ? Color.White : Color.Gray;
JobTitleLineEdit.Editable = interfaceEnabled;

//ss220 format name fix start
JobTitleLineEdit.Text = JobTitleLineEdit.Text
.Replace('[', '(')
.Replace(']', ')');
//ss220 format name fix end

if (!jobTitleDirty)
{
JobTitleLineEdit.Text = state.TargetIdJobTitle ?? string.Empty;
Expand Down Expand Up @@ -194,10 +208,12 @@ private void SubmitData()
var jobProtoDirty = _lastJobProto != null &&
_jobPrototypeIds[JobPresetOptionButton.SelectedId] != _lastJobProto;

var fullNameSafe = FullNameLineEdit.Text.Replace("[", "(").Replace("]", ")"); //ss220 format name fix start
var jobTitleSafe = JobTitleLineEdit.Text.Replace("[", "(").Replace("]", ")"); //ss220 format name fix start

_owner.SubmitData(
FullNameLineEdit.Text,
JobTitleLineEdit.Text,
// Iterate over the buttons dictionary, filter by `Pressed`, only get key from the key/value pair
fullNameSafe, //ss220 format name fix
jobTitleSafe, //ss220 format name fix
_accessButtons.ButtonsList.Where(x => x.Value.Pressed).Select(x => x.Key).ToList(),
jobProtoDirty ? _jobPrototypeIds[JobPresetOptionButton.SelectedId] : string.Empty);
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Chemistry/UI/ChemMasterWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-buffer-text'}" />
<Control HorizontalExpand="True" />
<Button MinSize="80 0" Name="BufferTransferButton" Access="Public" Text="{Loc 'chem-master-window-transfer-button'}" ToggleMode="True" StyleClasses="OpenRight" />
<Button MinSize="80 0" Name="BufferSortButton" Access="Public" Text="{Loc 'chem-master-window-sort-button'}" ToggleMode="True" StyleClasses="OpenRight"/> <!--ss220 tweak sort -->
<Button MinSize="80 0" Name="BufferTransferButton" Access="Public" Text="{Loc 'chem-master-window-transfer-button'}" ToggleMode="True" StyleClasses="OpenBoth" /> <!--ss220 tweak sort -->
<Button MinSize="80 0" Name="BufferDiscardButton" Access="Public" Text="{Loc 'chem-master-window-discard-button'}" ToggleMode="True" StyleClasses="OpenLeft" />
</BoxContainer>

Expand Down
31 changes: 30 additions & 1 deletion Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public sealed partial class ChemMasterWindow : FancyWindow
public event Action<BaseButton.ButtonEventArgs, ReagentButton>? OnReagentButtonPressed;
public readonly Button[] PillTypeButtons;

private ChemMasterBoundUserInterfaceState? _chemState; //ss220 tweak sort chem
private bool _isSortingEnabled; //ss220 tweak sort chem

private const string PillsRsiPath = "/Textures/Objects/Specific/Chemistry/pills.rsi";

/// <summary>
Expand All @@ -37,6 +40,17 @@ public ChemMasterWindow()
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

//ss220 tweak sort chem start
BufferSortButton.OnPressed += _ =>
{
_isSortingEnabled = !_isSortingEnabled;
if (_chemState != null)
{
UpdatePanelInfo(_chemState);
}
};
//ss220 tweak sort chem end

// Pill type selection buttons, in total there are 20 pills.
// Pill rsi file should have states named as pill1, pill2, and so on.
var resourcePath = new ResPath(PillsRsiPath);
Expand Down Expand Up @@ -105,6 +119,9 @@ public void UpdateState(BoundUserInterfaceState state)
var castState = (ChemMasterBoundUserInterfaceState) state;
if (castState.UpdateLabel)
LabelLine = GenerateLabel(castState);

_chemState = castState; //ss220 tweak sort chem

UpdatePanelInfo(castState);

var output = castState.OutputContainerInfo;
Expand Down Expand Up @@ -182,7 +199,19 @@ private void UpdatePanelInfo(ChemMasterBoundUserInterfaceState state)
};
bufferHBox.AddChild(bufferVol);

foreach (var (reagent, quantity) in state.BufferReagents)
//ss220 tweak sort chem start
var newBuffer = _isSortingEnabled
? state.BufferReagents
.OrderBy(reagent =>
{
_prototypeManager.TryIndex(reagent.Reagent.Prototype, out ReagentPrototype? proto);
return proto?.LocalizedName ?? Loc.GetString("chem-master-window-unknown-reagent-text");
})
.ToList()
: state.BufferReagents;
//ss220 tweak sort chem end

foreach (var (reagent, quantity) in newBuffer) //ss220 tweak sort chem
{
// Try to get the prototype for the given reagent. This gives us its name.
_prototypeManager.TryIndex(reagent.Prototype, out ReagentPrototype? proto);
Expand Down
11 changes: 10 additions & 1 deletion Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Client.DebugMon;
using Content.Client.Eui;
using Content.Client.Fullscreen;
using Content.Client.GameTicking.Managers;
using Content.Client.GhostKick;
using Content.Client.Guidebook;
using Content.Client.Input;
Expand Down Expand Up @@ -79,6 +80,7 @@ public sealed class EntryPoint : GameClient
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly DiscordPlayerInfoManager _discordPlayerInfoManager = default!; // SS220 discord info manager
[Dependency] private readonly DebugMonitorManager _debugMonitorManager = default!;
[Dependency] private readonly TitleWindowManager _titleWindowManager = default!;

public override void Init()
{
Expand Down Expand Up @@ -149,6 +151,12 @@ public override void Init()
_configManager.SetCVar("interface.resolutionAutoScaleMinimum", 0.5f);
}

public override void Shutdown()
{
base.Shutdown();
_titleWindowManager.Shutdown();
}

public override void PostInit()
{
base.PostInit();
Expand All @@ -172,7 +180,8 @@ public override void PostInit()
_discordAuthManager.Initialize(); // Corvax-DiscordAuth
_userInterfaceManager.SetActiveTheme(_configManager.GetCVar(CVars.InterfaceTheme));
_documentParsingManager.Initialize();
_discordPlayerInfoManager.Initialize();
_discordPlayerInfoManager.Initialize(); // SS220 tier info
_titleWindowManager.Initialize();

_baseClient.RunLevelChanged += (_, args) =>
{
Expand Down
62 changes: 62 additions & 0 deletions Content.Client/GameTicking/Managers/TitleWindowManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Content.Shared.CCVar;
using Robust.Client;
using Robust.Client.Graphics;
using Robust.Shared;
using Robust.Shared.Configuration;

namespace Content.Client.GameTicking.Managers;

public sealed class TitleWindowManager
{
[Dependency] private readonly IBaseClient _client = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IGameController _gameController = default!;

public void Initialize()
{
_cfg.OnValueChanged(CVars.GameHostName, OnHostnameChange, true);
_cfg.OnValueChanged(CCVars.GameHostnameInTitlebar, OnHostnameTitleChange, true);

_client.RunLevelChanged += OnRunLevelChangedChange;
}

public void Shutdown()
{
_cfg.UnsubValueChanged(CVars.GameHostName, OnHostnameChange);
_cfg.UnsubValueChanged(CCVars.GameHostnameInTitlebar, OnHostnameTitleChange);
}

private void OnHostnameChange(string hostname)
{
var defaultWindowTitle = _gameController.GameTitle();

// Since the game assumes the server name is MyServer and that GameHostnameInTitlebar CCVar is true by default
// Lets just... not show anything. This also is used to revert back to just the game title on disconnect.
if (_client.RunLevel == ClientRunLevel.Initialize)
{
_clyde.SetWindowTitle(defaultWindowTitle);
return;
}

if (_cfg.GetCVar(CCVars.GameHostnameInTitlebar))
// If you really dislike the dash I guess change it here
_clyde.SetWindowTitle(hostname + " - " + defaultWindowTitle);
else
_clyde.SetWindowTitle(defaultWindowTitle);
}

// Clients by default assume game.hostname_in_titlebar is true
// but we need to clear it as soon as we join and actually receive the servers preference on this.
// This will ensure we rerun OnHostnameChange and set the correct title bar name.
private void OnHostnameTitleChange(bool colonthree)
{
OnHostnameChange(_cfg.GetCVar(CVars.GameHostName));
}

// This is just used we can rerun the hostname change function when we disconnect to revert back to just the games title.
private void OnRunLevelChangedChange(object? sender, RunLevelChangedEventArgs runLevelChangedEventArgs)
{
OnHostnameChange(_cfg.GetCVar(CVars.GameHostName));
}
}
3 changes: 2 additions & 1 deletion Content.Client/Info/PlaytimeStats/PlaytimeStatsEntry.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared.Localizations; // SS220 Playtime Format Fix
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
Expand All @@ -16,7 +17,7 @@ public PlaytimeStatsEntry(string role, TimeSpan playtime, StyleBox styleBox)

RoleLabel.Text = role;
Playtime = playtime; // store the TimeSpan value directly
PlaytimeLabel.Text = playtime.ToString(Loc.GetString("ui-playtime-time-format")); // convert to string for display
PlaytimeLabel.Text = ContentLocalizationManager.FormatPlaytime(playtime); // convert to string for display // SS220 Playtime Format Fix
BackgroundColorPanel.PanelOverride = styleBox;
}

Expand Down
3 changes: 1 addition & 2 deletions Content.Client/Info/PlaytimeStats/PlaytimeStatsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ private void PopulatePlaytimeData()
{
var overallPlaytime = _jobRequirementsManager.FetchOverallPlaytime();

var formattedPlaytime = overallPlaytime.ToString(Loc.GetString("ui-playtime-time-format"));
OverallPlaytimeLabel.Text = Loc.GetString("ui-playtime-overall", ("time", formattedPlaytime));
OverallPlaytimeLabel.Text = Loc.GetString("ui-playtime-overall", ("time", overallPlaytime)); // SS220 Playtime Format Fix

var rolePlaytimes = _jobRequirementsManager.FetchPlaytimeByRoles();

Expand Down
2 changes: 2 additions & 0 deletions Content.Client/IoC/ClientContentIoC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Client.DebugMon;
using Content.Client.Eui;
using Content.Client.Fullscreen;
using Content.Client.GameTicking.Managers;
using Content.Client.GhostKick;
using Content.Client.Guidebook;
using Content.Client.Launcher;
Expand Down Expand Up @@ -65,6 +66,7 @@ public static void Register()
collection.Register<DebugMonitorManager>();
collection.Register<PlayerRateLimitManager>();
collection.Register<SharedPlayerRateLimitManager, PlayerRateLimitManager>();
collection.Register<TitleWindowManager>();
}
}
}
7 changes: 0 additions & 7 deletions Content.Client/Polymorph/Systems/ChameleonProjectorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ public override void Initialize()

private void OnHandleState(Entity<ChameleonDisguiseComponent> ent, ref AfterAutoHandleStateEvent args)
{
//ss220 cham fix start
CopyComp<EntityStorageVisualsComponent>(ent);
CopyComp<LockVisualsComponent>(ent);
CopyComp<WiresVisualsComponent>(ent);
CopyComp<VendingMachineComponent>(ent);
//ss220 cham fix end

CopyComp<SpriteComponent>(ent);
CopyComp<GenericVisualizerComponent>(ent);
CopyComp<SolutionContainerVisualsComponent>(ent);
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/VendingMachines/UI/VendingMachineMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:co="clr-namespace:Content.Client.UserInterface.Controls">
xmlns:co="clr-namespace:Content.Client.UserInterface.Controls"
MinHeight="210">
<BoxContainer Name="MainContainer" Orientation="Vertical">
<LineEdit Name="SearchBar" PlaceHolder="{Loc 'vending-machine-component-search-filter'}" HorizontalExpand="True" Margin ="4 4"/>
<co:SearchListContainer Name="VendingContents" VerticalExpand="True" Margin="4 4"/>
Expand Down
Loading

0 comments on commit b5931fb

Please sign in to comment.