Editor/Data/ArchArchetypes.cs

A static editor data file that defines default architectural archetypes for the editor. It returns a list of ArchArchetype objects (House, Manor, Factory) with preset properties, section rules, openings, steps, and layout parameters used by the architecture tooling.

File Access
using System.Collections.Generic;
using Sandbox;

namespace Sunless.Architecture;

// What core ships, standing whether or not the project has authored a folder; a file on disk beats this table.
public static class ArchArchetypes
{
	public static List<ArchArchetype> Defaults()
	{
		return new List<ArchArchetype> { House(), Manor(), Factory() };
	}

	static ArchArchetype House()
	{
		return new ArchArchetype
		{
			Name = "house",
			Title = "House",
			Description = "Suburban defaults - hip roof, lined ceilings, gutters, raised plinth.",
			Icon = "home",
			Openings = new List<string> { "door", "door_double", "doorway", "garage_single", "garage_double" },
			Pillars = new List<string> { "post", "column" },
			Shell = new ArchSectionRules { Roof = RoofStyle.Hip },
			Wing = new ArchSectionRules(),
			WingRoof = SectionRoof.Continue,
			Shows = new List<ArchOptionGroup>
			{
				ArchOptionGroup.Section, ArchOptionGroup.Foundation, ArchOptionGroup.RoofStyle,
				ArchOptionGroup.Ridge, ArchOptionGroup.WingRoof, ArchOptionGroup.Approach, ArchOptionGroup.Boundary
			},
			DriveWidth = 132f,
			DriveSplay = 36f
		};
	}

	static ArchArchetype Manor()
	{
		return new ArchArchetype
		{
			Name = "house_third_person",
			Title = "House (3rd person)",
			Description = "Suburban house at third-person scale - 14 ft ceilings, taller doorways, deeper plot for the camera.",
			Icon = "villa",
			Openings = new List<string> { "door_double", "door", "doorway", "garage_double", "garage_single" },
			Pillars = new List<string> { "column", "post" },
			Shell = new ArchSectionRules
			{
				Roof = RoofStyle.Hip,
				WallHeight = 168f,
				// A stock overhang on a 14 ft wall would read as a lid.
				Overhang = 24f
			},
			// Steps down a course but stays tall enough to walk a camera through.
			Wing = new ArchSectionRules { WallHeight = 156f, Overhang = 24f },
			WingRoof = SectionRoof.Continue,
			Shows = new List<ArchOptionGroup>
			{
				ArchOptionGroup.Section, ArchOptionGroup.Foundation, ArchOptionGroup.RoofStyle,
				ArchOptionGroup.Ridge, ArchOptionGroup.WingRoof, ArchOptionGroup.Approach, ArchOptionGroup.Boundary
			},
			DriveWidth = 168f,
			DriveSplay = 48f,
			MinimumPlot = new Vector2( 420f, 340f ),
			Steps = new List<ArchArchetypeStep>
			{
				new()
				{
					Kind = ArchStepKind.Shell,
					Name = "shell",
					Rect = new ArchPlotRect { Min = new Vector2( 0f, 0f ), Max = new Vector2( 0.68f, 1f ) }
				},
				new()
				{
					Kind = ArchStepKind.Wing,
					Name = "garage",
					Rect = new ArchPlotRect { Min = new Vector2( 0.68f, 0f ), Max = new Vector2( 1f, 0.72f ) },
					WingRoof = SectionRoof.Continue
				},
				new()
				{
					Kind = ArchStepKind.Canopy,
					Target = "shell",
					Rect = new ArchPlotRect
					{
						Min = new Vector2( 0.06f, 0f ),
						Max = new Vector2( 0.62f, 0f ),
						MinInset = new Vector2( 0f, -132f ),
						MaxInset = new Vector2( 0f, 6f )
					},
					Deck = true,
					Railings = true,
					Steps = true,
					HeadHeight = 156f,
					PostSpacing = 132f,
					Rafters = true
				},
				new()
				{
					Kind = ArchStepKind.Opening,
					Target = "shell",
					Side = ArchSide.MinY,
					Preset = "door_double",
					Height = 108f
				},
				new()
				{
					Kind = ArchStepKind.Opening,
					Target = "garage",
					Side = ArchSide.MinY,
					Preset = "garage_double",
					Height = 108f
				}
			}
		};
	}

