From d0a52674dcba1d20b3a5923327980cceaa0b2618 Mon Sep 17 00:00:00 2001 From: Peptide90 Date: Thu, 22 Feb 2024 09:21:58 +0000 Subject: [PATCH 01/11] Update default development cvars Enable shipyard (cherry picked from commit 240e84588b2f7edced6c9b155a1a7518b5d63c8b) --- Resources/ConfigPresets/Build/development.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Resources/ConfigPresets/Build/development.toml b/Resources/ConfigPresets/Build/development.toml index da3a41302627..f29618c2c836 100644 --- a/Resources/ConfigPresets/Build/development.toml +++ b/Resources/ConfigPresets/Build/development.toml @@ -5,9 +5,6 @@ lobbyenabled = false map = "Dev" role_timers = false -[gateway] -generator_enabled = false - [physics] # Makes mapping annoying grid_splitting = false @@ -23,6 +20,7 @@ grid_fill = false auto_call_time = 0 emergency = false arrivals = false +shipyard = true [admin] see_own_notes = true From d82246f9efa89ae38a061ece52e6a2f86c54466c Mon Sep 17 00:00:00 2001 From: Peptide90 Date: Thu, 22 Feb 2024 09:22:45 +0000 Subject: [PATCH 02/11] Shipyard Changes (#422) * Shipyard show sell price * Sell Price * Update ShipyardSystem.Consoles.cs * FTL (cherry picked from commit 8d5169f99f86e2ddfb645100a9e46458149984dd) --- .../BUI/ShipyardConsoleBoundUserInterface.cs | 92 +++++ .../Shipyard/UI/ShipyardConsoleMenu.xaml | 39 ++ .../Shipyard/UI/ShipyardConsoleMenu.xaml.cs | 152 +++++++ .../Systems/ShipyardSystem.Consoles.cs | 391 ++++++++++++++++++ .../BUI/ShipyardConsoleInterfaceState.cs | 30 ++ .../_NF/cargo/cargo-console-component.ftl | 3 + 6 files changed, 707 insertions(+) create mode 100644 Content.Client/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs create mode 100644 Content.Client/Shipyard/UI/ShipyardConsoleMenu.xaml create mode 100644 Content.Client/Shipyard/UI/ShipyardConsoleMenu.xaml.cs create mode 100644 Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs create mode 100644 Content.Shared/Shipyard/BUI/ShipyardConsoleInterfaceState.cs create mode 100644 Resources/Locale/en-US/_NF/cargo/cargo-console-component.ftl diff --git a/Content.Client/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs b/Content.Client/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs new file mode 100644 index 000000000000..b81ae55694fa --- /dev/null +++ b/Content.Client/Shipyard/BUI/ShipyardConsoleBoundUserInterface.cs @@ -0,0 +1,92 @@ +using Content.Client.Shipyard.UI; +using Content.Shared.Containers.ItemSlots; +using Content.Shared.Shipyard; +using Content.Shared.Shipyard.BUI; +using Content.Shared.Shipyard.Events; +using Robust.Client.GameObjects; +using Robust.Shared.Utility; +using static Robust.Client.UserInterface.Controls.BaseButton; + +namespace Content.Client.Shipyard.BUI; + +public sealed class ShipyardConsoleBoundUserInterface : BoundUserInterface +{ + private ShipyardConsoleMenu? _menu; + private ShipyardRulesPopup? _rulesWindow; + public int Balance { get; private set; } + + public int? ShipSellValue { get; private set; } + + public ShipyardConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + _menu = new ShipyardConsoleMenu(this); + var rules = new FormattedMessage(); + _rulesWindow = new ShipyardRulesPopup(this); + _menu.OpenCentered(); + if (ShipyardConsoleUiKey.Security == (ShipyardConsoleUiKey) UiKey) + { + rules.AddText(Loc.GetString($"shipyard-rules-default1")); + rules.PushNewline(); + rules.AddText(Loc.GetString($"shipyard-rules-default2")); + _rulesWindow.ShipRules.SetMessage(rules); + _rulesWindow.OpenCentered(); + } + _menu.OnClose += Close; + _menu.OnOrderApproved += ApproveOrder; + _menu.OnSellShip += SellShip; + _menu.TargetIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent("ShipyardConsole-targetId")); + } + + private void Populate(byte uiKey) + { + if (_menu == null) + return; + + _menu.PopulateProducts((ShipyardConsoleUiKey) uiKey); + _menu.PopulateCategories(); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (state is not ShipyardConsoleInterfaceState cState) + return; + + Balance = cState.Balance; + ShipSellValue = cState.ShipSellValue; + var castState = (ShipyardConsoleInterfaceState) state; + Populate(castState.UiKey); + _menu?.UpdateState(castState); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (!disposing) return; + + _menu?.Dispose(); + } + + private void ApproveOrder(ButtonEventArgs args) + { + if (args.Button.Parent?.Parent is not VesselRow row || row.Vessel == null) + { + return; + } + + var vesselId = row.Vessel.ID; + SendMessage(new ShipyardConsolePurchaseMessage(vesselId)); + } + private void SellShip(ButtonEventArgs args) + { + //reserved for a sanity check, but im not sure what since we check all the important stuffs on server already + SendMessage(new ShipyardConsoleSellMessage()); + } +} \ No newline at end of file diff --git a/Content.Client/Shipyard/UI/ShipyardConsoleMenu.xaml b/Content.Client/Shipyard/UI/ShipyardConsoleMenu.xaml new file mode 100644 index 000000000000..16dad360d4f4 --- /dev/null +++ b/Content.Client/Shipyard/UI/ShipyardConsoleMenu.xaml @@ -0,0 +1,39 @@ + + +