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.
This commit is contained in:
josh
2026-11-29 21:34:36 -05:00
parent 290e4cb45d
commit 86ee1b99bf
57 changed files with 2454 additions and 62 deletions

View File

@@ -950,6 +950,27 @@ namespace BigShipTycoon
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);
@@ -972,8 +993,29 @@ namespace BigShipTycoon
&& underway.Plan.Order == PassageOrder.Economy && underway.DepartureFuelBurn <= underway.FuelBurn,
"Cast off on a short river trip with the planned economy order"))
yield break;
holdCinematicClock = true;
yield return CapturePortAndSkipSmoke(directory, "03-river-departure", 1.3f);
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");
@@ -1010,9 +1052,16 @@ namespace BigShipTycoon
int voyages = company.Voyages;
int helmChecks = company.HelmQualifications(Market.River);
for (int i = 0; i < 2000 && !passageHelm.Arrived; i++)
passageHelm.Advance(.1f, 0, livePassage.SpeedFactor, underway.Weather);
if (!CheckSmoke(passageHelm.Arrived, "The riverboat reaches port under navigation") || !SubmitSmoke("dock-now")
|| !SubmitSmoke("port-cinematic-skip") || !CheckSmoke(company.Voyages == voyages + 1 && company.History[0].Miles <= 30
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;
@@ -1028,8 +1077,12 @@ namespace BigShipTycoon
if (!CheckSmoke(encounteredEdge && Mathf.Abs(shallowWater.Position.y) < 6, "The riverboat stays inside the river navigation channel"))
yield break;
OpenVoyageChart();
if (!SubmitSmoke("dispatch") || !SubmitSmoke("port-cinematic-skip") || !SubmitSmoke("dock-now")
|| !SubmitSmoke("port-cinematic-skip") || !CheckSmoke(company.CommandVoyages(Market.River) == 2
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;
@@ -1041,10 +1094,67 @@ namespace BigShipTycoon
"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];