From 1e423cabf99354debccfb3ff822a64dd449ac73a Mon Sep 17 00:00:00 2001 From: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com> Date: Sat, 15 Feb 2025 18:21:57 -0400 Subject: [PATCH] v245.0.0 (and Storage UI V2) (#1799) Contains: - Storage UI v2, required for removing DeferredClose. - Stock market refactor (mostly some basic changes to stock market, didn't want to make a whole other PR for it) - Make guidebook remember where you left off - Any other PRs are purely for fixing issues related to the above PRs or the engine update. :cl: - add: Ported Storage UI v2. - tweak: The guidebook will now remember where you left off. --------- Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: 12rabbits <53499656+12rabbits@users.noreply.github.com> Co-authored-by: Pieter-Jan Briers Co-authored-by: gluesniffler <159397573+gluesniffler@users.noreply.github.com> Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com> (cherry picked from commit 3c37ff1c48637d1cdf8bc3c6b1412dad338ea205) --- .../Cartridges/StockTradingUi.cs | 2 +- .../Cartridges/StockTradingUiFragment.xaml.cs | 14 +- .../Guidebook/Controls/GuidebookWindow.xaml | 8 +- .../Controls/GuidebookWindow.xaml.cs | 16 + Content.Client/Guidebook/GuideEntry.cs | 2 + .../Storage/StorageBoundUserInterface.cs | 64 ++- .../Storage/Systems/StorageSystem.cs | 138 +++---- .../Guidebook/GuidebookUIController.cs | 21 + .../Systems/Hotbar/HotbarUIController.cs | 3 +- .../Systems/Hotbar/Widgets/HotbarGui.xaml | 5 +- .../Systems/Hotbar/Widgets/HotbarGui.xaml.cs | 2 +- .../Systems/Storage/Controls/ItemGridPiece.cs | 7 +- .../{StorageContainer.cs => StorageWindow.cs} | 324 ++++++++++++---- .../Systems/Storage/StorageUIController.cs | 364 +++++++++--------- Content.Client/Viewport/ScalingViewport.cs | 4 +- .../Components/StationStockMarketComponent.cs | 21 +- .../Cargo/Systems/StockMarketSystem.cs | 164 ++++---- .../Cartridges/StockTradingCartridgeSystem.cs | 14 +- Content.Shared/Body/Organ/OrganComponent.cs | 8 +- Content.Shared/Body/Part/BodyPartComponent.cs | 14 +- Content.Shared/CCVar/CCVars.Interactions.cs | 19 + .../Cartridges/StockTradingUiMessageEvent.cs | 4 +- .../Cartridges/StockTradingUiState.cs | 8 +- .../EntitySystems/SharedStorageSystem.cs | 255 ++++++++---- Content.Shared/Storage/StorageComponent.cs | 23 +- .../Steps/SurgeryAddMarkingStepComponent.cs | 2 +- .../SurgeryRemoveMarkingStepComponent.cs | 3 +- .../Entities/Structures/Machines/lathe.yml | 54 +-- Resources/Prototypes/Guidebook/rules.yml | 4 +- Resources/Prototypes/Guidebook/security.yml | 1 + Resources/Prototypes/Guidebook/ss14.yml | 1 - .../Entities/Clothing/Belt/belts.yml | 2 - .../Entities/Structures/Machines/lathe.yml | 46 +++ RobustToolbox | 2 +- 34 files changed, 982 insertions(+), 637 deletions(-) rename Content.Client/UserInterface/Systems/Storage/Controls/{StorageContainer.cs => StorageWindow.cs} (64%) create mode 100644 Resources/Prototypes/_Shitmed/Entities/Structures/Machines/lathe.yml diff --git a/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUi.cs b/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUi.cs index 45704ee234..7468d96b7a 100644 --- a/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUi.cs +++ b/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUi.cs @@ -36,7 +36,7 @@ public sealed partial class StockTradingUi : UIFragment } } - private static void SendStockTradingUiMessage(StockTradingUiAction action, int company, float amount, BoundUserInterface userInterface) + private static void SendStockTradingUiMessage(StockTradingUiAction action, int company, int amount, BoundUserInterface userInterface) { var newsMessage = new StockTradingUiMessageEvent(action, company, amount); var message = new CartridgeUiMessage(newsMessage); diff --git a/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs b/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs index b44e8f44c7..7aaed6e49d 100644 --- a/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs +++ b/Content.Client/DeltaV/CartridgeLoader/Cartridges/StockTradingUiFragment.xaml.cs @@ -14,8 +14,8 @@ public sealed partial class StockTradingUiFragment : BoxContainer private readonly Dictionary _companyEntries = new(); // Event handlers for the parent UI - public event Action? OnBuyButtonPressed; - public event Action? OnSellButtonPressed; + public event Action? OnBuyButtonPressed; + public event Action? OnSellButtonPressed; // Define colors public static readonly Color PositiveColor = Color.FromHex("#00ff00"); // Green @@ -70,8 +70,8 @@ public sealed partial class StockTradingUiFragment : BoxContainer public CompanyEntry(int companyIndex, string displayName, - Action? onBuyPressed, - Action? onSellPressed) + Action? onBuyPressed, + Action? onSellPressed) { Container = new BoxContainer { @@ -216,13 +216,13 @@ public sealed partial class StockTradingUiFragment : BoxContainer // Button click events _buyButton.OnPressed += _ => { - if (float.TryParse(_amountEdit.Text, out var amount) && amount > 0) + if (int.TryParse(_amountEdit.Text, out var amount) && amount > 0) onBuyPressed?.Invoke(companyIndex, amount); }; _sellButton.OnPressed += _ => { - if (float.TryParse(_amountEdit.Text, out var amount) && amount > 0) + if (int.TryParse(_amountEdit.Text, out var amount) && amount > 0) onSellPressed?.Invoke(companyIndex, amount); }; @@ -235,7 +235,7 @@ public sealed partial class StockTradingUiFragment : BoxContainer }; } - public void Update(StockCompanyStruct company, int ownedStocks) + public void Update(StockCompany company, int ownedStocks) { _nameLabel.Text = company.LocalizedDisplayName; _priceLabel.Text = $"${company.CurrentPrice:F2}"; diff --git a/Content.Client/Guidebook/Controls/GuidebookWindow.xaml b/Content.Client/Guidebook/Controls/GuidebookWindow.xaml index cc6cc6e82b..b52eacfa72 100644 --- a/Content.Client/Guidebook/Controls/GuidebookWindow.xaml +++ b/Content.Client/Guidebook/Controls/GuidebookWindow.xaml @@ -2,7 +2,7 @@ xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" xmlns:fancyTree="clr-namespace:Content.Client.UserInterface.Controls.FancyTree" xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" - SetSize="750 700" + SetSize="850 700" MinSize="100 200" Resizable="True" Title="{Loc 'guidebook-window-title'}"> @@ -21,9 +21,13 @@ Margin="0 5 10 5"> + +