Add riverboat captain career and distinct ship classes
Add class-specific vessel geometry and sea motion, a guided helm qualification path, dockside sailing orders, and local excursions at all 24 ports.
This commit is contained in:
@@ -20,6 +20,16 @@ namespace BigShipTycoon
|
||||
|
||||
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++)
|
||||
@@ -890,6 +900,176 @@ namespace BigShipTycoon
|
||||
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)
|
||||
{
|
||||
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;
|
||||
holdCinematicClock = true;
|
||||
yield return CapturePortAndSkipSmoke(directory, "03-river-departure", 1.3f);
|
||||
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, 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
|
||||
&& 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") || !SubmitSmoke("port-cinematic-skip") || !SubmitSmoke("dock-now")
|
||||
|| !SubmitSmoke("port-cinematic-skip") || !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");
|
||||
Debug.Log($"Big Ship Tycoon Captain Career smoke passed at {Screen.width} × {Screen.height}.");
|
||||
Application.Quit(0);
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user