	static ArchArchetype Factory()
	{
		return new ArchArchetype
		{
			Name = "factory",
			Title = "Factory",
			Description = "Sawtooth north-light roof over a column grid, exposed frame, flush with the terrain.",
			Icon = "factory",
			Openings = new List<string> { "loading_dock", "loading_dock_open", "bay_mouth", "roller_shutter", "window_strip", "door" },
			Pillars = new List<string> { "stanchion", "pier" },
			Shell = new ArchSectionRules
			{
				Roof = RoofStyle.Sawtooth,
				WallHeight = 216f,
				RoofPitch = 14f,
				Ceiling = false,
				Fascia = false,
				Soffit = false,
				Frame = true,
				Floor = false,
				Foundation = false,
				Wall = new ArchWallPreset
				{
					Name = "industrial",
					Cladding = WallCladding.Profiled,
					Baseboard = false,
					Bands = new List<ArchWallBand> { new() { Height = 24f, Field = ArchSurface.Foundation } },
					Pilasters = new ArchPilasterRun { Bay = 168f, Width = 14f, Depth = 3f }
				}
			},
			Wing = new ArchSectionRules
			{
				WallHeight = 156f,
				Ceiling = false,
				Fascia = false,
				Soffit = false,
				Floor = false,
				Foundation = false,
				Parapet = true,
				ParapetHeight = 18f,
				Wall = new ArchWallPreset
				{
					Name = "office",
					Cap = false,
					Bands = new List<ArchWallBand> { new() { Height = 60f, Field = ArchSurface.WallBase } }
				}
			},
			WingRoof = SectionRoof.Capped,
			Shows = new List<ArchOptionGroup>
			{
				ArchOptionGroup.Section, ArchOptionGroup.WingRoof, ArchOptionGroup.Approach, ArchOptionGroup.Yard
			},
			DriveWidth = 336f,
			DriveSplay = 120f,
			MinimumPlot = new Vector2( 600f, 500f ),
			Steps = new List<ArchArchetypeStep>
			{
				new()
				{
					Kind = ArchStepKind.Shell,
					Name = "shell",
					SawtoothBays = 5
				},
				new()
				{
					Kind = ArchStepKind.Pillars,
					Target = "shell",
					Rect = new ArchPlotRect { Min = new Vector2( 0.14f, 0.14f ), Max = new Vector2( 0.86f, 0.86f ) },
					Spacing = new Vector2( 240f, 240f ),
					Span = PillarSpan.Beam
				},
				new()
				{
					Kind = ArchStepKind.Canopy,
					Target = "shell",
					Rect = new ArchPlotRect
					{
						Min = new Vector2( 0.08f, 0f ),
						Max = new Vector2( 0.55f, 0f ),
						MinInset = new Vector2( 0f, -132f ),
						MaxInset = new Vector2( 0f, 48f )
					},
					Rules = new ArchSectionRules { RoofPitch = 7f, Fascia = false, Soffit = false, Gutters = false },
					HeadHeight = 156f,
					PostSpacing = 216f,
					Braces = true,
					Rafters = true
				},
				new()
				{
					Kind = ArchStepKind.Opening,
					Target = "shell",
					Side = ArchSide.MinY,
					Preset = "loading_dock_open",
					Count = 2
				},
				new()
				{
					Kind = ArchStepKind.Opening,
					Target = "shell",
					Side = ArchSide.MinX,
					Preset = "bay_mouth",
					Width = 336f,
					Height = 204f
				},
				new()
				{
					Kind = ArchStepKind.Opening,
					Target = "shell",
					Side = ArchSide.MaxX,
					Preset = "window_strip",
					Count = 4
				}
			}
		};
	}
}