From 497f43ec651da4f730046d0712355d595e106190 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sat, 26 Apr 2025 22:06:45 -0400 Subject: [PATCH] Remove legacy cargo shuttle code/prototypes (#36967) --- .../CargoShuttleConsoleComponent.cs | 10 -- .../Cargo/Systems/CargoSystem.Orders.cs | 10 -- .../Cargo/Systems/CargoSystem.Shuttle.cs | 105 ------------------ .../Catalog/Fills/Lockers/heads.yml | 1 - .../Devices/Circuitboards/computer.yml | 11 -- .../Machines/Computers/computers.yml | 39 ------- .../ServerInfo/Guidebook/Cargo/Cargo.xml | 2 +- .../Guidebook/Engineering/VoltageNetworks.xml | 2 +- Resources/migration.yml | 4 + 9 files changed, 6 insertions(+), 178 deletions(-) delete mode 100644 Content.Server/Cargo/Components/CargoShuttleConsoleComponent.cs diff --git a/Content.Server/Cargo/Components/CargoShuttleConsoleComponent.cs b/Content.Server/Cargo/Components/CargoShuttleConsoleComponent.cs deleted file mode 100644 index 2f6172601a..0000000000 --- a/Content.Server/Cargo/Components/CargoShuttleConsoleComponent.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Robust.Shared.Audio; - -namespace Content.Server.Cargo.Components; - -[RegisterComponent] -public sealed partial class CargoShuttleConsoleComponent : Component -{ - [ViewVariables(VVAccess.ReadWrite), DataField("soundDeny")] - public SoundSpecifier DenySound = new SoundPathSpecifier("/Audio/Effects/Cargo/buzz_two.ogg"); -} diff --git a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs index f89f1b0e8f..fe37f56e02 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs @@ -378,16 +378,6 @@ namespace Content.Server.Cargo.Systems UpdateOrderState(uid, station); } - - var consoleQuery = AllEntityQuery(); - while (consoleQuery.MoveNext(out var uid, out var _)) - { - var station = _station.GetOwningStation(uid); - if (station != dbUid) - continue; - - UpdateShuttleState(uid, station); - } } public bool AddAndApproveOrder( diff --git a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs index 2516965b6d..4fc2c08813 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs @@ -6,7 +6,6 @@ using Content.Shared.Cargo.Components; using Content.Shared.Cargo.Events; using Content.Shared.Cargo.Prototypes; using Content.Shared.CCVar; -using JetBrains.Annotations; using Robust.Shared.Audio; using Robust.Shared.Prototypes; @@ -25,8 +24,6 @@ public sealed partial class CargoSystem { SubscribeLocalEvent(OnTradeSplit); - SubscribeLocalEvent(OnCargoShuttleConsoleStartup); - SubscribeLocalEvent(OnPalletSale); SubscribeLocalEvent(OnPalletAppraise); SubscribeLocalEvent(OnPalletUIOpen); @@ -35,26 +32,6 @@ public sealed partial class CargoSystem } #region Console - - [PublicAPI] - private void UpdateCargoShuttleConsoles(EntityUid shuttleUid, CargoShuttleComponent _) - { - // Update pilot consoles that are already open. - _console.RefreshDroneConsoles(); - - // Update order consoles. - var shuttleConsoleQuery = AllEntityQuery(); - - while (shuttleConsoleQuery.MoveNext(out var uid, out var _)) - { - var stationUid = _station.GetOwningStation(uid); - if (stationUid != shuttleUid) - continue; - - UpdateShuttleState(uid, stationUid); - } - } - private void UpdatePalletConsoleInterface(EntityUid uid) { if (Transform(uid).GridUid is not { } gridUid) @@ -89,32 +66,6 @@ public sealed partial class CargoSystem UpdatePalletConsoleInterface(uid); } - private void OnCargoShuttleConsoleStartup(EntityUid uid, CargoShuttleConsoleComponent component, ComponentStartup args) - { - var station = _station.GetOwningStation(uid); - UpdateShuttleState(uid, station); - } - - private void UpdateShuttleState(EntityUid uid, EntityUid? station = null) - { - TryComp(station, out var orderDatabase); - TryComp(orderDatabase?.Shuttle, out var shuttle); - - var orders = GetProjectedOrders(station ?? EntityUid.Invalid, orderDatabase, shuttle); - var shuttleName = orderDatabase?.Shuttle != null ? MetaData(orderDatabase.Shuttle.Value).EntityName : string.Empty; - - if (_uiSystem.HasUi(uid, CargoConsoleUiKey.Shuttle)) - { - _uiSystem.SetUiState(uid, - CargoConsoleUiKey.Shuttle, - new CargoShuttleConsoleBoundUserInterfaceState( - station != null ? MetaData(station.Value).EntityName : Loc.GetString("cargo-shuttle-console-station-unknown"), - string.IsNullOrEmpty(shuttleName) ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") : shuttleName, - orders - )); - } - } - #endregion private void OnTradeSplit(EntityUid uid, TradeStationComponent component, ref GridSplitEvent args) @@ -127,62 +78,6 @@ public sealed partial class CargoSystem } #region Shuttle - - /// - /// Returns the orders that can fit on the cargo shuttle. - /// - private List GetProjectedOrders( - EntityUid shuttleUid, - StationCargoOrderDatabaseComponent? component = null, - CargoShuttleComponent? shuttle = null) - { - var orders = new List(); - - if (component == null || shuttle == null || component.Orders.Count == 0) - return orders; - - var spaceRemaining = GetCargoSpace(shuttleUid); - var allOrders = component.AllOrders.ToList(); - for (var i = 0; i < allOrders.Count && spaceRemaining > 0; i++) - { - var order = allOrders[i]; - if (order.Approved) - { - var numToShip = order.OrderQuantity - order.NumDispatched; - if (numToShip > spaceRemaining) - { - // We won't be able to fit the whole order on, so make one - // which represents the space we do have left: - var reducedOrder = new CargoOrderData( - order.OrderId, - order.ProductId, - order.ProductName, - order.Price, - spaceRemaining, - order.Requester, - order.Reason); - orders.Add(reducedOrder); - } - else - { - orders.Add(order); - } - spaceRemaining -= numToShip; - } - } - - return orders; - } - - /// - /// Get the amount of space the cargo shuttle can fit for orders. - /// - private int GetCargoSpace(EntityUid gridUid) - { - var space = GetCargoPallets(gridUid, BuySellType.Buy).Count; - return space; - } - /// GetCargoPallets(gridUid, BuySellType.Sell) to return only Sell pads /// GetCargoPallets(gridUid, BuySellType.Buy) to return only Buy pads private List<(EntityUid Entity, CargoPalletComponent Component, TransformComponent PalletXform)> GetCargoPallets(EntityUid gridUid, BuySellType requestType = BuySellType.All) diff --git a/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml b/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml index bf49e30923..6770680b63 100644 --- a/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml +++ b/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml @@ -7,7 +7,6 @@ - id: CargoBountyComputerCircuitboard - id: CargoRequestComputerCircuitboard - id: CargoSaleComputerCircuitboard - - id: CargoShuttleComputerCircuitboard - id: CargoShuttleConsoleCircuitboard - id: SalvageMagnetMachineCircuitboard - id: CigPackGreen diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml index 89cf314e95..6af8b9639e 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml @@ -198,17 +198,6 @@ prototype: ComputerCargoBounty - type: StaticPrice -- type: entity - parent: BaseComputerCircuitboard - id: CargoShuttleComputerCircuitboard - name: cargo shuttle computer board - description: A computer printed circuit board for a cargo shuttle computer. - components: - - type: Sprite - state: cpu_supply - - type: ComputerBoard - prototype: ComputerCargoShuttle - - type: entity parent: BaseComputerCircuitboard id: SalvageExpeditionsComputerCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml index 93125455bc..a05c88aadb 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml @@ -854,45 +854,6 @@ energy: 1.6 color: "#e6e227" -- type: entity - id: ComputerCargoShuttle - parent: BaseComputerAiAccess - name: cargo shuttle computer - description: Used to order the shuttle. - components: - - type: Sprite - layers: - - map: ["computerLayerBody"] - state: computer - - map: ["computerLayerKeyboard"] - state: generic_keyboard - - map: ["computerLayerScreen"] - state: supply - - map: ["computerLayerKeys"] - state: tech_key - - map: [ "enum.WiresVisualLayers.MaintenancePanel" ] - state: generic_panel_open - - type: CargoShuttleConsole - - type: ActivatableUI - key: enum.CargoConsoleUiKey.Shuttle - - type: UserInterface - interfaces: - enum.CargoConsoleUiKey.Shuttle: - type: CargoShuttleConsoleBoundUserInterface - enum.WiresUiKey.Key: - type: WiresBoundUserInterface - - type: Computer - board: CargoShuttleComputerCircuitboard - - type: PointLight - radius: 1.5 - energy: 1.6 - color: "#b89f25" - - type: AccessReader - access: [["Cargo"]] - - type: GuideHelp - guides: - - Cargo - - type: entity id: ComputerCargoOrders parent: BaseComputerAiAccess diff --git a/Resources/ServerInfo/Guidebook/Cargo/Cargo.xml b/Resources/ServerInfo/Guidebook/Cargo/Cargo.xml index 526dd35ffe..c4147f5e47 100644 --- a/Resources/ServerInfo/Guidebook/Cargo/Cargo.xml +++ b/Resources/ServerInfo/Guidebook/Cargo/Cargo.xml @@ -73,7 +73,7 @@ Orders are delivered to the station via the orbiting [color=cyan]Trade Station[/color] and are transported to the main station by the [color=cyan]Cargo Shuttle[color]. The shuttle does not fly itself, so it must either be piloted in the shuttle or remotely. - + To fly the shuttle, you must first find the [color=cyan]Cargo Shuttle Console[/color]. One is inside the Cargo Bay, and the other is inside the Cargo Shuttle. diff --git a/Resources/ServerInfo/Guidebook/Engineering/VoltageNetworks.xml b/Resources/ServerInfo/Guidebook/Engineering/VoltageNetworks.xml index 9d7ed30096..3f635715ce 100644 --- a/Resources/ServerInfo/Guidebook/Engineering/VoltageNetworks.xml +++ b/Resources/ServerInfo/Guidebook/Engineering/VoltageNetworks.xml @@ -16,7 +16,7 @@ - + diff --git a/Resources/migration.yml b/Resources/migration.yml index 742429bbec..667a6c090b 100644 --- a/Resources/migration.yml +++ b/Resources/migration.yml @@ -610,3 +610,7 @@ MediumXenoArtifact: ComplexXenoArtifact SimpleXenoArtifactItem: ComplexXenoArtifactItem MediumXenoArtifactItem: ComplexXenoArtifactItem VariedXenoArtifactItem: ComplexXenoArtifactItem + +# 2025-04-26 +ComputerCargoShuttle: ComputerShuttleCargo +CargoShuttleComputerCircuitboard: CargoShuttleConsoleCircuitboard -- 2.51.2