Fix Issue #4056 - Prevent cargo order quantities larger than the maximum (#4057)

* Fix merge conflicts with #4078
Check if the requested cargo order amount exceeds the maximum capacity
Check if the maximum order capacity would be exceeded given current capcity and order amount when approved
Cap maximum cargo request amount on client-side
Play an error sound if a cargo order could not be added or approved

* Add back error sound

* Cargo orders over the maximum amount do not close the order UI
This commit is contained in:
R. Neuser
2021-05-31 23:45:28 -05:00
committed by GitHub
parent ae4534a29a
commit db4213b21a
3 changed files with 37 additions and 15 deletions

View File

@@ -151,8 +151,11 @@ namespace Content.Server.GameObjects.EntitySystems
public bool AddOrder(int id, string requester, string reason, string productId, int amount, int payingAccountId)
{
if (amount < 1 || !TryGetOrderDatabase(id, out var database))
if (amount < 1 || !TryGetOrderDatabase(id, out var database) || amount > database.MaxOrderSize)
{
return false;
}
database.AddOrder(requester, reason, productId, amount, payingAccountId);
SyncComponentsWithId(id);
return true;