643 lines
42 KiB
C#
643 lines
42 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.IO;
|
||
using UnityEngine;
|
||
using UnityEngine.UIElements;
|
||
|
||
namespace Soundings
|
||
{
|
||
public sealed partial class SoundingsApp
|
||
{
|
||
private IEnumerator VisualSmoke()
|
||
{
|
||
string[] args = Environment.GetCommandLineArgs();
|
||
int index = Array.IndexOf(args, "-soundings-smoke");
|
||
if (index + 1 >= args.Length)
|
||
{
|
||
Application.Quit(1);
|
||
yield break;
|
||
}
|
||
|
||
string directory = args[index + 1];
|
||
Directory.CreateDirectory(directory);
|
||
if (!CheckSmoke(Harbor.AllPortsHaveScenery, "Every destination has a port scenery profile"))
|
||
yield break;
|
||
for (int port = 0; port < Market.Ports.Count; port++)
|
||
{
|
||
if (!CheckSmoke(PassageAudio.LoadPortClip("Departure", port) is { length: > 1 }
|
||
&& PassageAudio.LoadPortClip("Approach", port) is { length: > 1 }, "Named PA recordings for " + Market.Ports[port].Name))
|
||
yield break;
|
||
}
|
||
Vector2[] pacific = MapPaths(new[] { 15, 16 })[0];
|
||
if (!CheckSmoke(Mathf.Abs(pacific[MapSamples].x - pacific[0].x) < 45, "Voyage map wraps the date line"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "01-title");
|
||
|
||
if (!CheckSmoke(guidedCareer, "The guide is on by default")
|
||
|| !SubmitSmoke("guide-toggle") || !CheckSmoke(!guidedCareer, "Guide can be turned off at title")
|
||
|| !SubmitSmoke("guide-toggle") || !SubmitSmoke("start-used") || !SubmitSmoke("replace")
|
||
|| !CheckSmoke(Ship?.Name == "MV Meridian" && guideContext == GuideStep.SetCourse, "Guided used start"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "02-harbor");
|
||
float harborOverview = harbor.OrbitVerticalSpan;
|
||
Vector3 harborCenter = harbor.OrbitTarget;
|
||
harbor.Zoom(-90, new Vector2(.56f, .54f));
|
||
yield return new WaitForSecondsRealtime(.65f);
|
||
if (!CheckSmoke(harbor.OrbitVerticalSpan < harborOverview * .22f && harbor.OrbitCameraIsClear
|
||
&& Vector3.Distance(harborCenter, harbor.OrbitTarget) > 2f, "Harbor wheel reaches close inspection and follows the pointer"))
|
||
yield break;
|
||
harbor.Zoom(90);
|
||
yield return new WaitForSecondsRealtime(.65f);
|
||
if (!CheckSmoke(harbor.OrbitVerticalSpan > harborOverview * .97f
|
||
&& Vector3.Distance(harborCenter, harbor.OrbitTarget) < .4f, "Zooming back out restores the harbor framing"))
|
||
yield break;
|
||
harbor.ResetView(true);
|
||
harbor.Zoom(-13, new Vector2(.49f, .56f));
|
||
yield return new WaitForSecondsRealtime(.55f);
|
||
yield return CaptureSmoke(directory, "02a-harbor-close-up");
|
||
harbor.ResetView(true);
|
||
if (!SubmitSmoke("plan-voyage") || !CheckSmoke(page == 3 && destination == 1 && guideContext == GuideStep.Fare, "Set course and fare guide"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "03-passage-chart");
|
||
int fare = Ship.Fare;
|
||
if (!SubmitSmoke("fare-plus") || !CheckSmoke(Ship.Fare == fare + 50 && guideContext == GuideStep.CastOff, "Fare control and departure guide"))
|
||
yield break;
|
||
if (!SubmitSmoke("port-plan-open"))
|
||
yield break;
|
||
IntegerField provisioning = root.Q<IntegerField>("port-food-units");
|
||
if (!CheckSmoke(provisioning != null && provisioning.value > 0, "Dockside orders show recommended provisions"))
|
||
yield break;
|
||
provisioning.value = 1120;
|
||
if (!SubmitSmoke("port-program-1") || !CheckSmoke(portFoodOrder == 1120 && portProgram == EntertainmentProgram.LiveMusic,
|
||
"Order an exact food quantity and book local musicians"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "03a-dockside-orders");
|
||
if (!SubmitSmoke("port-plan-close"))
|
||
yield break;
|
||
if (!SubmitSmoke("weather-swell") || !CheckSmoke(PassageWeatherFor(0, 1) == WeatherCondition.Swell, "Select forecast conditions")
|
||
|| !SubmitSmoke("weather-calm"))
|
||
yield break;
|
||
if (!SubmitSmoke("dispatch") || !CheckSmoke(underway != null && livePassage != null && Ship.Port == 0
|
||
&& company.Voyages == 0 && PassageDuration(underway) >= 175 && livePassage.Assisted && underway.Weather == WeatherCondition.Calm
|
||
&& underway.Plan?.FoodUnits == 1120 && underway.Plan.Program == EntertainmentProgram.LiveMusic,
|
||
"Cast off into an assisted live crossing"))
|
||
yield break;
|
||
if (!CheckSmoke(harbor.PortCinematicActive && Harbor.PortCinematicDuration < 5
|
||
&& root.Q<Label>("port-cinematic-name")?.text == "Miami"
|
||
&& passageAudio.CurrentAnnouncement == PassageAnnouncement.Departure
|
||
&& passageAudio.Caption.Contains("next port of call is Nassau"), "Cast off at Miami with a short cinematic and named PA"))
|
||
yield break;
|
||
Vector3 departureStart = harbor.PassageWorldPosition;
|
||
yield return new WaitForSecondsRealtime(1.3f);
|
||
if (!CheckSmoke(harbor.PortCinematicActive && passageHelm.Progress == 0
|
||
&& Vector3.Distance(departureStart, harbor.PassageWorldPosition) > 1,
|
||
"Departure moves the ship through the harbor before starting the voyage clock")
|
||
|| !CheckSmoke(harbor.HasActiveGuest(GuestActivity.Swim) && harbor.HasActiveGuest(GuestActivity.Wade)
|
||
&& harbor.HasActiveGuest(GuestActivity.Lounge), "Guests swim, wade, and use the pool loungers in calm weather"))
|
||
yield break;
|
||
holdCinematicClock = true;
|
||
yield return CapturePortAndSkipSmoke(directory, "03a-departure-cinematic");
|
||
if (!CheckSmoke(!harbor.PortCinematicActive
|
||
&& guideContext == GuideStep.AtSea && root.Q<Button>("guide-skip") != null, "Skipping the shot hands control to the voyage"))
|
||
yield break;
|
||
int mealPrice = livePassage.GetPrice(OnboardService.Meals);
|
||
int provisions = livePassage.ProvisionsRemaining;
|
||
if (!SubmitSmoke("passage-price-meals-plus") || !SubmitSmoke("passage-special-meals")
|
||
|| !CheckSmoke(provisions == 1120 && livePassage.GetPrice(OnboardService.Meals) == mealPrice + 1 && livePassage.DiscountTicks(OnboardService.Meals) > 0,
|
||
"Change live prices and start a meal special"))
|
||
yield break;
|
||
if (!CheckSmoke(passageAudio.CurrentAnnouncement == PassageAnnouncement.Departure,
|
||
"An on-demand special queues behind the ship's welcome"))
|
||
yield break;
|
||
Vector3 castingOff = harbor.PassageWorldPosition;
|
||
MovePassageToSmoke(.17f);
|
||
if (!CheckSmoke(harbor.PassageUsesPerspective && Vector3.Distance(castingOff, harbor.PassageWorldPosition) > 70f,
|
||
"Ship travels through the world in the exterior perspective view")
|
||
|| !CheckSmoke(livePassage.CrewCall == StationKind.Galley, "First crew call sends you to the galley")
|
||
|| !SubmitSmoke("passage-service") || !SubmitSmoke("service-area-1"))
|
||
yield break;
|
||
if (!CheckSmoke(!harbor.TryGetFacingStation(out _), "Station cannot be used from across the passage"))
|
||
yield break;
|
||
WalkSmoke(Vector2.up, 6);
|
||
if (!CheckSmoke(harbor.TryGetFacingStation(out StationKind galley) && galley == StationKind.Galley,
|
||
"Galley control becomes available as you approach the equipment"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "03b-galley-crew-call");
|
||
if (!CheckSmoke(UseFacingStation() && livePassage.CrewRequestsCompleted == 1 && livePassage.GalleyBoost,
|
||
"Physical galley interaction answers the crew call and starts a paid extra shift")
|
||
|| !SubmitSmoke("passage-deck-all") || !SubmitSmoke("passage-business"))
|
||
yield break;
|
||
MovePassageToSmoke(.30f);
|
||
if (!CheckSmoke(livePassage.CurrentEvent.HasValue && livePassage.ProvisionsRemaining < provisions,
|
||
"Service uses inventory and opens a timed event")
|
||
|| !SubmitSmoke("passage-event-0") || !CheckSmoke(livePassage.Expenses > 0 && !livePassage.CurrentEvent.HasValue, "Resolve the event"))
|
||
yield break;
|
||
for (int i = 0; i < 100; i++)
|
||
{
|
||
passageHelm.Advance(.1f, 0, livePassage.SpeedFactor, underway.Weather);
|
||
PresentVessel(.1f);
|
||
}
|
||
yield return CaptureSmoke(directory, "04-underway");
|
||
float passageOverview = harbor.OrbitVerticalSpan;
|
||
harbor.Zoom(-90, new Vector2(.57f, .54f));
|
||
yield return new WaitForSecondsRealtime(.65f);
|
||
if (!CheckSmoke(harbor.PassageUsesPerspective && harbor.OrbitCameraIsClear
|
||
&& harbor.OrbitVerticalSpan < passageOverview * .22f, "Underway exterior zoom keeps a clear perspective view at deck level"))
|
||
yield break;
|
||
harbor.ResetView(true);
|
||
harbor.Zoom(-13, new Vector2(.46f, .57f));
|
||
yield return new WaitForSecondsRealtime(.55f);
|
||
yield return CaptureSmoke(directory, "04b-underway-close-up");
|
||
harbor.ResetView(true);
|
||
harbor.RotateView(112f);
|
||
yield return new WaitForSecondsRealtime(.38f);
|
||
yield return CaptureSmoke(directory, "04a-underway-wake");
|
||
if (!SubmitSmoke("passage-deck-0") || !CheckSmoke(passageDeck == 0, "Inspect the cabin deck"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "05-cabin-deck");
|
||
if (!SubmitSmoke("passage-deck-1") || !CheckSmoke(passageDeck == 1, "Inspect the second guest deck"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "06-guest-deck");
|
||
if (!CheckSmoke(harbor.HasActiveGuest(GuestActivity.Drink) && harbor.HasActiveGuest(GuestActivity.TendBar)
|
||
&& harbor.HasActiveGuest(GuestActivity.Dine) && harbor.HasActiveGuest(GuestActivity.Watch),
|
||
"The fitted bar, dining room, and entertainment venue are active"))
|
||
yield break;
|
||
float deckOverview = harbor.OrbitVerticalSpan;
|
||
harbor.Zoom(-90, new Vector2(.57f, .46f));
|
||
yield return new WaitForSecondsRealtime(.65f);
|
||
if (!CheckSmoke(harbor.OrbitCameraIsClear && harbor.OrbitVerticalSpan < deckOverview * .22f,
|
||
"Cutaway zoom gives a clear view into individual rooms"))
|
||
yield break;
|
||
harbor.ResetView(true);
|
||
harbor.Zoom(-19, new Vector2(.43f, .49f));
|
||
yield return new WaitForSecondsRealtime(.55f);
|
||
yield return CaptureSmoke(directory, "06-guest-deck-close-up");
|
||
harbor.ResetView(true);
|
||
harbor.Zoom(-19, new Vector2(.67f, .39f));
|
||
yield return new WaitForSecondsRealtime(.55f);
|
||
yield return CaptureSmoke(directory, "06-bar-service-close-up");
|
||
if (!SubmitSmoke("passage-bridge") || !CheckSmoke(passageBridge && harbor.FirstPersonPositionIsClear, "Enter the first-person bridge"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "06a-bridge");
|
||
Vector3 bridgeEntry = harbor.FirstPersonPosition;
|
||
WalkSmoke(Vector2.up, 35);
|
||
float bridgeWalk = Vector3.Distance(bridgeEntry, harbor.FirstPersonPosition);
|
||
if (!CheckSmoke(bridgeWalk > 1 && bridgeWalk < 3 && harbor.FirstPersonPositionIsClear, "Bridge console blocks grounded movement")
|
||
|| !SubmitSmoke("passage-camera-reset") || !CheckSmoke(UseFacingStation(), "Engage physical helm from its console")
|
||
|| !CheckSmoke(passageHelm.Manual, "Take physical control on the bridge"))
|
||
yield break;
|
||
passageHelm.Advance(8, 0, livePassage.SpeedFactor, underway.Weather);
|
||
float originalHeading = passageHelm.Heading;
|
||
for (int i = 0; i < 100; i++)
|
||
passageHelm.Advance(.1f, 1, livePassage.SpeedFactor, underway.Weather);
|
||
PresentVessel(.1f);
|
||
if (!CheckSmoke(passageHelm.Heading > originalHeading + 5 && passageHelm.Position.y > .3f, "Rudder changes the ship heading and track"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "06a-manual-helm");
|
||
if (!SubmitSmoke("helm-order-0") || !CheckSmoke(passageHelm.PropulsionStopped, "Stop order at the helm"))
|
||
yield break;
|
||
float coastingSpeed = passageHelm.Speed;
|
||
passageHelm.Advance(.55f, 0, livePassage.SpeedFactor, underway.Weather);
|
||
if (!CheckSmoke(passageHelm.Speed > 0 && passageHelm.Speed < coastingSpeed, "Ship coasts when propulsion is stopped")
|
||
|| !SubmitSmoke("helm-toggle") || !CheckSmoke(!passageHelm.Manual && !passageHelm.PropulsionStopped, "Autopilot resumes propulsion"))
|
||
yield break;
|
||
if (!SubmitSmoke("passage-deck-0") || !SubmitSmoke("passage-explore")
|
||
|| !CheckSmoke(passageExploring && passageDeck == 0 && harbor.FirstPersonPositionIsClear, "Explore inside the cabin deck"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "06a-cabin-corridor");
|
||
Vector3 corridorEntry = harbor.FirstPersonPosition;
|
||
WalkSmoke(Vector2.up, 9);
|
||
WalkSmoke(Vector2.right, 12);
|
||
Vector3 nearBulkhead = harbor.FirstPersonPosition;
|
||
if (!CheckSmoke(nearBulkhead.x > corridorEntry.x + 2 && Mathf.Abs(nearBulkhead.z - corridorEntry.z) < .8f,
|
||
"Cabin corridor is clear and bulkheads block sideways movement"))
|
||
yield break;
|
||
WalkSmoke(Vector2.up, 8);
|
||
WalkSmoke(Vector2.right, 6);
|
||
if (!CheckSmoke(Mathf.Abs(harbor.FirstPersonPosition.z - corridorEntry.z) > 1 && harbor.FirstPersonPositionIsClear,
|
||
"Walk into a cabin through its open doorway"))
|
||
yield break;
|
||
if (!SubmitSmoke("passage-service") || !CheckSmoke(passageServiceArea == 0 && harbor.FirstPersonPositionIsClear, "Enter engineering"))
|
||
yield break;
|
||
Vector3 serviceEntry = harbor.FirstPersonPosition;
|
||
WalkSmoke(Vector2.up, 38);
|
||
float serviceWalk = Vector3.Distance(serviceEntry, harbor.FirstPersonPosition);
|
||
if (!CheckSmoke(serviceWalk > 1.6f && serviceWalk < 5 && harbor.FirstPersonPositionIsClear, "Walk through an engineering doorway and stop at the machinery")
|
||
|| !SubmitSmoke("passage-camera-reset"))
|
||
yield break;
|
||
int cruiseBurn = livePassage.ProjectedFuelBurn;
|
||
if (!SubmitSmoke("service-engine-0") || !CheckSmoke(livePassage.ProjectedFuelBurn < cruiseBurn, "Economy throttle saves fuel")
|
||
|| !SubmitSmoke("service-assist") || !CheckSmoke(!livePassage.Assisted, "Switch to manual operations"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "06b-engine-room");
|
||
if (!SubmitSmoke("service-area-1") || (!livePassage.GalleyBoost && !SubmitSmoke("service-operate"))
|
||
|| !CheckSmoke(livePassage.GalleyBoost, "Extend galley service"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "06c-galley");
|
||
if (!SubmitSmoke("service-area-2") || !CheckSmoke(passageServiceArea == 2, "Inspect stores")
|
||
|| !SubmitSmoke("service-area-3") || !SubmitSmoke("service-operate") || !CheckSmoke(livePassage.RepairCredit > 0, "Service machinery")
|
||
|| !SubmitSmoke("service-area-4") || !SubmitSmoke("service-operate") || !CheckSmoke(livePassage.PumpsBoost, "Boost freshwater pumps")
|
||
|| !SubmitSmoke("service-area-5") || !SubmitSmoke("service-operate") || !CheckSmoke(livePassage.TreatmentBoost, "Boost sewage treatment"))
|
||
yield break;
|
||
if (!SubmitSmoke("company-menu") || !CheckSmoke(paused, "Pause voyage"))
|
||
yield break;
|
||
Vector2 pausedPosition = passageHelm.Position;
|
||
yield return new WaitForSecondsRealtime(.15f);
|
||
if (!CheckSmoke(passageHelm.Position == pausedPosition, "Paused passage clock") || !SubmitSmoke("resume-game"))
|
||
yield break;
|
||
if (!SubmitSmoke("dock-now") || !CheckSmoke(harbor.PortCinematicActive && Ship.Port == 1 && company.Voyages == 1
|
||
&& root.Q<Label>("port-cinematic-name")?.text == "Nassau", "Arrival shot opens on the destination after settlement"))
|
||
yield break;
|
||
FinishVoyage();
|
||
yield return new WaitForSecondsRealtime(1.4f);
|
||
if (!CheckSmoke(harbor.PortCinematicActive && company.Voyages == 1, "Arrival cannot settle the voyage twice"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "07-arrival-cinematic");
|
||
yield return new WaitUntil(() => !harbor.PortCinematicActive);
|
||
if (!CheckSmoke(underway == null && page == 4 && guideContext == GuideStep.Review
|
||
&& company.History[0].Plan.FoodUnits == 1120 && company.History[0].Onboard.CrewCalls == 1,
|
||
"Arrival hands off to the logbook with the passenger orders and crew call"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "07-logbook");
|
||
if (!SubmitSmoke("voyage-0") || !SubmitSmoke("log-accounts") || !SubmitSmoke("log-voyages")
|
||
|| !SubmitSmoke("guide-finish") || !CheckSmoke(company.TutorialStep == 0, "Finish first voyage guide"))
|
||
yield break;
|
||
|
||
if (!SubmitSmoke("nav-1"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "08-deck-plans");
|
||
if (!SubmitSmoke("deck-1") || !SubmitSmoke("facility-4") || !SubmitSmoke("berth-0")
|
||
|| !CheckSmoke(Ship.Decks[1].Cells[0] == Facility.Tank, "Deck placement")
|
||
|| !SubmitSmoke("add-deck") || !CheckSmoke(Ship.Decks.Count == 3 && deckIndex == 2, "Build a third deck")
|
||
|| !SubmitSmoke("facility-5") || !SubmitSmoke("berth-3") || !SubmitSmoke("facility-6") || !SubmitSmoke("berth-4")
|
||
|| !CheckSmoke(Ship.Decks[2].Cells[3] == Facility.Bar && Ship.Decks[2].Cells[4] == Facility.Amenity, "Fit a bar and amenity on a new deck")
|
||
|| !SubmitSmoke("facility-systems") || !SubmitSmoke("facility-7") || !SubmitSmoke("berth-0")
|
||
|| !CheckSmoke(Ship.Decks[2].Cells[0] == Facility.Galley, "Fit a service expansion on the new deck"))
|
||
yield break;
|
||
|
||
if (!SubmitSmoke("nav-3") || !SubmitSmoke("port-2") || !SubmitSmoke("permit")
|
||
|| !CheckSmoke(company.Permits[2], "Ports control"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "09-ports");
|
||
|
||
if (!SubmitSmoke("chart-world") || !SubmitSmoke("port-12") || !CheckSmoke(inspectedPort == 12, "Global port chart"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "10-world");
|
||
|
||
if (!SubmitSmoke("nav-0") || !SubmitSmoke("plan-voyage") || !SubmitSmoke("port-0")
|
||
|| !SubmitSmoke("itinerary-open") || !SubmitSmoke("itinerary-add") || !SubmitSmoke("itinerary-port-2")
|
||
|| !SubmitSmoke("itinerary-add") || !CheckSmoke(Ship.Itinerary is { TotalStops: 2, NextPort: 0, LastPort: 2 }
|
||
&& destination == 0, "Plan Nassau to Miami to Key West without changing the first departure"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "10a-itinerary-plan");
|
||
if (!SubmitSmoke("itinerary-port-1") || !SubmitSmoke("itinerary-add") || !SubmitSmoke("itinerary-remove")
|
||
|| !CheckSmoke(Ship.Itinerary.TotalStops == 2 && Ship.Itinerary.LastPort == 2, "Edit the last pending call")
|
||
|| !SubmitSmoke("itinerary-next") || !SubmitSmoke("weather-storm")
|
||
|| !SubmitSmoke("dispatch") || !CheckSmoke(underway.Weather == WeatherCondition.Storm
|
||
&& livePassage.Get(OnboardService.Amenities).Capacity == 0 && passageAudio.Caption.Contains("Miami"),
|
||
"Depart for the first planned call in a storm"))
|
||
yield break;
|
||
yield return new WaitUntil(() => !harbor.PortCinematicActive);
|
||
if (!CheckSmoke(!harbor.HasActiveGuest(GuestActivity.Swim) && !harbor.HasActiveGuest(GuestActivity.Wade),
|
||
"Storm conditions close the pool"))
|
||
yield break;
|
||
SelectPassageDeck(2);
|
||
if (!CheckSmoke(passageDeck == 2, "Visit the newly fitted third deck during the next crossing"))
|
||
yield break;
|
||
MovePassageToSmoke(.42f);
|
||
yield return CaptureSmoke(directory, "11-new-service-deck");
|
||
if (!SubmitSmoke("voyage-map-toggle") || !CheckSmoke(voyageMapOpen && voyageMapPlot != null, "Open the live voyage map"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "11a-live-voyage-map");
|
||
if (!SubmitSmoke("voyage-map-close"))
|
||
yield break;
|
||
SetPassageSpeed(4);
|
||
if (!CheckSmoke(passageSpeed == 4, "Fast-forward setting"))
|
||
yield break;
|
||
MovePassageToSmoke(.87f);
|
||
UpdatePortApproach();
|
||
if (!CheckSmoke(passageAudio.ApproachSent && passageAudio.CurrentAnnouncement == PassageAnnouncement.Approach
|
||
&& passageAudio.Caption.Contains("approaching Miami"), "The ship announces its approach to Miami before docking"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "11b-approaching-miami");
|
||
float timeout = Time.realtimeSinceStartup + 20;
|
||
while (underway != null && Time.realtimeSinceStartup < timeout)
|
||
yield return null;
|
||
if (!CheckSmoke(underway == null && Ship.Port == 0 && company.Voyages == 2
|
||
&& Ship.Itinerary is { CompletedStops: 1, NextPort: 2 }
|
||
&& company.History[0].ItineraryLeg == 1, "Settle the first itinerary leg and remain in Miami"))
|
||
yield break;
|
||
company = JsonUtility.FromJson<Company>(JsonUtility.ToJson(company));
|
||
if (!CheckSmoke(company.CanLoad() && Ship.Itinerary.NextPort == 2, "Continue the same ship's itinerary after reloading at a call"))
|
||
yield break;
|
||
ResetItinerary();
|
||
Render();
|
||
yield return CaptureSmoke(directory, "11c-intermediate-arrival");
|
||
if (!SubmitSmoke("log-next-leg") || !CheckSmoke(destination == 2 && inspectedPort == 2, "Review the next call from the Logbook")
|
||
|| !SubmitSmoke("buy-fuel") || !SubmitSmoke("dispatch")
|
||
|| !CheckSmoke(underway.Origin == 0 && underway.Destination == 2 && passageAudio.Caption.Contains("Key West"),
|
||
"Fuel at the intermediate stop and cast off with the correct new port name"))
|
||
yield break;
|
||
if (!SubmitSmoke("port-cinematic-skip"))
|
||
yield break;
|
||
MovePassageToSmoke(.9f);
|
||
UpdatePortApproach();
|
||
if (!CheckSmoke(passageAudio.CurrentAnnouncement == PassageAnnouncement.Approach
|
||
&& passageAudio.Caption.Contains("approaching Key West"), "The second leg announces Key West")
|
||
|| !SubmitSmoke("dock-now") || !CheckSmoke(Ship.Port == 2 && company.Voyages == 3
|
||
&& Ship.Itinerary is { CompletedStops: 2, HasNext: false }
|
||
&& company.History[0].ItineraryLeg == 2 && company.History[0].ItineraryStartDay == company.History[1].ItineraryStartDay
|
||
&& root.Q<Label>("port-cinematic-name")?.text == "Key West",
|
||
"Complete the itinerary with two linked ledger records"))
|
||
yield break;
|
||
holdCinematicClock = true;
|
||
yield return CapturePortAndSkipSmoke(directory, "11d-key-west-cinematic", 1.4f);
|
||
yield return CaptureSmoke(directory, "11d-itinerary-complete");
|
||
|
||
if (!SubmitSmoke("company-menu") || !SubmitSmoke("return-title") || !SubmitSmoke("start-financed") || !SubmitSmoke("replace")
|
||
|| !CheckSmoke(company.Debt == 500000 && company.Fleet.Count == 0 && guideContext == GuideStep.GetShip, "Guided financed start"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "12-shipyard");
|
||
if (!SubmitSmoke("buy-ship") || !CheckSmoke(Ship != null && Ship.Beds == 0 && page == 1 && guideContext == GuideStep.Cabins, "Ship commissioning and cabin guide"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "13-new-hull");
|
||
if (!SubmitSmoke("facility-1"))
|
||
yield break;
|
||
for (int i = 0; i < StarterCabinModules; i++)
|
||
if (!SubmitSmoke($"berth-{i}"))
|
||
yield break;
|
||
if (!CheckSmoke(guideContext == GuideStep.Dining, "Starter cabin block advances to dining")
|
||
|| !SubmitSmoke("facility-2") || !SubmitSmoke($"berth-{StarterCabinModules}")
|
||
|| !CheckSmoke(guideContext == GuideStep.SetCourse, "Dining advances to course planning")
|
||
|| !SubmitSmoke("nav-0") || !SubmitSmoke("plan-voyage")
|
||
|| !CheckSmoke(guideContext == GuideStep.Bunker && company.Forecast(Ship, destination).NetIncome > 0,
|
||
"Unfueled hull shows bunker lesson for a profitable first sailing"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "14-bunker-lesson");
|
||
if (!SubmitSmoke("buy-fuel") || !CheckSmoke(Ship.Fuel > 0 && guideContext == GuideStep.Fare, "Bunkering and guide progress")
|
||
|| !SubmitSmoke("guide-skip") || !CheckSmoke(company.TutorialStep == 0, "Guide can be skipped"))
|
||
yield break;
|
||
|
||
company.Cash = 3_000_000;
|
||
if (!SubmitSmoke("nav-1") || !SubmitSmoke("facility-larger")
|
||
|| !CheckSmoke(root.Q<Button>("facility-12")?.ClassListContains("work-tool-locked") == true,
|
||
"Larger venues show the lock on a Coastal hull")
|
||
|| !CheckSmoke(company.BuildBlock(Ship, 0, 4, Facility.Suite) != null, "A Coastal hull cannot fit a suite"))
|
||
yield break;
|
||
|
||
company.Voyages = 3;
|
||
company.Reputation = 24;
|
||
if (!SubmitSmoke("nav-2") || !SubmitSmoke("yard-2") || !SubmitSmoke("buy-ship")
|
||
|| !CheckSmoke(Ship.HullIndex == 1 && Ship.Decks.Count == 4, "Regional hull is delivered with four decks")
|
||
|| !SubmitSmoke("nav-1") || !SubmitSmoke("deck-3") || !SubmitSmoke("facility-larger")
|
||
|| !SubmitSmoke("facility-12") || !SubmitSmoke("berth-0")
|
||
|| !CheckSmoke(Ship.Decks[3].AnchorAt(1, Ship.Hull.Columns) == 0 && Ship.SuiteBerths > 0,
|
||
"A Regional suite joins two bays and adds premium berths")
|
||
|| !CheckSmoke(company.BuildBlock(Ship, 3, 7, Facility.ResortPool) != null
|
||
&& company.BuildBlock(Ship, 3, 1, Facility.Restaurant) != null
|
||
&& company.BuildBlock(Ship, 3, 3, Facility.GrandTheater) != null,
|
||
"Expanded facilities respect deck edges, occupied bays, and Ocean Class limits"))
|
||
yield break;
|
||
|
||
int suiteRefund = Market.Facilities[(int)Facility.Suite].Price / 4;
|
||
int beforeClear = company.Cash;
|
||
if (!SubmitSmoke("facility-0") || !SubmitSmoke("berth-1")
|
||
|| !CheckSmoke(Ship.SuiteBerths == 0 && Ship.Decks[3].Cells[0] == Facility.Empty
|
||
&& Ship.Decks[3].Cells[1] == Facility.Empty && company.Cash == beforeClear + suiteRefund,
|
||
"Clearing a linked bay removes the whole fitting and refunds once")
|
||
|| !SubmitSmoke("facility-12") || !SubmitSmoke("berth-0")
|
||
|| !SubmitSmoke("facility-14") || !SubmitSmoke("berth-3")
|
||
|| !SubmitSmoke("facility-16") || !SubmitSmoke("berth-8")
|
||
|| !CheckSmoke(VesselExterior.SunDeck(Ship).Resort && Ship.PoolCapacity > 64
|
||
&& VesselExterior.SunDeck(Ship).PoolHalfSize.x > VesselExterior.PoolHalfLength * 2,
|
||
"The larger pool changes the top deck and service capacity"))
|
||
yield break;
|
||
Ship regional = Ship;
|
||
yield return CaptureSmoke(directory, "15a-regional-expanded-plans");
|
||
if (!SubmitSmoke("nav-0"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "15-regional-hull");
|
||
|
||
company.Voyages = 10;
|
||
company.Reputation = 70;
|
||
if (!SubmitSmoke("nav-2") || !SubmitSmoke("yard-4"))
|
||
yield break;
|
||
TextField vesselName = root.Q<TextField>("vessel-name");
|
||
if (!CheckSmoke(vesselName != null, "Name the Ocean Class commission"))
|
||
yield break;
|
||
vesselName.value = "Crownhaven";
|
||
if (!SubmitSmoke("buy-ship")
|
||
|| !CheckSmoke(Ship.HullIndex == Market.Ocean && Ship.Decks.Count == 6, "Ocean Class is delivered with six decks")
|
||
|| !SubmitSmoke("add-deck") || !SubmitSmoke("add-deck")
|
||
|| !CheckSmoke(Ship.Decks.Count == 8, "Ocean Class can add two more decks"))
|
||
yield break;
|
||
for (int bay = 0; bay < 7; bay++)
|
||
if (!CheckSmoke(company.Build(Ship, 0, bay, Facility.Cabin) == null, "Fit flagship passenger berths"))
|
||
yield break;
|
||
if (!SubmitSmoke("nav-1") || !SubmitSmoke("deck-5") || !SubmitSmoke("facility-leisure")
|
||
|| !SubmitSmoke("facility-20") || !SubmitSmoke("facility-rotate") || !SubmitSmoke("berth-4")
|
||
|| !SubmitSmoke("facility-21") || !SubmitSmoke("berth-7")
|
||
|| !CheckSmoke(Ship.Decks[5].RotationAt(4) == 1 && Ship.Decks[5].AnchorAt(18, Ship.Hull.Columns) == 7,
|
||
"Rotate an L-shaped shopping arcade and fit an adjacent 2×2 spa")
|
||
|| !SubmitSmoke("deck-6") || !SubmitSmoke("facility-22") || !SubmitSmoke("facility-rotate") || !SubmitSmoke("berth-3")
|
||
|| !CheckSmoke(Ship.Decks[6].RotationAt(3) == 1 && Ship.Decks[6].AnchorAt(24, Ship.Hull.Columns) == 3,
|
||
"Rotate a 3×2 water park to span three rows"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "15b-rotated-water-park-plan");
|
||
if (!CheckSmoke(company.Build(Ship, 7, 10, Facility.Restaurant) == null && company.Build(Ship, 7, 21, Facility.CocktailLounge) == null
|
||
&& company.Build(Ship, 7, 0, Facility.ResortPool) == null && company.Build(Ship, 7, 3, Facility.GrandTheater) == null
|
||
&& company.Build(Ship, 7, 14, Facility.GrandSuite) == null && company.Build(Ship, 7, 28, Facility.Shop) == null
|
||
&& VesselExterior.SunDeck(Ship).Theater
|
||
&& company.Refuel(Ship, 100) == null, "Fit and fuel the largest hull") || !SubmitSmoke("nav-0"))
|
||
yield break;
|
||
Ship flagship = Ship;
|
||
yield return CaptureSmoke(directory, "16-ocean-class-hull");
|
||
if (!SubmitSmoke("plan-voyage") || !SubmitSmoke("port-1") || !SubmitSmoke("dispatch")
|
||
|| !CheckSmoke(harbor.PortCinematicActive && Ship.Name == "MV Crownhaven" && Ship.Decks.Count == 8,
|
||
"A custom eight-deck flagship casts off in the live cinematic"))
|
||
yield break;
|
||
holdCinematicClock = true;
|
||
yield return CapturePortAndSkipSmoke(directory, "16b-ocean-class-departure", 1.4f);
|
||
int retailPrice = livePassage.GetPrice(OnboardService.Retail) + 1;
|
||
if (!SubmitSmoke("passage-price-retail-plus") || !livePassage.TryWorkStation(StationKind.Retail, out _)
|
||
|| !CheckSmoke(livePassage.Get(OnboardService.Retail).Served > 0
|
||
&& livePassage.GetPrice(OnboardService.Retail) == retailPrice && livePassage.DiscountTicks(OnboardService.Retail) > 0,
|
||
"Shops serve passengers and support checkout promotions and onboard pricing"))
|
||
yield break;
|
||
MovePassageToSmoke(.18f);
|
||
if (!CheckSmoke(livePassage.Get(OnboardService.Retail).Revenue > 0 && livePassage.Expenses > 0,
|
||
"Shop orders record retail takings and wholesale expense")
|
||
|| !SubmitSmoke("passage-deck-6"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "16c-water-park-cutaway");
|
||
if (!SubmitSmoke("passage-deck-7")
|
||
|| !CheckSmoke(passageDeck == 7, "Select the eighth deck during the voyage"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "17-ocean-class-cutaway");
|
||
harbor.Zoom(-13, new Vector2(.40f, .53f));
|
||
yield return new WaitForSecondsRealtime(.55f);
|
||
yield return CaptureSmoke(directory, "17a-expanded-venues-close-up");
|
||
harbor.ResetView(true);
|
||
harbor.Zoom(-90, new Vector2(.48f, .53f));
|
||
yield return new WaitForSecondsRealtime(.65f);
|
||
if (!CheckSmoke(harbor.OrbitCameraIsClear && harbor.OrbitVerticalSpan < 12f,
|
||
"The eighth deck can also zoom to room scale without clipping"))
|
||
yield break;
|
||
if (!SubmitSmoke("passage-explore") || !CheckSmoke(harbor.FirstPersonPositionIsClear, "Walk safely on the eighth deck"))
|
||
yield break;
|
||
|
||
int firstReserve = company.Cash - company.AvailableCash;
|
||
OnboardSession flagshipSession = livePassage;
|
||
HelmNavigation flagshipHelm = passageHelm;
|
||
int flagshipMealPrice = flagshipSession.GetPrice(OnboardService.Meals) + 1;
|
||
flagshipSession.ChangePrice(OnboardService.Meals, 1);
|
||
if (!SubmitSmoke("fleet-toggle") || !SubmitSmoke("fleet-1") || !CheckSmoke(Ship == regional && underway == null
|
||
&& FleetStatus(flagship).Session == flagshipSession && firstReserve > 0,
|
||
"Switch from the flagship to a docked ship while keeping its voyage and funding"))
|
||
yield break;
|
||
|
||
float flagshipPosition = flagshipHelm.Position.x;
|
||
if (!CheckSmoke(company.Refuel(regional, 60) == null, "Prepare the second fleet departure")
|
||
|| !SubmitSmoke("plan-voyage") || !SubmitSmoke("port-1")
|
||
|| !CheckSmoke(root.Q<Button>("dispatch")?.enabledInHierarchy == true,
|
||
"The second departure is ready: " + company.DepartureBlock(Ship, company.Forecast(Ship, destination)))
|
||
|| !SubmitSmoke("dispatch")
|
||
|| !CheckSmoke(FleetStatus(regional).Session == livePassage && company.Cash - company.AvailableCash > firstReserve,
|
||
"Dispatch a second ship with an independent session and cash reservation"))
|
||
yield break;
|
||
if (!SubmitSmoke("port-cinematic-skip"))
|
||
yield break;
|
||
HelmNavigation regionalHelm = passageHelm;
|
||
regionalHelm.SetProgress(.34f);
|
||
if (!SubmitSmoke("fleet-toggle") || !CheckSmoke(root.Q("fleet-overview") != null
|
||
&& root.Q<Label>("fleet-status-1") != null && root.Q<Label>("fleet-status-2") != null,
|
||
"Fleet overview lists both active crossings"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "18-fleet-overview");
|
||
if (!CheckSmoke(flagshipHelm.Position.x > flagshipPosition && regionalHelm.Progress >= .34f,
|
||
"Both ships keep sailing while the fleet chart is open")
|
||
|| !SubmitSmoke("fleet-2") || !CheckSmoke(Ship == flagship && livePassage == flagshipSession
|
||
&& livePassage.GetPrice(OnboardService.Meals) == flagshipMealPrice && passageHelm == flagshipHelm,
|
||
"Returning to a ship restores its exact voyage, prices, and track"))
|
||
yield break;
|
||
|
||
MovePassageToSmoke(.30f);
|
||
if (!SubmitSmoke("passage-deck-7") || !SubmitSmoke("passage-special-retail") || !SubmitSmoke("company-menu"))
|
||
yield break;
|
||
int savedReserve = company.ReservedCash;
|
||
Company departingCompany = company;
|
||
if (!SubmitSmoke("career-save") || !SubmitSmoke("career-save-as"))
|
||
yield break;
|
||
TextField saveName = root.Q<TextField>("career-save-name");
|
||
if (!CheckSmoke(saveName != null, "Name the separate save slot"))
|
||
yield break;
|
||
saveName.value = "Fleet Crossing";
|
||
if (!SubmitSmoke("career-save-confirm") || !SubmitSmoke("career-load-open")
|
||
|| !CheckSmoke(careers.List().Count >= 3 && careerName == "Fleet Crossing", "Save as preserves existing careers"))
|
||
yield break;
|
||
FleetPassageSnapshot[] before = careers.Read(careerId)?.Passages;
|
||
if (!CheckSmoke(before?.Length == 2, "The named save contains both crossings"))
|
||
yield break;
|
||
yield return CaptureSmoke(directory, "19-saved-careers");
|
||
if (!SubmitSmoke("career-load-0"))
|
||
yield break;
|
||
FleetPassageSnapshot[] after = CaptureFleetPassages();
|
||
if (!CheckSmoke(company != departingCompany && careerMenu == CareerMenu.Closed && careerName == "Fleet Crossing",
|
||
"The load browser activates the selected save")
|
||
|| !CheckSmoke(after.Length == 2 && company.ReservedCash == savedReserve, "Both crossings retain their cash reserves")
|
||
|| !CheckSmoke(SameSavedCrossing(before[0], after[0]), "The background crossing retains its navigation and operation state")
|
||
|| !CheckSmoke(SameSavedCrossing(before[1], after[1]), "The foreground crossing retains its navigation and operation state")
|
||
|| !CheckSmoke(Ship.Decks[6].RotationAt(3) == 1 && Ship.Decks[5].RotationAt(4) == 1, "Both rotated layouts load intact")
|
||
|| !CheckSmoke(passageDeck == 7 && livePassage.GetPrice(OnboardService.Retail) == retailPrice
|
||
&& livePassage.DiscountTicks(OnboardService.Retail) > 0, "The selected deck and active shop sale resume"))
|
||
yield break;
|
||
flagship = Ship;
|
||
flagshipSession = livePassage;
|
||
flagshipHelm = passageHelm;
|
||
regional = company.Fleet[1];
|
||
regionalHelm = FleetStatus(regional).Helm;
|
||
int sailed = company.Voyages;
|
||
regionalHelm.SetProgress(1);
|
||
yield return null;
|
||
yield return null;
|
||
if (!CheckSmoke(Ship == flagship && livePassage == flagshipSession && !harbor.PortCinematicActive
|
||
&& regional.Port == 1 && FleetStatus(regional).Voyage == null && company.Voyages == sailed + 1
|
||
&& company.Cash - company.AvailableCash == firstReserve, "Background arrival frees its funds and records one receipt"))
|
||
yield break;
|
||
if (!SubmitSmoke("fleet-toggle"))
|
||
yield break;
|
||
flagshipHelm.SetProgress(1);
|
||
yield return null;
|
||
yield return null;
|
||
if (!CheckSmoke(company.Voyages == sailed + 2 && company.Cash == company.AvailableCash
|
||
&& fleetOpen && root.Q("fleet-overview") != null && !harbor.PortCinematicActive,
|
||
"Same-day arrivals settle without interrupting the fleet overview"))
|
||
yield break;
|
||
Debug.Log($"Soundings player smoke passed at {Screen.width} × {Screen.height}.");
|
||
Application.Quit(0);
|
||
}
|
||
|
||
private static bool SameSavedCrossing(FleetPassageSnapshot before, FleetPassageSnapshot after) =>
|
||
before.ShipIndex == after.ShipIndex && before.Voyage.Destination == after.Voyage.Destination
|
||
&& JsonUtility.ToJson(before.Helm) == JsonUtility.ToJson(after.Helm)
|
||
&& JsonUtility.ToJson(before.Session) == JsonUtility.ToJson(after.Session);
|
||
|
||
private void MovePassageToSmoke(float progress)
|
||
{
|
||
passageHelm.SetProgress(progress);
|
||
livePassage.AdvanceTo(progress);
|
||
PresentVessel(0);
|
||
UpdatePassageUi(progress);
|
||
}
|
||
|
||
private void WalkSmoke(Vector2 movement, int steps)
|
||
{
|
||
for (int i = 0; i < steps; i++)
|
||
harbor.Walk(movement, .1f, true);
|
||
}
|
||
|
||
private bool SubmitSmoke(string element)
|
||
{
|
||
Button button = root.Q<Button>(element);
|
||
if (!CheckSmoke(button != null && button.enabledInHierarchy, "Available control: " + element))
|
||
return false;
|
||
using NavigationSubmitEvent navigation = NavigationSubmitEvent.GetPooled();
|
||
navigation.target = button;
|
||
button.SendEvent(navigation);
|
||
return true;
|
||
}
|
||
|
||
private static bool CheckSmoke(bool condition, string label)
|
||
{
|
||
if (!condition)
|
||
{
|
||
Debug.LogError("Soundings player smoke failed: " + label);
|
||
Application.Quit(1);
|
||
}
|
||
return condition;
|
||
}
|
||
|
||
private IEnumerator CapturePortAndSkipSmoke(string directory, string name, float time = -1f)
|
||
{
|
||
if (time >= 0)
|
||
{
|
||
cinematicTime = time;
|
||
PresentPortCinematicFrame(time);
|
||
}
|
||
yield return CaptureSmoke(directory, name);
|
||
SubmitSmoke("port-cinematic-skip");
|
||
holdCinematicClock = false;
|
||
}
|
||
|
||
private static IEnumerator CaptureSmoke(string directory, string name)
|
||
{
|
||
yield return null;
|
||
yield return null;
|
||
yield return new WaitForEndOfFrame();
|
||
Texture2D image = ScreenCapture.CaptureScreenshotAsTexture();
|
||
File.WriteAllBytes(Path.Combine(directory, name + ".png"), image.EncodeToPNG());
|
||
Destroy(image);
|
||
}
|
||
}
|
||
}
|