Cargo: pizza & bureaucracy (#5123)

* add paper label component

* git mv

* rename namespace

* add cargo printouts

* more crates

* directly attach paper

* comment typo
This commit is contained in:
Leon Friedrich
2021-11-11 02:15:23 +13:00
committed by GitHub
parent b8d8f48b11
commit 88df3d8b10
33 changed files with 384 additions and 162 deletions

View File

@@ -135,6 +135,10 @@ namespace Content.Server.Cargo.Components
break;
}
var uid = msg.Session.AttachedEntityUid;
if (uid == null)
break;
PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype? product);
if (product == null!)
break;
@@ -143,13 +147,14 @@ namespace Content.Server.Cargo.Components
(capacity.CurrentCapacity == capacity.MaxCapacity
|| capacity.CurrentCapacity + order.Amount > capacity.MaxCapacity
|| !_cargoConsoleSystem.CheckBalance(_bankAccount.Id, (-product.PointCost) * order.Amount)
|| !_cargoConsoleSystem.ApproveOrder(orders.Database.Id, msg.OrderNumber)
|| !_cargoConsoleSystem.ApproveOrder(Owner.Uid, uid.Value, orders.Database.Id, msg.OrderNumber)
|| !_cargoConsoleSystem.ChangeBalance(_bankAccount.Id, (-product.PointCost) * order.Amount))
)
{
SoundSystem.Play(Filter.Local(), _errorSound.GetSound(), Owner, AudioParams.Default);
break;
}
UpdateUIState();
break;
}
@@ -189,12 +194,7 @@ namespace Content.Server.Cargo.Components
orders.Database.ClearOrderCapacity();
foreach (var order in approvedOrders)
{
if (!PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype? product))
continue;
for (var i = 0; i < order.Amount; i++)
{
telepadComponent.QueueTeleport(product);
}
telepadComponent.QueueTeleport(order);
}
}
}