Add fleet save slots and rotatable onboard venues

This commit is contained in:
josh
2026-11-28 16:04:48 -05:00
parent a9472edc35
commit c570a64840
37 changed files with 1970 additions and 310 deletions

View File

@@ -226,30 +226,188 @@ namespace Soundings
}
}
private static void FitRetailArcade(Geometry shape, Layout layout, DeckGrid grid,
System.Collections.Generic.IReadOnlyList<Vector2Int> footprint, int col, int row, float floor, int rotation, int seed)
{
for (int i = 0; i < footprint.Count; i++)
{
Vector2Int offset = footprint[i];
int bayRow = row + offset.y;
var center = new Vector3(grid.Center(col + offset.x), floor + .06f, grid.Row(bayRow));
float width = grid.CellWidth - .19f, depth = grid.RowDepth - .18f;
if ((rotation & 1) != 0)
(width, depth) = (depth, width);
var wing = new Venue(shape, layout, center, bayRow == 0 ? -1 : 1, seed + i * 13, rotation);
FitRetail(wing, width, depth, offset == Vector2Int.zero, i);
}
}
private static void FitNewVenue(Venue room, Facility facility, float width, float depth)
{
if (facility == Facility.Shop)
FitRetail(room, width, depth, true, 0);
else
FitWellness(room, width, depth, facility == Facility.WaterPark);
}
private static void FitRetail(Venue room, float width, float depth, bool checkout, int selection)
{
float displayX = width * .235f;
float displayZ = depth * .30f;
float shelfWidth = Mathf.Min(width * .29f, 2.36f);
float shelfDepth = Mathf.Min(.40f, depth * .115f);
room.Box(Carpet, 0, .012f, -depth * .08f, width * .89f, .023f, depth * .50f);
room.Box(Brass, 0, .024f, -depth * .335f, width * .89f, .015f, .034f);
room.Solid(Joinery, displayX, .21f, displayZ, shelfWidth, .42f, shelfDepth);
room.Solid(Joinery, displayX, 1.11f, displayZ + shelfDepth * .41f, shelfWidth, 1.42f, .079f);
room.Box(Brass, displayX, 1.846f, displayZ, shelfWidth + .07f, .055f, shelfDepth + .047f);
room.Box(LightStrip, displayX, 1.791f, displayZ - shelfDepth * .41f, shelfWidth * .96f, .024f, .06f);
for (int level = 0; level < 3; level++)
{
float y = .49f + level * .42f;
room.Solid(Ivory, displayX, y, displayZ, shelfWidth + .07f, .055f, shelfDepth + .035f);
for (int item = 0; item < 4; item++)
{
float x = displayX + (item - 1.5f) * shelfWidth * .227f;
int color = ((item + level + selection) % 4) switch
{
0 => ShowVelvet, 1 => LoungeLeather, 2 => PoolTile, _ => Ivory
};
float packWidth = Mathf.Min(.27f, shelfWidth * .182f);
float height = level == 2 ? .15f + item % 2 * .055f : .095f + item % 3 * .064f;
room.Box(color, x, y + .027f + height * .5f, displayZ - .045f, packWidth, height, shelfDepth * .67f);
room.Box(Brass, x, y + .045f + height * .63f, displayZ - shelfDepth * .37f - .045f, packWidth * .52f, .025f, .014f);
}
}
room.Guest(GuestActivity.Shopper, displayX, displayZ - .62f, 17, OnboardService.Retail, .24f);
float counterX = -width * .232f;
float counterZ = checkout ? depth * .035f : depth * .25f;
float counterWidth = Mathf.Min(width * .28f, 2.02f);
float counterDepth = Mathf.Min(depth * .17f, .66f);
room.Solid(Joinery, counterX, .462f, counterZ, counterWidth, .924f, counterDepth);
room.Box(Marble, counterX, .945f, counterZ, counterWidth + .072f, .055f, counterDepth + .087f);
room.Box(Brass, counterX, .774f, counterZ - counterDepth * .50f, counterWidth, .027f, .029f);
if (!checkout)
{
room.Box(WindowGlass, counterX, 1.118f, counterZ, counterWidth * .91f, .29f, counterDepth * .82f);
for (int item = -1; item <= 1; item++)
room.Box(item == 0 ? ShowVelvet : LoungeLeather, counterX + item * counterWidth * .24f,
1.029f, counterZ, .124f, .095f, .092f);
room.Guest(GuestActivity.Shopper, counterX, counterZ - counterDepth * .5f - .42f, 31, OnboardService.Retail, .48f);
return;
}
room.Box(DeckTrim, counterX, 1.027f, counterZ + counterDepth * .29f, .297f, .111f, .193f);
room.Box(PoolTile, counterX, 1.101f, counterZ + counterDepth * .33f, .246f, .106f, .049f);
room.Box(LightStrip, counterX, 1.108f, counterZ + counterDepth * .302f, .165f, .049f, .013f);
room.Guest(GuestActivity.ShopClerk, counterX, counterZ + counterDepth * .5f + .40f, 27,
OnboardService.Retail, .04f, direction: -1);
room.Guest(GuestActivity.Shopper, counterX - .11f, counterZ - counterDepth * .5f - .50f, 34, OnboardService.Retail, .39f);
room.Station(StationKind.Retail, counterX, counterZ - counterDepth * .5f - .10f);
}
private static void FitWellness(Venue room, float width, float depth, bool park)
{
float poolZ = depth * .093f;
var basin = new Vector2(width * (park ? .313f : .253f), depth * .213f);
float surface = park ? .50f : .44f;
room.Box(Marble, 0, .014f, poolZ, basin.x * 2 + 1.06f, .025f, basin.y * 2 + .99f);
room.Pool(poolZ, basin, surface + .103f, surface);
if (park)
{
for (int lane = -1; lane <= 1; lane++)
room.Swimmer(lane * .34f, surface, poolZ + lane * basin.y * .54f, basin.x * .69f,
74 + lane * 7, .24f + lane * .11f);
for (int side = -1; side <= 1; side += 2)
{
room.Guest(GuestActivity.Wade, side * basin.x * .82f, poolZ + basin.y * .68f,
89 + side, OnboardService.Amenities, .31f + side * .11f, lift: surface);
room.Box(SafetyGreen, side * (basin.x + .09f), .617f, poolZ - basin.y * .51f, .13f, .041f, .46f);
}
float splashX = basin.x * .79f;
for (int spray = -1; spray <= 1; spray++)
{
float x = splashX + spray * basin.x * .053f;
float z = poolZ - basin.y * .72f;
room.Cylinder(Brass, x, surface, z, .091f, .088f);
Vector3 last = new(x, surface + .081f, z);
for (int segment = 1; segment <= 8; segment++)
{
float t = segment / 8f;
Vector3 stream = new(x + spray * t * basin.x * .018f,
surface + Mathf.Lerp(.081f, .014f, t) + Mathf.Sin(t * Mathf.PI) * (.57f + spray * .14f),
z + t * basin.y * .76f);
room.Rod(PoolWater, last, stream, .020f);
last = stream;
}
}
}
else
{
for (int seat = -1; seat <= 1; seat += 2)
{
float x = seat * basin.x * .69f;
room.Guest(GuestActivity.Wade, x, poolZ, 128 + seat, OnboardService.Amenities, .26f + seat * .09f, lift: surface);
float sconce = poolZ + basin.y + .32f;
room.Cylinder(Brass, x, .012f, sconce, .25f, .136f);
room.Cylinder(LightStrip, x, .262f, sconce, .053f, .102f);
}
}
// Keep the entrance sightline and cross-ship walkway clear past the basin.
for (int side = -1; side <= 1; side += 2)
{
float x = side * width * .317f;
float z = -depth * .379f;
room.Solid(Joinery, x, .228f, z, width * .235f, .444f, .57f);
room.Box(LoungeLeather, x, .48f, z, width * .238f, .083f, .586f);
room.Box(Brass, x, .51f, z + .27f, width * .233f, .028f, .039f);
for (int towel = -1; towel <= 1; towel++)
room.Box(towel == 0 ? PoolTile : Ivory, x + towel * width * .051f + width * .029f,
.554f, z, .192f, .093f, .23f);
room.Guest(GuestActivity.Rest, x - width * .077f, z, 145 + side, OnboardService.Amenities, .45f, .514f);
}
room.Station(StationKind.Pool, 0, poolZ - basin.y - .36f);
}
private readonly struct Venue
{
private readonly Geometry shape;
private readonly Layout layout;
private readonly Vector3 center;
private readonly int facing, seed;
private readonly int facing, seed, rotation;
public Venue(Geometry shape, Layout layout, Vector3 center, int facing, int seed)
public Venue(Geometry shape, Layout layout, Vector3 center, int facing, int seed, int rotation)
{
this.shape = shape;
this.layout = layout;
this.center = center;
this.facing = facing;
this.seed = seed;
this.rotation = rotation;
}
private Vector3 Point(float x, float y, float z) => center + new Vector3(x, y, z * facing);
private Vector3 Point(float x, float y, float z) => center + (rotation switch
{
1 => new Vector3(-z * facing, y, x),
2 => new Vector3(-x, y, -z * facing),
3 => new Vector3(z * facing, y, -x),
_ => new Vector3(x, y, z * facing)
});
private Vector3 Size(float width, float height, float depth) =>
(rotation & 1) == 0 ? new Vector3(width, height, depth) : new Vector3(depth, height, width);
public void Station(StationKind kind, float x, float z) =>
layout.Stations.Add(new ShipStation(kind, Point(x, 1.4f, z)));
public void Box(int color, float x, float y, float z, float width, float height, float depth) =>
shape.Box(color, Point(x, y, z), new Vector3(width, height, depth));
shape.Box(color, Point(x, y, z), Size(width, height, depth));
public void Solid(int color, float x, float y, float z, float width, float height, float depth)
{
var size = new Vector3(width, height, depth);
var size = Size(width, height, depth);
Vector3 point = Point(x, y, z);
shape.Box(color, point, size);
layout.WalkSpace.Block(point, size);
@@ -261,29 +419,49 @@ namespace Soundings
shape.Mesh(color).Rod(point, point + Vector3.up * height, radius, 12, true);
}
public void Rod(int color, Vector3 start, Vector3 end, float radius) =>
shape.Mesh(color).Rod(Point(start.x, start.y, start.z), Point(end.x, end.y, end.z), radius, 8);
public void Seat(float x, float z, int color, int direction = 1)
{
Vector3 point = Point(x, 0, z);
Chair(shape, point, color, facing * direction);
layout.WalkSpace.Block(point, new Vector3(.50f, .91f, .54f));
Box(color, x, .45f, z, .44f, .089f, .41f);
Box(color, x, .69f, z - .185f * direction, .43f, .41f, .085f);
for (int side = -1; side <= 1; side += 2)
for (int fore = -1; fore <= 1; fore += 2)
Box(Joinery, x + side * .167f, .208f, z + fore * .158f, .044f, .414f, .044f);
layout.WalkSpace.Block(Point(x, 0, z), Size(.50f, .91f, .54f));
}
public void Guest(GuestActivity activity, float x, float z, int variant, OnboardService service, float occupancy,
float seatHeight = 0, int direction = 1, float lift = 0, EntertainmentProgram? program = null) =>
AddGuest(layout, activity, Point(x, lift, z), seed * 11 + variant, facing * direction > 0 ? 0 : 180,
AddGuest(layout, activity, Point(x, lift, z), seed * 11 + variant, (facing * direction > 0 ? 0 : 180) - rotation * 90,
(int)service, occupancy, seatHeight, program);
public void Pool(float z, Vector2 basin, float rim, float surface)
{
Vector3 foot = Point(0, 0, z);
VesselExterior.PoolBasin(shape.Mesh(Ivory), shape.Mesh(PoolTile), shape.Mesh(PoolWater), foot, basin, rim, surface);
Vector3 ladder = Point(basin.x * .68f, .20f, z + basin.y - .07f);
VesselExterior.PoolRails(shape.Mesh(Alloy), ladder, facing);
layout.WalkSpace.Block(foot, new Vector3((basin.x + .23f) * 2f, rim, (basin.y + .23f) * 2f));
Vector2 worldBasin = (rotation & 1) == 0 ? basin : new Vector2(basin.y, basin.x);
VesselExterior.PoolBasin(shape.Mesh(Ivory), shape.Mesh(PoolTile), shape.Mesh(PoolWater), foot, worldBasin, rim, surface);
float ladderX = basin.x * .68f, ladderZ = z + basin.y - .07f;
var rails = shape.Mesh(Alloy);
for (int rail = -1; rail <= 1; rail += 2)
{
float x = ladderX + rail * .23f;
Vector3 post = Point(x, .23f, ladderZ + .36f);
Vector3 elbow = Point(x, .95f, ladderZ + .23f);
rails.Rod(post, elbow, .028f, 8, true);
rails.Rod(elbow, Point(x, .54f, ladderZ - .19f), .028f, 8, true);
}
for (int rung = 0; rung < 2; rung++)
{
float y = .34f + rung * .18f;
rails.Rod(Point(ladderX - .23f, y, ladderZ - .15f), Point(ladderX + .23f, y, ladderZ - .15f), .024f, 8, true);
}
layout.WalkSpace.Block(foot, Size((basin.x + .23f) * 2f, rim, (basin.y + .23f) * 2f));
}
public void Swimmer(float x, float y, float z, float halfLength, int variant, float occupancy) =>
AddGuest(layout, GuestActivity.Swim, Point(x, y, z), seed * 11 + variant, facing * 90,
AddGuest(layout, GuestActivity.Swim, Point(x, y, z), seed * 11 + variant, facing * 90 - rotation * 90,
(int)OnboardService.Amenities, occupancy, swimHalfLength: halfLength);
}
}