Minor changes to display of cargo order manifests (#12618)
Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
This commit is contained in:
@@ -158,7 +158,7 @@ namespace Content.Client.Cargo.BUI
|
|||||||
if (args.Button.Parent?.Parent is not CargoOrderRow row || row.Order == null)
|
if (args.Button.Parent?.Parent is not CargoOrderRow row || row.Order == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SendMessage(new CargoConsoleRemoveOrderMessage(row.Order.OrderNumber));
|
SendMessage(new CargoConsoleRemoveOrderMessage(row.Order.OrderIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApproveOrder(ButtonEventArgs args)
|
private void ApproveOrder(ButtonEventArgs args)
|
||||||
@@ -169,7 +169,7 @@ namespace Content.Client.Cargo.BUI
|
|||||||
if (OrderCount >= OrderCapacity)
|
if (OrderCount >= OrderCapacity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SendMessage(new CargoConsoleApproveOrderMessage(row.Order.OrderNumber));
|
SendMessage(new CargoConsoleApproveOrderMessage(row.Order.OrderIndex));
|
||||||
// Most of the UI isn't predicted anyway so.
|
// Most of the UI isn't predicted anyway so.
|
||||||
// _menu?.UpdateCargoCapacity(OrderCount + row.Order.Amount, OrderCapacity);
|
// _menu?.UpdateCargoCapacity(OrderCount + row.Order.Amount, OrderCapacity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No order to approve?
|
// No order to approve?
|
||||||
if (!orderDatabase.Orders.TryGetValue(args.OrderNumber, out var order) ||
|
if (!orderDatabase.Orders.TryGetValue(args.OrderIndex, out var order) ||
|
||||||
order.Approved) return;
|
order.Approved) return;
|
||||||
|
|
||||||
// Invalid order
|
// Invalid order
|
||||||
@@ -163,7 +163,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
// Log order approval
|
// Log order approval
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||||
$"{ToPrettyString(player):user} approved order [orderNum:{order.OrderNumber}, amount:{order.Amount}, product:{order.ProductId}, requester:{order.Requester}, reason:{order.Reason}] with balance at {bankAccount.Balance}");
|
$"{ToPrettyString(player):user} approved order [orderIdx:{order.OrderIndex}, amount:{order.Amount}, product:{order.ProductId}, requester:{order.Requester}, reason:{order.Reason}] with balance at {bankAccount.Balance}");
|
||||||
|
|
||||||
DeductFunds(bankAccount, cost);
|
DeductFunds(bankAccount, cost);
|
||||||
UpdateOrders(orderDatabase);
|
UpdateOrders(orderDatabase);
|
||||||
@@ -173,7 +173,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
{
|
{
|
||||||
var orderDatabase = GetOrderDatabase(component);
|
var orderDatabase = GetOrderDatabase(component);
|
||||||
if (orderDatabase == null) return;
|
if (orderDatabase == null) return;
|
||||||
RemoveOrder(orderDatabase, args.OrderNumber);
|
RemoveOrder(orderDatabase, args.OrderIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args)
|
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args)
|
||||||
@@ -199,7 +199,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
// Log order addition
|
// Log order addition
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||||
$"{ToPrettyString(player):user} added order [orderNum:{data.OrderNumber}, amount:{data.Amount}, product:{data.ProductId}, requester:{data.Requester}, reason:{data.Reason}]");
|
$"{ToPrettyString(player):user} added order [orderIdx:{data.OrderIndex}, amount:{data.Amount}, product:{data.ProductId}, requester:{data.Requester}, reason:{data.Reason}]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
public bool TryAddOrder(StationCargoOrderDatabaseComponent component, CargoOrderData data)
|
public bool TryAddOrder(StationCargoOrderDatabaseComponent component, CargoOrderData data)
|
||||||
{
|
{
|
||||||
component.Orders.Add(data.OrderNumber, data);
|
component.Orders.Add(data.OrderIndex, data);
|
||||||
UpdateOrders(component);
|
UpdateOrders(component);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ public sealed partial class CargoSystem
|
|||||||
|
|
||||||
if (cappedAmount < order.Amount)
|
if (cappedAmount < order.Amount)
|
||||||
{
|
{
|
||||||
var reducedOrder = new CargoOrderData(order.OrderNumber, order.ProductId, cappedAmount, order.Requester, order.Reason);
|
var reducedOrder = new CargoOrderData(order.OrderIndex, order.ProductId, cappedAmount, order.Requester, order.Reason);
|
||||||
|
|
||||||
orders.Add(reducedOrder);
|
orders.Add(reducedOrder);
|
||||||
break;
|
break;
|
||||||
@@ -447,11 +447,11 @@ public sealed partial class CargoSystem
|
|||||||
{
|
{
|
||||||
// Yes this is functioning as a stack, I was too lazy to re-jig the shuttle state event.
|
// Yes this is functioning as a stack, I was too lazy to re-jig the shuttle state event.
|
||||||
orders.RemoveSwap(0);
|
orders.RemoveSwap(0);
|
||||||
orderDatabase.Orders.Remove(order.OrderNumber);
|
orderDatabase.Orders.Remove(order.OrderIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
orderDatabase.Orders[order.OrderNumber] = order;
|
orderDatabase.Orders[order.OrderIndex] = order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,13 +471,13 @@ public sealed partial class CargoSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// fill in the order data
|
// fill in the order data
|
||||||
var val = Loc.GetString("cargo-console-paper-print-name", ("orderNumber", order.OrderNumber));
|
var val = Loc.GetString("cargo-console-paper-print-name", ("orderNumber", order.PrintableOrderNumber));
|
||||||
|
|
||||||
MetaData(printed).EntityName = val;
|
MetaData(printed).EntityName = val;
|
||||||
|
|
||||||
_paperSystem.SetContent(printed, Loc.GetString(
|
_paperSystem.SetContent(printed, Loc.GetString(
|
||||||
"cargo-console-paper-print-text",
|
"cargo-console-paper-print-text",
|
||||||
("orderNumber", order.OrderNumber),
|
("orderNumber", order.PrintableOrderNumber),
|
||||||
("itemName", prototype.Name),
|
("itemName", prototype.Name),
|
||||||
("requester", order.Requester),
|
("requester", order.Requester),
|
||||||
("reason", order.Reason),
|
("reason", order.Reason),
|
||||||
|
|||||||
@@ -143,13 +143,13 @@ public sealed partial class CargoSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// fill in the order data
|
// fill in the order data
|
||||||
var val = Loc.GetString("cargo-console-paper-print-name", ("orderNumber", data.OrderNumber));
|
var val = Loc.GetString("cargo-console-paper-print-name", ("orderNumber", data.PrintableOrderNumber));
|
||||||
|
|
||||||
MetaData(printed).EntityName = val;
|
MetaData(printed).EntityName = val;
|
||||||
|
|
||||||
_paperSystem.SetContent(printed, Loc.GetString(
|
_paperSystem.SetContent(printed, Loc.GetString(
|
||||||
"cargo-console-paper-print-text",
|
"cargo-console-paper-print-text",
|
||||||
("orderNumber", data.OrderNumber),
|
("orderNumber", data.PrintableOrderNumber),
|
||||||
("itemName", prototype.Name),
|
("itemName", prototype.Name),
|
||||||
("requester", data.Requester),
|
("requester", data.Requester),
|
||||||
("reason", data.Reason),
|
("reason", data.Reason),
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Content.Server.Paper
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (paperComp.Content != "")
|
if (paperComp.Content != "")
|
||||||
args.Message.AddMarkup(
|
args.PushMarkup(
|
||||||
Loc.GetString(
|
Loc.GetString(
|
||||||
"paper-component-examine-detail-has-words", ("paper", uid)
|
"paper-component-examine-detail-has-words", ("paper", uid)
|
||||||
)
|
)
|
||||||
@@ -68,9 +68,8 @@ namespace Content.Server.Paper
|
|||||||
|
|
||||||
if (paperComp.StampedBy.Count > 0)
|
if (paperComp.StampedBy.Count > 0)
|
||||||
{
|
{
|
||||||
args.Message.PushNewline();
|
|
||||||
string commaSeparated = string.Join(", ", paperComp.StampedBy);
|
string commaSeparated = string.Join(", ", paperComp.StampedBy);
|
||||||
args.Message.AddMarkup(
|
args.PushMarkup(
|
||||||
Loc.GetString(
|
Loc.GetString(
|
||||||
"paper-component-examine-detail-stamped-by", ("paper", uid), ("stamps", commaSeparated))
|
"paper-component-examine-detail-stamped-by", ("paper", uid), ("stamps", commaSeparated))
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ namespace Content.Shared.Cargo
|
|||||||
[NetSerializable, Serializable]
|
[NetSerializable, Serializable]
|
||||||
public sealed class CargoOrderData
|
public sealed class CargoOrderData
|
||||||
{
|
{
|
||||||
public int OrderNumber;
|
public int OrderIndex;
|
||||||
|
/// The human-readable number, when displaying this order
|
||||||
|
public int PrintableOrderNumber { get { return OrderIndex + 1; } }
|
||||||
public string ProductId;
|
public string ProductId;
|
||||||
public int Amount;
|
public int Amount;
|
||||||
public string Requester;
|
public string Requester;
|
||||||
@@ -16,9 +18,9 @@ namespace Content.Shared.Cargo
|
|||||||
public bool Approved => Approver is not null;
|
public bool Approved => Approver is not null;
|
||||||
public string? Approver;
|
public string? Approver;
|
||||||
|
|
||||||
public CargoOrderData(int orderNumber, string productId, int amount, string requester, string reason)
|
public CargoOrderData(int orderIndex, string productId, int amount, string requester, string reason)
|
||||||
{
|
{
|
||||||
OrderNumber = orderNumber;
|
OrderIndex = orderIndex;
|
||||||
ProductId = productId;
|
ProductId = productId;
|
||||||
Amount = amount;
|
Amount = amount;
|
||||||
Requester = requester;
|
Requester = requester;
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ namespace Content.Shared.Cargo.Events;
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class CargoConsoleApproveOrderMessage : BoundUserInterfaceMessage
|
public sealed class CargoConsoleApproveOrderMessage : BoundUserInterfaceMessage
|
||||||
{
|
{
|
||||||
public int OrderNumber;
|
public int OrderIndex;
|
||||||
|
|
||||||
public CargoConsoleApproveOrderMessage(int orderNumber)
|
public CargoConsoleApproveOrderMessage(int orderIndex)
|
||||||
{
|
{
|
||||||
OrderNumber = orderNumber;
|
OrderIndex = orderIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,10 @@ namespace Content.Shared.Cargo.Events;
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class CargoConsoleRemoveOrderMessage : BoundUserInterfaceMessage
|
public sealed class CargoConsoleRemoveOrderMessage : BoundUserInterfaceMessage
|
||||||
{
|
{
|
||||||
public int OrderNumber;
|
public int OrderIndex;
|
||||||
|
|
||||||
public CargoConsoleRemoveOrderMessage(int orderNumber)
|
public CargoConsoleRemoveOrderMessage(int orderIndex)
|
||||||
{
|
{
|
||||||
OrderNumber = orderNumber;
|
OrderIndex = orderIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user