Add MEGA Ocean Liner, split decks, and detailed ship materials

This commit is contained in:
josh
2026-11-28 21:02:42 -05:00
parent ce0d38c8de
commit 46624bf5ba
47 changed files with 2042 additions and 382 deletions

View File

@@ -8,9 +8,10 @@ namespace BigShipTycoon
public sealed partial class TycoonApp
{
private static readonly (int HullIndex, bool Used)[] Offers =
{ (0, true), (0, false), (1, true), (1, false), (2, false) };
{ (Market.Coastal, true), (Market.Coastal, false), (Market.Regional, true), (Market.Regional, false),
(Market.Ocean, false), (Market.Mega, false) };
private enum DeckTools { GuestFacilities, LargerVenues, LeisureAndRetail, ShipSystems, Gaming }
private enum DeckTools { GuestFacilities, LargerVenues, LeisureAndRetail, ShipSystems, Gaming, MegaVenues, MegaSystems }
private DeckTools deckTools;
private int toolRotation;
private Action refreshDeckPlacement;
@@ -23,6 +24,10 @@ namespace BigShipTycoon
private static readonly Facility[] CasinoTools = { Facility.CasinoLounge, Facility.Casino, Facility.GrandCasino, Facility.Empty };
private static readonly Facility[] SystemsTools = { Facility.Galley, Facility.Stores, Facility.Water,
Facility.Waste, Facility.Workshop, Facility.Empty };
private static readonly Facility[] MegaVenueTools = { Facility.SkyResidence, Facility.MarketHall, Facility.OceanArena,
Facility.PanoramaClub, Facility.ThermalSpa, Facility.Galleria, Facility.RoyalCasino, Facility.Empty };
private static readonly Facility[] MegaSystemTools = { Facility.ProductionGalley, Facility.ColdChain, Facility.MembranePlant,
Facility.ReclamationPlant, Facility.EngineeringCenter, Facility.BunkerFarm, Facility.LaundryPlant, Facility.Empty };
private static readonly Color DraftGrid = new Color(.37f, .62f, .65f, .19f);
private static readonly Color DraftFine = new Color(.47f, .75f, .74f, .42f);
@@ -42,6 +47,8 @@ namespace BigShipTycoon
return;
}
bool mega = ship.HasAftTerrace;
work.EnableInClassList("work-mega", mega);
deckIndex = Mathf.Clamp(deckIndex, 0, ship.Decks.Count - 1);
var titleBar = Add(work, "ship-work-head");
var heading = Add(titleBar, "ship-work-name");
@@ -52,6 +59,7 @@ namespace BigShipTycoon
var deckControls = Add(titleBar, "work-deck-controls");
var selector = Add(deckControls, "work-deck-selector");
VisualElement band = mega ? Add(selector, "work-deck-band") : selector;
Button sunDeck = Action("Sun deck", () =>
{
sunDeckEditing = true;
@@ -59,9 +67,11 @@ namespace BigShipTycoon
Render();
}, "work-deck-tab", "sun-deck-open");
sunDeck.EnableInClassList("work-selected", sunDeckEditing);
selector.Add(sunDeck);
band.Add(sunDeck);
for (int i = ship.Decks.Count - 1; i >= 0; i--)
{
if (mega && ship.Decks.Count - i == 8)
band = Add(selector, "work-deck-band work-deck-band-lower");
int floor = i;
Button level = Action($"Deck {i + 1}", () =>
{
@@ -71,7 +81,7 @@ namespace BigShipTycoon
Render();
}, "work-deck-tab", $"deck-{i}");
level.EnableInClassList("work-selected", !sunDeckEditing && deckIndex == i);
selector.Add(level);
band.Add(level);
}
int deckPrice = company.DeckPrice(ship);
string addLabel = ship.Decks.Count == ship.Hull.MaxDecks ? "Deck limit reached" : $"+ Deck {Money(deckPrice)}";
@@ -111,12 +121,17 @@ namespace BigShipTycoon
var fittings = Add(work, "work-fittings");
var gauges = Add(fittings, "work-capacity-strip");
if (deckTools == DeckTools.ShipSystems)
if (deckTools is DeckTools.ShipSystems or DeckTools.MegaSystems)
{
AddText(gauges, $"{ship.GalleyCapacity:N0} galley covers", "work-capacity");
AddText(gauges, $"{ship.FoodCapacity:N0} stored portions", "work-capacity");
AddText(gauges, $"{ship.WaterCapacity:N0} L freshwater", "work-capacity");
AddText(gauges, $"{ship.WasteCapacity:N0} L sewage buffer", "work-capacity");
if (deckTools == DeckTools.MegaSystems)
{
AddText(gauges, $"{ship.Tank:N0} t bunker capacity", "work-capacity");
AddText(gauges, $"{ship.FittedLaundryCapacity:N0} added laundry loads/day", "work-capacity");
}
}
else
{
@@ -132,7 +147,7 @@ namespace BigShipTycoon
else
AddText(gauges, $"{ship.BarCapacity:N0} drink orders", "work-capacity");
}
else if (deckTools == DeckTools.Gaming)
else if (deckTools is DeckTools.Gaming or DeckTools.MegaVenues)
AddText(gauges, $"{ship.CasinoCapacity:N0} gaming seats", "work-capacity");
else
AddText(gauges, $"{ship.Tank:N0} t bunker capacity", "work-capacity");
@@ -145,6 +160,8 @@ namespace BigShipTycoon
AddBuildToolTab(toolMode, "Leisure & retail", "facility-leisure", DeckTools.LeisureAndRetail, Facility.Shop);
AddBuildToolTab(toolMode, "Casinos", "facility-casino", DeckTools.Gaming, Facility.CasinoLounge);
AddBuildToolTab(toolMode, "Ship systems", "facility-systems", DeckTools.ShipSystems, Facility.Galley);
AddBuildToolTab(toolMode, "MEGA venues", "facility-mega-venues", DeckTools.MegaVenues, Facility.SkyResidence);
AddBuildToolTab(toolMode, "MEGA systems", "facility-mega-systems", DeckTools.MegaSystems, Facility.ProductionGalley);
FacilitySpec selectedSpec = Market.Facilities[(int)tool];
if (selectedSpec.BayCount > 1)
{
@@ -160,6 +177,8 @@ namespace BigShipTycoon
DeckTools.LeisureAndRetail => LeisureTools,
DeckTools.Gaming => CasinoTools,
DeckTools.ShipSystems => SystemsTools,
DeckTools.MegaVenues => MegaVenueTools,
DeckTools.MegaSystems => MegaSystemTools,
_ => GuestTools
};
foreach (Facility option in options)
@@ -239,7 +258,7 @@ namespace BigShipTycoon
Facility existing = deck.FacilityAt(cell, columns);
FacilitySpec room = Market.Facilities[(int)existing];
var slot = Add(strip, "work-berth-slot");
Button berth = Action("", () => BuildAtBerth(ship, deck, cell), "work-berth work-room-" + (int)existing, "berth-" + cell);
Button berth = Action("", () => BuildAtBerth(ship, deck, cell), "work-berth work-room-" + (int)Market.BaseFacility(existing), "berth-" + cell);
berths[cell] = berth;
slot.Add(berth);
berth.RegisterCallback<PointerEnterEvent>(_ => { hovered = cell; UpdatePreview(); });
@@ -357,6 +376,8 @@ namespace BigShipTycoon
private static string VenueRequirement(FacilitySpec spec)
{
HullSpec hull = Market.Hulls[spec.MinimumHull];
if (spec.MinimumHull == Market.Mega)
return $"Requires a {hull.Name}. Complete the flagship charter, reach {hull.Voyages} voyages and earn {hull.Reputation} reputation.";
return $"Requires a {hull.Name} hull. Unlock the hull with {hull.Voyages} completed voyages and {hull.Reputation} reputation.";
}
@@ -463,7 +484,7 @@ namespace BigShipTycoon
pen.LineTo(Point(xy[i], xy[i + 1]));
}
switch (facility)
switch (facility == Facility.LaundryPlant ? facility : Market.BaseFacility(facility))
{
case Facility.Cabin:
case Facility.Suite:
@@ -546,6 +567,11 @@ namespace BigShipTycoon
case Facility.Workshop:
Segment(6,19,15,10,14,7,18,5,20,7,19,10,16,11,8,21,6,19);
break;
case Facility.LaundryPlant:
Segment(4,4,20,4,20,21,4,21,4,4);
Line(4,8,20,8);
Segment(8,13,9,11,15,11,17,14,16,17,10,18,8,16,8,13);
break;
default:
Line(6,6,18,18);
Line(6,18,18,6);
@@ -560,6 +586,7 @@ namespace BigShipTycoon
var work = Add(workspace, "ship-work yard-work");
(int hullIndex, bool used) = Offers[yardSelection];
HullSpec hull = Market.Hulls[hullIndex];
work.EnableInClassList("yard-work-mega", hullIndex == Market.Mega);
var titleBar = Add(work, "ship-work-head");
var heading = Add(titleBar, "ship-work-name");
@@ -568,7 +595,7 @@ namespace BigShipTycoon
AddText(heading, used ? "Fitted for service · 72% condition at delivery" : hull.Description, "ship-work-detail");
var stamp = Add(titleBar, "work-yard-stamp");
AddText(stamp, "DELIVERY AT MIAMI", "work-caption");
AddText(stamp, $"{hull.StarterDecks} decks delivered · {hull.MaxDecks} max · {hull.Tank} t fuel", "work-yard-specs");
AddText(stamp, $"{hull.Length:N0} × {hull.Beam:N0} m · {hull.StarterDecks} decks delivered · {hull.MaxDecks} max · {hull.Tank:N0} t fuel", "work-yard-specs");
var slipway = Add(work, "work-slipway");
slipway.generateVisualContent += context => DrawYardElevation(context, hullIndex, used);
@@ -583,7 +610,7 @@ namespace BigShipTycoon
int selection = item;
var offer = Offers[item];
HullSpec candidate = Market.Hulls[offer.HullIndex];
bool locked = company.Voyages < candidate.Voyages || company.Reputation < candidate.Reputation;
string requirement = company.ShipyardUnlock(offer.HullIndex);
Button option = Action("", () =>
{
yardSelection = selection;
@@ -591,7 +618,9 @@ namespace BigShipTycoon
Render();
}, "work-offer", "yard-" + item);
option.EnableInClassList("work-selected", selection == yardSelection);
AddText(option, locked ? "LOCKED" : offer.Used ? "PRE-OWNED" : "NEW HULL", "work-caption");
option.EnableInClassList("work-offer-mega", offer.HullIndex == Market.Mega);
option.tooltip = requirement ?? candidate.Description;
AddText(option, requirement != null ? "LOCKED" : offer.Used ? "PRE-OWNED" : "NEW HULL", "work-caption");
AddText(option, candidate.Name, "work-offer-name");
AddText(option, Money(offer.Used ? Market.UsedPrice(offer.HullIndex) : candidate.Price), "work-offer-price");
inventory.Add(option);
@@ -706,9 +735,12 @@ namespace BigShipTycoon
pen.Stroke();
pen.BeginPath();
bool expanded = columns > Market.Hulls[Market.Ocean].Columns;
float firstBay = expanded ? .12f : .135f;
float lastBay = expanded ? .83f : .785f;
for (int i = 0; i <= columns; i++)
{
float station = Mathf.Lerp(.135f, .785f, i / (float)columns);
float station = Mathf.Lerp(firstBay, lastBay, i / (float)columns);
pen.MoveTo(P(station, .198f));
pen.LineTo(P(station, .256f));
pen.MoveTo(P(station, .744f));
@@ -813,14 +845,16 @@ namespace BigShipTycoon
int levels = Market.Hulls[hullIndex].StarterDecks;
int allowedDecks = Market.Hulls[hullIndex].MaxDecks;
const float deckRise = .047f;
bool mega = hullIndex == Market.Mega;
float deckRise = mega ? .0275f : .047f;
float LeftEdge(int level) => mega ? level >= levels - 1 ? .285f : .055f + level * .0018f : .079f + level * .031f;
float RightEdge(int level) => mega ? .934f - level * .0041f : .872f - level * .04f;
pen.strokeColor = new Color(DraftFine.r, DraftFine.g, DraftFine.b, .28f);
pen.BeginPath();
for (int level = levels; level < allowedDecks; level++)
{
float y = .561f - level * deckRise;
float left = .079f + level * .031f;
float right = .872f - level * .04f;
float left = LeftEdge(level), right = RightEdge(level);
for (float x = left; x < right; x += .022f)
Path(x, y, Mathf.Min(x + .012f, right), y);
}
@@ -828,13 +862,12 @@ namespace BigShipTycoon
for (int level = 0; level < levels; level++)
{
float bottom = .561f - level * deckRise;
float left = .079f + level * .031f;
float right = .872f - level * .04f;
pen.fillColor = new Color(.17f + .022f * level, .29f, .30f);
float left = LeftEdge(level), right = RightEdge(level);
pen.fillColor = new Color(.17f + (mega ? .010f : .022f) * level, .29f, .30f);
pen.strokeColor = DraftFine;
pen.lineWidth = 1.25f;
pen.BeginPath();
Path(left,bottom, left + .006f,bottom - .038f, right - .036f,bottom - .044f, right,bottom);
Path(left,bottom, left + .006f,bottom - deckRise * .81f, right - .036f,bottom - deckRise * .94f, right,bottom);
pen.ClosePath();
pen.Fill();
pen.Stroke();
@@ -842,10 +875,10 @@ namespace BigShipTycoon
pen.BeginPath();
if (used)
for (float x = left + .022f; x < right - .04f; x += .028f)
Path(x,bottom - .022f, x + .014f,bottom - .022f);
Path(x,bottom - deckRise * .47f, x + .014f,bottom - deckRise * .47f);
else
for (float x = left + .025f; x < right - .04f; x += .1f)
Path(x,bottom - .019f, x + .050f,bottom - .019f);
Path(x,bottom - deckRise * .40f, x + .050f,bottom - deckRise * .40f);
pen.Stroke();
}