Salvage Job Board (#37549)
* Salvage Job Board * More development * Small boy * Computer yaml (partial) * UI * Rank unlock logic * Job label printing * appraisal tool integration * Jobs * add board to QM locker * boom! * command desc * mild rewording * ackh, mein pr ist brohken
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Server.Cargo.Components;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Shared.Cargo;
|
||||
@@ -372,7 +373,7 @@ namespace Content.Server.Cargo.Systems
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.AllowedGroups.Contains(product.Group))
|
||||
if (!GetAvailableProducts((uid, component)).Contains(args.CargoProductId))
|
||||
return;
|
||||
|
||||
if (component.SlipPrinter)
|
||||
@@ -421,7 +422,8 @@ namespace Content.Server.Cargo.Systems
|
||||
GetOutstandingOrderCount(orderDatabase, console.Account),
|
||||
orderDatabase.Capacity,
|
||||
GetNetEntity(station.Value),
|
||||
orderDatabase.Orders[console.Account]
|
||||
orderDatabase.Orders[console.Account],
|
||||
GetAvailableProducts((consoleUid, console))
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -617,6 +619,29 @@ namespace Content.Server.Cargo.Systems
|
||||
|
||||
}
|
||||
|
||||
public List<ProtoId<CargoProductPrototype>> GetAvailableProducts(Entity<CargoOrderConsoleComponent> ent)
|
||||
{
|
||||
if (_station.GetOwningStation(ent) is not { } station ||
|
||||
!TryComp<StationCargoOrderDatabaseComponent>(station, out var db))
|
||||
{
|
||||
return new List<ProtoId<CargoProductPrototype>>();
|
||||
}
|
||||
|
||||
var products = new List<ProtoId<CargoProductPrototype>>();
|
||||
|
||||
// Note that a market must be both on the station and on the console to be available.
|
||||
var markets = ent.Comp.AllowedGroups.Intersect(db.Markets).ToList();
|
||||
foreach (var product in _protoMan.EnumeratePrototypes<CargoProductPrototype>())
|
||||
{
|
||||
if (!markets.Contains(product.Group))
|
||||
continue;
|
||||
|
||||
products.Add(product.ID);
|
||||
}
|
||||
|
||||
return products;
|
||||
}
|
||||
|
||||
#region Station
|
||||
|
||||
private bool TryGetOrderDatabase([NotNullWhen(true)] EntityUid? stationUid, [MaybeNullWhen(false)] out StationCargoOrderDatabaseComponent dbComp)
|
||||
|
||||
Reference in New Issue
Block a user