diff --git a/Assets/Scripts/ServerShared/HaulRun.cs b/Assets/Scripts/ServerShared/HaulRun.cs index f7a813ce3..764e6376a 100644 --- a/Assets/Scripts/ServerShared/HaulRun.cs +++ b/Assets/Scripts/ServerShared/HaulRun.cs @@ -43,13 +43,16 @@ public static class HaulRun return refused; } - // How many units of the good the hauler loads: what To took of it on its last visit while that sight is fresh, none of a good it saw - // refused outright, and the whole hold of a good it has no fresh sight of (it learns by trying). + // How many units of the good the hauler loads: up to ProbeFactor times what To took of it on its last visit while that sight is fresh (a + // carrier that brings only what was taken last time never finds a door that has grown hungrier), none of a good it saw refused + // outright, and the whole hold of a good it has no fresh sight of (it learns by trying). The hold and what From has cap it further. + public const int ProbeFactor = 2; + private static int LoadLimit(Ship ship, CultRecordKey good) { var sight = ship.HaulSeen?.Sights.FirstOrDefault(candidate => candidate.Good.Key.Equals(good)); if (sight == null || !Fresh(ship, sight)) return int.MaxValue; - return sight.Took > 0 ? sight.Took : sight.Left > 0 ? 0 : int.MaxValue; + return sight.Took > 0 ? Math.Max(1, ProbeFactor * sight.Took) : sight.Left > 0 ? 0 : int.MaxValue; } // The units of the good the hold may still take at From: its load limit less what it carries. diff --git a/tests/Aetheria.Shared.Tests/RegionLegsMemoryTests.cs b/tests/Aetheria.Shared.Tests/RegionLegsMemoryTests.cs index 8b523bc7a..4fdc779f9 100644 --- a/tests/Aetheria.Shared.Tests/RegionLegsMemoryTests.cs +++ b/tests/Aetheria.Shared.Tests/RegionLegsMemoryTests.cs @@ -187,7 +187,7 @@ public sealed partial class RunStartTests } // A hauler loads toward what the door took on its last visit, not a whole hold: with a fresh sight of 3 units taken, a call at a From that - // holds twenty loads three; with no sight it loads what the hold takes. + // holds twenty loads six, twice what was taken (it probes upward). [Fact] public void ALoadFollowsWhatTheDoorTook() { @@ -196,8 +196,9 @@ public sealed partial class RunStartTests Stock(leg.From, leg.Good, 20); leg.Hauler.HaulSeen = new HaulSeen { Sights = { new HaulSight { Good = new CultRecordRef(leg.Good), At = leg.FromZone.Contents.ExactTime, Took = 3 } } }; Assert.True(HaulRun.Call(leg.Hauler, leg.From)); - Assert.Equal(3, Held(new[] { leg.Hauler }, leg.Good)); - Assert.False(HaulRun.CanCall(leg.Hauler, leg.From, leg.Order) && Held(new[] { leg.Hauler }, leg.Good) >= 3 && HaulRun.Leg(leg.Hauler, leg.Order).Equals(leg.From.OrbitData)); + Assert.Equal(6, Held(new[] { leg.Hauler }, leg.Good)); + Assert.Equal(2, HaulRun.ProbeFactor); + Assert.False(HaulRun.CanCall(leg.Hauler, leg.From, leg.Order) && Held(new[] { leg.Hauler }, leg.Good) >= 6 && HaulRun.Leg(leg.Hauler, leg.Order).Equals(leg.From.OrbitData)); } // No ping-pong: over 24 sim h on seed 2 a hauler never turns straight back through the wormhole it came by without a call between (the