A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Map kits: White City and Tel Aviv laundry rooms stand inside the roof parapet (#2417)
Eyal Golanf745583d0887
diff --git a/changelog.d/kit-laundry-parapet.md b/changelog.d/kit-laundry-parapet.mdnew file mode 100644index 000000000..737f8a035--- /dev/null+++ b/changelog.d/kit-laundry-parapet.md@@ -0,0 +1,3 @@+### Fixed++- White City and Tel Aviv roof laundry rooms now stand inside the roof parapet instead of cutting through it (Refs #2388).diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.TelAviv.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.TelAviv.csindex 65dc4f803..b521b6016 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.TelAviv.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.TelAviv.cs@@ -113,7 +113,9 @@ namespace Statecraft.Game.Map.Kitsif (rnd.Chance(0.4f)){float lw = w * rnd.Range(0.14f, 0.2f), ld = b.d * rnd.Range(0.22f, 0.3f);- var r2 = At(du + (rnd.Chance(0.5f) ? 1f : -1f) * (0.5f * w - 0.6f * lw), rnd.Range(-0.2f, 0.2f) * b.d);+ // Keep the old 0.1 lw clearance, but measure it from the parapet's inner edge rather than the outer wall.+ var r2 = At(du + (rnd.Chance(0.5f) ? 1f : -1f) * (0.5f * w - WhiteParapetThicknessM * m - 0.6f * lw),+ rnd.Range(-0.2f, 0.2f) * b.d);if (!setback) km.Box(r2.x, r2.y, yaw, lw, ld, top + h - 2f, top + h, 2.4f * m, wall, terrace, Facade.Plain, m);}Record(id, "building", p, yaw, b.w, b.d, b.h, wall);@@ -175,7 +177,7 @@ namespace Statecraft.Game.Map.Kits/// <summary>A flat roof's parapet: a low plastered rim round the terrace, inside the block's footprint.</summary>static void RoofParapet(KitMesh km, Vector2 c, float yaw, float w, float d, float roofY, Color32 wall, float m){- float t = 0.35f * m, hgt = 1.0f * m, a = yaw * Mathf.Deg2Rad, ca = Mathf.Cos(a), sa = Mathf.Sin(a);+ float t = WhiteParapetThicknessM * m, hgt = 1.0f * m, a = yaw * Mathf.Deg2Rad, ca = Mathf.Cos(a), sa = Mathf.Sin(a);for (int side = -1; side <= 1; side += 2){float v = side * 0.5f * (d - t), u = side * 0.5f * (w - t);diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.csindex 231b4d418..c948abfd4 100644--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.cs+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.cs@@ -963,7 +963,9 @@ namespace Statecraft.Game.Map.Kitsif (white && !stepped && rnd.Chance(0.45f)){float rw = b.w * rnd.Range(0.16f, 0.24f), rd = b.d * rnd.Range(0.25f, 0.35f), a = yaw * Mathf.Deg2Rad;- float u = (rnd.Chance(0.5f) ? 1f : -1f) * (0.5f * b.w - 0.6f * rw), v = rnd.Range(-0.2f, 0.2f) * b.d;+ // Keep the old 0.1 rw clearance, but measure it from the parapet's inner edge rather than the outer wall.+ float inset = parapet > 0f ? parapetT : 0f;+ float u = (rnd.Chance(0.5f) ? 1f : -1f) * (0.5f * b.w - inset - 0.6f * rw), v = rnd.Range(-0.2f, 0.2f) * b.d;km.Box(p.x + u * Mathf.Cos(a) - v * Mathf.Sin(a), p.y + u * Mathf.Sin(a) + v * Mathf.Cos(a), yaw, rw, rd, top + b.h - 2f, top + b.h,2.4f * m, wall, roof, Facade.Plain, m);}diff --git a/unity/Assets/Tests/EditMode/KitRoofContainmentTests.cs b/unity/Assets/Tests/EditMode/KitRoofContainmentTests.csindex 4d3fac767..e57ec88b7 100644--- a/unity/Assets/Tests/EditMode/KitRoofContainmentTests.cs+++ b/unity/Assets/Tests/EditMode/KitRoofContainmentTests.cs@@ -27,9 +27,10 @@ public class KitRoofContainmentTestsconst float Storey = 3.3f;/// <summary>The highest parapet any building draws (real m: the White City's and a town house's top, 1.0).</summary>const float MaxParapet = 1.0f;- /// <summary>Anything higher than this above its roof (real m) stands on the roof: a stair head (2.8), its tank or a roof- /// room (0.85 storey); a White City laundry room (2.4), a dome (at most about 2.2) and the parapets stay below it.</summary>+ /// <summary>Anything higher than this above its roof (real m) is a stair head (2.8), its tank or a roof room+ /// (0.85 storey); a dome (at most about 2.2) and the parapets stay below it.</summary>const float StandsOn = 2.5f;+ const float LaundryHeight = 2.4f;static readonly float[] Shrinks = { 1f, 0.72f, 0.5f };static readonly float[] Yaws = { 0f, 90f, 45f };const int Seeds = 40;@@ -169,6 +170,49 @@ public class KitRoofContainmentTestsAssert.IsEmpty(bad, "stair heads or tanks outside their roof's parapet");}+ /// <summary>Every shared laundry room on a WhiteBlock or Tel Aviv block lies inside the parapet's inner edge. The room's+ /// top is below StandsOn, so select its 2.4 m top explicitly; the positive count keeps the sweep from passing vacuously.</summary>+ [Test]+ public void EveryLaundryRoomStandsInsideItsRoofsParapet()+ {+ var g = Ground();+ float cm = KitScale.CityBlocks;+ var kinds = new[]+ {+ new Kind { Name = "WhiteBlock laundry", W0 = 12f, W1 = 16f, D0 = 9f, D1 = 11.5f, M = cm, Storeys = new[] { 3, 6 },+ Draw = Lattice(SettlementKits.Style.WhiteBlock, g, cm) },+ new Kind { Name = "TelAviv laundry", W0 = 21f, W1 = 24f, D0 = 13f, D1 = 15f, M = cm, Storeys = new[] { 4, 8 },+ Draw = Lattice(SettlementKits.Style.TelAviv, g, cm) },+ };+ var bad = new List<string>();+ foreach (var k in kinds)+ {+ int rooms = 0; var draws = new List<int>();+ foreach (var (spec, m, roofY, v, p, yaw, n) in Sweep(k))+ {+ draws.Add(n);+ float eps = 0.01f * m, roomTop = roofY + LaundryHeight * m;+ var laundry = v.Where(q => Mathf.Abs(q.y - roomTop) <= eps).ToList();+ if (laundry.Count == 0) continue;+ rooms++;+ var rim = Rim(v, p, yaw, roofY, roofY + MaxParapet * m, eps);+ if (rim == null) { bad.Add(spec + ": laundry room has no parapet on its roof"); continue; }+ var outside = laundry.Select(q => Local(q, p, yaw)).Where(l => !Inside(l, rim.Value, eps)).ToList();+ if (outside.Count > 0)+ {+ var worst = outside[0];+ bad.Add($"{spec}: laundry room at ({worst.x / m:0.00}, {worst.y / m:0.00}) m, parapet inside u {rim.Value.u0 / m:0.00}..{rim.Value.u1 / m:0.00}, v {rim.Value.v0 / m:0.00}..{rim.Value.v1 / m:0.00}");+ }+ }+ TestContext.WriteLine($"ROOF_CONTAIN {k.Name}: {draws.Count} blocks, {rooms} laundry rooms checked");+ Log(k.Name, draws);+ Assert.Greater(rooms, 0, k.Name + ": laundry rooms swept");+ }+ TestContext.WriteLine($"ROOF_CONTAIN laundry rooms outside the parapet's inner edge: {bad.Count}");+ foreach (var s in bad.Take(12)) TestContext.WriteLine(" " + s);+ Assert.IsEmpty(bad, "laundry rooms outside their roof's parapet");+ }+/// <summary>A stone or mud-brick house's roof room (StoneHouse: the old towns', the Arab towns' and villages') never cuts/// a parapet: a roof with a room has no rim the room's walls stand through, and the rim goes on the room, the topmost/// roof (a town house always has one there unless it is domed).</summary>