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

@@ -343,8 +343,6 @@ namespace Soundings
float roomStart = aft + endCrossing;
int columns = ship.Hull.Columns, rows = ship.Hull.Rows;
float rowDepth = (halfWidth * 2 - (rows - 1) * AisleWidth) / rows;
float RowCenter(int row) => -halfWidth + (row + .5f) * rowDepth + row * AisleWidth;
float AisleCenter(int aisle) => RowCenter(aisle) + (rowDepth + AisleWidth) * .5f;
float cellWidth = (usableLength - endCrossing * 2) / columns;
float mid = (fore + aft) * .5f;
structure.Box(Carpet, new Vector3(mid, y + .020f, 0), new Vector3(usableLength, .028f, halfWidth * 2));
@@ -357,82 +355,8 @@ namespace Soundings
DeckWall(interior, cutaway, new Vector3(side < 0 ? aft : fore, y, 0), .14f, halfWidth * 2);
}
for (int aisle = 0; aisle < rows - 1; aisle++)
{
float z = AisleCenter(aisle);
structure.Box(DeckTrim, new Vector3(mid, y + .037f, z), new Vector3(usableLength, .018f, AisleWidth - .21f));
for (int side = -1; side <= 1; side += 2)
{
structure.Box(Joinery, new Vector3(mid, y + .049f, z + side * .615f), new Vector3(usableLength, .008f, .025f));
interior.Box(DeckTrim, new Vector3(mid, y + DeckCeiling - .083f, z + side * .60f), new Vector3(usableLength, .12f, .028f));
}
for (int col = 0; col < columns; col++)
{
float x = roomStart + (col + .5f) * cellWidth;
interior.Box(Gasket, new Vector3(x, y + DeckCeiling - .009f, z), new Vector3(2.22f, .045f, .43f));
interior.Box(LightStrip, new Vector3(x, y + DeckCeiling - .031f, z), new Vector3(2.04f, .018f, .28f));
structure.Box(Joinery, new Vector3(x, y + .048f, z), new Vector3(.035f, .009f, 1.23f));
}
}
Deck plan = ship.Decks[index];
for (int col = 0; col < columns; col++)
{
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));
float halfRow = rowDepth * .5f;
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 - 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, roomWidth, door, -1, index, slot, facility);
if (row < rows - 1)
{
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)
{
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++)
{
int walkers = columns / 2;
for (int walker = 0; walker < walkers; walker++)
{
float start = (walker + .29f * aisle) / walkers;
var route = new Vector3(aft + 1.35f, y + .055f, AisleCenter(aisle));
layout.People.Add(new DeckGuest(route, fore - 1.2f, .37f, start,
index * 53 + aisle * 17 + walker * 11, .19f + walker * .14f));
}
}
var grid = new DeckGrid(columns, rows, roomStart, cellWidth, rowDepth, halfWidth);
BuildDeckPlan(index, layout, structure, interior, cutaway, grid, aft, fore, y);
structure.Finish();
interior.Finish();
cutaway.Finish();
@@ -524,13 +448,7 @@ namespace Soundings
private void Room(Geometry shape, Layout layout, Facility facility, Vector3 pos, float width, float depth,
int seed, int facing, bool programVenue)
{
int floor = facility switch
{
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
};
int floor = FacilityFloor(facility);
void Box(int color, float x, float y, float z, float w, float height, float d)
=> shape.Box(color, pos + new Vector3(x, y, z * facing), new Vector3(w, height, d));
void Solid(int color, float x, float y, float z, float w, float h, float d)
@@ -556,29 +474,10 @@ namespace Soundings
if (facility == Facility.Empty)
return;
StationKind? station = facility switch
{
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,
Facility.Waste => StationKind.Waste,
Facility.Workshop => StationKind.Maintenance,
_ => null
};
StationKind? station = FacilityStation(facility);
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: