diff --git a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs index caf437fccee..637dd34ccf7 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs @@ -234,7 +234,7 @@ private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent compone if (!component.AllowedGroups.Contains(product.Group)) return; - var data = GetOrderData(args, product, GenerateOrderId(orderDatabase)); + var data = GetOrderData(EntityManager.GetNetEntity(uid), args, product, GenerateOrderId(orderDatabase)); if (!TryAddOrder(orderDatabase.Owner, data, orderDatabase)) { @@ -283,12 +283,15 @@ private void UpdateOrderState(CargoOrderConsoleComponent component, EntityUid? s if (station == null || !TryGetOrderDatabase(station.Value, out var _, out var orderDatabase, component)) return; + // Frontier - we only want to see orders made on the same computer, so filter them out + var filteredOrders = orderDatabase.Orders.Where(order => order.Computer == EntityManager.GetNetEntity(component.Owner)).ToList(); + var state = new CargoConsoleInterfaceState( MetaData(player).EntityName, GetOutstandingOrderCount(orderDatabase), orderDatabase.Capacity, balance, - orderDatabase.Orders); + filteredOrders); _uiSystem.SetUiState(bui, state); } @@ -303,9 +306,9 @@ private void PlayDenySound(EntityUid uid, CargoOrderConsoleComponent component) _audio.PlayPvs(_audio.GetSound(component.ErrorSound), uid); } - private static CargoOrderData GetOrderData(CargoConsoleAddOrderMessage args, CargoProductPrototype cargoProduct, int id) + private static CargoOrderData GetOrderData(NetEntity consoleUid, CargoConsoleAddOrderMessage args, CargoProductPrototype cargoProduct, int id) { - return new CargoOrderData(id, cargoProduct.Product, cargoProduct.Cost, args.Amount, args.Requester, args.Reason); + return new CargoOrderData(id, cargoProduct.Product, cargoProduct.Cost, args.Amount, args.Requester, args.Reason, consoleUid); } public static int GetOutstandingOrderCount(StationCargoOrderDatabaseComponent component) @@ -366,7 +369,7 @@ StationDataComponent stationData DebugTools.Assert(_protoMan.HasIndex(spawnId)); // Make an order var id = GenerateOrderId(component); - var order = new CargoOrderData(id, spawnId, cost, qty, sender, description); + var order = new CargoOrderData(id, spawnId, cost, qty, sender, description, null); // Approve it now order.SetApproverData(dest, sender); @@ -411,9 +414,9 @@ public void ClearOrders(StationCargoOrderDatabaseComponent component) component.Orders.Clear(); } - private static bool PopFrontOrder(StationCargoOrderDatabaseComponent orderDB, [NotNullWhen(true)] out CargoOrderData? orderOut) + private static bool PopFrontOrder(List consoleUidList, StationCargoOrderDatabaseComponent orderDB, [NotNullWhen(true)] out CargoOrderData? orderOut) { - var orderIdx = orderDB.Orders.FindIndex(order => order.Approved); + var orderIdx = orderDB.Orders.FindIndex(order => order.Approved && consoleUidList.Any(consoleUid => consoleUid == order.Computer)); if (orderIdx == -1) { orderOut = null; @@ -434,9 +437,9 @@ private static bool PopFrontOrder(StationCargoOrderDatabaseComponent orderDB, [N /// /// Tries to fulfill the next outstanding order. /// - private bool FulfillNextOrder(StationCargoOrderDatabaseComponent orderDB, EntityCoordinates spawn, string? paperProto) + private bool FulfillNextOrder(List consoleUidList, StationCargoOrderDatabaseComponent orderDB, EntityCoordinates spawn, string? paperProto) { - if (!PopFrontOrder(orderDB, out var order)) + if (!PopFrontOrder(consoleUidList, orderDB, out var order)) return false; return FulfillOrder(order, spawn, paperProto); diff --git a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs index a8c4971b880..712c9a1f950 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs @@ -165,7 +165,7 @@ private List GetProjectedOrders( // We won't be able to fit the whole order on, so make one // which represents the space we do have left: var reducedOrder = new CargoOrderData(order.OrderId, - order.ProductId, order.Price, spaceRemaining, order.Requester, order.Reason); + order.ProductId, order.Price, spaceRemaining, order.Requester, order.Reason, null); orders.Add(reducedOrder); } else diff --git a/Content.Server/Cargo/Systems/CargoSystem.Telepad.cs b/Content.Server/Cargo/Systems/CargoSystem.Telepad.cs index c76e52943b2..fef44b02c67 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Telepad.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Telepad.cs @@ -1,3 +1,4 @@ +using System.Linq; using Content.Server.Cargo.Components; using Content.Server.Construction; using Content.Server.Paper; @@ -67,8 +68,11 @@ private void UpdateTelepad(float frameTime) continue; } + // Frontier - This makes sure telepads spawn goods of linked computers only. + List consoleUidList = sinkComponent.LinkedSources.Select(item => EntityManager.GetNetEntity(item)).ToList(); + var xform = Transform(uid); - if (FulfillNextOrder(orderDatabase, xform.Coordinates, comp.PrinterOutput)) + if (FulfillNextOrder(consoleUidList, orderDatabase, xform.Coordinates, comp.PrinterOutput)) { _audio.PlayPvs(_audio.GetSound(comp.TeleportSound), uid, AudioParams.Default.WithVolume(-8f)); UpdateOrders(station.Value, orderDatabase); diff --git a/Content.Shared/Cargo/CargoOrderData.cs b/Content.Shared/Cargo/CargoOrderData.cs index a6d5fb0a18a..879c4225b0e 100644 --- a/Content.Shared/Cargo/CargoOrderData.cs +++ b/Content.Shared/Cargo/CargoOrderData.cs @@ -39,7 +39,9 @@ public sealed class CargoOrderData public bool Approved => Approver is not null; public string? Approver; - public CargoOrderData(int orderId, string productId, int price, int amount, string requester, string reason) + public NetEntity? Computer = null; + + public CargoOrderData(int orderId, string productId, int price, int amount, string requester, string reason, NetEntity? computer) { OrderId = orderId; ProductId = productId; @@ -47,6 +49,7 @@ public CargoOrderData(int orderId, string productId, int price, int amount, stri OrderQuantity = amount; Requester = requester; Reason = reason; + Computer = computer; } public void SetApproverData(string? fullName, string? jobTitle)