Made ordering multiple crates at cargo order multiple crates (#25518)

* please tell me this is empty

* it wasn't empty, fixing that

* This should fix it

* fix for the fix

* address changes

* fix

* Added some comments, hoping that failed test was a fluke.
This commit is contained in:
Flesh
2024-02-25 08:36:22 +01:00
committed by GitHub
parent 9a4c10cc89
commit aa4e7c0619
2 changed files with 17 additions and 9 deletions

View File

@@ -209,15 +209,19 @@ namespace Content.Server.Cargo.Systems
_random.Shuffle(tradePads);
var freePads = GetFreeCargoPallets(trade, tradePads);
foreach (var pad in freePads)
if (freePads.Count >= order.OrderQuantity) //check if the station has enough free pallets
{
var coordinates = new EntityCoordinates(trade, pad.Transform.LocalPosition);
if (FulfillOrder(order, coordinates, orderDatabase.PrinterOutput))
foreach (var pad in freePads)
{
tradeDestination = trade;
break;
var coordinates = new EntityCoordinates(trade, pad.Transform.LocalPosition);
if (FulfillOrder(order, coordinates, orderDatabase.PrinterOutput))
{
tradeDestination = trade;
order.NumDispatched++;
if (order.OrderQuantity <= order.NumDispatched) //Spawn a crate on free pellets until the order is fulfilled.
break;
}
}
}