A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Raid flight on New game: the Dakotas bomb Tel Aviv before the raid card (PR 2 of #2968) (#3003)
Eyal Golan344ac8474e32
diff --git a/changelog.d/c30-3000-raid-flight.md b/changelog.d/c30-3000-raid-flight.mdnew file mode 100644index 000000000..42a7cd30d--- /dev/null+++ b/changelog.d/c30-3000-raid-flight.md@@ -0,0 +1,7 @@+- New game flies the raid on Tel Aviv after the opening and before the raid card (#3000): the two Egyptian Dakotas+ already on the map come in from the south-west along the coast, bomb Tel Aviv with their own bombs, flashes and smoke,+ and fly away south; then the card shows. (The 15 May 1948 raiders were Spitfires; the map's Dakotas stand in for them.)+ Any click, or Escape, skips the flight and the card still follows. Continue, a loaded game and the automated runs never+ fly it. Presentation only: no game state changes.+- The Tel Aviv raid card on New game is no longer a draft: the owner reviewed its text, its Hebrew and its clip on 10+ November 2026, so player builds now show the card, and the raid flight before it, with no preview label (Refs #3003).diff --git a/docs/event-videos.md b/docs/event-videos.mdindex d7345dd60..5fcc76fa2 100644--- a/docs/event-videos.md+++ b/docs/event-videos.md@@ -168,8 +168,10 @@ war's total for all the Egyptian air raids on Tel Aviv, with every figure founddrops the frame and keeps the text and OK; with video off there is no frame.- **The gate.** A player build shows the card only when `status` is `sensitivity-reviewed`, every source is checked, theHebrew is `he_review: approved` and the clip is `sensitivity_reviewed: true` (`RaidCardContent.MayPresent`). The Editor- shows the draft with the opening's preview label. `tools/tests/test_raid_intro_sources.py` checks the sources, the- `ASSETS.yaml` row (AI-generated, CC0, verified), the `docs/ai-disclosure.md` line and that the card has no credit line.+ shows a draft with the opening's preview label. The owner reviewed the card on 10 November 2026 ("Approve text, HE,+ clip", and "Approve as is" for the Hebrew), so player builds show it. `tools/tests/test_raid_intro_sources.py`+ checks the sources, the `ASSETS.yaml` row (AI-generated, CC0, verified), the `docs/ai-disclosure.md` line and that the+ card has no credit line.## Where things arediff --git a/tools/tests/test_raid_intro_sources.py b/tools/tests/test_raid_intro_sources.pyindex cf7662c72..48d8e25f3 100644--- a/tools/tests/test_raid_intro_sources.py+++ b/tools/tests/test_raid_intro_sources.py@@ -82,20 +82,21 @@ def test_the_real_card_has_its_sources_and_hebrew():assert source_problems(actual()) == []-def test_the_real_card_is_a_draft_that_is_not_shareable():- assert actual()["status"] == "draft"- assert set(shareable_problems(actual())) == {- "the card needs the owner's sensitivity review",- "the Hebrew needs a native read (he_review: approved)",- "the clip needs the owner's sensitivity review"}+def test_the_real_card_is_reviewed_and_shareable():+ """Owner, 10 November 2026: "Approve text, HE, clip", and "Approve as is" for the Hebrew (native read, #564)."""+ assert actual()["status"] == "sensitivity-reviewed"+ assert shareable_problems(actual()) == []-def test_a_reviewed_fixture_is_shareable():+def test_a_draft_fixture_is_not_shareable():"""Only an in-memory fixture: this test never writes review markers to disk."""doc = copy.deepcopy(actual())- doc["status"], doc["he_review"] = "sensitivity-reviewed", "approved"- doc["clip"]["sensitivity_reviewed"] = True- assert shareable_problems(doc) == []+ doc["status"], doc["he_review"] = "draft", "pending"+ doc["clip"]["sensitivity_reviewed"] = False+ assert set(shareable_problems(doc)) == {+ "the card needs the owner's sensitivity review",+ "the Hebrew needs a native read (he_review: approved)",+ "the clip needs the owner's sensitivity review"}def test_missing_impossible_and_short_dates_are_not_checks():diff --git a/unity/Assets/Resources/RaidIntro/raid-intro.yaml b/unity/Assets/Resources/RaidIntro/raid-intro.yamlindex 7af57a8e6..d15e4fb20 100644--- a/unity/Assets/Resources/RaidIntro/raid-intro.yaml+++ b/unity/Assets/Resources/RaidIntro/raid-intro.yaml@@ -10,15 +10,21 @@# a native read and the clip has the owner's sensitivity review (RaidCardContent.MayPresent); the Editor shows the# draft with the opening's preview label.# For the native reviewer (#564): agent-drafted Hebrew. Names as the game and he.wiki write them: שדה דב (he.wiki-# "נמל התעופה דב הוז"), ספיטפייר and נ״מ (he.wiki, with the typographic gershayim of HE-06), התחנה המרכזית הישנה (the-# NLI records' own title), dates as date.day_month_year ("15 במאי 1948"); no parentheses or quotation marks, and no+# "נמל התעופה דב הוז"), ספיטפייר and נ״מ (he.wiki, with the typographic gershayim of HE-06), dates+# as date.day_month_year ("15 במאי 1948"); no parentheses or quotation marks, and no# Latin letters (HE-09).-status: draft+# Owner review, 10 November 2026 (asked with the full English and Hebrew text, the 172 toll and its source, and the+# clip's camouflage trousers from about 0.5 s): "Approve text, HE, clip" for the card, and "Approve as is" for the+# Hebrew title and text (the native read, #564). So status, he_review and the clip's sensitivity_reviewed below are set.+# Owner, 10 November 2026, asked with the bus-station date dispute (#3021: the NLI records say 15 May; the NLI blog,+# en.wiki, Nicolle and JTA say 18 May): "Drop the line (Recommended)". The card no longer names the bus station, in+# English or Hebrew, and the two NLI photo records that supported it are removed from the sources.+status: sensitivity-reviewedtitle: "Egyptian planes bomb Tel Aviv"title_he: "מטוסים מצריים מפציצים את תל אביב"-text: "Early on the morning of 15 May 1948, the day after independence was declared, Egyptian Spitfires attacked Tel Aviv. They bombed the Sde Dov airfield in the north of the city and damaged aircraft and buildings there. Anti-aircraft fire brought down one of the attackers, and its pilot was taken prisoner. Bombs also hit the old Central Bus Station, and more raids followed that day. Across all the Egyptian air raids on Tel Aviv in the war, 172 people were killed, most of them civilians."-text_he: "בשעות הבוקר המוקדמות של 15 במאי 1948, יום לאחר הכרזת העצמאות, תקפו מטוסי ספיטפייר מצריים את תל אביב. הם הפציצו את שדה התעופה שדה דב בצפון העיר וגרמו שם נזק למטוסים ולמבנים. אש נ״מ הפילה את אחד המטוסים התוקפים, וטייסו נלקח בשבי. פצצות פגעו גם בתחנה המרכזית הישנה, ובמהלך היום באו פשיטות נוספות. בכל הפשיטות האוויריות המצריות על תל אביב במהלך המלחמה נהרגו 172 בני אדם, רובם אזרחים."-he_review: pending+text: "Early on the morning of 15 May 1948, the day after independence was declared, Egyptian Spitfires attacked Tel Aviv. They bombed the Sde Dov airfield in the north of the city and damaged aircraft and buildings there. Anti-aircraft fire brought down one of the attackers, and its pilot was taken prisoner. More raids followed that day. Across all the Egyptian air raids on Tel Aviv in the war, 172 people were killed, most of them civilians."+text_he: "בשעות הבוקר המוקדמות של 15 במאי 1948, יום לאחר הכרזת העצמאות, תקפו מטוסי ספיטפייר מצריים את תל אביב. הם הפציצו את שדה התעופה שדה דב בצפון העיר וגרמו שם נזק למטוסים ולמבנים. אש נ״מ הפילה את אחד המטוסים התוקפים, וטייסו נלקח בשבי. במהלך היום באו פשיטות נוספות. בכל הפשיטות האוויריות המצריות על תל אביב במהלך המלחמה נהרגו 172 בני אדם, רובם אזרחים."+he_review: approved# The toll (owner: the total across all the Egyptian raids on Tel Aviv): 172 killed, from Naor (2008), the one read# source with a footnote, which cites the Civil Guard's comprehensive summary of the bombings in Tel Aviv (Tel Aviv# Municipality Archive 4/408). It covers both waves of raids: 15 May to the First Truce on 11 June, and the Ten Days@@ -45,12 +51,6 @@ sources:- url: "https://www.upi.com/Archives/1948/05/15/Arab-nations-Attack-Israel/6118818754330"supports: "UPI, 15 May 1948: 'The first Egyptian air raid on Tel Aviv came early today.'; a second attack 'within two hours' bombed 'the airport just north of this new Jewish capital'; a third raid before noon; 'one Egyptian pilot was taken prisoner'. It reports no casualties ('Little damage resulted.')"checked: 2026-11-08- - url: "https://commons.wikimedia.org/wiki/File:Tel_Aviv-Yafo_(997008136796305171).jpg"- supports: "NLI record 997008136796305171, taken on 15 May 1948 (Benno Rothenberg): 'אוטובוס מפויח של חברת דן בתחנה המרכזית הישנה בת\"א לאחר שהופגזה ע\"י מטוסים מצריים בעקבות הכרזת העצמאות'. The NLI blog and en.wiki put the bus-station raid on 18 May; owner, 7 Nov 2026: keep, go by the record"- checked: 2026-11-08- - url: "https://commons.wikimedia.org/wiki/File:Tel_Aviv-Yafo_(997008136796105171).jpg"- supports: "NLI record 997008136796105171, taken on 15 May 1948 (Benno Rothenberg): 'עשן מיתמר מהתחנה המרכזית הישנה בת\"א לאחר שהופגזה ע\"י מטוסים מצריים בעקבות הכרזת העצמאות'"- checked: 2026-11-08# The clip: the opening film's shot V19c, whole (0 to 4.0 s), an AI-only clip (CC0; ASSETS.yaml has the recipe). It# loops silently in the card's frame, labelled with the cards' "AI-generated illustration" string; with no photograph# in it, it has no credit line. CLIP-REVIEW-v8.md records the soldier's camouflage trousers from about 0.5 s.@@ -61,4 +61,4 @@ clip:alt_he_review: agent-checkedai_generated: truesensitive: true- sensitivity_reviewed: false+ sensitivity_reviewed: truediff --git a/unity/Assets/Scripts/Map/Collection/DakotaLoop.cs b/unity/Assets/Scripts/Map/Collection/DakotaLoop.csindex 0cb8159c7..b44d96e1b 100644--- a/unity/Assets/Scripts/Map/Collection/DakotaLoop.cs+++ b/unity/Assets/Scripts/Map/Collection/DakotaLoop.cs@@ -68,7 +68,10 @@ namespace Statecraft.Game.Map.Collectionvoid Update(){- if (!still) Place(SpitfireLoop.Clock());+ if (still) return;+ // New game's raid (#3000) flies every Dakota on its path until it ends; then the loop's clock again.+ if (DakotaRaidFlight.Since(out float raid)) PlaceRaid(raid);+ else Place(SpitfireLoop.Clock());}void OnEnable() => RenderPipelineManager.beginCameraRendering += Face;@@ -90,8 +93,27 @@ namespace Statecraft.Game.Map.Collection{PlacedAt = seconds;float u = seconds - lag;- var at = SeaAirCollection.DakotaLoopOffset(u);var turn = SeaAirCollection.DakotaTurn(u, out var forward, out float bank);+ Put(SeaAirCollection.DakotaLoopOffset(u), turn, forward, bank, seconds, u);+ }++ /// <summary>Puts the aircraft where New game's raid has it <paramref name="seconds"/> after the raid started+ /// (DakotaRaidFlight, #3000): on its path at its raid time (the wing DakotaRaidFlight.TrailS behind the lead), as+ /// <see cref="Place"/> does on the loop, its bombs at that raid time, which is their loop time on the pass over Tel Aviv.+ /// <see cref="PlacedAt"/> stays where the loop last put it: the map's names are hidden while the raid flies.</summary>+ internal void PlaceRaid(float seconds)+ {+ int plane = Mathf.RoundToInt(lag / SeaAirCollection.DakotaTrailSeconds);+ float u = DakotaRaidFlight.U(seconds, plane), tau = DakotaRaidFlight.PathTime(u);+ var turn = DakotaRaidFlight.Turn(tau, out var forward, out float bank);+ Put(DakotaRaidFlight.Offset(tau), turn, forward, bank, seconds, u);+ }++ /// <summary>Puts the aircraft at <paramref name="at"/> from its loop's centre, turned by <paramref name="turn"/> (heading+ /// <paramref name="forward"/>, <paramref name="bank"/> degrees), its propellers at their angle <paramref name="seconds"/>+ /// into the clock, and its bombs as they are at <paramref name="u"/> into its loop.</summary>+ void Put(Vector2 at, Quaternion turn, Vector3 forward, float bank, float seconds, float u)+ {transform.localRotation = turn * level;var drawn = centre + new Vector3(at.x, 0f, at.y);transform.position = drawn - turn * offset;diff --git a/unity/Assets/Scripts/Map/Collection/DakotaRaidFlight.cs b/unity/Assets/Scripts/Map/Collection/DakotaRaidFlight.csnew file mode 100644index 000000000..f8fd3b759--- /dev/null+++ b/unity/Assets/Scripts/Map/Collection/DakotaRaidFlight.cs@@ -0,0 +1,178 @@+#nullable enable+using UnityEngine;++namespace Statecraft.Game.Map.Collection+{+ /// <summary>The Dakotas' raid on Tel Aviv, flown once on New game after the opening and before the raid card (#3000, PR 2 of+ /// #2968; owner, 8 November 2026, "Film, raid, card, advisors (Recommended)", and the Dakotas by "Reuse Dakotas+ /// (Recommended)"): each Dakota flies in from the south-west along the coast, turns east over the sea onto its loop's+ /// southern pass, crosses Tel Aviv on it dropping its bombs exactly as on the loop (DakotaBombRun, the same releases, flashes,+ /// blasts and smoke), then turns south and flies away. The wing follows the lead <see cref="TrailS"/> later on the same+ /// path. The same models, flags, shadows and effects as the loop (DakotaLoop.PlaceRaid): nothing is forked or added.+ /// Presentation only: a pure function of the map's animation clock (SpitfireLoop.Clock) since <see cref="Start"/>; no sim,+ /// content, save or hash change. While it flies, every DakotaLoop follows it instead of its loop; <see cref="Stop"/> hands+ /// them back to their loop clock.+ ///+ /// Time: an aircraft's raid time u is 0 at the middle of its pass over Tel Aviv, as its loop time is (SeaAirCollection+ /// .DakotaLoopOffset(0) is Tel Aviv's hex centre), and runs at the real clock's pace, so the bombs fall and the smoke rises+ /// at the loop's pace. The path is drawn in path time (<see cref="PathTime"/>): the same as u on the pass, and+ /// <see cref="Speedup"/> times faster on the way in and out, so the flight is not a minute long.</summary>+ public static class DakotaRaidFlight+ {+ /// <summary>DESIGN VALUE: half the pass (s of raid time) on which the raid flies the loop itself, through every release:+ /// the releases over Tel Aviv's hex lie within about 4 s of the pass's middle (its hex is 7.6 km across, about 10 s at+ /// the loop's 760 m/s), so 6 s keeps every bomb under its aircraft (SeaAirCollectionTests).</summary>+ public const float PassS = 6f;++ /// <summary>DESIGN VALUE: the path time (s) of the turn in from the start and of the turn out to the end. At the+ /// loop's speed at each end, the curves turn no tighter than about 6 km (the loop's own ends are 5.4 km).</summary>+ public const float TurnS = 50f;++ /// <summary>DESIGN VALUES: where the raid starts and ends, from Tel Aviv's hex centre (world x east, z north, m), and the+ /// bearing it flies there (degrees clockwise from north). In from about 39 km south-west, out at sea off Ashdod, flying+ /// north-north-east up the coast; out to about 34 km south-south-east, inland, flying due south. Chosen so neither turn+ /// first swings the other way (the heading turns one way only, to within a few degrees).</summary>+ public static readonly Vector2 FromM = new Vector2(-25000f, -30000f), ToM = new Vector2(16000f, -30000f);+ public const float FromBearing = 20f, ToBearing = 180f;++ /// <summary>DESIGN VALUES: off the pass the path runs this many times faster than the real clock, easing in over+ /// <see cref="RampS"/> real seconds from the pass's own pace, so the speed never jumps.</summary>+ public const float Speedup = 8f, RampS = 2f;++ /// <summary>DESIGN VALUE: the wing flies the raid this many seconds after the lead. Two Dakotas never meet while their+ /// centres are more than 2 x 0.54 x 9.8 = 10.6 km apart (SeaAirCollection.DakotaTrailShare); on the pass, the slowest+ /// part of the path, 15 s is about 11.4 km.</summary>+ public const float TrailS = 15f;++ /// <summary>DESIGN VALUE: the share of each turn's path time over which its bank eases from the loop's at the join and+ /// from level at the far end, so the bank never jumps.</summary>+ public const float BankEaseShare = 0.15f;++ /// <summary>Real seconds from the pass's end to the turn's far end (the warp's inverse at <see cref="TurnS"/>).</summary>+ public static float TurnRealS => (TurnS + (Speedup - 1f) * 0.5f * RampS) / Speedup;++ /// <summary>Seconds from <see cref="Start"/> to the middle of the lead's pass over Tel Aviv.</summary>+ public static float ArriveS => PassS + TurnRealS;++ /// <summary>How long the raid lasts (s): until the wing reaches the end of its way out.</summary>+ public static float Seconds => 2f * ArriveS + TrailS;++ /// <summary>Aircraft <paramref name="plane"/>'s raid time (0 the lead, 1 its wing) <paramref name="seconds"/> after the+ /// raid starts.</summary>+ public static float U(float seconds, int plane) => seconds - ArriveS - plane * TrailS;++ /// <summary>The seconds after the raid starts when aircraft <paramref name="plane"/> is at raid time <paramref name="u"/>.</summary>+ public static float SecondsAt(float u, int plane) => u + ArriveS + plane * TrailS;++ /// <summary>The path time at raid time <paramref name="u"/>: u on the pass; beyond it, faster by <see cref="Speedup"/>+ /// after a smooth ramp of <see cref="RampS"/> (the pace's rise is a smoothstep, so this is its integral).</summary>+ public static float PathTime(float u)+ {+ float r = Mathf.Abs(u) - PassS;+ if (r <= 0f) return u;+ float g;+ if (r < RampS) { float y = r / RampS; g = r + (Speedup - 1f) * RampS * (y * y * y - 0.5f * y * y * y * y); }+ else g = r + (Speedup - 1f) * (r - 0.5f * RampS);+ return Mathf.Sign(u) * (PassS + g);+ }++ /// <summary>Where an aircraft is at path time <paramref name="tau"/>, from its loop's centre (world x, z, m), as+ /// SeaAirCollection.DakotaLoopOffset: the loop itself on the pass; a cubic Hermite curve from the start to the pass and+ /// from the pass to the end, at the loop's speed and heading where it joins; a straight line before the start and+ /// after the end.</summary>+ public static Vector2 Offset(float tau)+ {+ if (Mathf.Abs(tau) <= PassS) return SeaAirCollection.DakotaLoopOffset(tau);+ Side(tau, out var at, out _, out _, out _, out _);+ return at;+ }++ /// <summary>The aircraft's turn at path time <paramref name="tau"/>, as SeaAirCollection.DakotaTurn: on the pass, the+ /// loop's own; off it, a yaw to the path's heading (<paramref name="forward"/>) and a bank (<paramref name="bank"/>,+ /// positive for a left turn, its left wing down) from the path's curvature seen from above, as the loop's+ /// (SeaAirCollection.BankFor at the Dakotas' scale), signed by the turn's side and eased in at each end of a turn+ /// (<see cref="BankEaseShare"/>).</summary>+ public static Quaternion Turn(float tau, out Vector3 forward, out float bank)+ {+ if (Mathf.Abs(tau) <= PassS) return SeaAirCollection.DakotaTurn(tau, out forward, out bank);+ Side(tau, out _, out var velocity, out var accel, out float toJoin, out float toFar);+ var heading = velocity.normalized;+ forward = new Vector3(heading.x, 0f, heading.y);+ var yaw = Quaternion.Euler(0f, -Mathf.Atan2(heading.y, heading.x) * Mathf.Rad2Deg, 0f);+ float speed = velocity.magnitude, cross = velocity.x * accel.y - velocity.y * accel.x;+ float curvature = speed > 1f ? cross / (speed * speed * speed) : 0f;+ float curve = Mathf.Sign(curvature) * SeaAirCollection.BankFor(SeaAirCollection.DakotaLoopScale * Mathf.Abs(curvature));+ float join = SeaAirCollection.DakotaBankDegrees(tau < 0f ? -PassS : PassS);+ float far = Mathf.SmoothStep(0f, 1f, toFar / BankEaseShare), near = Mathf.SmoothStep(0f, 1f, toJoin / BankEaseShare);+ bank = Mathf.Lerp(join, curve * far, near);+ return Quaternion.AngleAxis(bank, forward) * yaw;+ }++ /// <summary>The path off the pass at path time <paramref name="tau"/>: where it is, its velocity and acceleration (per+ /// path second), and how far (share of the turn) it is from the pass's join and from the turn's far end.</summary>+ static void Side(float tau, out Vector2 at, out Vector2 velocity, out Vector2 accel, out float toJoin, out float toFar)+ {+ var telAviv = SeaAirCollection.DakotaLoopOffset(0f);+ float speed = LoopVelocity(PassS).magnitude;+ Vector2 p0, v0, p1, v1; float s;+ if (tau < 0f)+ {+ p0 = telAviv + FromM; v0 = Bearing(FromBearing) * speed;+ p1 = SeaAirCollection.DakotaLoopOffset(-PassS); v1 = LoopVelocity(-PassS);+ s = (tau + PassS + TurnS) / TurnS;+ toJoin = 1f - s; toFar = s;+ }+ else+ {+ p0 = SeaAirCollection.DakotaLoopOffset(PassS); v0 = LoopVelocity(PassS);+ p1 = telAviv + ToM; v1 = Bearing(ToBearing) * speed;+ s = (tau - PassS) / TurnS;+ toJoin = s; toFar = 1f - s;+ }+ if (s < 0f) { at = p0 + v0 * (s * TurnS); velocity = v0; accel = Vector2.zero; return; }+ if (s > 1f) { at = p1 + v1 * ((s - 1f) * TurnS); velocity = v1; accel = Vector2.zero; return; }+ float s2 = s * s, s3 = s2 * s, d = TurnS;+ at = (2f * s3 - 3f * s2 + 1f) * p0 + (s3 - 2f * s2 + s) * d * v0 + (-2f * s3 + 3f * s2) * p1 + (s3 - s2) * d * v1;+ velocity = ((6f * s2 - 6f * s) * p0 + (3f * s2 - 4f * s + 1f) * d * v0 + (-6f * s2 + 6f * s) * p1 + (3f * s2 - 2f * s) * d * v1) / d;+ accel = ((12f * s - 6f) * p0 + (6f * s - 4f) * d * v0 + (-12f * s + 6f) * p1 + (6f * s - 2f) * d * v1) / (d * d);+ }++ /// <summary>The loop's velocity (world x, z, m a second) <paramref name="seconds"/> into it: the derivative of+ /// SeaAirCollection.DakotaLoopOffset.</summary>+ static Vector2 LoopVelocity(float seconds)+ {+ float w = 2f * Mathf.PI / SeaAirCollection.DakotaLoopSeconds, a = w * seconds;+ return new Vector2(SeaAirCollection.DakotaLoopHalfLengthM * w * Mathf.Cos(a), SeaAirCollection.DakotaLoopHalfWidthM * w * Mathf.Sin(a));+ }++ /// <summary>A unit direction (world x east, z north) at <paramref name="degrees"/> clockwise from north.</summary>+ static Vector2 Bearing(float degrees) => new Vector2(Mathf.Sin(degrees * Mathf.Deg2Rad), Mathf.Cos(degrees * Mathf.Deg2Rad));++ static float? startedAt;++ /// <summary>True from <see cref="Start"/> until <see cref="Stop"/>.</summary>+ public static bool Flying => startedAt.HasValue;++ /// <summary>The seconds since the raid started, when it is flying.</summary>+ public static bool Since(out float seconds)+ {+ seconds = startedAt.HasValue ? SpitfireLoop.Clock() - startedAt.Value : 0f;+ return startedAt.HasValue;+ }++ /// <summary>True once the raid has flown its <see cref="Seconds"/>, or when it is not flying.</summary>+ public static bool Over => !Since(out float seconds) || seconds >= Seconds;++ /// <summary>Starts the raid now, when a Dakota is in the scene (they stream in, and fly only on their dates,+ /// SeaAirCollection.DakotaFrom); false, and nothing flies, when none is.</summary>+ public static bool Start()+ {+ if (Object.FindAnyObjectByType<DakotaLoop>() == null) return false;+ startedAt = SpitfireLoop.Clock();+ return true;+ }++ /// <summary>Ends the raid: the Dakotas go back to their loop's clock at their next frame. Safe to call at any time.</summary>+ public static void Stop() => startedAt = null;+ }+}diff --git a/unity/Assets/Scripts/Map/Collection/DakotaRaidFlight.cs.meta b/unity/Assets/Scripts/Map/Collection/DakotaRaidFlight.cs.metanew file mode 100644index 000000000..96430ff60--- /dev/null+++ b/unity/Assets/Scripts/Map/Collection/DakotaRaidFlight.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: f12aebe1850c4938b303a2ff33586142diff --git a/unity/Assets/Scripts/UI/AdvisorPresenter.cs b/unity/Assets/Scripts/UI/AdvisorPresenter.csindex 9475a2f6a..011303b0e 100644--- a/unity/Assets/Scripts/UI/AdvisorPresenter.cs+++ b/unity/Assets/Scripts/UI/AdvisorPresenter.cs@@ -197,11 +197,12 @@ namespace Statecraft.Game.UI/// Covered(hudRoot) alone misses Settings, and Next's focus would steal the screen's own (#1915).</summary>bool ScreenOpen() => Covered(hudRoot) || hudRoot.ClassListContains(ScreenNav.ScreenOpenClass);- /// <summary>A modal layer is open (spec 4.2): the start screen, the opening (#530), the raid card on New game, the open decision card, the capture+ /// <summary>A modal layer is open (spec 4.2): the start screen, the opening (#530), the raid card on New game and the raid flight before it (#3000), the open decision card, the capture/// dialog, the turn report, an outcome clip, the end screen; and, on the two-row HUD, any side screen (it takes the full width).</summary>public static bool Covered(VisualElement hudRoot) =>hudRoot.ClassListContains(StartScreenPresenter.OpenClass) || hudRoot.ClassListContains(OpeningPresenter.OpenClass)- || hudRoot.ClassListContains(RaidCardPresenter.OpenClass) || hudRoot.ClassListContains(EventCardPresenter.OpenClass)+ || hudRoot.ClassListContains(RaidCardPresenter.OpenClass) || hudRoot.ClassListContains(RaidFlightPresenter.OpenClass)+ || hudRoot.ClassListContains(EventCardPresenter.OpenClass)|| hudRoot.ClassListContains(CaptureDialogPresenter.OpenClass) || hudRoot.ClassListContains(TurnReportPresenter.OpenClass)|| hudRoot.ClassListContains(OutcomePresenter.OpenClass) || hudRoot.ClassListContains(EndScreenPresenter.OpenClass)|| (hudRoot.ClassListContains(HudPresenter.TwoRowClass) && hudRoot.ClassListContains(ScreenNav.ScreenOpenClass));@@ -652,7 +653,8 @@ namespace Statecraft.Game.UI}bool HardMediaCover() => hudRoot.ClassListContains(StartScreenPresenter.OpenClass) || hudRoot.ClassListContains(OpeningPresenter.OpenClass)- || hudRoot.ClassListContains(RaidCardPresenter.OpenClass) || hudRoot.ClassListContains(EventCardPresenter.OpenClass)+ || hudRoot.ClassListContains(RaidCardPresenter.OpenClass) || hudRoot.ClassListContains(RaidFlightPresenter.OpenClass)+ || hudRoot.ClassListContains(EventCardPresenter.OpenClass)|| hudRoot.ClassListContains(CaptureDialogPresenter.OpenClass) || hudRoot.ClassListContains(TurnReportPresenter.OpenClass)|| hudRoot.ClassListContains(OutcomePresenter.OpenClass) || hudRoot.ClassListContains(EndScreenPresenter.OpenClass)|| hudRoot.ClassListContains(FeedbackPresenter.OpenClass) || hudRoot.ClassListContains(SharePresenter.OpenClass);diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.csindex 208c2f532..9c9cee338 100644--- a/unity/Assets/Scripts/UI/GameRoot.cs+++ b/unity/Assets/Scripts/UI/GameRoot.cs@@ -62,6 +62,7 @@ namespace Statecraft.Game.UIStartScreenPresenter? start;OpeningPresenter? opening;RaidCardPresenter? raid;+ RaidFlightPresenter? raidFlight;EventCardPresenter? card;/// <summary>Tests: the decision card of the last Begin.</summary>internal EventCardPresenter? Card => card;@@ -129,6 +130,9 @@ namespace Statecraft.Game.UI/// <summary>Whether the last Begin was a smoke run: the language switch then leaves the UI as it is, so the golden-seed/// game never gets the autosave and New Game a normal Begin gives (SwitchLanguage).</summary>bool smokeRun;+ /// <summary>True while Shutdown disposes the presenters: the start screen's Dispose reports it closed, which must not+ /// play a New game's intro (the raid flight, card or advisors) for a session that is going away (#3003).</summary>+ bool shuttingDown;public SimBridge? Bridge { get; private set; }/// <summary>Where the autosave lives; null (the default) = SaveStore.ForPlatform(). Tests set a temporary folder.</summary>@@ -147,6 +151,12 @@ namespace Statecraft.Game.UI/// <summary>The Tel Aviv raid card on New game outside Play mode: off by default, as OpeningInEditMode; its own tests/// set it.</summary>internal bool RaidCardInEditMode { get; set; }+ /// <summary>The raid flight before that card (#3000) outside Play mode: off by default, as RaidCardInEditMode; its own+ /// tests set it, with <see cref="RaidFlightForTests"/>.</summary>+ internal bool RaidFlightInEditMode { get; set; }+ /// <summary>Tests: flies the raid in place of the Dakotas (EditMode has no frame clock to fly them by): given what to+ /// call when it ends by itself, returns how to stop it, or null when there is nothing to fly.</summary>+ internal Func<Action, Action?>? RaidFlightForTests { get; set; }/// <summary>The start menu's music (#39) outside Play mode: off by default, so EditMode tests stay silent and fetch/// nothing; its wiring test sets it.</summary>internal bool MenuMusicInEditMode { get; set; }@@ -547,7 +557,7 @@ namespace Statecraft.Game.UIif (smoke == 0) Own(new AchievementReporter(bridge, () => PlatformServices.Current));// An outcome clip holds the pointer while it shows and in the frame it closes (the skipping click selects no hex).- Func<Vector2, bool> overUi = p => opening?.HoldsThePointer == true || raid?.HoldsThePointer == true || outcomes?.HoldsThePointer == true || UiPointer.IsOverUi(root.panel, p, Screen.height);+ Func<Vector2, bool> overUi = p => opening?.HoldsThePointer == true || raidFlight?.HoldsThePointer == true || raid?.HoldsThePointer == true || outcomes?.HoldsThePointer == true || UiPointer.IsOverUi(root.panel, p, Screen.height);var terrain = map.Terrain;var size = terrain.terrainData.size;var oldBounds = cameraController.Bounds;@@ -727,6 +737,22 @@ namespace Statecraft.Game.UI() => advisor?.NewGame(),video == null ? null : Own(new CardVideo()))); // its own player: no clip in the automated runs either}+ // The Dakotas' raid before that card (#3000, PR 2 of #2968; the Dakotas by "Reuse Dakotas (Recommended)"): only where+ // the card shows, and only with video on, so never in the automated runs (CardVideo.ForcedOff) nor in EditMode but+ // where a test asks for it (RaidFlightInEditMode). It flies the Dakotas already on the map (DakotaRaidFlight) and+ // reads no sim state; a click or Escape skips it, and the card follows either way (PlayNewGameIntro).+ if (raid != null && video != null && (Application.isPlaying || RaidFlightInEditMode))+ {+ Func<Action, Action?> fly = RaidFlightForTests ?? (ended =>+ {+ if (!Application.isPlaying || !Statecraft.Game.Map.Collection.DakotaRaidFlight.Start()) return null;+ var poll = root.schedule.Execute(() => { if (Statecraft.Game.Map.Collection.DakotaRaidFlight.Over) ended(); }).Every(100);+ return () => { poll.Pause(); Statecraft.Game.Map.Collection.DakotaRaidFlight.Stop(); };+ });+ raidFlight = Own(new RaidFlightPresenter(root, fly,+ shown => { if (cameraController != null) cameraController.enabled = !shown && start?.IsOpen != true; },+ () => raid?.Show()));+ }// The start screen goes up in the same frame the loading state ends, so the HUD never flashes before it. While it// shows, the camera keys are off (keyboard pan would otherwise move the hidden map; plan amendment A4).if (showsStart) // newGame is made above whenever smoke == 0@@ -1115,10 +1141,14 @@ namespace Statecraft.Game.UI/// <summary>What a new game plays after its opening, or at once without one (owner, 8 Nov 2026, "Film, raid, card,/// advisors (Recommended)"): the raid card, whose OK starts the turn 1 advisor chain; the chain at once when there is no/// card. Never on Continue or a load (the start screen's close calls Resume then). New game can report one game twice- /// (the start screen's close and Started); RaidCardPresenter.Show and AdvisorPresenter.NewGame both ignore the second.</summary>+ /// (the start screen's close and Started); RaidCardPresenter.Show and AdvisorPresenter.NewGame both ignore the second,+ /// and so does this while the raid flight (#3000) or the card it leads to is up. The flight, where there is one, flies+ /// first and shows the card when it ends or is skipped.</summary>void PlayNewGameIntro(){- if (raid != null) raid.Show();+ if (shuttingDown || raidFlight?.IsOpen == true || raid?.IsOpen == true) return;+ if (raidFlight != null) raidFlight.Show();+ else if (raid != null) raid.Show();else advisor?.NewGame();}@@ -1128,6 +1158,7 @@ namespace Statecraft.Game.UIvoid Shutdown(bool keepCompanionPage = false){StopAllCoroutines();+ shuttingDown = true;// The card first: disposing the start screen uncovers the decision layer, and a card still waiting for it would// then render and load the photo catalog for a game that is going away (#592; since the GDD cutover a new game's// card waits under the screen, so New Game's Begin would load it).@@ -1140,10 +1171,11 @@ namespace Statecraft.Game.UIowned.Clear();savePersistenceResult = null;if (hoveredCity != null) { hoveredCity = null; HandCursor(false); } // the next Begin's pills start unlit- companion = null; minimap = null; unseenSkipped = null; labels = null; nav = null; start = null; opening = null; raid = null; card = null; outcomes = null; playback = null; report = null; end = null; advisor = null; cabinet = null; budgetScreen = null; newGame = null; encyclopedia = null; feedback = null; share = null; info = null; rig = null; drawn = null; drawnSites = null; units = null; Regions = null; logCamera = false;+ companion = null; minimap = null; unseenSkipped = null; labels = null; nav = null; start = null; opening = null; raidFlight = null; raid = null; card = null; outcomes = null; playback = null; report = null; end = null; advisor = null; cabinet = null; budgetScreen = null; newGame = null; encyclopedia = null; feedback = null; share = null; info = null; rig = null; drawn = null; drawnSites = null; units = null; Regions = null; logCamera = false;// A ?profile run cut short (a stopped coroutine never reaches its restore line) must not leave the terrain at the// profile's pixel error (Task 24 review M1). Nothing else changes it, so restoring is always right.if (map != null && map.Terrain != null) map.Terrain.heightmapPixelError = MapBuilder.TerrainPixelError;+ shuttingDown = false;}/// <summary>Draws the placements only when State.Placements with the built city projects (PlacementLayer.Drawn, #1123)@@ -1301,6 +1333,13 @@ namespace Statecraft.Game.UI// A reviewed opening is part of the normal media path: the instrument uses its actual Skip control.if (hud.ClassListContains(OpeningPresenter.OpenClass)&& !Press(root.Q<Button>("opening-skip"), s => log(s.Replace("SMOKE FAIL", "FIRST CARD FAIL")))) yield break;+ // So is the raid flight after it (RaidFlightPresenter, #3000): skipped as a player's Escape skips it; the card follows.+ if (hud.ClassListContains(RaidFlightPresenter.OpenClass))+ {+ var flight = root.Q("raid-flight-layer");+ using (var cancel = NavigationCancelEvent.GetPooled()) { cancel.target = flight; flight.SendEvent(cancel); }+ if (hud.ClassListContains(RaidFlightPresenter.OpenClass)) { log("FIRST CARD FAIL the raid flight did not skip"); yield break; }+ }// So is the raid card after it (RaidCardPresenter): its only control, OK.if (hud.ClassListContains(RaidCardPresenter.OpenClass)&& !Press(root.Q<Button>("raid-ok"), s => log(s.Replace("SMOKE FAIL", "FIRST CARD FAIL")))) yield break;@@ -1344,11 +1383,13 @@ namespace Statecraft.Game.UI// takes the Cancel event when it has the focus), and so on the open capture dialog (CaptureDialogPresenter.Escape),// which shows only while the card does not.// The report panel (#1169) and the share panel (#1170) are over everything: their Escape goes no further.- // Nor does the opening's (#530), over all but those two, in the frame it closes too; nor the raid card's after it (its OK).+ // Nor does the opening's (#530), over all but those two, in the frame it closes too; nor the raid flight's after it+ // (#3000, which shows the card); nor the raid card's after that (its OK).// Nor does the advisors' popup's, with the focus inside it (AdvisorPresenter.Escape, also in the frame its Cancel closed it).if (UnityEngine.InputSystem.Keyboard.current?.escapeKey.wasPressedThisFrame == true&& feedback?.Escape() != true && share?.Escape() != true && advisor?.Escape() != true&& opening?.ClosedThisFrame != true && opening?.Escape() != true+ && raidFlight?.ClosedThisFrame != true && raidFlight?.Escape() != true&& raid?.ClosedThisFrame != true && raid?.Escape() != true){bool done = outcomes?.SkipAll() == true || outcomes?.ClosedThisFrame == true;diff --git a/unity/Assets/Scripts/UI/RaidCardPresenter.cs b/unity/Assets/Scripts/UI/RaidCardPresenter.csindex d420b4415..02290b54e 100644--- a/unity/Assets/Scripts/UI/RaidCardPresenter.cs+++ b/unity/Assets/Scripts/UI/RaidCardPresenter.cs@@ -26,7 +26,7 @@ namespace Statecraft.Game.UIreadonly EventCallback<NavigationCancelEvent> onCancel;readonly PressSource presses;bool disposed;- int closedFrame = -1;+ int closedFrame = -1, shownFrame = -1;public bool IsOpen { get; private set; }public bool ClosedThisFrame => closedFrame == Time.frameCount;public bool HoldsThePointer => IsOpen || ClosedThisFrame;@@ -56,7 +56,15 @@ namespace Statecraft.Game.UImedia.tooltip = hebrew && !string.IsNullOrWhiteSpace(data.Clip.AltHe) ? data.Clip.AltHe : data.Clip.Alt;onOk = () => Close(finish: true);ok.clicked += onOk;- onCancel = e => { if (Escape()) e.StopPropagation(); };+ // One press, two readers (#3000): GameRoot's poll can skip the raid flight (or the opening) and so show this card,+ // whose Show focuses OK, and the same Escape then reaches OK as the UI Cancel, in that frame or the next+ // (OutcomePresenter.HoldsThePointer's one-frame margin). That Cancel was the press that showed the card: used, the+ // card stays up. GameRoot's poll (Escape) is not held back: it reads a press only once.+ onCancel = e =>+ {+ if (IsOpen && Time.frameCount - shownFrame <= 1) { e.StopPropagation(); return; }+ if (Escape()) e.StopPropagation();+ };layer.RegisterCallback(onCancel);presses = new PressSource(layer);layer.style.display = DisplayStyle.None;@@ -67,7 +75,7 @@ namespace Statecraft.Game.UIpublic void Show(){if (disposed || IsOpen) return;- IsOpen = true;+ IsOpen = true; shownFrame = Time.frameCount;root.AddToClassList(OpenClass); layer.style.display = DisplayStyle.Flex;ScreenNav.DisableCovered(root);shownChanged(true);diff --git a/unity/Assets/Scripts/UI/RaidFlightPresenter.cs b/unity/Assets/Scripts/UI/RaidFlightPresenter.csnew file mode 100644index 000000000..8aa86eb8e--- /dev/null+++ b/unity/Assets/Scripts/UI/RaidFlightPresenter.cs@@ -0,0 +1,90 @@+#nullable enable+using System;+using UnityEngine;+using UnityEngine.UIElements;++namespace Statecraft.Game.UI+{+ /// <summary>New game's raid flight (#3000, PR 2 of #2968): after the opening and before the raid card, the Egyptian Dakotas+ /// fly in over Tel Aviv, bomb it and fly away (Map.Collection.DakotaRaidFlight), with the HUD hidden as under the card, and+ /// then the card shows. Any click on the map, or Escape, skips the rest of the flight; the card still follows. No bridge,+ /// commands, RNG or save access. GameRoot plays it only where it plays the card, and never in the automated runs.</summary>+ public sealed class RaidFlightPresenter : IDisposable+ {+ public const string OpenClass = "raid-flight-open";++ readonly VisualElement root, layer;+ readonly Func<Action, Action?> fly;+ readonly Action<bool> shownChanged;+ readonly Action finished;+ readonly EventCallback<PointerDownEvent> onPointer;+ readonly EventCallback<NavigationCancelEvent> onCancel;+ Action? stop;+ int run;+ bool disposed;+ int closedFrame = -1;++ public bool IsOpen { get; private set; }+ public bool ClosedThisFrame => closedFrame == Time.frameCount;+ /// <summary>The click that skips the flight must not also reach the map underneath (GameRoot's overUi).</summary>+ public bool HoldsThePointer => IsOpen || ClosedThisFrame;++ /// <param name="fly">Starts the flight and is told when it ends of itself; returns how to stop it, or null when there+ /// is nothing to fly (no Dakota in the scene): then the card follows at once.</param>+ /// <param name="shownChanged">Told when the flight covers the HUD and when it no longer does.</param>+ /// <param name="finished">Called once the flight has ended or been skipped (not on Dispose): GameRoot shows the card.</param>+ public RaidFlightPresenter(VisualElement root, Func<Action, Action?> fly, Action<bool> shownChanged, Action finished)+ {+ this.root = root.Q("root") ?? root; this.fly = fly; this.shownChanged = shownChanged; this.finished = finished;+ layer = root.Q("raid-flight-layer");+ onPointer = e => { if (IsOpen) { Close(finish: true); e.StopPropagation(); } };+ onCancel = e => { if (Escape()) e.StopPropagation(); };+ layer.RegisterCallback(onPointer);+ layer.RegisterCallback(onCancel);+ layer.style.display = DisplayStyle.None;+ }++ /// <summary>Flies the raid; nothing while it flies (the start screen's close and New game's Started can both report one+ /// new game) or after Dispose. With nothing to fly, it finishes at once.</summary>+ public void Show()+ {+ if (disposed || IsOpen) return;+ int mine = ++run;+ IsOpen = true;+ root.AddToClassList(OpenClass); layer.style.display = DisplayStyle.Flex;+ ScreenNav.DisableCovered(root);+ shownChanged(true);+ stop = fly(() => { if (mine == run) Close(finish: true); });+ if (stop == null && IsOpen && mine == run) Close(finish: true);+ // The layer takes the keyboard focus, so Escape reaches it as a NavigationCancelEvent.+ if (IsOpen) { layer.focusable = true; layer.Focus(); }+ }++ /// <summary>Skips the rest of the flight (Escape); false when it is not flying.</summary>+ public bool Escape()+ {+ if (!IsOpen) return false;+ Close(finish: true);+ return true;+ }++ void Close(bool finish)+ {+ if (!IsOpen) return;+ IsOpen = false; closedFrame = Time.frameCount; run++;+ var halt = stop; stop = null;+ halt?.Invoke();+ layer.style.display = DisplayStyle.None; layer.focusable = false; root.RemoveFromClassList(OpenClass);+ ScreenNav.DisableCovered(root); shownChanged(false);+ if (finish) finished();+ }++ public void Dispose()+ {+ if (disposed) return;+ disposed = true; Close(finish: false);+ layer.UnregisterCallback(onPointer);+ layer.UnregisterCallback(onCancel);+ }+ }+}diff --git a/unity/Assets/Scripts/UI/RaidFlightPresenter.cs.meta b/unity/Assets/Scripts/UI/RaidFlightPresenter.cs.metanew file mode 100644index 000000000..deeb4aec8--- /dev/null+++ b/unity/Assets/Scripts/UI/RaidFlightPresenter.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: f510f6d086ce42e7ba7a5447f1050fd0diff --git a/unity/Assets/Scripts/UI/ScreenNav.cs b/unity/Assets/Scripts/UI/ScreenNav.csindex f90657bc8..473ca44ce 100644--- a/unity/Assets/Scripts/UI/ScreenNav.cs+++ b/unity/Assets/Scripts/UI/ScreenNav.cs@@ -44,8 +44,10 @@ namespace Statecraft.Game.UIpublic static void DisableCovered(VisualElement root){var r = root.Q("root") ?? root;- // The raid card on New game (RaidCardPresenter) covers the HUD as the opening does.- bool opening = r.ClassListContains(OpeningPresenter.OpenClass) || r.ClassListContains(RaidCardPresenter.OpenClass);+ // The raid card on New game (RaidCardPresenter), and the raid flight before it (RaidFlightPresenter), cover the HUD+ // as the opening does.+ bool opening = r.ClassListContains(OpeningPresenter.OpenClass) || r.ClassListContains(RaidCardPresenter.OpenClass)+ || r.ClassListContains(RaidFlightPresenter.OpenClass);bool start = r.ClassListContains(StartScreenPresenter.OpenClass) || opening;r.Q("start-screen")?.SetEnabled(!opening);bool screen = r.ClassListContains(ScreenOpenClass);diff --git a/unity/Assets/Tests/EditMode/DakotaRaidFlightTests.cs b/unity/Assets/Tests/EditMode/DakotaRaidFlightTests.csnew file mode 100644index 000000000..0b1ee1995--- /dev/null+++ b/unity/Assets/Tests/EditMode/DakotaRaidFlightTests.cs@@ -0,0 +1,159 @@+#nullable enable+using NUnit.Framework;+using Statecraft.Game.Map.Collection;+using UnityEditor.SceneManagement;+using UnityEngine;+using Object = UnityEngine.Object;++/// <summary>New game's raid flight (#3000, PR 2 of #2968): the Dakotas fly in from the south-west along the coast, over Tel Aviv+/// on their loop's own pass (where their bombs fall, SeaAirCollectionTests), and away south (DakotaRaidFlight). Pure path+/// checks; the scene's aircraft and bombs are in SeaAirCollectionTests, the flight's place in a new game in+/// RaidFlightRoutingTests.</summary>+public class DakotaRaidFlightTests+{+ const float Step = 0.01f;++ [TearDown]+ public void Land()+ {+ DakotaRaidFlight.Stop();+ EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);+ }++ static Vector2 At(float seconds, int plane) => DakotaRaidFlight.Offset(DakotaRaidFlight.PathTime(DakotaRaidFlight.U(seconds, plane)));++ static Vector3 Forward(float seconds, int plane, out float bank)+ {+ DakotaRaidFlight.Turn(DakotaRaidFlight.PathTime(DakotaRaidFlight.U(seconds, plane)), out var forward, out bank);+ return forward;+ }++ [Test]+ public void ThePassOverTelAvivIsTheLoopItself()+ {+ for (float u = -DakotaRaidFlight.PassS; u <= DakotaRaidFlight.PassS; u += 0.25f)+ {+ Assert.AreEqual(u, DakotaRaidFlight.PathTime(u), 1e-5f, "real pace on the pass");+ var turn = DakotaRaidFlight.Turn(u, out var forward, out float bank);+ var loop = SeaAirCollection.DakotaTurn(u, out var loopForward, out float loopBank);+ Assert.Less((DakotaRaidFlight.Offset(u) - SeaAirCollection.DakotaLoopOffset(u)).magnitude, 1e-3f, $"on the loop at {u}");+ Assert.Less(Quaternion.Angle(turn, loop), 1e-3f, $"turned as on the loop at {u}");+ Assert.AreEqual(loopBank, bank, 1e-4f);+ Assert.Less((forward - loopForward).magnitude, 1e-5f);+ }+ Assert.Less((At(DakotaRaidFlight.ArriveS, 0) - SeaAirCollection.DakotaLoopOffset(0f)).magnitude, 1e-3f, "the lead over Tel Aviv at ArriveS");+ Assert.Less((At(DakotaRaidFlight.ArriveS + DakotaRaidFlight.TrailS, 1) - SeaAirCollection.DakotaLoopOffset(0f)).magnitude, 1e-3f, "the wing TrailS later");+ Assert.AreEqual(3.5f, DakotaRaidFlight.U(DakotaRaidFlight.SecondsAt(3.5f, 1), 1), 1e-4f, "SecondsAt is U's inverse");+ }++ [Test]+ public void ItComesFromTheSouthWestAlongTheCoastAndLeavesSouth()+ {+ var telAviv = SeaAirCollection.DakotaLoopOffset(0f);+ var from = At(0f, 0) - telAviv;+ var to = At(DakotaRaidFlight.Seconds, 1) - telAviv;+ Assert.Less((from - DakotaRaidFlight.FromM).magnitude, 1f, $"the lead starts at FromM ({from})");+ Assert.Less((to - DakotaRaidFlight.ToM).magnitude, 1f, $"the wing ends at ToM ({to})");+ Assert.Less(from.x, 0f, "west of Tel Aviv"); Assert.Less(from.y, 0f, "south of it");+ Assert.Less(to.y, -20000f, "far south of it at the end");+ var inbound = Forward(0f, 0, out _);+ Assert.Greater(inbound.z, 0.9f, "flying north along the coast");+ Assert.Greater(inbound.x, 0f, "a little east of north");+ var outbound = Forward(DakotaRaidFlight.Seconds, 1, out _);+ Assert.Less(outbound.z, -0.99f, "flying south at the end");+ // Every point is south of the pass's latitude plus the loop's southern half-width: it never crosses the loop's north.+ for (float s = 0f; s <= DakotaRaidFlight.Seconds; s += 0.5f)+ for (int p = 0; p < 2; p++)+ Assert.Less(At(s, p).y, 0f, $"south of the loop's centre at {s} s (plane {p})");+ }++ [Test]+ public void ThePathIsSmoothAndBanksLikeTheLoop()+ {+ float maxStep = 0f, maxHeading = 0f, maxBank = 0f, most = 0f;+ for (int p = 0; p < 2; p++)+ {+ var last = At(0f, p); var lastForward = Forward(0f, p, out float lastBank);+ for (float s = Step; s <= DakotaRaidFlight.Seconds + 1e-4f; s += Step)+ {+ var at = At(s, p); var forward = Forward(s, p, out float bank);+ maxStep = Mathf.Max(maxStep, (at - last).magnitude);+ maxHeading = Mathf.Max(maxHeading, Vector3.Angle(forward, lastForward));+ maxBank = Mathf.Max(maxBank, Mathf.Abs(bank - lastBank));+ most = Mathf.Max(most, Mathf.Abs(bank));+ Assert.AreEqual(0f, forward.y, 1e-6f); Assert.AreEqual(1f, forward.magnitude, 1e-4f);+ last = at; lastForward = forward; lastBank = bank;+ }+ }+ TestContext.WriteLine($"per {Step} s: step {maxStep:0.0} m, heading {maxHeading:0.00} deg, bank {maxBank:0.00} deg; most bank {most:0.0} deg");+ Assert.Less(maxStep, 100f, "no jump");+ Assert.Less(maxHeading, 1f, "no snap in heading");+ Assert.Less(maxBank, 1f, "no snap in bank");+ Assert.LessOrEqual(most, Statecraft.Game.Map.Units.UnitShowcase.BankDegrees + 1e-3f, "never past the tokens' bank");+ }++ [Test]+ public void BothTurnsAreToTheRightAndBankRight()+ {+ // In, from 20 degrees to the pass's east, and out, from east to south: both to the right, so their bank is negative,+ // as the loop's left turns bank positive. Level (within the loop's own bank at the join) everywhere else.+ float join = Mathf.Max(SeaAirCollection.DakotaBankDegrees(-DakotaRaidFlight.PassS), SeaAirCollection.DakotaBankDegrees(DakotaRaidFlight.PassS));+ foreach (var (from, to, name) in new[] {+ (0f, DakotaRaidFlight.SecondsAt(-DakotaRaidFlight.PassS, 0), "in"),+ (DakotaRaidFlight.SecondsAt(DakotaRaidFlight.PassS, 0), DakotaRaidFlight.Seconds - DakotaRaidFlight.TrailS, "out") })+ {+ float least = 0f, most = float.MinValue;+ for (float s = from; s <= to; s += Step) { Forward(s, 0, out float bank); least = Mathf.Min(least, bank); most = Mathf.Max(most, bank); }+ TestContext.WriteLine($"turn {name}: bank {least:0.0} to {most:0.00} deg");+ Assert.Less(least, -10f, $"banked right on the way {name}");+ Assert.LessOrEqual(most, join + 1e-3f, $"never banked left on the way {name}, past the loop's own bank where it joins");+ }+ }++ [Test]+ public void TheWingNeverMeetsTheLead()+ {+ float apart = 2f * SeaAirCollection.DakotaReachShare * SeaAirCollection.SizeOf(SeaAirCollection.Dakota), least = float.MaxValue;+ for (float s = 0f; s <= DakotaRaidFlight.Seconds; s += Step)+ least = Mathf.Min(least, (At(s, 0) - At(s, 1)).magnitude);+ TestContext.WriteLine($"closest {least:0} m, {apart:0} m needed");+ Assert.Greater(least, apart, "every point of a Dakota is within DakotaReachShare of its span of its centre");+ }++ [Test]+ public void ItLastsUntilTheWingHasLeft()+ {+ Assert.AreEqual(DakotaRaidFlight.PassS + DakotaRaidFlight.TurnS, DakotaRaidFlight.PathTime(DakotaRaidFlight.U(DakotaRaidFlight.Seconds, 1)), 1e-3f,+ "the wing at the end of its way out");+ Assert.AreEqual(-(DakotaRaidFlight.PassS + DakotaRaidFlight.TurnS), DakotaRaidFlight.PathTime(DakotaRaidFlight.U(0f, 0)), 1e-3f,+ "the lead at the start of its way in");+ Assert.That(DakotaRaidFlight.Seconds, Is.InRange(30f, 50f), "not a minute long");+ }++ [Test]+ public void ItFliesOnlyWithADakotaAndEndsByTheMapClock()+ {+ Assert.IsFalse(DakotaRaidFlight.Start(), "no Dakota in an empty scene: nothing flies");+ Assert.IsFalse(DakotaRaidFlight.Flying);+ Assert.IsTrue(DakotaRaidFlight.Over, "not flying is over");+ var clock = SpitfireLoop.Clock;+ var go = new GameObject("dakota", typeof(DakotaLoop));+ try+ {+ float now = 100f;+ SpitfireLoop.Clock = () => now;+ Assert.IsTrue(DakotaRaidFlight.Start());+ Assert.IsTrue(DakotaRaidFlight.Flying);+ now += 1f;+ Assert.IsTrue(DakotaRaidFlight.Since(out float seconds)); Assert.AreEqual(1f, seconds, 1e-4f);+ Assert.IsFalse(DakotaRaidFlight.Over);+ now = 100f + DakotaRaidFlight.Seconds;+ Assert.IsTrue(DakotaRaidFlight.Over, "over after Seconds");+ Assert.IsTrue(DakotaRaidFlight.Flying, "until it is stopped");+ DakotaRaidFlight.Stop();+ Assert.IsFalse(DakotaRaidFlight.Flying);+ DakotaRaidFlight.Stop(); // safe twice+ }+ finally { SpitfireLoop.Clock = clock; Object.DestroyImmediate(go); }+ }+}diff --git a/unity/Assets/Tests/EditMode/DakotaRaidFlightTests.cs.meta b/unity/Assets/Tests/EditMode/DakotaRaidFlightTests.cs.metanew file mode 100644index 000000000..cc6306d0d--- /dev/null+++ b/unity/Assets/Tests/EditMode/DakotaRaidFlightTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: acdcfad64d994f4e98c258e57ad07575diff --git a/unity/Assets/Tests/EditMode/GameRootEscapeLayerTests.cs b/unity/Assets/Tests/EditMode/GameRootEscapeLayerTests.csindex fa9a6f4da..cbccbf14f 100644--- a/unity/Assets/Tests/EditMode/GameRootEscapeLayerTests.cs+++ b/unity/Assets/Tests/EditMode/GameRootEscapeLayerTests.cs@@ -1,5 +1,6 @@#nullable enableusing System;+using System.Collections;using System.Collections.Generic;using System.IO;using System.Reflection;@@ -13,6 +14,8 @@ using UnityEditor;using UnityEditor.SceneManagement;using UnityEngine;using UnityEngine.InputSystem;+using UnityEngine.InputSystem.LowLevel;+using UnityEngine.TestTools;using UnityEngine.UIElements;using Object = UnityEngine.Object;@@ -183,6 +186,93 @@ public class GameRootEscapeLayerTests : SharedCameraActionsFixturefinally { field.SetValue(root, own); }}+ /// <summary>#3000: the Escape that skips New game's raid flight shows the raid card in the same frame (the flight's finish).+ /// The press was the flight's: GameRoot's poll of it finds the flight closed this frame (RaidFlightPresenter.ClosedThisFrame)+ /// and leaves the card it just showed open, whether the press reached the flight as the focused layer's Cancel first or only+ /// through the poll. The next Escape closes the card. Booted as RaidFlightRoutingTests boots it, with a flight of its own.</summary>+ [Test]+ public void EscapeThatSkipsTheRaidFlightLeavesTheRaidCardItShowedOpen([Values(false, true)] bool focusedCancel)+ {+ var inputs = GameInputs.FromDisk(Paths.Content, Paths.StreamingMap);+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);+ Object.FindFirstObjectByType<MapScene>().Build(inputs.Map);+ var root = Object.FindFirstObjectByType<GameRoot>();+ root.Store = new SaveStore(saveDir);+ root.Settings = new SettingsStore(Path.Combine(saveDir, "settings")); root.Language = "en";+ root.RaidCardInEditMode = true; root.RaidFlightInEditMode = true;+ int stops = 0;+ root.RaidFlightForTests = ended => () => stops++; // flies until skipped: EditMode has no frame clock+ root.Begin(inputs, 0, startScreen: true);+ keyboard = InputSystem.AddDevice<Keyboard>();+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.IsTrue(HudRoot.ClassListContains(RaidFlightPresenter.OpenClass), "precondition: New game flies the raid");+ Assert.IsFalse(HudRoot.ClassListContains(RaidCardPresenter.OpenClass), "precondition: the card waits for the flight");++ if (focusedCancel)+ {+ var layer = Ui.Q("raid-flight-layer");+ using (var e = NavigationCancelEvent.GetPooled()) { e.target = layer; layer.SendEvent(e); }+ Assert.IsFalse(HudRoot.ClassListContains(RaidFlightPresenter.OpenClass), "precondition: the Cancel skipped the flight");+ Press(keyboard.escapeKey); // the same press, as GameRoot's poll reads it+ Assert.IsTrue(keyboard.escapeKey.wasPressedThisFrame, "precondition: Escape went down this frame");+ typeof(GameRoot).GetMethod("Update", BindingFlags.NonPublic | BindingFlags.Instance)!.Invoke(root, null);+ Release(keyboard.escapeKey);+ }+ else Escape(root);+ Assert.IsFalse(HudRoot.ClassListContains(RaidFlightPresenter.OpenClass), "the Escape skips the flight");+ Assert.AreEqual(1, stops, "the Dakotas are stopped once");+ Assert.IsTrue(HudRoot.ClassListContains(RaidCardPresenter.OpenClass), "and only the flight: the card it showed stays open");++ // A later frame: the flight's close counts as this press's only in the frame it happened (ClosedThisFrame), and an+ // EditMode test cannot advance Time.frameCount between two presses.+ var flight = typeof(GameRoot).GetField("raidFlight", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(root)!;+ typeof(RaidFlightPresenter).GetField("closedFrame", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(flight, -1);+ Escape(root);+ Assert.IsFalse(HudRoot.ClassListContains(RaidCardPresenter.OpenClass), "the next Escape closes the card");+ }++ /// <summary>#3000, seen in a headed WebGL run: one Escape 6 s into the flight ended the flight and the card with it, and the+ /// advisors came up. The flight's layer has the focus. GameRoot's poll reads the press first and skips the flight, whose+ /// finish shows the card, and the card's Show focuses its OK. The same press then reaches the UI as the Cancel, sent to the+ /// element focused now, the card's OK, and bubbles to the card's layer. That Cancel was the flight's: the card stays up.+ /// The Cancel is sent to OK as the panel sends it to the focused element, so the test does not hang on EditMode focus.</summary>+ [UnityTest]+ public IEnumerator OneEscapeThePollTakesFirstSkipsTheRaidFlightAndItsCancelLeavesTheCardUp()+ {+ var inputs = GameInputs.FromDisk(Paths.Content, Paths.StreamingMap);+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);+ Object.FindFirstObjectByType<MapScene>().Build(inputs.Map);+ var root = Object.FindFirstObjectByType<GameRoot>();+ root.Store = new SaveStore(saveDir);+ root.Settings = new SettingsStore(Path.Combine(saveDir, "settings")); root.Language = "en";+ root.RaidCardInEditMode = true; root.RaidFlightInEditMode = true;+ int stops = 0;+ root.RaidFlightForTests = ended => () => stops++; // flies until skipped: EditMode has no frame clock+ root.Begin(inputs, 0, startScreen: true);+ keyboard = InputSystem.AddDevice<Keyboard>();+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.IsTrue(HudRoot.ClassListContains(RaidFlightPresenter.OpenClass), "precondition: New game flies the raid");+ Assert.IsFalse(HudRoot.ClassListContains(RaidCardPresenter.OpenClass), "precondition: the card waits for the flight");++ // The one press, as GameRoot's poll reads it first. Queued by hand: InputTestFixture's Press refuses an EditMode+ // [UnityTest], and this test needs its frame (CameraScreenCoverTests presses keys the same way).+ InputSystem.QueueStateEvent(keyboard, new KeyboardState(Key.Escape)); InputSystem.Update();+ Assert.IsTrue(keyboard.escapeKey.wasPressedThisFrame, "precondition: Escape went down this frame");+ typeof(GameRoot).GetMethod("Update", BindingFlags.NonPublic | BindingFlags.Instance)!.Invoke(root, null);+ Assert.IsFalse(HudRoot.ClassListContains(RaidFlightPresenter.OpenClass), "precondition: the poll skipped the flight");+ Assert.IsTrue(HudRoot.ClassListContains(RaidCardPresenter.OpenClass), "precondition: and the flight's finish showed the card");+ var ok = Ui.Q<Button>("raid-ok"); // what the card's Show focused+ using (var e = NavigationCancelEvent.GetPooled()) { e.target = ok; ok.SendEvent(e); } // the same press, as the UI's Cancel+ InputSystem.QueueStateEvent(keyboard, new KeyboardState()); InputSystem.Update();++ Assert.AreEqual(1, stops, "the flight ends, the Dakotas stopped once");+ Assert.IsTrue(HudRoot.ClassListContains(RaidCardPresenter.OpenClass), "the card the flight showed stays up: the press was the flight's");+ Assert.IsFalse(root.Advisor!.IsOpen, "and the advisors wait for the card's OK");+ yield return null;+ Assert.IsTrue(HudRoot.ClassListContains(RaidCardPresenter.OpenClass), "still up one frame later");+ Assert.IsFalse(root.Advisor.IsOpen);+ }+/// <summary>An ended autosave opens the end screen before the start screen goes up over it. Escape on the start screen/// is the start screen's: it withdraws an armed New Game, and never closes the hidden end screen under it.</summary>[Test]diff --git a/unity/Assets/Tests/EditMode/RaidCardTests.cs b/unity/Assets/Tests/EditMode/RaidCardTests.csindex 2dab4f352..ded8123b7 100644--- a/unity/Assets/Tests/EditMode/RaidCardTests.cs+++ b/unity/Assets/Tests/EditMode/RaidCardTests.cs@@ -27,16 +27,17 @@ public class RaidCardTests}[Test]- public void TheShippedCardIsADraftThatOnlyTheEditorPreviews()+ public void TheShippedCardIsReviewedSoAPlayerBuildShowsIt(){var data = RaidCardContent.Load();Assert.IsNotNull(data, "Resources/" + RaidCardContent.ResourcePath + " loads");- Assert.AreEqual("draft", data!.Status, "the card stays draft until a human review");- Assert.AreEqual(OpeningContent.HePending, data.HeReview);- Assert.IsFalse(data.Clip.SensitivityReviewed, "the owner's sensitivity review of the clip is pending");- Assert.IsFalse(data.Reviewed);- Assert.IsFalse(RaidCardContent.MayPresent(data, editorPreview: false), "a player never sees the draft");- Assert.IsTrue(RaidCardContent.MayPresent(data, editorPreview: true), "the Editor shows it, labelled, for QA");+ // Owner, 10 November 2026: "Approve text, HE, clip", and "Approve as is" for the Hebrew (native read, #564).+ Assert.AreEqual(Statecraft.Sim.ReleaseGate.ReviewedStatus, data!.Status, "the owner reviewed the card");+ Assert.AreEqual(OpeningContent.HeApproved, data.HeReview, "the owner's native read of the Hebrew");+ Assert.IsTrue(data.Clip.SensitivityReviewed, "the owner's sensitivity review of the clip");+ Assert.IsTrue(data.Reviewed);+ Assert.IsTrue(RaidCardContent.MayPresent(data, editorPreview: false), "a player build shows the reviewed card");+ Assert.IsTrue(RaidCardContent.MayPresent(data, editorPreview: true));Assert.IsTrue(data.Sources.Count >= 2 && data.Sources.All(s => s.IsChecked), "every source carries its checked date");Assert.IsTrue(data.Clip.AiGenerated);Assert.IsTrue(File.Exists(Path.Combine(Application.streamingAssetsPath, "video", data.Clip.File)),@@ -60,9 +61,9 @@ public class RaidCardTestsAssert.IsTrue(RaidCardContent.MayPresent(clip, editorPreview: true), "the Editor preview relaxes only the reviews");}- [TestCase("status: draft", "status: draft\nextra: 1", TestName = "an unknown key")]- [TestCase("status: draft", "status: draft\nstatus: draft", TestName = "a repeated key")]- [TestCase("he_review: pending", "he_review: maybe", TestName = "a he_review that is neither pending nor approved")]+ [TestCase("status: sensitivity-reviewed", "status: sensitivity-reviewed\nextra: 1", TestName = "an unknown key")]+ [TestCase("status: sensitivity-reviewed", "status: sensitivity-reviewed\nstatus: draft", TestName = "a repeated key")]+ [TestCase("he_review: approved", "he_review: maybe", TestName = "a he_review that is neither pending nor approved")][TestCase("title_he: ", "# title_he: ", TestName = "Hebrew that is not complete")][TestCase(" ai_generated: true", " ai_generated: false", TestName = "an AI clip not marked as one")][TestCase(" sensitive: true", " sensitive: false", TestName = "a clip of the raid's aftermath not marked sensitive")]@@ -114,7 +115,7 @@ public class RaidCardTestsAssert.AreEqual("raid-ok", buttons[0].name);Assert.AreEqual(Text(lang)["raid.ok"], buttons[0].text);Assert.AreEqual(Text(lang)["opening.preview"], ui.Q<Label>("raid-preview").text);- Assert.AreEqual(DisplayStyle.Flex, ui.Q<Label>("raid-preview").style.display.value, "the Editor draft is labelled");+ Assert.AreEqual(DisplayStyle.None, ui.Q<Label>("raid-preview").style.display.value, "the reviewed card has no draft label");bool he = lang == "he";Assert.AreEqual(he ? data.TitleHe : data.Title, ui.Q<Label>("raid-title").text);Assert.AreEqual(he ? data.TextHe : data.Text, ui.Q<Label>("raid-text").text);@@ -127,12 +128,21 @@ public class RaidCardTests}[Test]- public void AReviewedCardHidesThePreviewLabel()+ public void AReviewedCardHidesThePreviewLabelAndADraftShowsIt(){- using var ui = new UiTestKit();- using var card = new RaidCardPresenter(ui.Root, ReviewedFixture(), Text("en"), _ => { }, () => { });- card.Show();- Assert.AreEqual(DisplayStyle.None, ui.Q<Label>("raid-preview").style.display.value);+ using (var ui = new UiTestKit())+ using (var card = new RaidCardPresenter(ui.Root, ReviewedFixture(), Text("en"), _ => { }, () => { }))+ {+ card.Show();+ Assert.AreEqual(DisplayStyle.None, ui.Q<Label>("raid-preview").style.display.value);+ }+ var draft = ReviewedFixture(); draft.Status = "draft";+ using (var ui = new UiTestKit())+ using (var card = new RaidCardPresenter(ui.Root, draft, Text("en"), _ => { }, () => { }))+ {+ card.Show();+ Assert.AreEqual(DisplayStyle.Flex, ui.Q<Label>("raid-preview").style.display.value, "the Editor draft is labelled");+ }}[Test]diff --git a/unity/Assets/Tests/EditMode/RaidFlightRoutingTests.cs b/unity/Assets/Tests/EditMode/RaidFlightRoutingTests.csnew file mode 100644index 000000000..f719b5e3c--- /dev/null+++ b/unity/Assets/Tests/EditMode/RaidFlightRoutingTests.cs@@ -0,0 +1,264 @@+#nullable enable+using System;+using System.Collections;+using System.Collections.Generic;+using System.IO;+using System.Linq;+using NUnit.Framework;+using Statecraft.Game;+using Statecraft.Game.Boot;+using Statecraft.Game.Map;+using Statecraft.Game.UI;+using Statecraft.Sim;+using UnityEditor.SceneManagement;+using UnityEngine;+using UnityEngine.TestTools;+using UnityEngine.UIElements;+using Object = UnityEngine.Object;++/// <summary>New game's raid flight (#3000, PR 2 of #2968; owner, 8 Nov 2026, "Film, raid, card, advisors (Recommended)"):+/// after the opening and before the raid card, once per New game; Continue, a load and the tools' Begin never fly it, nor do+/// the automated runs (no video, CardVideo.ForcedOff). Any click, or Escape, skips it and the card still follows. Booted as a+/// player boots it, as RaidCardRoutingTests; the flight itself is a fake here (the Dakotas' path and bombs are in+/// DakotaRaidFlightTests and SeaAirCollectionTests): EditMode has no frame clock to fly it by.</summary>+public class RaidFlightRoutingTests+{+ sealed class FakeFlight+ {+ public int Plays, Stops;+ public bool Available = true;+ Action? ended;++ public Action? Start(Action ended)+ {+ if (!Available) return null;+ Plays++; this.ended = ended;+ return () => Stops++;+ }++ /// <summary>The flight ends by itself (the wing has flown away).</summary>+ public void End() => ended?.Invoke();+ }++ static GameInputs? inputs;+ static GameInputs Inputs => inputs ??= GameInputs.FromDisk(Paths.Content, Paths.StreamingMap);+ readonly List<string> directories = new List<string>();+ readonly List<(PanelSettings panel, RenderTexture texture)> panels = new List<(PanelSettings, RenderTexture)>();+ static VisualElement Ui => Object.FindFirstObjectByType<UIDocument>().rootVisualElement;+ static VisualElement Hud => Ui.Q("root");+ static bool FlightOpen => Hud.ClassListContains(RaidFlightPresenter.OpenClass);+ static bool RaidOpen => Hud.ClassListContains(RaidCardPresenter.OpenClass);+ static bool OpeningOpen => Hud.ClassListContains(OpeningPresenter.OpenClass);+ static VisualElement Layer => Ui.Q("raid-flight-layer");++ string NewDirectory()+ {+ var dir = Path.Combine(Path.GetTempPath(), "statecraft-raid-flight-" + Guid.NewGuid().ToString("N"));+ directories.Add(dir);+ return dir;+ }++ GameRoot Open(FakeFlight flight, bool saved = false, bool opening = false, bool settings = true)+ {+ var store = new SaveStore(NewDirectory());+ if (saved) store.WriteAutosave(GameSession.New(Inputs.Content, 23UL, Mode.Historical).Save.Write());+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);+ var doc = Object.FindFirstObjectByType<UIDocument>();+ var panel = Object.Instantiate(doc.panelSettings);+ var texture = new RenderTexture(1280, 720, 24);+ panel.targetTexture = texture;+ panels.Add((panel, texture));+ doc.panelSettings = panel; // real layout/focus in EditMode; never mutate the shared PanelSettings asset+ Object.FindFirstObjectByType<MapScene>().Build(Inputs.Map);+ var root = Object.FindFirstObjectByType<GameRoot>();+ root.Store = store; root.Settings = settings ? new SettingsStore(NewDirectory()) : null; root.Language = "en";+ root.OpeningInEditMode = opening; root.RaidCardInEditMode = true;+ root.RaidFlightInEditMode = true; root.RaidFlightForTests = flight.Start;+ root.Begin(Inputs, 0, startScreen: true);+ return root;+ }++ [TearDown]+ public void Clean()+ {+ CardVideo.ForceOffForTests = false;+ EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);+ foreach (var dir in directories) if (Directory.Exists(dir)) Directory.Delete(dir, true);+ directories.Clear();+ foreach (var (panel, texture) in panels)+ {+ if (panel != null) Object.DestroyImmediate(panel);+ if (texture != null) { texture.Release(); Object.DestroyImmediate(texture); }+ }+ panels.Clear();+ }++ [Test]+ public void NewGameFliesTheRaidThenShowsTheCardThenTheAdvisors()+ {+ var flight = new FakeFlight();+ var root = Open(flight);+ Assert.IsFalse(FlightOpen, "not on the start screen");+ Assert.AreEqual(0, flight.Plays);+ var hash = root.Bridge!.State.Hash();+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.AreEqual(1, flight.Plays, "New game flies it once");+ Assert.IsTrue(FlightOpen);+ Assert.IsFalse(RaidOpen, "the card waits for the flight");+ Assert.IsFalse(root.Advisor!.IsOpen, "the advisors wait too");+ Assert.AreEqual(DisplayStyle.Flex, Layer.style.display.value, "its layer takes the clicks over the map");+ flight.End();+ Assert.IsFalse(FlightOpen);+ Assert.AreEqual(1, flight.Stops, "stopped once it ended");+ Assert.IsTrue(RaidOpen, "the card follows the flight");+ Assert.IsFalse(root.Advisor.IsOpen);+ UiTestKit.Press(Ui.Q<Button>("raid-ok"));+ Assert.IsTrue(root.Advisor.InChain, "the card's OK starts the turn 1 advisor chain, as before");+ Assert.AreEqual(1, flight.Plays, "once per New game");+ Assert.AreEqual(hash, root.Bridge.State.Hash(), "presentation only: the flight changes no game state");+ Assert.AreEqual(0, root.Bridge.State.Turn);+ }++ [Test]+ public void TheOpeningComesFirstThenTheFlightThenTheCard()+ {+ var flight = new FakeFlight();+ Open(flight, opening: true);+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.IsTrue(OpeningOpen, "the opening plays first");+ Assert.AreEqual(0, flight.Plays, "nothing flies under the opening");+ UiTestKit.Press(Ui.Q<Button>("opening-skip"));+ Assert.AreEqual(1, flight.Plays, "the flight follows the opening");+ Assert.IsTrue(FlightOpen); Assert.IsFalse(RaidOpen);+ flight.End();+ Assert.IsTrue(RaidOpen, "then the card");+ }++ [UnityTest]+ public IEnumerator ASavedGamesNewGameFliesItOnceAndContinueNever()+ {+ var flight = new FakeFlight();+ Open(flight, saved: true);+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ yield return null;+ Assert.AreEqual(0, flight.Plays, "one press only asks to confirm");+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ yield return null;+ Assert.AreEqual(1, flight.Plays, "the confirmed New game flies it once: the start screen's close and New game's Started are one game");+ Assert.IsTrue(FlightOpen);+ flight.End();+ Assert.IsTrue(RaidOpen);+ UiTestKit.Press(Ui.Q<Button>("raid-ok"));+ Assert.AreEqual(1, flight.Plays, "not again after the card");++ var again = new FakeFlight();+ Open(again, saved: true);+ yield return null;+ UiTestKit.Press(Ui.Q<Button>("start-continue"));+ yield return null;+ Assert.IsFalse(Hud.ClassListContains(StartScreenPresenter.OpenClass), "precondition: Continue closed the start screen");+ Assert.AreEqual(0, again.Plays, "Continue never flies it");+ Assert.IsFalse(FlightOpen); Assert.IsFalse(RaidOpen);+ }++ [Test]+ public void AClickSkipsTheFlightAndTheCardStillFollows()+ {+ var flight = new FakeFlight();+ Open(flight);+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.IsTrue(FlightOpen);+ using (var down = PointerDownEvent.GetPooled()) { down.target = Layer; Layer.SendEvent(down); }+ Assert.IsFalse(FlightOpen, "a click skips it");+ Assert.AreEqual(1, flight.Stops, "the Dakotas go back to their loop");+ Assert.IsTrue(RaidOpen, "the card still follows");+ flight.End(); // the skipped flight's own end, late+ Assert.AreEqual(1, flight.Stops, "a late end of a skipped flight does nothing");+ Assert.IsTrue(RaidOpen, "and leaves the card up");+ Assert.AreEqual(1, flight.Plays);+ }++ [Test]+ public void EscapeSkipsTheFlightAndTheCardStillFollows()+ {+ var flight = new FakeFlight();+ var root = Open(flight);+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.IsTrue(FlightOpen);+ using (var cancel = NavigationCancelEvent.GetPooled()) { cancel.target = Layer; Layer.SendEvent(cancel); }+ Assert.IsFalse(FlightOpen, "Escape (the UI's Cancel) skips it");+ Assert.AreEqual(1, flight.Stops);+ Assert.IsTrue(RaidOpen, "the card still follows");+ Assert.IsFalse(root.Advisor!.IsOpen);+ }++ // The resolved display is read after two frames: a synchronous test reads it before the panel has resolved any style.+ [UnityTest]+ public IEnumerator WithoutVideoAsInTheAutomatedRunsTheCardShowsWithoutTheFlight()+ {+ CardVideo.ForceOffForTests = true; // as the smoke, golden and shot runs boot (reset in Clean)+ var flight = new FakeFlight();+ Open(flight);+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.AreEqual(0, flight.Plays, "no flight with video off");+ Assert.IsFalse(FlightOpen);+ yield return null; yield return null;+ Assert.AreEqual(DisplayStyle.None, Layer.resolvedStyle.display);+ }++ [UnityTest]+ public IEnumerator TheToolsBeginNeverFliesIt()+ {+ var flight = new FakeFlight();+ var root = Open(flight);+ root.Begin(Inputs, 0); // the tools' Begin: no start screen+ Assert.AreEqual(0, flight.Plays, "the open start screen going away with the old session plays no intro (#3003)");+ Assert.IsFalse(FlightOpen);+ yield return null; yield return null;+ Assert.AreEqual(DisplayStyle.None, Layer.resolvedStyle.display);+ }++ [Test]+ public void TheTopBarsNewGameFliesItAgain()+ {+ var flight = new FakeFlight();+ var root = Open(flight);+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ flight.End();+ UiTestKit.Press(Ui.Q<Button>("raid-ok"));+ if (root.Advisor!.InChain) root.Advisor.CloseChain();+ Assert.IsFalse(root.Advisor.IsOpen, "precondition: nothing covers the top bar");+ UiTestKit.Press(Ui.Q<Button>("new-game"));+ Assert.AreEqual(1, flight.Plays, "one press only arms New game");+ UiTestKit.Press(Ui.Q<Button>("new-game"));+ Assert.AreEqual(2, flight.Plays, "every New game flies it");+ Assert.IsTrue(FlightOpen);+ }++ [Test]+ public void WithNoDakotaToFlyTheCardShowsAtOnce()+ {+ var flight = new FakeFlight { Available = false }; // the Dakotas not streamed in yet+ Open(flight);+ UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.IsFalse(FlightOpen);+ Assert.IsTrue(RaidOpen, "the card at once");+ Assert.AreEqual(DisplayStyle.None, Layer.style.display.value, "its layer gone again");+ }++ [Test]+ public void FirstCardInstrumentSkipsTheFlightThenPressesOk()+ {+ // No settings file, as under ?firstcard (RaidCardRoutingTests.FirstCardInstrumentPressesOkBeforeAwaitingTheCard).+ var flight = new FakeFlight();+ var root = Open(flight, settings: false);+ var lines = new List<string>();+ double clock = 0;+ var check = GameRoot.FirstCardCheck(Ui, root.Card!, lines.Add, () => clock++);+ int steps = 0;+ while (check.MoveNext()) Assert.Less(++steps, 12, "the existing clock-bound instrument is finite");+ Assert.AreEqual(1, flight.Plays, "the instrument met the flight");+ Assert.IsFalse(FlightOpen); Assert.IsFalse(RaidOpen);+ Assert.IsTrue(lines.Any(line => line.StartsWith("FIRST CARD OK ", StringComparison.Ordinal)), string.Join("\n", lines));+ }+}diff --git a/unity/Assets/Tests/EditMode/RaidFlightRoutingTests.cs.meta b/unity/Assets/Tests/EditMode/RaidFlightRoutingTests.cs.metanew file mode 100644index 000000000..a8a3b2062--- /dev/null+++ b/unity/Assets/Tests/EditMode/RaidFlightRoutingTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 328e962fd9a3496b94f45c85c87f93badiff --git a/unity/Assets/Tests/EditMode/SeaAirCollectionTests.cs b/unity/Assets/Tests/EditMode/SeaAirCollectionTests.csindex 06f166c8e..f7c9583d1 100644--- a/unity/Assets/Tests/EditMode/SeaAirCollectionTests.cs+++ b/unity/Assets/Tests/EditMode/SeaAirCollectionTests.cs@@ -924,6 +924,61 @@ public class SeaAirCollectionTests}}+ /// <summary>New game's raid (#3000, DakotaRaidFlight) bombs Tel Aviv as the loop does: every release lies on the pass+ /// where the raid flies the loop itself (within DakotaRaidFlight.PassS of its middle), so at each release the aircraft is+ /// where the loop has it and its bomb leaves its belly; half way through its fall a bomb is a quarter of the way down; the+ /// smoke columns rise only from their first hit; when the raid ends the aircraft is back on its loop's clock.</summary>+ [Test]+ public void TheRaidFlightBombsTelAvivAsTheLoopDoes()+ {+ var map = OpenMap();+ var (_, planes, loops, _) = DrawnDakotas(map);+ float period = SeaAirCollection.DakotaLoopSeconds, fall = SeaAirCollection.DakotaBombFallS;+ try+ {+ for (int p = 0; p < planes.Length; p++)+ {+ var loop = loops[p]; var run = loop.Bombs!;+ Assert.AreEqual(p, Mathf.RoundToInt(loop.Lag / SeaAirCollection.DakotaTrailSeconds), "lead first, then its wing");+ float firstHit = float.MaxValue;+ foreach (var d in run.Drops)+ {+ float u = d.At - period * Mathf.Floor(d.At / period + 0.5f); // its time in the pass, in (-60, 60]+ Assert.That(u, Is.InRange(-DakotaRaidFlight.PassS, DakotaRaidFlight.PassS), $"{planes[p].name}'s release at {d.At:0.0} s is on the raid's pass");+ firstHit = Mathf.Min(firstHit, u + fall);+ loop.Place(loop.Lag + u);+ var onLoop = planes[p].position; var turned = planes[p].rotation;+ loop.PlaceRaid(DakotaRaidFlight.SecondsAt(u, p));+ Assert.Less((planes[p].position - onLoop).magnitude, 0.5f, $"the raid has {planes[p].name} where the loop has it at the release {u:0.0}");+ Assert.Less(Quaternion.Angle(planes[p].rotation, turned), 0.5f, "turned as on the loop");+ }+ var first = run.Drops.OrderBy(d => d.At - period * Mathf.Floor(d.At / period + 0.5f)).First();+ float at = first.At - period * Mathf.Floor(first.At / period + 0.5f);+ loop.PlaceRaid(DakotaRaidFlight.SecondsAt(at + 0.5f * fall, p));+ var expect = Vector3.Lerp(first.From, first.To, 0.5f); expect.y = first.From.y - 0.25f * (first.From.y - first.To.y);+ Assert.IsTrue(run.Bombs.Any(r => r.enabled && (r.transform.position - expect).magnitude < 1f), "half way through its fall a bomb is a quarter of the way down");+ loop.PlaceRaid(0f);+ Assert.IsFalse(run.Bombs.Concat(run.Flashes).Concat(run.Blasts).Concat(run.Smoke).Concat(run.Columns).Any(r => r.enabled),+ $"{planes[p].name}: nothing falls or burns as the raid comes in");+ loop.PlaceRaid(DakotaRaidFlight.SecondsAt(firstHit - 0.05f, p));+ Assert.IsFalse(run.Columns.Any(r => r.enabled), "no column before the first hit");+ loop.PlaceRaid(DakotaRaidFlight.Seconds);+ Assert.IsTrue(run.Columns.Any(r => r.enabled), "Tel Aviv burning as the raid leaves");+ for (int i = 0; i <= 400; i++)+ {+ float t = i * DakotaRaidFlight.Seconds / 400f;+ loop.PlaceRaid(t);+ foreach (var r in run.Bombs.Concat(run.Flashes).Concat(run.Blasts).Concat(run.Smoke).Concat(run.Columns))+ if (r.enabled) Assert.IsTrue(OnTelAviv(map, r.transform.position), $"{r.name} over Tel Aviv {t:0.00} s into the raid");+ }+ }+ // Its end hands the aircraft back to the loop: Update places it by the loop's clock again (DakotaRaidFlight.Stop).+ DakotaRaidFlight.Stop();+ Assert.IsFalse(DakotaRaidFlight.Since(out _));+ }+ finally { DakotaRaidFlight.Stop(); }+ }+/// <summary>The owner, 4 November 2026, on the 15 May captures: "the explosions look bad in the screenshot and there is no/// smoke columns coming up", then "it needs to look top quality" (Unity Labs' CC0 flipbooks approved). The blast plays/// the explosion flipbook once over DakotaBlastS: it opens at DakotaBlastOpenShare of DakotaBlastM, swells to the fulldiff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxmlindex 98777ff65..5d0916939 100644--- a/unity/Assets/UI/Game.uxml+++ b/unity/Assets/UI/Game.uxml@@ -718,6 +718,9 @@<Statecraft.Game.UI.UiFrame /></ui:VisualElement></ui:VisualElement>+ <!-- New game's raid flight (RaidFlightPresenter, #3000): the Dakotas bomb Tel Aviv after the opening, before the raid+ card. A clear layer over the map: a click on it, or Escape, skips the flight. -->+ <ui:VisualElement name="raid-flight-layer" class="raid-flight-layer" /><!-- The Tel Aviv raid card on New game (RaidCardPresenter; owner, 8 Nov 2026): after the opening, before the turn 1advisors. One card in the event-card frame, its silent clip labelled as an AI illustration, and only OK.Editor drafts are labelled; a player build shows it only once it is reviewed. -->diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex 38dcc24d3..f0f3728ac 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -1336,3 +1336,8 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas.raid-actions > Button { min-height: 44px; min-width: 160px; margin: 4px 6px; }.raid-open .top-bar, .raid-open .left-column, .raid-open .community-column, .raid-open .right-column, .raid-open .event-layer, .raid-open .info-panel, .raid-open .screen, .raid-open .map-labels, .raid-open .start-screen, .raid-open .advisor-layer { display: none; }.loading .raid-layer { display: none; }+/* New game's raid flight before that card (RaidFlightPresenter, #3000): a clear layer over the whole map, so the Dakotas+ show and any click on it skips the flight; the HUD under it is hidden as under the card, the map's names too. */+.raid-flight-layer { display: none; position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0); }+.raid-flight-open .top-bar, .raid-flight-open .left-column, .raid-flight-open .community-column, .raid-flight-open .right-column, .raid-flight-open .event-layer, .raid-flight-open .info-panel, .raid-flight-open .screen, .raid-flight-open .map-labels, .raid-flight-open .start-screen, .raid-flight-open .advisor-layer { display: none; }+.loading .raid-flight-layer { display: none; }