A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Map: Revivim and Nahalal draw Tal's b09a and b07 up close (Fixes #659) (#1361)
Beri4d92aff9eb16
diff --git a/changelog.d/revivim-nahalal-models-659.md b/changelog.d/revivim-nahalal-models-659.mdnew file mode 100644index 000000000..6ea8a402e--- /dev/null+++ b/changelog.d/revivim-nahalal-models-659.md@@ -0,0 +1,4 @@+- Map, up close (#659): Revivim and Nahalal are built from Tal Heuberger's building models too, by the owner's call of+ 18 October 2026 ("Use b09a and b07"). Nahalal's public building is a b09a communal building. Revivim's walled lookout+ keeps its wall and tower, and its dining hall is a b07 and its other three buildings b09a, inside the wall. Far off,+ both keep their kits.diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.csindex 94e99d2d1..8bc8e909d 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.Moshav.cs@@ -35,10 +35,13 @@ namespace Statecraft.Game.Map.Kitsfloat yaw = RingYaw(p - heart);var (bottom, top) = GroundSpan(p, yaw, w, d, ground, m);var wall = C(0.91f, 0.86f, 0.75f); var roof = C(0.70f, 0.30f, 0.20f);- var start = km.CutStart();+ // Issue #659 (owner, 18 Oct 2026: "Use b09a and b07"): up close the hall is Tal Heuberger's b09a communal+ // building, its gable included; far off, the kit's.+ AddModel(owner, TownModel.B09aCommunal, p, yaw, w, d, h + d * 0.42f, bottom, top, km, m, exactHeight: false, flip: false);+ var cut = km.CutStart();km.Box(p.x, p.y, yaw, w, d, bottom, top, h, wall, roof, Facade.Village, m, roofed: true);km.Gable(p.x, p.y, yaw, w, d, top + h, d * 0.42f, roof, wall);- AtWorldScale(owner, "public_building", km, start, p, top, m); // #1032+ km.CutEnd(cut);Record(owner, "public_building", p, yaw, w, d, h, wall);return 1;}diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.Outpost.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.Outpost.csindex 8e37cd78f..6beadf1f9 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.Outpost.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.Outpost.cs@@ -23,8 +23,9 @@ namespace Statecraft.Game.Map.Kits/// <summary>A Negev lookout at <paramref name="heart"/>, on the settlement's grid angle: the walled yard with its gate,/// the lookout tower in one corner, the living quarters along the opposite side and the service buildings along a/// third, all flat-roofed. One lot for the whole yard; nothing is built when no free dry spot takes it. Returns how- /// many things were built (the yard, the tower and the four buildings, or 0). Up close (issue #1032) the yard, its- /// tower and its rooms are copied as one landmark at the models' scale, so they keep their places in the yard.</summary>+ /// many things were built (the yard, the tower and the four buildings, or 0). Up close (issue #1032) the yard and its+ /// tower are copied as one landmark at the models' scale, and (issue #659) each building is one of Tal Heuberger's+ /// models at its place in that copy, so they keep their places in the yard.</summary>static int NegevOutpostKit(Settlement s, Vector2 heart, KitGround ground, KitMesh km, Lots lots){float m = KitScale.Houses, side = OutpostSide * m, half = 0.5f * side;@@ -55,6 +56,9 @@ namespace Statecraft.Game.Map.Kitskm.Box(p.x, p.y, yaw, w * 1.08f, w * 1.08f, top + th, top + th, 1f * m, stone, roof, Facade.Plain, m);Record(s.Id, "lookout_tower", p, yaw, w, w, th + 1f * m, stone);}+ AtWorldScale(s.Id, "outpost_yard", km, start, c, ground.Y(c.x, c.y), m); // #1032: the wall and the tower, as one landmark+ // Issue #659: the copy above is shrunk about the yard's centre by this, so each building's model stands there.+ float k = Mathf.Min(1f, ModelScale / m);// The living quarters along the -v side, the service buildings along the -u side: one storey, flat// roofs, the living rooms' small windows. Inside the wall, clear of each other and of the tower.float inner = h - t;@@ -68,12 +72,19 @@ namespace Statecraft.Game.Map.Kitsvar (u, v, w, d, living) = rooms[i];var p = At(u, v); float bh = 3.3f * m;var (bottom, top) = GroundSpan(p, yaw, w * m, d * m, ground, m);+ // Issue #659 (owner, 18 Oct 2026: "Use b09a and b07"): up close the dining hall is Tal Heuberger's b07 and+ // the other buildings his b09a communal building, at their places in the yard's copy; far off, the kit's.+ var q = c + (p - c) * k;+ var (qBottom, qTop) = GroundSpan(q, yaw, w * m * k, d * m * k, ground, m);+ AddModel(s.Id, i == 0 ? TownModel.B07DiningHall : TownModel.B09aCommunal, q, yaw, w * m, d * m, bh, qBottom, qTop, km, m,+ exactHeight: false, flip: false);+ var cut = km.CutStart();km.Box(p.x, p.y, yaw, w * m, d * m, bottom, top, bh, concrete, roof, living ? Facade.Village : Facade.Plain, m);+ km.CutEnd(cut);// The first, larger living building holds the fortress's "חדר אוכל" (the source above): Revivim's one dining hall.Record(s.Id, i == 0 ? "dining_hall" : "building", p, yaw, w * m, d * m, bh, concrete);if (i == 0) kibbutzHalls++;}- AtWorldScale(s.Id, "outpost_yard", km, start, c, ground.Y(c.x, c.y), m); // #1032: the whole yard, as one landmarkreturn 2 + rooms.Length;}}diff --git a/unity/Assets/Tests/EditMode/TownModelScaleTests.cs b/unity/Assets/Tests/EditMode/TownModelScaleTests.csindex cfb9effa2..056111c27 100644--- a/unity/Assets/Tests/EditMode/TownModelScaleTests.cs+++ b/unity/Assets/Tests/EditMode/TownModelScaleTests.cs@@ -178,7 +178,7 @@ public class TownModelScaleTests}/// <summary>Issue #1032: each kit landmark's real height (m), the tallest part the kit draws for it, read off the kit's- /// own parts (SettlementKits.Landmarks.cs, .Moshav.cs, .Outpost.cs). The harbour works (low, in the sea), the Haram's+ /// own parts (SettlementKits.Landmarks.cs, .Outpost.cs). The harbour works (low, in the sea), the Haram's/// platform (ground, sized in metres to hold the Old City's lots) and the palms (trees) are not buildings and keep the/// kit's size.</summary>static readonly Dictionary<string, float> LandmarkRealM = new Dictionary<string, float>@@ -195,7 +195,6 @@ public class TownModelScaleTests["walls"] = 9.9f, // Suleiman's walls and their parapet at 100x["wall_tower"] = 13f, // a tower by a gate (the others 11.6 m)["gate"] = 13f,- ["public_building"] = 6.8f, // Nahalal's hall: 1.3 storeys and its gable["outpost_yard"] = 10.5f, // the lookout tower and its cap};diff --git a/unity/Assets/Tests/EditMode/TownModelTests.cs b/unity/Assets/Tests/EditMode/TownModelTests.csindex 35c50d9a6..9ddb97562 100644--- a/unity/Assets/Tests/EditMode/TownModelTests.cs+++ b/unity/Assets/Tests/EditMode/TownModelTests.cs@@ -58,7 +58,7 @@ public class TownModelTestsswitch (s.Type){case "kibbutz": return new HashSet<M> { M.B07DiningHall, M.B09aCommunal, M.B24Barn, M.B28WaterTower }; // #820: sheds are barns- case "moshav": return new HashSet<M>(moshava);+ case "moshav": return new HashSet<M>(moshava) { M.B09aCommunal }; // #659: Nahalal's public buildingcase "town" when s.Id != "tiberias" && s.Id != "safed":var h = new HashSet<M>(moshava) { M.B13aTwoStorey };if (TownModels.WineMoshava(s.Id)) h.Add(M.B23Winery);@@ -80,8 +80,6 @@ public class TownModelTestsvar used = built.Models.Where(m => m.Id == s.Id).Select(m => m.Model).ToList();TestContext.WriteLine($"{s.Id} ({s.Type}): {used.Count} models: " +string.Join(", ", used.GroupBy(x => x).OrderBy(g => g.Key).Select(g => $"{g.Key} {g.Count()}")));- // A Negev lookout's yard (#825) has no model that fits a 1943 walled outpost: it keeps its kit up close.- if (outposts.Contains(s.Id)) { if (used.Count > 0) bad.Add(s.Id + ": a lookout with models"); continue; }if (used.Count == 0) bad.Add(s.Id + " has no models");var wrong = used.Where(u => !Allowed(s).Contains(u)).Distinct().ToList();if (wrong.Count > 0) bad.Add($"{s.Id} ({s.Type}) uses {string.Join(", ", wrong)}");@@ -89,7 +87,8 @@ public class TownModelTestsvar halls = placed.Where(p => p.Id == s.Id && p.Kind == "dining_hall").ToList();var b07 = built.Models.Where(m => m.Id == s.Id && m.Model == M.B07DiningHall).ToList();if (b07.Count != halls.Count) bad.Add($"{s.Id}: {b07.Count} b07 models for {halls.Count} dining halls");- else if (halls.Count == 1 && (b07[0].C - halls[0].C).magnitude > 1f) bad.Add($"{s.Id}: the b07 model is not on the dining hall");+ // A lookout's hall stands in its yard's shrunk close copy, not on the kit's plot (RevivimAndNahalalDrawB09aAndB07UpClose).+ else if (halls.Count == 1 && !outposts.Contains(s.Id) && (b07[0].C - halls[0].C).magnitude > 1f) bad.Add($"{s.Id}: the b07 model is not on the dining hall");if (TownModels.WineMoshava(s.Id) && used.Count(u => u == M.B23Winery) != 1) bad.Add(s.Id + ": not one winery");}// The cities' own models are there (not only a fallback).@@ -125,10 +124,10 @@ public class TownModelTests{var map = OpenMap();var built = Build(map, out var placed);- var outposts = Outposts(placed); // a Negev lookout keeps its kit up close (#825)+ var outposts = Outposts(placed); // a lookout's models stand in its yard copy, not on kit plots (RevivimAndNahalalDrawB09aAndB07UpClose)var towns = map.Settlements.Select(s => s.Id).Where(id => !outposts.Contains(id)).ToHashSet();var want = placed.Where(p => towns.Contains(p.Id)- && (p.Kind == "building" || p.Kind == "water_tower" || p.Kind == "warehouse" || p.Kind == "dining_hall")).ToList();+ && (p.Kind == "building" || p.Kind == "water_tower" || p.Kind == "warehouse" || p.Kind == "dining_hall" || p.Kind == "public_building")).ToList();Assert.IsTrue(want.Any(p => p.Kind == "dining_hall"), "the kibbutzim's dining halls are in the census (#820)");var got = built.Models.Where(m => towns.Contains(m.Id)).ToList();TestContext.WriteLine($"{want.Count} town buildings in the census, {got.Count} town models, {built.Models.Count} models with the localities");@@ -162,10 +161,10 @@ public class TownModelTests/// <summary>Owner ruling, 18 October 2026: "Whole model far, buildings near". Every town/// with a whole-town model (TownLandmarks.ModelFor: the cities, the six moshavot, every kibbutz, the moshav and every/// Arab town) is built of the single building models up close: every house, hall, water tower and warehouse its kit- /// places is a model on its plot. What keeps the kit up close is a landmark no model fits (the list below), Nahalal's- /// public building (#851: no model of a moshav's school or offices) and Revivim's walled lookout (#825: no model of a- /// 1943 walled outpost); those two are the gaps the PR lists. A new kind of building in these towns fails here until it- /// is given a model or named as a gap.</summary>+ /// places is a model on its plot. What keeps the kit up close is a landmark no model fits (the list below). Nahalal's+ /// public building is a b09a and Revivim's walled lookout, whose buildings stand in its yard's close copy rather than on+ /// their kit plots, has its own test (the owner, 18 October 2026: "Use b09a and b07"). A new kind of building in these+ /// towns fails here until it is given a model or named as a landmark.</summary>[Test]public void EveryTownWithAWholeTownModelIsTheBuildingModelsUpClose(){@@ -176,14 +175,14 @@ public class TownModelTestsvar ids = mapped.Select(s => s.Id).ToHashSet();CollectionAssert.IsSubsetOf(new[] { "tel_aviv", "jerusalem", "haifa", "rishon_lezion", "degania_alef", "nahalal", "nazareth" }, ids);Assert.AreEqual(new[] { "arab_town", "city", "kibbutz", "moshav", "town" }, mapped.Select(s => s.Type).Distinct().OrderBy(t => t).ToArray());- var modelled = new HashSet<string> { "building", "dining_hall", "water_tower", "warehouse" };+ var modelled = new HashSet<string> { "building", "dining_hall", "water_tower", "warehouse", "public_building" };var landmarks = new HashSet<string>{"al_aqsa", "breakwater", "church", "citadel", "clock_tower", "dome_of_the_rock", "gate", "german_colony", "haram","lighthouse", "mosque", "palm", "port", "village_mosque", "walls", "white_tower",};var outposts = Outposts(placed);- CollectionAssert.AreEqual(new[] { "revivim" }, outposts.Where(ids.Contains).ToArray(), "the one walled lookout (a listed gap)");+ CollectionAssert.AreEqual(new[] { "revivim" }, outposts.Where(ids.Contains).ToArray(), "the one walled lookout (RevivimAndNahalalDrawB09aAndB07UpClose)");var at = built.Models.ToLookup(m => (m.Id, Mathf.RoundToInt(m.Plot.x), Mathf.RoundToInt(m.Plot.y)));var bad = new List<string>();int houses = 0;@@ -195,13 +194,43 @@ public class TownModelTestshouses++;if (!at[(p.Id, Mathf.RoundToInt(p.C.x), Mathf.RoundToInt(p.C.y))].Any()) bad.Add($"{p.Id}: a {p.Kind} at {p.C} with no model");}- else if (!landmarks.Contains(p.Kind) && !(p.Id == "nahalal" && p.Kind == "public_building")) bad.Add($"{p.Id}: {p.Kind} keeps the kit up close");+ else if (!landmarks.Contains(p.Kind)) bad.Add($"{p.Id}: {p.Kind} keeps the kit up close");}TestContext.WriteLine($"{houses} buildings in those towns, all models: {bad.Count == 0}");Assert.Greater(houses, 100);CollectionAssert.IsEmpty(bad.Take(20), $"{bad.Count} kit buildings left up close");}+ /// <summary>Issue #659, the owner on 18 October 2026: "Use b09a and b07" at Revivim and Nahalal, the two places whose+ /// kit buildings had no fitting model. Up close Nahalal's public building is one b09a communal building on its plot, and+ /// the kit's hall no longer draws there. Revivim's walled lookout keeps its wall and tower (no model of either), and its+ /// four buildings are models: the dining hall a b07 and the other three b09a, each inside the yard's close copy, so they+ /// stand within its wall at the models' scale.</summary>+ [Test]+ public void RevivimAndNahalalDrawB09aAndB07UpClose()+ {+ var map = OpenMap();+ var built = Build(map, out var placed);+ var hall = placed.Single(p => p.Id == "nahalal" && p.Kind == "public_building");+ var onHall = built.Models.Where(m => m.Id == "nahalal" && (m.Plot - hall.C).magnitude < 1f).Select(m => m.Model).ToArray();+ CollectionAssert.AreEqual(new[] { M.B09aCommunal }, onHall, "Nahalal's public building up close");+ Assert.IsFalse(built.CloseLandmarks.Any(l => l.Id == "nahalal" && l.Kind == "public_building"), "Nahalal's kit hall still draws up close");+ var revivim = built.Models.Where(m => m.Id == "revivim").ToList();+ TestContext.WriteLine($"revivim: {string.Join(", ", revivim.Select(m => $"{m.Model} at {m.C}"))}");+ Assert.AreEqual(1, revivim.Count(m => m.Model == M.B07DiningHall), "Revivim's dining hall is a b07");+ Assert.AreEqual(3, revivim.Count(m => m.Model == M.B09aCommunal), "Revivim's other three buildings are b09a");+ Assert.AreEqual(4, revivim.Count, "Revivim's four buildings, no other model");+ var yard = built.CloseLandmarks.Single(l => l.Id == "revivim" && l.Kind == "outpost_yard");+ var corners = new List<Vector3>();+ foreach (var mi in revivim)+ {+ corners.Clear(); mi.Corners(corners);+ foreach (var c in corners)+ Assert.IsTrue(Mathf.Abs(c.x - yard.C.x) <= 0.5f * yard.W + 1f && Mathf.Abs(c.z - yard.C.y) <= 0.5f * yard.D + 1f,+ $"Revivim's {mi.Model} at {mi.C} stands outside the yard's close copy ({yard.C}, {yard.W:0} x {yard.D:0} m)");+ }+ }+/// <summary>A model stands on its plot at the world scale (SettlementKits.ModelScale, the owner on v0.1.1: the buildings/// were "way bigger then the train"): a plot w x d x h at the kit's scale k stands for a building w/k x d/k x h/k real,/// so the model's longer side is max(w, d) / k x ModelScale along the plot's longer side, one scale on both ground axes