Files
Delta-v/Content.Shared/Cargo/CargoOrderData.cs
T
a667530e18 Single item cargo orders are delivered in Parcel Wrap instead of crates (#40834)
* - rework a bunch of cargo orders to not send a crate with just one thing
  - instead sends the item, wrapped
- add ability for cargo orders to wrap the item ordered in parcel wrap
- cargo order name and descriptions are now localization strings, but still 99.99% of the time just get that info from the entity they're spawning
- small refactor to how cargo orders move around in cargo code so that the actual order proto is kept around longer
- small rework to certain restock cargo orders to halve the cost and number of items received in one order

* oop

* Suffering

* Arbitrary containers for cargo products

* I ran the tests locally and they passed, github please rerun :)

* massage Slarti's work into this.
Mainly by taking the API wrapping ability out back with the rifle q-q

* testfail fake

* wow `_applyingState` is useful, I wonder where I should've been using that in other PRs before :^)

* pr comments

* tfw the hook doesn't update the submodule

* Update Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs

Co-authored-by: āda <ss.adasts@gmail.com>

* PR comments

* fixies

* Update Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs

* Update Content.Shared/ParcelWrap/Systems/ParcelWrappingSystem.WrappedParcel.cs

* fix wrapped parcel entity name + audio

* Actually read PR comments

* Apply suggestions from code review

Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>

---------

Co-authored-by: āda <ss.adasts@gmail.com>
Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
2026-06-29 12:44:06 +02:00

81 lines
2.4 KiB
C#

using Content.Shared.Cargo.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using System.Text;
namespace Content.Shared.Cargo
{
[DataDefinition, NetSerializable, Serializable]
public sealed partial class CargoOrderData
{
/// <summary>
/// A unique (arbitrary) ID which identifies this order.
/// </summary>
[DataField]
public int OrderId { get; private set; }
/// <summary>
/// The ID of the cargo product ordered.
/// </summary>
[DataField]
public ProtoId<CargoProductPrototype> Product;
/// <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;
/// <summary>
/// Which account to deduct funds from when ordering
/// </summary>
[DataField]
public ProtoId<CargoAccountPrototype> Account;
public CargoOrderData(int orderId, ProtoId<CargoProductPrototype> product, int amount, string requester, string reason, ProtoId<CargoAccountPrototype> account)
{
OrderId = orderId;
Product = product;
OrderQuantity = amount;
Requester = requester;
Reason = reason;
Account = account;
}
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();
}
}
}