Name the gear-room reading GearCellsLeft: StockRoom is a name the role-bay cut retired

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-12-03 06:13:16 +01:00
commit fb184066b6
3 changed files with 5 additions and 5 deletions

View file

@ -156,7 +156,7 @@ public class LoadoutGenerator
{
var instance = ItemManager.CreateInstance(entry.product);
var cells = entry.design.Shape.Coordinates.Length;
if (cells > StationServices.StockRoom(entity)) continue;
if (cells > StationServices.GearCellsLeft(entity)) continue;
stockBays.Any(bay => bay.TryStore(instance));
}

View file

@ -110,7 +110,7 @@ public static class StationServices
if (item is ICommodityStack)
throw new ArgumentException("A commodity stack sells through TrySellPart, which says how many units sold.", nameof(item));
var price = SellPrice(station.ItemManager, item);
if (station.ItemManager.GetData(item).Shape.Coordinates.Length > StockRoom(station)) return false;
if (station.ItemManager.GetData(item).Shape.Coordinates.Length > GearCellsLeft(station)) return false;
if (!station.CargoBays.Any(bay => from.TryTransferItem(bay, item, 1))) return false;
credits += price;
return true;
@ -118,7 +118,7 @@ public static class StationServices
// The cells of gear the Stock bays may still take: StationStockShare of their cells together, less the cells occupied, generated
// and pawned gear alike (ruling pawn-stock-in-stock-bay-share). Role bays refuse gear, so the Stock bays are the only bays gear lands in.
public static int StockRoom(Entity station)
public static int GearCellsLeft(Entity station)
{
var bays = StationWants.RoleBays(station, BayRole.Stock).ToArray();
var cap = (int) (bays.Sum(bay => bay.Data.InteriorShape.Coordinates.Length) * LoadoutGenerator.StationStockShare);

View file

@ -195,7 +195,7 @@ public sealed class StationServicesTests : IDisposable
Assert.Equal(5, pawned);
Assert.Equal(5 * StationServices.SellPrice(_items, Mint("Gun")), credits);
Assert.Equal(0, StationServices.StockRoom(station));
Assert.Equal(0, StationServices.GearCellsLeft(station));
Assert.Equal(8, stock.Occupancy.Cast<ItemInstance>().Count(held => held != null));
Assert.Contains(held[pawned], from.Cargo.Keys);
}
@ -253,7 +253,7 @@ public sealed class StationServicesTests : IDisposable
var others = StationWants.RoleBays(station, BayRole.Stock).Skip(1).ToArray();
while (full.TryStore(Mint("Gun"))) { }
// Three Crates, 48 cells: the stock share is 24, and the full bay spends 16 of it, so the sale lands in another Crate.
Assert.Equal(8, StationServices.StockRoom(station));
Assert.Equal(8, StationServices.GearCellsLeft(station));
var credits = 0;
Assert.True(StationServices.TrySell(from, station, gun, ref credits));