Skip to content

Commit

Permalink
Allow linked telepads only
Browse files Browse the repository at this point in the history
  • Loading branch information
GreaseMonk committed Apr 3, 2024
1 parent abec0de commit 28999b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,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<NetEntity> 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;
Expand All @@ -437,9 +437,9 @@ private static bool PopFrontOrder(StationCargoOrderDatabaseComponent orderDB, [N
/// <summary>
/// Tries to fulfill the next outstanding order.
/// </summary>
private bool FulfillNextOrder(StationCargoOrderDatabaseComponent orderDB, EntityCoordinates spawn, string? paperProto)
private bool FulfillNextOrder(List<NetEntity> 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);
Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Cargo/Systems/CargoSystem.Telepad.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.Cargo.Components;
using Content.Server.Construction;
using Content.Server.Paper;
Expand Down Expand Up @@ -67,8 +68,11 @@ private void UpdateTelepad(float frameTime)
continue;
}

// Frontier - This makes sure telepads spawn goods of linked computers only.
List<NetEntity> 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);
Expand Down

0 comments on commit 28999b4

Please sign in to comment.