diff --git a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs index 9ce414adc3..7a81e1a424 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs @@ -184,6 +184,15 @@ namespace Content.Server.Cargo.Systems order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle); _audio.PlayPvs(component.ConfirmSound, uid); + var approverName = idCard.Comp?.FullName ?? Loc.GetString("access-reader-unknown-id"); + var approverJob = idCard.Comp?.JobTitle ?? Loc.GetString("access-reader-unknown-id"); + var message = Loc.GetString("cargo-console-unlock-approved-order-broadcast", + ("productName", Loc.GetString(order.ProductName)), + ("orderAmount", order.OrderQuantity), + ("approverName", approverName), + ("approverJob", approverJob), + ("cost", cost)); + _radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false); ConsolePopup(args.Session, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(tradeDestination.Value).EntityName))); // Log order approval @@ -327,7 +336,7 @@ namespace Content.Server.Cargo.Systems private static CargoOrderData GetOrderData(CargoConsoleAddOrderMessage args, CargoProductPrototype cargoProduct, int id) { - return new CargoOrderData(id, cargoProduct.Product, cargoProduct.Cost, args.Amount, args.Requester, args.Reason); + return new CargoOrderData(id, cargoProduct.Product, cargoProduct.Name, cargoProduct.Cost, args.Amount, args.Requester, args.Reason); } public static int GetOutstandingOrderCount(StationCargoOrderDatabaseComponent component) @@ -376,6 +385,7 @@ namespace Content.Server.Cargo.Systems public bool AddAndApproveOrder( EntityUid dbUid, string spawnId, + string name, int cost, int qty, string sender, @@ -388,7 +398,7 @@ namespace Content.Server.Cargo.Systems DebugTools.Assert(_protoMan.HasIndex(spawnId)); // Make an order var id = GenerateOrderId(component); - var order = new CargoOrderData(id, spawnId, cost, qty, sender, description); + var order = new CargoOrderData(id, spawnId, name, cost, qty, sender, description); // Approve it now order.SetApproverData(dest, sender); diff --git a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs index 3bcd6d8d20..aa2614cdb8 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs @@ -154,7 +154,7 @@ public sealed partial class CargoSystem // 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.Price, spaceRemaining, order.Requester, order.Reason); + order.ProductId, order.ProductName, order.Price, spaceRemaining, order.Requester, order.Reason); orders.Add(reducedOrder); } else diff --git a/Content.Server/Cargo/Systems/CargoSystem.cs b/Content.Server/Cargo/Systems/CargoSystem.cs index badad9e57b..a93a7bdcc2 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.cs @@ -8,6 +8,7 @@ using Content.Server.Stack; using Content.Server.Station.Systems; using Content.Shared.Access.Systems; using Content.Shared.Administration.Logs; +using Content.Server.Radio.EntitySystems; using Content.Shared.Cargo; using Content.Shared.Cargo.Components; using Content.Shared.Containers.ItemSlots; @@ -42,6 +43,7 @@ public sealed partial class CargoSystem : SharedCargoSystem [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly MetaDataSystem _metaSystem = default!; + [Dependency] private readonly RadioSystem _radio = default!; private EntityQuery _xformQuery; private EntityQuery _blacklistQuery; diff --git a/Content.Server/StationEvents/Events/CargoGiftsRule.cs b/Content.Server/StationEvents/Events/CargoGiftsRule.cs index c174cc48c0..194786fca7 100644 --- a/Content.Server/StationEvents/Events/CargoGiftsRule.cs +++ b/Content.Server/StationEvents/Events/CargoGiftsRule.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Content.Server.Cargo.Components; using Content.Server.Cargo.Systems; using Content.Server.GameTicking; @@ -62,6 +62,7 @@ public sealed class CargoGiftsRule : StationEventSystem if (!_cargoSystem.AddAndApproveOrder( station!.Value, product.Product, + product.Name, product.Cost, qty, Loc.GetString(component.Sender), diff --git a/Content.Shared/Cargo/CargoOrderData.cs b/Content.Shared/Cargo/CargoOrderData.cs index a6d5fb0a18..831010cedd 100644 --- a/Content.Shared/Cargo/CargoOrderData.cs +++ b/Content.Shared/Cargo/CargoOrderData.cs @@ -21,6 +21,11 @@ namespace Content.Shared.Cargo /// public readonly string ProductId; + /// + /// Prototype Name + /// + public readonly string ProductName; + /// /// The number of items in the order. Not readonly, as it might change /// due to caps on the amount of orders that can be placed. @@ -39,10 +44,11 @@ namespace Content.Shared.Cargo public bool Approved => Approver is not null; public string? Approver; - public CargoOrderData(int orderId, string productId, int price, int amount, string requester, string reason) + public CargoOrderData(int orderId, string productId, string productName, int price, int amount, string requester, string reason) { OrderId = orderId; ProductId = productId; + ProductName = productName; Price = price; OrderQuantity = amount; Requester = requester; diff --git a/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs b/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs index a7d1f53175..873e9bb7b9 100644 --- a/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs +++ b/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs @@ -1,6 +1,8 @@ using Content.Shared.Cargo.Prototypes; using Robust.Shared.Audio; using Robust.Shared.GameStates; +using Content.Shared.Radio; +using Robust.Shared.Prototypes; namespace Content.Shared.Cargo.Components; @@ -21,5 +23,11 @@ public sealed partial class CargoOrderConsoleComponent : Component /// [DataField, ViewVariables(VVAccess.ReadWrite)] public List AllowedGroups = new() { "market" }; + + /// + /// Radio channel on which order approval announcements are transmitted + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public ProtoId AnnouncementChannel = "Supply"; } diff --git a/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs b/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs index 1d0ca8abdb..af2f6613d6 100644 --- a/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs +++ b/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs @@ -1,4 +1,4 @@ -using Robust.Shared.Prototypes; +using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array; using Robust.Shared.Utility; diff --git a/Resources/Locale/en-US/cargo/cargo-console-component.ftl b/Resources/Locale/en-US/cargo/cargo-console-component.ftl index b56f4730cc..532481f4a2 100644 --- a/Resources/Locale/en-US/cargo/cargo-console-component.ftl +++ b/Resources/Locale/en-US/cargo/cargo-console-component.ftl @@ -30,6 +30,7 @@ cargo-console-snip-snip = Order trimmed to capacity cargo-console-insufficient-funds = Insufficient funds (require {$cost}) cargo-console-unfulfilled = No room to fulfill order cargo-console-trade-station = Sent to {$destination} +cargo-console-unlock-approved-order-broadcast = [bold]{$productName} x{$orderAmount}[/bold], which cost [bold]{$cost}[/bold], was approved by [bold]{$approverName}, {$approverJob}[/bold] cargo-console-paper-print-name = Order #{$orderNumber} cargo-console-paper-print-text = diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml index 95bf2e1dd4..ef15f73b32 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml @@ -735,6 +735,9 @@ - map: ["computerLayerKeys"] state: tech_key - type: CargoOrderConsole + - type: ActiveRadio + channels: + - Supply - type: ActivatableUI key: enum.CargoConsoleUiKey.Orders - type: UserInterface