Files
ss14-wl/Content.Client/Cargo/UI/CargoShuttleMenu.xaml.cs
T
Centronias 38f7800370 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-03-15 13:45:46 +00:00

70 lines
2.4 KiB
C#

using Content.Client.UserInterface.Controls;
using Content.Shared.Cargo;
using Content.Shared.Cargo.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Client.Cargo.UI
{
[GenerateTypedNameReferences]
public sealed partial class CargoShuttleMenu : FancyWindow
{
public CargoShuttleMenu()
{
RobustXamlLoader.Load(this);
Title = Loc.GetString("cargo-shuttle-console-menu-title");
}
public void SetAccountName(string name)
{
AccountNameLabel.Text = name;
}
public void SetShuttleName(string name)
{
ShuttleNameLabel.Text = name;
}
public void SetOrders(SpriteSystem sprites, IPrototypeManager protoManager, List<CargoOrderData> orders)
{
Orders.RemoveAllChildren();
foreach (var order in orders)
{
if (!protoManager.Resolve(order.Product, out var productProto))
continue;
var product = protoManager.Index<EntityPrototype>(productProto.Product);
var productName = product.Name;
var account = protoManager.Index(order.Account);
var row = new CargoOrderRow
{
Order = order,
Icon = { Texture = sprites.Frame0(product) },
ProductName =
{
Text = Loc.GetString(
"cargo-console-menu-populate-orders-cargo-order-row-product-name-text",
("productName", productName),
("orderAmount", order.OrderQuantity - order.NumDispatched),
("orderRequester", order.Requester),
("accountColor", account.Color),
("account", Loc.GetString(account.Code)))
},
Description = {Text = Loc.GetString("cargo-console-menu-order-reason-description",
("reason", order.Reason))}
};
row.Approve.Visible = false;
row.Cancel.Visible = false;
Orders.AddChild(row);
}
}
}
}