Unlock expanded venues and manage concurrent fleet voyages

This commit is contained in:
josh
2026-11-28 15:36:55 -05:00
parent 636a0e2cf8
commit a9472edc35
33 changed files with 2094 additions and 363 deletions

View File

@@ -4,7 +4,7 @@ using UnityEngine;
namespace Soundings
{
internal sealed class DeckPassengers : IDisposable
internal sealed partial class DeckPassengers : IDisposable
{
private const float EyeHeight = 1.64f;
private const float DeckCeiling = 2.44f;
@@ -13,7 +13,8 @@ namespace Soundings
private const int Bulkhead = 25, Joinery = 26, Alloy = 27, DeckTrim = 28, Carpet = 29,
Ivory = 30, LightStrip = 31, Gasket = 32, DisplayDark = 33, ScreenChart = 34,
ScreenGreen = 35, ScreenAmber = 36, BridgeFloor = 37, Upholstery = 38, SafetyGreen = 39,
ScreenWater = 40, ScreenLand = 41, ScreenRed = 42, WindowGlass = 43, PoolWater = 44, PoolTile = 45;
ScreenWater = 40, ScreenLand = 41, ScreenRed = 42, WindowGlass = 43, PoolWater = 44, PoolTile = 45,
SuiteCarpet = 46, Brass = 47, ShowVelvet = 48, PoolDeck = 49, LoungeLeather = 50, Marble = 51;
private static readonly string[] Paint =
{
"142C3F", "E1DBCA", "B88754", "8A613C", "283846", "678B93", "B45944", "497975",
@@ -21,7 +22,7 @@ namespace Soundings
"573B2E", "A46C50", "DFAB86", "40577D", "BF7756", "D3B973", "76ADA8", "A684AB", "E3DED0",
"B7BFC0", "AD825C", "91A9AF", "284550", "385361", "DCE1DB", "FFF1D7", "202D36",
"111D25", "8ED9E0", "65C89B", "E7B868", "3F565C", "416172", "527D65", "29485A", "A8AB71",
"D66D57", "80B6C5", "3796A3", "47878F"
"D66D57", "80B6C5", "3796A3", "47878F", "485C6C", "BD9660", "85424D", "6A908E", "59716B", "E7E0D5"
};
private readonly Transform shipRoot;
@@ -74,7 +75,9 @@ namespace Soundings
this.beam = beam;
shader = surface;
decks = new Layout[ship.Decks.Count];
Facility programVenue = ship.Entertainment > 0 ? Facility.Entertainment : Facility.Dining;
Facility programVenue = ship.Count(Facility.GrandTheater) > 0 ? Facility.GrandTheater
: ship.Count(Facility.Entertainment) > 0 ? Facility.Entertainment
: ship.Count(Facility.Restaurant) > 0 ? Facility.Restaurant : Facility.Dining;
for (int index = 0; index < ship.Decks.Count; index++)
{
int room = Array.IndexOf(ship.Decks[index].Cells, programVenue);
@@ -210,16 +213,13 @@ namespace Soundings
private Layout BuildPromenade()
{
var layout = new Layout("Open promenade", shipRoot);
int deck = ship.Decks.Count - 1;
float y = BridgeHeight + .015f;
float deckLength = VesselExterior.DeckLength(length, deck);
float width = VesselExterior.DeckHalfBeam(beam, deck);
float offset = VesselExterior.DeckOffset(length, deck);
float aft = offset - deckLength * .305f;
float fore = Mathf.Min(BridgeCenter - 6.0f, offset + deckLength * .17f);
float pool = VesselExterior.SunDeckCenter(length, deck);
bool hasPool = ship.Count(Facility.Amenity) > 0;
int sunDeckService = hasPool ? (int)OnboardService.Amenities : -1;
VesselExterior.SunDeckLayout plan = VesselExterior.SunDeck(ship);
float width = plan.HalfBeam;
float aft = plan.Offset - plan.Length * .305f;
float fore = Mathf.Min(BridgeCenter - 6.0f, plan.Offset + plan.Length * .17f);
float pool = plan.PoolCenter;
int sunDeckService = plan.HasPool ? (int)OnboardService.Amenities : -1;
int walkers = 7 + ship.HullIndex * 3;
for (int side = -1; side <= 1; side += 2)
{
@@ -236,29 +236,53 @@ namespace Soundings
AddGuest(layout, GuestActivity.Rail, new Vector3(fore + .92f, y, side * rail), 78 + side, heading, -1, .28f);
AddGuest(layout, GuestActivity.Photograph, new Vector3(aft - .98f, y, side * (rail - .16f)), 32 + side, heading, -1, .57f);
float seatZ = side * (width * VesselExterior.LoungerBeamFraction + .105f);
float seatZ = side * (plan.LoungerDistance + .105f);
for (int chair = 0; chair < 3; chair++)
{
float x = VesselExterior.LoungerX(pool, chair * 3 + (side > 0 ? 1 : 0));
float x = plan.LoungerX(chair * 3 + (side > 0 ? 1 : 0));
AddGuest(layout, GuestActivity.Lounge, new Vector3(x, y, seatZ), 96 + chair * 7 + side * 4,
heading + 180, sunDeckService, .19f + chair * .20f, VesselExterior.LoungerSeatHeight + .065f);
}
}
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - 3.57f, y, -.61f), 37, 22, sunDeckService, .28f);
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - 3.21f, y, .26f), 214, 202, sunDeckService, .44f);
if (hasPool)
float poolLength = plan.PoolHalfSize.x;
float poolWidth = plan.PoolHalfSize.y;
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - poolLength - .96f, y, -.61f), 37, 22, sunDeckService, .28f);
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - poolLength - .60f, y, .26f), 214, 202, sunDeckService, .44f);
if (plan.HasPool)
{
float waterY = BridgeHeight + VesselExterior.PoolWaterHeight;
AddGuest(layout, GuestActivity.Swim, new Vector3(pool, waterY, -.67f), 440, 90, sunDeckService, .20f,
swimHalfLength: 1.50f);
AddGuest(layout, GuestActivity.Swim, new Vector3(pool - .32f, waterY, .25f), 587, -90, sunDeckService, .53f,
swimHalfLength: 1.18f);
AddGuest(layout, GuestActivity.Wade, new Vector3(pool + 1.72f, waterY, .79f), 768, -96, sunDeckService, .33f);
AddGuest(layout, GuestActivity.Wade, new Vector3(pool + 1.00f, waterY, .91f), 921, 82, sunDeckService, .67f);
AddGuest(layout, GuestActivity.Photograph, new Vector3(pool + 2.92f, y, -1.95f), 62, -53,
AddGuest(layout, GuestActivity.Swim, new Vector3(pool, waterY, -poolWidth * (plan.Resort ? .61f : .47f)),
440, 90, sunDeckService, .20f, swimHalfLength: poolLength - 1.11f);
AddGuest(layout, GuestActivity.Swim, new Vector3(pool - .32f, waterY, plan.Resort ? 0 : .25f),
587, -90, sunDeckService, .53f, swimHalfLength: poolLength - 1.43f);
if (plan.Resort)
AddGuest(layout, GuestActivity.Swim, new Vector3(pool - .64f, waterY, poolWidth * .61f),
387, 90, sunDeckService, .62f, swimHalfLength: poolLength - 1.76f);
AddGuest(layout, GuestActivity.Wade, new Vector3(pool + poolLength - .89f, waterY, poolWidth * .55f),
768, -96, sunDeckService, .33f);
AddGuest(layout, GuestActivity.Wade, new Vector3(pool + poolLength - 1.61f, waterY, poolWidth * .64f),
921, 82, sunDeckService, .67f);
AddGuest(layout, GuestActivity.Photograph, new Vector3(pool + poolLength + .31f, y, -poolWidth - .52f), 62, -53,
sunDeckService, .64f);
}
if (plan.Theater)
{
int shows = (int)OnboardService.Shows;
Vector3 stage = new(plan.StageCenter, y + .43f, 0);
AddGuest(layout, GuestActivity.Perform, stage, 782, 90, shows, .10f);
AddGuest(layout, GuestActivity.Guitar, stage, 823, 90, shows, .1f, program: EntertainmentProgram.LiveMusic);
for (int side = -1; side <= 1; side += 2)
{
AddGuest(layout, GuestActivity.Revue, stage + Vector3.forward * side * .83f, 706 + side, 90, shows, .10f,
program: EntertainmentProgram.Headline);
for (int row = 0; row < 2; row++)
for (int seat = 0; seat < 2; seat++)
AddGuest(layout, GuestActivity.Watch, new Vector3(plan.StageSeatX(row), y,
side * plan.StageHalfWidth * (.44f + seat * .27f)), 540 + row * 15 + seat * 31 + side * 4,
-90, shows, .24f + seat * .18f + row * .15f, .37f);
}
}
return layout;
}
@@ -352,28 +376,50 @@ namespace Soundings
}
}
Deck plan = ship.Decks[index];
for (int col = 0; col < columns; col++)
{
float x = roomStart + (col + .5f) * cellWidth;
for (int row = 0; row < rows; row++)
{
int slot = row * columns + col;
Facility facility = plan.Cells[slot];
if (facility == Facility.Extension)
continue;
int span = Market.Facilities[(int)facility].Length;
float roomWidth = span * cellWidth;
float x = roomStart + (col + span * .5f) * cellWidth;
var center = new Vector3(x, y + .055f, RowCenter(row));
Facility facility = ship.Decks[index].Cells[slot];
float halfRow = rowDepth * .5f;
float door = facility == Facility.Empty ? Mathf.Min(2.4f, cellWidth - .6f) : (facility == Facility.Cabin ? 1.18f : 1.48f);
float door = facility switch
{
Facility.Empty => Mathf.Min(2.4f, cellWidth - .6f),
Facility.Cabin => 1.18f,
Facility.Suite or Facility.GrandSuite => 1.56f,
_ => span > 1 ? 2.20f : 1.48f
};
if (col == 0)
SolidDeckWall(layout, interior, cutaway, new Vector3(x - cellWidth * .5f, y, center.z), .15f, rowDepth);
SolidDeckWall(layout, interior, cutaway, new Vector3(x + cellWidth * .5f, y, center.z), .15f, rowDepth);
SolidDeckWall(layout, interior, cutaway, new Vector3(x - roomWidth * .5f, y, center.z), .15f, rowDepth);
SolidDeckWall(layout, interior, cutaway, new Vector3(x + roomWidth * .5f, y, center.z), .15f, rowDepth);
if (row > 0)
RoomEntrance(layout, interior, cutaway, x, y, center.z - halfRow, cellWidth, door, -1, index, slot, facility);
RoomEntrance(layout, interior, cutaway, x, y, center.z - halfRow, roomWidth, door, -1, index, slot, facility);
if (row < rows - 1)
RoomEntrance(layout, interior, cutaway, x, y, center.z + halfRow, cellWidth, door, 1, index, slot, facility);
Room(structure, layout, facility, center, cellWidth - .19f, rowDepth - .18f, index * 70 + slot,
{
if (span == 1 || row == 0)
RoomEntrance(layout, interior, cutaway, x, y, center.z + halfRow, roomWidth, door, 1, index, slot, facility);
else
SolidDeckWall(layout, interior, cutaway, new Vector3(x, y, center.z + halfRow), roomWidth, .15f);
}
Room(structure, layout, facility, center, roomWidth - .19f, rowDepth - .18f, index * 70 + slot,
row == 0 ? -1 : 1, index == programDeck && slot == programRoom);
if (row == 0 || row == rows - 1)
RoomWindow(interior, cutaway, x, y, halfWidth * (row == 0 ? -1 : 1), cellWidth, row == 0 ? -1 : 1,
facility is Facility.Cabin or Facility.Dining or Facility.Bar or Facility.Amenity);
{
int side = row == 0 ? -1 : 1;
bool glazed = facility is Facility.Cabin or Facility.Dining or Facility.Bar or Facility.Amenity
or Facility.Suite or Facility.GrandSuite or Facility.Restaurant or Facility.ResortPool or Facility.CocktailLounge;
for (int bay = 0; bay < span; bay++)
RoomWindow(interior, cutaway, x - roomWidth * .5f + (bay + .5f) * cellWidth, y, halfWidth * side, cellWidth, side, glazed);
}
}
}
for (int aisle = 0; aisle < rows - 1; aisle++)
@@ -424,8 +470,9 @@ namespace Soundings
if (facility == Facility.Empty)
return;
string label = facility == Facility.Cabin ? $"{deck + 1}{slot + 1:00}" : Market.Facilities[(int)facility].Name.ToUpperInvariant();
float plaqueX = x + (door * .5f + .39f) * side;
interior.Box(DeckTrim, new Vector3(plaqueX, y + 1.63f, z + side * .088f), new Vector3(.61f, .15f, .045f));
float plaqueWidth = Mathf.Clamp(label.Length * .049f, .61f, 1.05f);
float plaqueX = x + (door * .5f + plaqueWidth * .5f + .08f) * side;
interior.Box(DeckTrim, new Vector3(plaqueX, y + 1.63f, z + side * .088f), new Vector3(plaqueWidth, .15f, .045f));
PlaceSign(layout.Interior.transform, label, new Vector3(plaqueX, y + 1.63f, z + side * .116f), side > 0 ? 180 : 0,
facility == Facility.Cabin ? .087f : .049f);
}
@@ -479,7 +526,9 @@ namespace Soundings
{
int floor = facility switch
{
Facility.Cabin => Carpet, Facility.Dining => Joinery, Facility.Entertainment => 11, Facility.Bar => 7,
Facility.Cabin => Carpet, Facility.Dining or Facility.Restaurant => Joinery,
Facility.Entertainment or Facility.GrandTheater => 11, Facility.Bar or Facility.CocktailLounge => 7,
Facility.Suite or Facility.GrandSuite => SuiteCarpet, Facility.ResortPool => PoolDeck,
Facility.Amenity => Alloy, Facility.Galley or Facility.Workshop => BridgeFloor, _ => DeckTrim
};
void Box(int color, float x, float y, float z, float w, float height, float d)
@@ -509,11 +558,11 @@ namespace Soundings
StationKind? station = facility switch
{
Facility.Cabin => StationKind.Cabins,
Facility.Dining => StationKind.Dining,
Facility.Bar => StationKind.Bar,
Facility.Entertainment => StationKind.Stage,
Facility.Amenity => StationKind.Pool,
Facility.Cabin or Facility.Suite or Facility.GrandSuite => StationKind.Cabins,
Facility.Dining or Facility.Restaurant => StationKind.Dining,
Facility.Bar or Facility.CocktailLounge => StationKind.Bar,
Facility.Entertainment or Facility.GrandTheater => StationKind.Stage,
Facility.Amenity or Facility.ResortPool => StationKind.Pool,
Facility.Galley => StationKind.Galley,
Facility.Stores => StationKind.Stores,
Facility.Water => StationKind.Water,
@@ -524,6 +573,12 @@ namespace Soundings
if (station.HasValue)
layout.Stations.Add(new ShipStation(station.Value, pos + new Vector3(0, 1.45f, -.33f * depth * facing)));
if (Market.Facilities[(int)facility].Length > 1)
{
FitVenue(new Venue(shape, layout, pos, facing, seed), facility, width, depth, programVenue);
return;
}
switch (facility)
{
case Facility.Cabin:
@@ -1001,13 +1056,13 @@ namespace Soundings
material = new Material(finish) { color = color, name = "Deck fittings " + Paint[id] };
if (id != WindowGlass)
{
bool metal = id is 4 or Alloy or Gasket;
bool metal = id is 4 or Alloy or Gasket or Brass;
Harbor.SurfaceFinish surfaceFinish = id switch
{
0 => Harbor.SurfaceFinish.Hull,
2 or Joinery => Harbor.SurfaceFinish.Timber,
Carpet or BridgeFloor or Upholstery or 11 => Harbor.SurfaceFinish.Fabric,
Alloy => Harbor.SurfaceFinish.Alloy,
Carpet or BridgeFloor or Upholstery or SuiteCarpet or ShowVelvet or LoungeLeather or 11 => Harbor.SurfaceFinish.Fabric,
Alloy or Brass => Harbor.SurfaceFinish.Alloy,
PoolWater => Harbor.SurfaceFinish.Pool,
_ => Harbor.SurfaceFinish.Paint
};