Files
tbd-station-14/Content.Shared/Cargo/CargoOrderData.cs
Fildrance 6380a9adca feat: now when research is unlocked in console, approver of reasearch is radio-ed too (#31170)
* feat: now when research is unlocked in console, approver of reasearch is radio-ed too

* refactor: now most of events that require actor name to be radio-ed or logged use TryGetIdentityShortInfoEvent which is subscibed by id-card system and borg system (to work for both carbon and synthetic life-forms)

* refactor: moved TryGetIdentityShortInfoEvent on id card system to shared, fixed cargo cent-com-originated orders

* remove unused check

* refactor: decoupled systems from IdCardSystem (those that are not dependent on it anymore)

* refactor: removed unuseed usings

* feat: emagged cargo/research consoles wont radio messages on buy/research confirm anymore

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
2024-09-03 23:01:38 +10:00

86 lines
2.5 KiB
C#

using Robust.Shared.Serialization;
using System.Text;
namespace Content.Shared.Cargo
{
[DataDefinition, NetSerializable, Serializable]
public sealed partial class CargoOrderData
{
/// <summary>
/// Price when the order was added.
/// </summary>
[DataField]
public int Price;
/// <summary>
/// A unique (arbitrary) ID which identifies this order.
/// </summary>
[DataField]
public int OrderId { get; private set; }
/// <summary>
/// Prototype Id for the item to be created
/// </summary>
[DataField]
public string ProductId { get; private set; }
/// <summary>
/// Prototype Name
/// </summary>
[DataField]
public string ProductName { get; private set; }
/// <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.
/// </summary>
[DataField]
public int OrderQuantity;
/// <summary>
/// How many instances of this order that we've already dispatched
/// </summary>
[DataField]
public int NumDispatched = 0;
[DataField]
public string Requester { get; private set; }
// public String RequesterRank; // TODO Figure out how to get Character ID card data
// public int RequesterId;
[DataField]
public string Reason { get; private set; }
public bool Approved;
[DataField]
public string? Approver;
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;
Reason = reason;
}
public void SetApproverData(string? approver)
{
Approver = approver;
}
public void SetApproverData(string? fullName, string? jobTitle)
{
var sb = new StringBuilder();
if (!string.IsNullOrWhiteSpace(fullName))
{
sb.Append($"{fullName} ");
}
if (!string.IsNullOrWhiteSpace(jobTitle))
{
sb.Append($"({jobTitle})");
}
Approver = sb.ToString();
}
}
}