Trading Outpost now has half buy-only and half sell-only pallets (#25955)
* Added new Buy & Sell specific cargo pallets * Remapped trading outpost with new pallets, tweaked texture * Removed debug message * Fixed/Compacted conditional checking to let old pallets still work for backwards compatability * Update Content.Server/Cargo/Components/CargoPalletComponent.cs Alright, updating all the references to it. Co-authored-by: Tayrtahn <tayrtahn@gmail.com> * Changed textures, changed to enum instead of string for pallet type check * Few minor code tweaks/formatting fixes * Missed the prototype change * Update Content.Server/Cargo/Components/CargoPalletComponent.cs * Update Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs --------- Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -173,13 +173,16 @@ public sealed partial class CargoSystem
|
||||
/// </summary>
|
||||
private int GetCargoSpace(EntityUid gridUid)
|
||||
{
|
||||
var space = GetCargoPallets(gridUid).Count;
|
||||
var space = GetCargoPallets(gridUid, BuySellType.Buy).Count;
|
||||
return space;
|
||||
}
|
||||
|
||||
private List<(EntityUid Entity, CargoPalletComponent Component, TransformComponent PalletXform)> GetCargoPallets(EntityUid gridUid)
|
||||
/// GetCargoPallets(gridUid, BuySellType.Sell) to return only Sell pads
|
||||
/// GetCargoPallets(gridUid, BuySellType.Buy) to return only Buy pads
|
||||
private List<(EntityUid Entity, CargoPalletComponent Component, TransformComponent PalletXform)> GetCargoPallets(EntityUid gridUid, BuySellType requestType = BuySellType.All)
|
||||
{
|
||||
_pads.Clear();
|
||||
|
||||
var query = AllEntityQuery<CargoPalletComponent, TransformComponent>();
|
||||
|
||||
while (query.MoveNext(out var uid, out var comp, out var compXform))
|
||||
@@ -190,7 +193,13 @@ public sealed partial class CargoSystem
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((requestType & comp.PalletType) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_pads.Add((uid, comp, compXform));
|
||||
|
||||
}
|
||||
|
||||
return _pads;
|
||||
@@ -250,7 +259,7 @@ public sealed partial class CargoSystem
|
||||
amount = 0;
|
||||
toSell = new HashSet<EntityUid>();
|
||||
|
||||
foreach (var (palletUid, _, _) in GetCargoPallets(gridUid))
|
||||
foreach (var (palletUid, _, _) in GetCargoPallets(gridUid, BuySellType.Sell))
|
||||
{
|
||||
// Containers should already get the sell price of their children so can skip those.
|
||||
_setEnts.Clear();
|
||||
|
||||
Reference in New Issue
Block a user