Fix cargo order amounts (#12070)
This commit is contained in:
@@ -424,21 +424,22 @@ public sealed partial class CargoSystem
|
|||||||
var pads = GetCargoPallets(component);
|
var pads = GetCargoPallets(component);
|
||||||
DebugTools.Assert(orders.Sum(o => o.Amount) <= pads.Count);
|
DebugTools.Assert(orders.Sum(o => o.Amount) <= pads.Count);
|
||||||
|
|
||||||
for (var i = 0; i < orders.Count; i++)
|
for (var i = 0; i < pads.Count; i++)
|
||||||
{
|
{
|
||||||
var order = orders[i];
|
if (orders.Count == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
var order = orders[0];
|
||||||
var coordinates = new EntityCoordinates(component.Owner, xformQuery.GetComponent(_random.PickAndTake(pads).Owner).LocalPosition);
|
var coordinates = new EntityCoordinates(component.Owner, xformQuery.GetComponent(_random.PickAndTake(pads).Owner).LocalPosition);
|
||||||
|
|
||||||
var item = Spawn(_protoMan.Index<CargoProductPrototype>(order.ProductId).Product, coordinates);
|
var item = Spawn(_protoMan.Index<CargoProductPrototype>(order.ProductId).Product, coordinates);
|
||||||
SpawnAndAttachOrderManifest(item, order, coordinates, component);
|
SpawnAndAttachOrderManifest(item, order, coordinates, component);
|
||||||
order.Amount--;
|
order.Amount--;
|
||||||
|
|
||||||
if (order.Amount == 0)
|
if (order.Amount == 0)
|
||||||
{
|
{
|
||||||
orders.RemoveSwap(i);
|
// Yes this is functioning as a stack, I was too lazy to re-jig the shuttle state event.
|
||||||
|
orders.RemoveSwap(0);
|
||||||
orderDatabase.Orders.Remove(order.OrderNumber);
|
orderDatabase.Orders.Remove(order.OrderNumber);
|
||||||
i--;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user