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
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)
public bool AddAndApproveOrder(
EntityUid dbUid,
string spawnId,
+ string name,
int cost,
int qty,
string sender,
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);
// 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
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;
[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;
-using System.Linq;
+using System.Linq;
using Content.Server.Cargo.Components;
using Content.Server.Cargo.Systems;
using Content.Server.GameTicking;
if (!_cargoSystem.AddAndApproveOrder(
station!.Value,
product.Product,
+ product.Name,
product.Cost,
qty,
Loc.GetString(component.Sender),
/// </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.
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;
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;
/// </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";
}
-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;
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 =
- map: ["computerLayerKeys"]
state: tech_key
- type: CargoOrderConsole
+ - type: ActiveRadio
+ channels:
+ - Supply
- type: ActivatableUI
key: enum.CargoConsoleUiKey.Orders
- type: UserInterface