AHaulerDocksOnlyToMoveSomething: a hauler the refinery refuses heads for Zenith with its cargo

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-12-01 00:59:53 +01:00
commit 4d7689d002

View file

@ -162,7 +162,8 @@ public sealed partial class RunStartTests
}
// A hauler docks only when the call would move a unit: with the silo empty it never docks and keeps its pilot; with the refinery's
// bays full of something else, a loaded hauler keeps its cargo.
// bays full of something else, a loaded hauler never docks at the refinery, which refuses its cargo, and heads for Zenith with it
// (ruling leftover-unloads-at-from): the 5 units are the hauler's or Zenith's silo's, none the refinery's.
[Fact]
public void AHaulerDocksOnlyToMoveSomething()
{
@ -180,9 +181,11 @@ public sealed partial class RunStartTests
while (bay.TryStore(new SimpleCommodity { Data = new CultRecordRef<ItemData>(_cache.RefOf(filler).Key), Quantity = 1 })) { }
Assert.Equal(0, Units(world.Refinery.CargoBays, world.Good));
Assert.True(world.Hauler.CargoBays[0].TryStore(new SimpleCommodity { Data = new CultRecordRef<ItemData>(world.Good), Quantity = 5 }));
var atRefinery = 0;
world.Hauler.Docked.Subscribe(station => { if (ReferenceEquals(station, world.Refinery)) atRefinery++; });
Fly(world.Arena, 60);
Assert.Equal(0, dockings);
Assert.Equal(5, Units(world.Hauler.CargoBays, world.Good));
Assert.Equal(0, atRefinery);
Assert.Equal(5, Units(world.Hauler.CargoBays, world.Good) + Units(new[] { world.Silo }, world.Good));
Assert.Equal(0, Units(world.Refinery.CargoBays, world.Good));
}