cargo console radio messages on approving (#27038)
* 1 * void --> "Unknown"
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -735,6 +735,9 @@
|
||||
- map: ["computerLayerKeys"]
|
||||
state: tech_key
|
||||
- type: CargoOrderConsole
|
||||
- type: ActiveRadio
|
||||
channels:
|
||||
- Supply
|
||||
- type: ActivatableUI
|
||||
key: enum.CargoConsoleUiKey.Orders
|
||||
- type: UserInterface
|
||||
|
||||
Reference in New Issue
Block a user