* 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:
@@ -1,4 +1,5 @@
|
||||
using Content.Client.UserInterface.Cargo;
|
||||
using System;
|
||||
using Content.Client.UserInterface.Cargo;
|
||||
using Content.Shared.GameObjects.Components.Cargo;
|
||||
using Content.Shared.Prototypes.Cargo;
|
||||
using Robust.Client.GameObjects;
|
||||
@@ -83,8 +84,10 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
_menu.OnOrderCanceled += RemoveOrder;
|
||||
_orderMenu.SubmitButton.OnPressed += (_) =>
|
||||
{
|
||||
AddOrder();
|
||||
_orderMenu.Close();
|
||||
if (AddOrder())
|
||||
{
|
||||
_orderMenu.Close();
|
||||
}
|
||||
};
|
||||
|
||||
_menu.OpenCentered();
|
||||
@@ -131,13 +134,21 @@ namespace Content.Client.GameObjects.Components.Cargo
|
||||
_orderMenu?.Dispose();
|
||||
}
|
||||
|
||||
private void AddOrder()
|
||||
private bool AddOrder()
|
||||
{
|
||||
int orderAmt = _orderMenu?.Amount.Value ?? 0;
|
||||
if (orderAmt < 1 || orderAmt > ShuttleCapacity.MaxCapacity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SendMessage(new CargoConsoleAddOrderMessage(
|
||||
_orderMenu?.Requester.Text ?? "",
|
||||
_orderMenu?.Reason.Text ?? "",
|
||||
_product?.ID ?? "",
|
||||
_orderMenu?.Amount.Value ?? 0));
|
||||
orderAmt));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void RemoveOrder(ButtonEventArgs args)
|
||||
|
||||
Reference in New Issue
Block a user