Files
josh 86ee1b99bf Add manual port pilotage and working bridge instruments
Scale docking momentum by hull, require manual mooring and channel maneuvers in Captain Career, and add rank-specific bridge instruments and voiced training.
2026-11-29 21:34:36 -05:00

1291 lines
84 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections;
using System.IO;
using UnityEngine;
using UnityEngine.UIElements;
namespace BigShipTycoon
{
public sealed partial class TycoonApp
{
private IEnumerator VisualSmoke()
{
string[] args = Environment.GetCommandLineArgs();
int index = Array.IndexOf(args, "-big-ship-tycoon-smoke");
if (index + 1 >= args.Length)
{
Application.Quit(1);
yield break;
}
string directory = args[index + 1];
Directory.CreateDirectory(directory);
if (Array.IndexOf(args, "-captain-only") >= 0)
{
yield return CaptainSmoke(directory);
yield break;
}
if (Array.IndexOf(args, "-class-lineup-only") >= 0)
{
yield return ClassLineupSmoke(directory);
yield break;
}
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;
if (!CheckSmoke(deckAmbience.Ready && titleArt != null && titleArt.name == "BigShipTycoonTitle", "New title art and all deck ambience loops are loaded"))
yield break;
brandingPreview = true;
Render();
yield return CaptureSmoke(directory, "00-big-ship-tycoon-thumbnail");
brandingPreview = false;
Render();
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");
yield return new WaitForSecondsRealtime(.45f);
float harborOverview = harbor.OrbitVerticalSpan;
float farDeckFocus = deckAmbience.Focus;
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")
|| !CheckSmoke(deckAmbience.Focus > farDeckFocus + .35f && deckAmbience.Level(DeckSound.Deck) > .05f,
$"Zooming in brings up local deck audio ({farDeckFocus:F2} to {deckAmbience.Focus:F2}, deck {deckAmbience.Level(DeckSound.Deck):F2})"))
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);
int laundry = Ship.CrewCount(CrewRole.Laundry), treasury = company.Cash;
int recruitment = CrewMarket.HireFee(Ship, CrewRole.Laundry), dailyPayroll = Ship.DailyPayroll;
if (!SubmitSmoke("harbor-crew-office") || !SubmitSmoke($"crew-hire-{(int)CrewRole.Laundry}")
|| !CheckSmoke(page == CrewOfficePage && Ship.CrewCount(CrewRole.Laundry) == laundry + 1
&& company.Cash == treasury - recruitment && Ship.DailyPayroll > dailyPayroll,
"Recruiting crew at the office spends cash and adds to voyage payroll"))
yield break;
yield return CaptureSmoke(directory, "02b-crew-office");
if (!SubmitSmoke("nav-0"))
yield break;
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
&& underway.Crew == Ship.DailyPayroll * underway.Days && livePassage.AssignedCrew(CrewRole.Laundry) == laundry + 1,
"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;
var miamiBerth = harbor.PortCinematicAlignment();
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(miamiBerth == harbor.PortCinematicAlignment(), "Miami's quay and shoreline stay aligned through cast-off")
|| !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(root.Q<Button>("passage-deck-1")?.worldBound.yMin < root.Q<Button>("passage-deck-0")?.worldBound.yMin,
"The deck stack puts the upper deck above Deck 1"))
yield break;
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");
yield return new WaitForSecondsRealtime(.65f);
if (!CheckSmoke(deckAmbience.Level(DeckSound.Galley) > .04f, "The galley has its own local audio")
|| !SubmitSmoke("service-area-6") || !CheckSmoke(passageServiceArea == 6 && harbor.FirstPersonPositionIsClear
&& livePassage.LaundryCapacity > 0, "Explore the crewed laundry"))
yield break;
yield return new WaitForSecondsRealtime(.7f);
if (!CheckSmoke(deckAmbience.Level(DeckSound.Laundry) > .04f && deckAmbience.Level(DeckSound.Laundry) > deckAmbience.Level(DeckSound.Galley),
"Walking into the laundry changes the local mix")
|| !SubmitSmoke("service-operate") || !CheckSmoke(livePassage.LaundryBoost, "Run an extra laundry shift at sea"))
yield break;
yield return CaptureSmoke(directory, "06d-laundry");
if (!SubmitSmoke("passage-crew-manifest") || !CheckSmoke(root.Q("crew-manifest") != null,
"Review the signed roster and laundry load while underway") || !SubmitSmoke("crew-manifest-close"))
yield break;
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;
var nassauBerth = harbor.PortCinematicAlignment();
FinishVoyage();
yield return new WaitForSecondsRealtime(1.4f);
if (!CheckSmoke(harbor.PortCinematicActive && company.Voyages == 1, "Arrival cannot settle the voyage twice")
|| !CheckSmoke(nassauBerth == harbor.PortCinematicAlignment(), "Nassau's quay and shoreline stay aligned during docking"))
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;
var keyWestBerth = harbor.PortCinematicAlignment();
cinematicTime = 1.4f;
PresentPortCinematicFrame(cinematicTime);
if (!CheckSmoke(keyWestBerth == harbor.PortCinematicAlignment(), "Key West's quay and shoreline stay aligned during docking"))
yield break;
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;
if (!SubmitSmoke("facility-casino")
|| !CheckSmoke(root.Q<Button>($"facility-{(int)Facility.CasinoLounge}")?.ClassListContains("work-tool-locked") == false
&& root.Q<Button>($"facility-{(int)Facility.Casino}")?.ClassListContains("work-tool-locked") == true
&& root.Q<Button>($"facility-{(int)Facility.GrandCasino}")?.ClassListContains("work-tool-locked") == true,
"The compact casino is available on Coastal hulls and larger casinos require bigger ships"))
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 (!SubmitSmoke("deck-4") || !SubmitSmoke("facility-casino") || !SubmitSmoke($"facility-{(int)Facility.GrandCasino}")
|| !SubmitSmoke("berth-4") || !CheckSmoke(Ship.CasinoCapacity == Market.Facilities[(int)Facility.GrandCasino].Capacity,
"Fit a 3×2 grand casino using Deck Plans"))
yield break;
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"))
yield break;
if (!SubmitSmoke("sun-deck-open"))
yield break;
var legacyTheater = FindExistingSunFittingSmoke(SunAttraction.Theater);
if (!CheckSmoke(legacyTheater >= 0, "The existing theater appears on the sun deck grid")
|| !SubmitSunCellSmoke(new SunDeckGrid(Ship).Existing[legacyTheater]) || !SubmitSmoke("sun-remove")
|| !SubmitSmoke("sun-pool-family") || !SubmitSmoke("sun-shape-oval"))
yield break;
SunDeckPlacement coaster = FindSunFittingSmoke(SunAttraction.RollerCoaster, 0, .16f);
if (!CheckSmoke(coaster.Kind == SunAttraction.RollerCoaster, "There is a footprint for a coaster")
|| !SubmitSmoke("sun-attraction-coaster") || !SubmitSunCellSmoke(coaster))
yield break;
int poolIndex = FindExistingSunFittingSmoke(SunAttraction.Pool);
if (!CheckSmoke(poolIndex >= 0, "The existing pool stays fitted after placing the coaster"))
yield break;
SunDeckPlacement oldPool = new SunDeckGrid(Ship).Existing[poolIndex];
SunDeckPlacement pool = FindSunFittingSmoke(SunAttraction.Pool, 1, .66f, poolIndex);
if (!CheckSmoke(pool.Kind == SunAttraction.Pool && pool.Column != oldPool.Column, "The pool has room to move and turn")
|| !SubmitSmoke("sun-attraction-pool") || !SubmitSmoke("sun-move") || !SubmitSmoke("sun-rotate")
|| !SubmitSunCellSmoke(pool))
yield break;
SunDeckPlacement golf = FindSunFittingSmoke(SunAttraction.MiniGolf, 0, .42f, fitQuarterTurn: true);
if (!CheckSmoke(golf.Kind == SunAttraction.MiniGolf, "There is a footprint for mini golf next to the pool and coaster")
|| !SubmitSmoke("sun-attraction-golf") || !SubmitSunCellSmoke(golf) || !SubmitSmoke("sun-rotate"))
yield break;
golf.Rotation = 1;
var sunDeck = VesselExterior.SunDeck(Ship);
if (!CheckSmoke(Ship.SunDeckPlan.CustomLayout && HasSunFittingSmoke(pool) && HasSunFittingSmoke(golf) && HasSunFittingSmoke(coaster)
&& sunDeck.HasPool && sunDeck.OvalPool && HasSunVenueSmoke(pool) && HasSunVenueSmoke(golf) && HasSunVenueSmoke(coaster),
"The pool, mini golf, and coaster occupy distinct positions and rotations on the actual sun deck"))
yield break;
yield return CaptureSmoke(directory, "15c-custom-sun-deck");
if (!SubmitSmoke("nav-0"))
yield break;
Ship flagship = Ship;
yield return CaptureSmoke(directory, "16-ocean-class-hull");
if (!SubmitSmoke("plan-voyage") || !SubmitSmoke("port-1") || !SubmitSmoke("weather-calm") || !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);
if (passageBusinessOpen && !SubmitSmoke("passage-business"))
yield break;
harbor.Orbit(new Vector2(0, 345f));
float coasterPhase = harbor.SunRidePhase(SunAttraction.RollerCoaster);
yield return new WaitForSecondsRealtime(.7f);
if (!CheckSmoke(coasterPhase >= 0 && !Mathf.Approximately(coasterPhase, harbor.SunRidePhase(SunAttraction.RollerCoaster)),
"The placed coaster train runs while the ship is underway"))
yield break;
yield return CaptureSmoke(directory, "16b-custom-sun-deck-at-sea");
harbor.ResetView(true);
if (!SubmitSmoke("passage-business"))
yield break;
int regularStake = livePassage.GetPrice(OnboardService.Casino);
if (!SubmitSmoke("passage-price-casino-plus") || !SubmitSmoke("passage-special-casino")
|| !CheckSmoke(livePassage.GetPrice(OnboardService.Casino) == regularStake + 1
&& livePassage.DiscountTicks(OnboardService.Casino) > 0, "Set table stakes and run a low-stakes hour"))
yield break;
MovePassageToSmoke(.12f);
if (!CheckSmoke(livePassage.Get(OnboardService.Casino).Served > 0
&& livePassage.CasinoPayouts > 0 && livePassage.Get(OnboardService.Casino).Revenue > livePassage.CasinoPayouts,
"The fitted casino serves guests and records stakes and payouts")
|| !SubmitSmoke("passage-deck-4"))
yield break;
harbor.Zoom(-14, new Vector2(.51f, .49f));
yield return new WaitForSecondsRealtime(.5f);
if (!CheckSmoke(harbor.HasActiveGuest(GuestActivity.PlayCards) && harbor.HasActiveGuest(GuestActivity.Dealer),
"Casino tables have active guests and dealers"))
yield break;
yield return CaptureSmoke(directory, "16c-casino");
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"))
yield break;
RefreshPassageBusiness();
if (livePassage.DiscountTicks(OnboardService.Retail) == 0 && !SubmitSmoke("passage-special-retail"))
yield break;
if (!CheckSmoke(livePassage.DiscountTicks(OnboardService.Retail) > 0, "Keep a shop sale active for the fleet save")
|| !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(Ship.SunDeckPlan.Shape == SunPoolShape.Oval && HasSunFittingSmoke(pool)
&& HasSunFittingSmoke(golf) && HasSunFittingSmoke(coaster), "All three sun deck fittings retain their positions and rotations at sea after reloading")
|| !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;
const int tourPort = 2;
const int tourIndex = 1;
var tour = ShoreExcursions.Catalog(tourPort)[tourIndex];
if (!SubmitSmoke("fleet-close") || !SubmitSmoke("nav-3") || !SubmitSmoke($"port-{tourPort}")
|| (!company.Permits[tourPort] && !SubmitSmoke("permit"))
|| !CheckSmoke(company.Refuel(Ship, 80) == null && Ship.Port == 1,
"Prepare the flagship's Nassau to Key West shore call")
|| !SubmitSmoke("weather-calm") || !SubmitSmoke("shore-planning-open"))
yield break;
IntegerField tourPrice = root.Q<IntegerField>($"shore-price-{tourIndex}");
IntegerField tourCapacity = root.Q<IntegerField>($"shore-capacity-{tourIndex}");
if (!CheckSmoke(tourPrice != null && tourCapacity != null && tourCapacity.value == 0
&& root.Q<Label>(className: "shore-tour-name")?.text == ShoreExcursions.Catalog(tourPort)[0].Name
&& ShoreExcursions.Catalog(tourPort)[0].Name != ShoreExcursions.Catalog(1)[0].Name,
"Chart opens port-specific optional shore offers"))
yield break;
int shorePrice = tour.MinPrice + 1;
int shoreCapacity = Math.Min(tour.MaxCapacity, 24);
tourPrice.value = shorePrice;
tourCapacity.value = shoreCapacity;
yield return CaptureSmoke(directory, "20-shore-excursion-planner");
if (!SubmitSmoke("shore-plan-save") || !SubmitSmoke("dispatch") || !SubmitSmoke("port-cinematic-skip")
|| !CheckSmoke(underway?.ShoreOffers is { Length: 1 } && underway.ShoreOffers[0].Price == shorePrice
&& underway.ShoreOffers[0].Capacity == shoreCapacity, "Configured prices and capacity carry into the voyage")
|| !SubmitSmoke("shore-planning-open"))
yield break;
tourPrice = root.Q<IntegerField>($"shore-price-{tourIndex}");
tourCapacity = root.Q<IntegerField>($"shore-capacity-{tourIndex}");
if (!CheckSmoke(tourPrice?.value == shorePrice && tourCapacity?.value == shoreCapacity,
"Underway planning shows the current offer before docking"))
yield break;
tourPrice.value = --shorePrice;
tourCapacity.value = --shoreCapacity;
if (!SubmitSmoke("shore-plan-save")
|| !CheckSmoke(underway.ShoreOffers[0].Price == shorePrice && underway.ShoreOffers[0].Capacity == shoreCapacity,
"Adjust ticket price and capacity during the crossing"))
yield break;
Voyage crossingWithShorePlan = underway;
if (!SubmitSmoke("company-menu") || !SubmitSmoke("career-save")
|| !SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0")
|| !CheckSmoke(underway != null && underway != crossingWithShorePlan
&& underway.ShoreOffers is { Length: 1 } && underway.ShoreOffers[0].Price == shorePrice
&& underway.ShoreOffers[0].Capacity == shoreCapacity,
"A mid-voyage save resumes the updated excursion plan"))
yield break;
int originalArrivalDay = underway.Day;
while (!(ShoreExcursions.Create(underway, underway.ShoreOffers)?.LateGuests > 0)
&& underway.Day < originalArrivalDay + 180)
underway.Day++;
if (!CheckSmoke(ShoreExcursions.Create(underway, underway.ShoreOffers)?.LateGuests > 0,
"Find a deterministic late return for the smoke scenario")
|| !SubmitSmoke("dock-now") || !SubmitSmoke("port-cinematic-skip")
|| !CheckSmoke(Ship.Port == tourPort && Ship.ShoreCall?.Phase == ShorePhase.Touring
&& root.Q("shore-operations") != null, "Docking begins the selected port's shore visit"))
yield break;
if (!SubmitSmoke("nav-3") || !SubmitSmoke("port-0")
|| !CheckSmoke(root.Q<Button>("dispatch")?.enabledInHierarchy == false,
"Next departure is blocked while excursion guests are ashore")
|| !SubmitSmoke("nav-0") || !SubmitSmoke("company-menu") || !SubmitSmoke("career-save"))
yield break;
int shoreCash = company.Cash;
int shoreVoyages = company.Voyages;
int lateGuests = Ship.ShoreCall.LateGuests;
float shoreTime = Ship.ShoreCall.RemainingSeconds;
Company beforeShoreLoad = company;
if (!SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0")
|| !CheckSmoke(company != beforeShoreLoad && Ship.ShoreCall?.Phase == ShorePhase.Touring
&& Ship.ShoreCall.LateGuests == lateGuests && Mathf.Abs(Ship.ShoreCall.RemainingSeconds - shoreTime) < .01f,
"Loading restores the shore clock and the same delayed group"))
yield break;
AdvanceShoreCalls(120);
if (!CheckSmoke(Ship.ShoreCall?.Phase == ShorePhase.AwaitingDecision,
"Late returning guests require a decision before departure"))
yield break;
yield return CaptureSmoke(directory, "21-shore-departure-decision");
if (!SubmitSmoke("shore-departure-hold")
|| !CheckSmoke(Ship.ShoreCall?.Phase == ShorePhase.Holding && Ship.Port == tourPort,
"Hold departure gives the late group time to return"))
yield break;
AdvanceShoreCalls(120);
ShoreReport heldReport = company.History[0].ShoreReport;
if (!CheckSmoke(Ship.ShoreCall == null && company.Voyages == shoreVoyages
&& heldReport?.Resolution == ShoreLateResolution.Held && heldReport.LateGuests == lateGuests
&& company.Cash == shoreCash + heldReport.NetIncome,
"The completed shore call settles once in the voyage's logbook"))
yield break;
if (!SubmitSmoke("nav-4"))
yield break;
yield return CaptureSmoke(directory, "22-shore-excursion-settlement");
if (!SubmitSmoke("company-menu") || !SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0"))
yield break;
AdvanceShoreCalls(120);
if (!SubmitSmoke("shore-departure-transport"))
yield break;
ShoreReport transportReport = company.History[0].ShoreReport;
if (!CheckSmoke(Ship.ShoreCall == null && company.Voyages == shoreVoyages
&& transportReport?.Resolution == ShoreLateResolution.AlternateTransport
&& transportReport.ExtraCost < heldReport.ExtraCost && transportReport.GuestImpact < heldReport.GuestImpact
&& company.Cash == shoreCash + transportReport.NetIncome,
"Arranging onward transport clears the call with cheaper costs and a worse guest survey"))
yield break;
if (!SubmitSmoke("nav-3") || !SubmitSmoke("port-0")
|| !CheckSmoke(root.Q<Button>("dispatch")?.enabledInHierarchy == true,
"Resolve the late group and clear the next departure"))
yield break;
company.Cash = 12_000_000;
company.Voyages = 20;
company.Reputation = 85;
company.Flagship = false;
if (!SubmitSmoke("nav-2") || !SubmitSmoke("yard-5")
|| !CheckSmoke(root.Q<Button>("buy-ship")?.enabledInHierarchy == false, "The MEGA liner requires the flagship charter"))
yield break;
company.Flagship = true;
Render();
vesselName = root.Q<TextField>("vessel-name");
if (!CheckSmoke(vesselName != null, "Name the MEGA Ocean Liner commission"))
yield break;
vesselName.value = "Aster Meridian";
if (!SubmitSmoke("buy-ship") || !CheckSmoke(Ship.HullIndex == Market.Mega && Ship.Decks.Count == 12 && Ship.HasAftTerrace,
"Commission the 300-meter split-deck hull with twelve decks")
|| !SubmitSmoke("add-deck") || !SubmitSmoke("add-deck") || !SubmitSmoke("add-deck")
|| !CheckSmoke(Ship.Decks.Count == 15, "Expand the MEGA liner to fifteen decks"))
yield break;
if (!SubmitSmoke("nav-1") || !SubmitSmoke("deck-0") || !SubmitSmoke("facility-mega-venues")
|| !SubmitSmoke($"facility-{(int)Facility.SkyResidence}") || !SubmitSmoke("berth-2")
|| !CheckSmoke(company.Build(Ship, 2, 4, Facility.MarketHall) == null
&& company.Build(Ship, 13, 5, Facility.OceanArena) == null && company.Build(Ship, 11, 6, Facility.ThermalSpa) == null
&& company.Build(Ship, 4, 5, Facility.ProductionGalley) == null && company.Refuel(Ship, 350) == null,
"Commission class-exclusive accommodation, entertainment, and service capacity"))
yield break;
if (!SubmitSmoke("sun-deck-open") || !SubmitSmoke("sun-zone-terrace") || !SubmitSmoke("sun-pool-lagoon")
|| !SubmitSmoke("sun-shape-oval"))
yield break;
SunDeckPlacement lagoon = FindSunFittingSmoke(SunAttraction.Pool, 0, .50f, zone: SunDeckZone.AftTerrace);
if (!CheckSmoke(lagoon.Kind == SunAttraction.Pool, "The lower aft terrace fits a lagoon pool")
|| !SubmitSmoke("sun-attraction-pool") || !SubmitSunCellSmoke(lagoon))
yield break;
yield return CaptureSmoke(directory, "23-mega-terrace-plan");
if (!SubmitSmoke("sun-zone-sky"))
yield break;
SunDeckPlacement garden = FindSunFittingSmoke(SunAttraction.SkyGarden, 0, .49f);
SunDeckPlacement megaCoaster;
if (!CheckSmoke(garden.Kind == SunAttraction.SkyGarden, "The upper deck fits the MEGA sky garden")
|| !SubmitSmoke("sun-attraction-garden") || !SubmitSunCellSmoke(garden))
yield break;
megaCoaster = FindSunFittingSmoke(SunAttraction.RollerCoaster, 0, .30f);
if (!CheckSmoke(megaCoaster.Kind == SunAttraction.RollerCoaster, "A coaster fits alongside the sky garden")
|| !SubmitSmoke("sun-attraction-coaster") || !SubmitSunCellSmoke(megaCoaster)
|| !CheckSmoke(VesselExterior.SunDeck(Ship, SunDeckZone.AftTerrace).HasPool
&& VesselExterior.SunDeck(Ship).Venues.Length == 2 && Ship.OutdoorAmenityCapacity == 649,
"Both outdoor levels contribute their own admissions"))
yield break;
if (!SubmitSmoke("nav-0") || !SubmitSmoke("plan-voyage") || !SubmitSmoke("port-1") || !SubmitSmoke("weather-calm")
|| !SubmitSmoke("dispatch") || !CheckSmoke(underway != null, "The MEGA liner can depart on a scheduled voyage"))
yield break;
holdCinematicClock = true;
yield return CapturePortAndSkipSmoke(directory, "24-mega-departure", 1.4f);
if (passageBusinessOpen && !SubmitSmoke("passage-business"))
yield break;
harbor.Orbit(new Vector2(-83f, 220f));
yield return new WaitForSecondsRealtime(.65f);
yield return CaptureSmoke(directory, "25-mega-liner-underway");
if (!SubmitSmoke("passage-deck-13"))
yield break;
harbor.Zoom(-3f, new Vector2(.50f, .52f));
yield return new WaitForSecondsRealtime(.5f);
yield return CaptureSmoke(directory, "26-mega-arena-cutaway");
if (!SubmitSmoke("passage-aft-terrace") || !SubmitSmoke("passage-explore")
|| !CheckSmoke(passageExploring && harbor.FirstPersonPositionIsClear
&& Mathf.Abs(harbor.FirstPersonPosition.y - 1.64f - MegaDeckGeometry.RoofHeight(Ship.Decks.Count, SunDeckZone.AftTerrace)) < .01f,
"Walk the lower aft terrace at its actual deck height"))
yield break;
yield return CaptureSmoke(directory, "27-mega-terrace-walk");
if (!SubmitSmoke("company-menu") || !SubmitSmoke("career-save") || !SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0")
|| !CheckSmoke(Ship.HullIndex == Market.Mega && Ship.Decks.Count == 15 && Ship.Count(Facility.OceanArena) == 1
&& Ship.SunDeckFor(SunDeckZone.AftTerrace).Pool == SunPoolStyle.Lagoon && Ship.OutdoorAmenityCapacity == 649
&& underway != null && passageSunZone == SunDeckZone.AftTerrace && passageExploring && harbor.FirstPersonPositionIsClear,
"A mid-voyage reload keeps the MEGA class, both layouts, and the aft terrace view"))
yield break;
Debug.Log($"Big Ship Tycoon player smoke passed at {Screen.width} × {Screen.height}.");
Application.Quit(0);
}
private IEnumerator ClassLineupSmoke(string directory)
{
StartCompany(CareerStart.Captain);
int[] classes = { Market.River, Market.Coastal, Market.Regional, Market.Ocean, Market.Mega };
for (int index = 0; index < classes.Length; index++)
{
int hull = classes[index];
if (hull == Market.Coastal)
StartCompany(false);
else if (hull != Market.River)
{
company.Cash = 20_000_000;
company.Voyages = 30;
company.Reputation = 80;
company.Flagship = true;
if (!CheckSmoke(company.Acquire(hull, false, $"Class {index}") == null, "Prepare the class lineup"))
yield break;
for (int deck = 0; deck < Ship.Decks.Count - 1; deck++)
for (int column = 0; column < Ship.Hull.Columns; column += 2)
{
company.Build(Ship, deck, column, Facility.Cabin);
company.Build(Ship, deck, Ship.Hull.Columns * (Ship.Hull.Rows - 1) + column, Facility.Cabin);
}
ResetItinerary();
Render();
}
harbor.BeginPassage();
harbor.SetPassage(new Vector2(.12f, 0), 0, hull == Market.River ? 9 : 16, .12f);
harbor.Orbit(new Vector2(-12, 31));
yield return new WaitForSecondsRealtime(.42f);
yield return new WaitForEndOfFrame();
RenderTexture frame = harbor.Frame;
if (!CheckSmoke(Ship.HullIndex == hull && frame != null, "Render each distinct vessel class"))
yield break;
var previous = RenderTexture.active;
RenderTexture.active = frame;
var image = new Texture2D(frame.width, frame.height, TextureFormat.RGB24, false);
image.ReadPixels(new Rect(0, 0, frame.width, frame.height), 0, 0);
RenderTexture.active = previous;
File.WriteAllBytes(Path.Combine(directory, $"{index + 1:00}-{Ship.Hull.Name.Replace(' ', '-')}.png"), image.EncodeToPNG());
Destroy(image);
harbor.EndPassage();
}
Debug.Log("Big Ship Tycoon class lineup passed for all five hulls.");
Application.Quit(0);
}
private IEnumerator CaptainSmoke(string directory)
{
float lastDisplacement = 0, lastCoast = 0;
foreach (int hull in new[] { Market.River, Market.Coastal, Market.Regional, Market.Ocean, Market.Mega })
{
var moving = new DockManeuver(hull, true, 3f);
if (!CheckSmoke(moving.DisplacementTonnes > lastDisplacement && moving.NeutralCoastMetres > lastCoast,
"At the same speed, larger hulls displace more water and coast farther"))
yield break;
lastDisplacement = moving.DisplacementTonnes;
lastCoast = moving.NeutralCoastMetres;
moving.Advance(.1f, 0, 0);
if (!CheckSmoke(moving.SpeedKnots > 2.85f, "Stop does not erase existing momentum"))
yield break;
var resting = new DockManeuver(hull, true);
resting.Advance(2, 0, -1);
if (!CheckSmoke(resting.HasBowThruster
? resting.BowThruster < 0 && resting.LateralSpeedKnots < 0 && resting.TurnRate < 0
: resting.BowThruster == 0 && resting.LateralSpeedKnots == 0,
"Only fitted bow thrusters can produce movement at a standstill"))
yield break;
}
Vector3 calm = PeakSeaResponseSmoke(Market.Coastal, 0);
Vector3 storm = PeakSeaResponseSmoke(Market.Coastal, 1);
Vector3 river = PeakSeaResponseSmoke(Market.River, 1);
Vector3 liner = PeakSeaResponseSmoke(Market.Mega, 1);
if (!CheckSmoke(storm.x > calm.x * 2 && storm.y > calm.y * 2 && liner.y < storm.y * .6f
&& river.x < storm.x * .5f && river.y <= 3.2f,
"Travelling waves produce stronger storm motion with class-specific vessel response")
|| !SubmitSmoke("start-captain") || !SubmitSmoke("replace")
|| !CheckSmoke(company.IsCaptainCareer && Ship.HullIndex == Market.River && Ship.Hull.Length < 40
&& company.CommandVoyages(Market.River) == 0 && company.HelmQualifications(Market.River) == 0,
"Start a Captain Career aboard the riverboat"))
yield break;
yield return CaptureSmoke(directory, "01-captain-career");
if (!SubmitSmoke("plan-voyage") || !CheckSmoke(destination >= 0 && destination != Ship.Port, "A local river departure is available")
|| !SubmitSmoke("port-plan-open") || !SubmitSmoke("port-order-economy"))
yield break;
yield return CaptureSmoke(directory, "02-river-sailing-orders");
if (!SubmitSmoke("port-plan-close") || !SubmitSmoke("dispatch")
|| !CheckSmoke(underway != null && underway.Miles <= 30 && livePassage.EngineMode == 0
&& underway.Plan.Order == PassageOrder.Economy && underway.DepartureFuelBurn <= underway.FuelBurn,
"Cast off on a short river trip with the planned economy order"))
yield break;
if (!CheckSmoke(!harbor.PortCinematicActive && ActiveDockManeuver is { Arriving: false, BowLine: true, SternLine: true }
&& harbor.DockManeuverVisible && harbor.DockLinesVisible == (true, true)
&& root.Q<Button>("dock-autopilot")?.enabledInHierarchy == false,
"Captain Career begins at the berth with the boat made fast and autopilot locked"))
yield break;
UpdatePilotageGuide(ActiveDockManeuver);
if (!CheckSmoke(PilotageClip(PilotageLesson.ReleaseLines) is { length: > 1 }
&& root.Q<Label>("pilotage-guide-heading")?.text == "Release both mooring lines",
"The captain's voiced guide introduces the actual mooring task"))
yield break;
yield return CaptureSmoke(directory, "03-river-departure");
if (!SubmitSmoke("dock-bow-line"))
yield break;
DockManeuver tied = ActiveDockManeuver;
tied.SetOrder(DockOrder.HalfAhead);
tied.Advance(2, 1, 0);
if (!CheckSmoke(tied.Order == DockOrder.Stop && tied.SpeedKnots == 0 && !tied.BowLine && tied.SternLine,
"The remaining line holds the ship with the engine interlocked")
|| !SubmitSmoke("company-menu") || !SubmitSmoke("career-save") || !SubmitSmoke("career-load-open")
|| !SubmitSmoke("career-load-0") || !CheckSmoke(ActiveDockManeuver is { BowLine: false, SternLine: true }
&& harbor.DockLinesVisible == (false, true), "A dock save restores each physical line independently")
|| !PilotDepartureSmoke())
yield break;
if (!CheckSmoke(harbor.RiverBanksVisible, "The riverboat sails between visible banks"))
yield break;
yield return CaptureSmoke(directory, "03a-river-underway");
if (!SubmitSmoke("voyage-map-toggle"))
yield break;
yield return CaptureSmoke(directory, "03b-river-voyage-map");
if (!SubmitSmoke("voyage-map-close"))
yield break;
if (!SubmitSmoke("passage-bridge") || !SubmitSmoke("helm-toggle") || !SubmitSmoke("helm-order-1")
|| !CheckSmoke(passageHelm.Manual && passageHelm.Practice.Exercise == HelmExercise.ChangeHeading,
"Use the bridge throttle to start the practical helm check"))
yield break;
for (int i = 0; i < 32; i++)
StepCaptainSmoke(.1f);
yield return CaptureSmoke(directory, "04-river-helm-practice");
if (!CheckSmoke(harbor.PassageSeaMotion.sqrMagnitude > .00001f && Mathf.Abs(harbor.HorizonRoll) < 5f
&& harbor.FirstPersonPositionIsClear, "The bridge camera follows the vessel with a damped horizon and valid footing"))
yield break;
HelmPracticeSnapshot before = passageHelm.Practice.Capture();
if (!SubmitSmoke("company-menu") || !SubmitSmoke("career-save") || !SubmitSmoke("career-load-open") || !SubmitSmoke("career-load-0")
|| !CheckSmoke(company.IsCaptainCareer && passageHelm.Manual && livePassage.EngineMode == 0
&& before.Exercise == passageHelm.Practice.Exercise
&& Mathf.Abs(before.Target - passageHelm.Practice.Capture().Target) < .01f,
"Resume the same manual manoeuvre and sailing order from a career save"))
yield break;
for (int i = 0; i < 580 && !passageHelm.Practice.Qualified && !passageHelm.Arrived; i++)
StepCaptainSmoke(.1f);
if (!CheckSmoke(passageHelm.Practice.Qualified && !passageHelm.Arrived,
"Steer onto the assigned heading, return to course and hold it") || !SubmitSmoke("helm-toggle"))
yield break;
yield return CaptureSmoke(directory, "05-river-helm-passed");
int voyages = company.Voyages;
int helmChecks = company.HelmQualifications(Market.River);
for (int i = 0; i < 2000 && !passageHelm.Arrived; i++)
passageHelm.Advance(.1f, 0, PassageEngineSpeed(passageHelm, livePassage), underway.Weather);
if (!CheckSmoke(passageHelm.Arrived, "The riverboat reaches the channel entrance under navigation"))
yield break;
UpdateActivePassage(0);
if (!CheckSmoke(ActiveDockManeuver is { Arriving: true, BowLine: false, SternLine: false } && !harbor.PortCinematicActive
&& harbor.DockExteriorVisible
&& company.Voyages == voyages, "The pilot takes over at the harbor entrance before the voyage settles"))
yield break;
yield return CaptureSmoke(directory, "06a-inbound-pilotage");
if (!PilotArrivalSmoke() || !CheckSmoke(company.Voyages == voyages + 1 && company.History[0].Miles <= 30
&& company.CommandVoyages(Market.River) == 1 && company.HelmQualifications(Market.River) == helmChecks + 1,
"A qualifying river crossing settles and continues the career"))
yield break;
yield return CaptureSmoke(directory, "06-captain-arrival");
var shallowWater = new HelmNavigation(103, Market.River) { Manual = true };
bool encounteredEdge = false;
for (int i = 0; i < 320; i++)
{
shallowWater.Advance(.1f, 1, 1, WeatherCondition.Calm);
encounteredEdge |= shallowWater.AtChannelEdge;
}
if (!CheckSmoke(encounteredEdge && Mathf.Abs(shallowWater.Position.y) < 6, "The riverboat stays inside the river navigation channel"))
yield break;
OpenVoyageChart();
if (!SubmitSmoke("dispatch") || !PilotDepartureSmoke())
yield break;
for (int i = 0; i < 2000 && !passageHelm.Arrived; i++)
passageHelm.Advance(.1f, 0, PassageEngineSpeed(passageHelm, livePassage), underway.Weather);
UpdateActivePassage(0);
if (!PilotArrivalSmoke() || !CheckSmoke(company.CommandVoyages(Market.River) == 2
&& company.HelmQualifications(Market.River) == 1 && company.ShipyardBlock(Market.Coastal, true) == null,
"Two river trips with one practical check unlock the Coastal command"))
yield break;
if (!SubmitSmoke("nav-2") || !SubmitSmoke("yard-0"))
yield break;
yield return CaptureSmoke(directory, "07a-coastal-shipyard");
if (!SubmitSmoke("buy-ship") || !CheckSmoke(Ship.HullIndex == Market.Coastal
&& company.ShipyardBlock(Market.Regional, true) != null,
"The Coastal command starts a fresh qualification path to Regional"))
yield break;
yield return CaptureSmoke(directory, "07-coastal-command");
company.Cash += 90000;
OpenVoyageChart();
Voyage coastal = company.Forecast(Ship, destination);
if (coastal.RequiredFuel > Ship.Fuel)
company.Refuel(Ship, coastal.RequiredFuel - Ship.Fuel);
if (!SubmitSmoke("dispatch") || !SubmitSmoke("dock-bridge") || !SubmitSmoke("dock-radar-range")
|| !CheckSmoke(harbor.LiveDockDisplayCount >= 4 && harbor.DockRadarRunning && harbor.FirstPersonPositionIsClear,
"The Coastal wheelhouse shows live instruments and an adjustable radar"))
yield break;
yield return CaptureSmoke(directory, "08-coastal-bridge-radar");
Debug.Log($"Big Ship Tycoon Captain Career smoke passed at {Screen.width} × {Screen.height}.");
Application.Quit(0);
}
private bool PilotDepartureSmoke()
{
DockManeuver dock = ActiveDockManeuver;
if (dock == null || dock.BowLine && !SubmitSmoke("dock-bow-line")
|| dock.SternLine && !SubmitSmoke("dock-stern-line") || !SubmitSmoke("dock-order-2"))
return false;
dock.Advance(.1f, 0, 0);
if (!CheckSmoke(dock.SpeedKnots is > 0 and < .5f, "The vessel builds speed gradually after casting off"))
return false;
for (int i = 0; i < 2000 && !dock.ReadyForAutopilot; i++)
{
float heading = Mathf.Atan2(-dock.Position.y, Mathf.Max(24f, Ship.Hull.Length * .53f)) * Mathf.Rad2Deg;
float rudder = Mathf.Clamp(.092f * Mathf.DeltaAngle(dock.Heading, heading) - .31f * dock.TurnRate, -1, 1);
dock.Advance(.1f, rudder, 0);
}
UpdateActiveDockManeuver(dock, 0);
return CheckSmoke(dock.ReadyForAutopilot, $"The vessel clears the channel ({dock.Position}, {dock.SpeedKnots:F2} kn)")
&& SubmitSmoke("dock-autopilot") && CheckSmoke(ActiveDockManeuver == null && !harbor.DockManeuverVisible
&& !passageHelm.Manual && Mathf.Abs(passageHelm.Speed - dock.SpeedKnots) < .08f,
"The explicit handoff carries actual forward speed into autopilot");
}
private bool PilotArrivalSmoke()
{
if (!CheckSmoke(ActiveDockManeuver is { Arriving: true } && root.Q<Button>("dock-bow-line")?.enabledInHierarchy == false,
"Mooring remains unavailable until aligned and stopped"))
return false;
DockManeuver dock = ActiveDockManeuver;
for (int i = 0; i < 3000 && !dock.CanToggleLine(true); i++)
{
float x = dock.Position.x, speed = dock.SpeedKnots;
float heading = 180f - Mathf.Atan2(dock.Berth.y - dock.Position.y, Mathf.Max(24f, Ship.Hull.Length * .28f)) * Mathf.Rad2Deg;
float rudder = Mathf.Clamp(.095f * Mathf.DeltaAngle(dock.Heading, heading) - .32f * dock.TurnRate, -1, 1);
DockOrder order = x > 16 && speed < 2 || x > 8 && speed < .65f ? DockOrder.DeadSlowAhead
: x < -4.5f && speed > -.55f ? DockOrder.DeadSlowAstern : DockOrder.Stop;
dock.SetOrder(order);
dock.Advance(.1f, speed < -.01f ? -rudder : rudder, 0);
}
UpdateActiveDockManeuver(dock, 0);
if (!CheckSmoke(dock.CanToggleLine(true), $"The vessel stops within the berth envelope ({dock.Position}, {dock.SpeedKnots:F2} kn)")
|| !SubmitSmoke("dock-bow-line") || !CheckSmoke(!dock.Secured, "One line alone cannot settle arrival")
|| !SubmitSmoke("dock-stern-line"))
return false;
UpdateActiveDockManeuver(dock, 0);
return CheckSmoke(underway == null && !harbor.DockManeuverVisible, "Both lines secure before the voyage settles");
}
private static Vector3 PeakSeaResponseSmoke(int hullIndex, float severity)
{
HullSpec hull = Market.Hulls[hullIndex];
var peak = Vector3.zero;
for (int sample = 0; sample < 90; sample++)
{
Vector3 motion = Harbor.SampleSeaResponse(new Vector2(sample * 2.5f, 7), sample * .3f, 26,
hull.Length, hull.Beam * .5f, severity, hullIndex == Market.River);
peak = Vector3.Max(peak, new Vector3(Mathf.Abs(motion.x), Mathf.Abs(motion.y), Mathf.Abs(motion.z)));
}
return peak;
}
private void StepCaptainSmoke(float delta)
{
HelmPractice practice = passageHelm.Practice;
float desired = practice.Exercise == HelmExercise.ChangeHeading ? practice.Capture().Target : passageHelm.CourseToDestination;
float difference = Mathf.DeltaAngle(passageHelm.Heading, desired);
float rudder = Mathf.Abs(difference) > 2.2f ? Mathf.Clamp(difference * .13f - passageHelm.Rudder * .015f, -1f, 1f) : 0;
passageHelm.Advance(delta, rudder, livePassage.SpeedFactor, underway.Weather);
practice.Advance(passageHelm, delta, rudder);
livePassage.AdvanceTo(passageHelm.Progress);
PresentVessel(delta);
}
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 int FindExistingSunFittingSmoke(SunAttraction kind)
{
var existing = new SunDeckGrid(Ship).Existing;
for (int i = 0; i < existing.Count; i++)
if (existing[i].Kind == kind)
return i;
return -1;
}
private SunDeckPlacement FindSunFittingSmoke(SunAttraction kind, int rotation, float fore, int replacing = -1,
bool fitQuarterTurn = false, SunDeckZone zone = SunDeckZone.Sky)
{
var grid = new SunDeckGrid(Ship, zone: zone);
var best = default(SunDeckPlacement);
float target = Mathf.Lerp(grid.Area.xMin, grid.Area.xMax, fore);
float score = float.PositiveInfinity;
for (int column = 0; column < grid.Columns; column++)
for (int row = 0; row < grid.Rows; row++)
{
var placement = new SunDeckPlacement(kind, column, row, rotation);
if (company.SunDeckPlacementBlock(Ship, placement, replacing, zone) != null
|| (fitQuarterTurn && company.SunDeckPlacementBlock(Ship, new SunDeckPlacement(kind, column, row, rotation + 1), replacing, zone) != null))
continue;
Vector2 center = grid.Bounds(placement, grid.SelectedPool).center;
float candidate = Mathf.Abs(center.x - target) + Mathf.Abs(center.y);
if (candidate >= score)
continue;
(best, score) = (placement, candidate);
}
return best;
}
private bool SubmitSunCellSmoke(SunDeckPlacement placement) => SubmitSmoke($"sun-cell-{placement.Column}-{placement.Row}");
private bool HasSunFittingSmoke(SunDeckPlacement expected) => Ship.SunDeckPlan.Placements != null
&& Array.Exists(Ship.SunDeckPlan.Placements, fitting => fitting.Kind == expected.Kind && fitting.Column == expected.Column
&& fitting.Row == expected.Row && fitting.Rotation == expected.Rotation);
private bool HasSunVenueSmoke(SunDeckPlacement expected)
{
Vector2 center = new SunDeckGrid(Ship).Bounds(expected, Ship.SunDeckPlan.Pool).center;
return Array.Exists(VesselExterior.SunDeck(Ship).Venues, venue => venue.Kind == expected.Kind
&& venue.Rotation == expected.Rotation && Vector2.SqrMagnitude(venue.Center - center) < .001f);
}
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("Big Ship Tycoon 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);
}
}
}