]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
cargo console radio messages on approving (#27038)
authoricekot8 <93311212+icekot8@users.noreply.github.com>
Thu, 18 Apr 2024 00:32:21 +0000 (03:32 +0300)
committerGitHub <noreply@github.com>
Thu, 18 Apr 2024 00:32:21 +0000 (17:32 -0700)
* 1

* void --> "Unknown"

Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs
Content.Server/Cargo/Systems/CargoSystem.cs
Content.Server/StationEvents/Events/CargoGiftsRule.cs
Content.Shared/Cargo/CargoOrderData.cs
Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs
Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs
Resources/Locale/en-US/cargo/cargo-console-component.ftl
Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml

index 9ce414adc32b44bcc733fcc754931aeca8762c66..7a81e1a4241f1399cb5a990c2fee22dbaef06584 100644 (file)
@@ -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<EntityPrototype>(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);
index 3bcd6d8d2067cfd644c15e3031112cf86543803f..aa2614cdb865c233dee109b655af19ea0932a3cf 100644 (file)
@@ -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
index badad9e57b4b55bdfdce06599b8e1f1c8b382b2a..a93a7bdcc225b723fa07c5c148a54ce5b8777ff9 100644 (file)
@@ -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<TransformComponent> _xformQuery;
     private EntityQuery<CargoSellBlacklistComponent> _blacklistQuery;
index c174cc48c09669af60ddc85f8796f4628398a994..194786fca7a254d5fff9335e742de012e61e8280 100644 (file)
@@ -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<CargoGiftsRuleComponent>
             if (!_cargoSystem.AddAndApproveOrder(
                     station!.Value,
                     product.Product,
+                    product.Name,
                     product.Cost,
                     qty,
                     Loc.GetString(component.Sender),
index a6d5fb0a18a5f47f93b1efdd7cbe15a9a9173551..831010cedd76409ca069bcef2c278edbdcabb8ca 100644 (file)
@@ -21,6 +21,11 @@ namespace Content.Shared.Cargo
         /// </summary>
         public readonly string ProductId;
 
+        /// <summary>
+        /// Prototype Name
+        /// </summary>
+        public readonly string ProductName;
+
         /// <summary>
         /// 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;
index a7d1f531754ffe8167d85d38a2be7bf2f55e64e6..873e9bb7b9da3e45e9d1bb9cd3051ce85670004b 100644 (file)
@@ -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
     /// </summary>
     [DataField, ViewVariables(VVAccess.ReadWrite)]
     public List<string> AllowedGroups = new() { "market" };
+
+    /// <summary>
+    /// Radio channel on which order approval announcements are transmitted
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public ProtoId<RadioChannelPrototype> AnnouncementChannel = "Supply";
 }
 
index 1d0ca8abdb47354987a0cfe2217b9dadd8656e9a..af2f6613d63bbccdd32cee54a67a740940056d1a 100644 (file)
@@ -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;
index b56f4730ccd641d4c717c259b755d868cb8be842..532481f4a23349e7e200793f62da74e24895fc58 100644 (file)
@@ -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 =
index 95bf2e1dd4a5688305fb94bcf356407ecacb7680..ef15f73b322d61bd92d412c1c6f57e8ff4e94f84 100644 (file)
     - map: ["computerLayerKeys"]
       state: tech_key
   - type: CargoOrderConsole
+  - type: ActiveRadio
+    channels:
+    - Supply
   - type: ActivatableUI
     key: enum.CargoConsoleUiKey.Orders
   - type: UserInterface