Table of Contents

Class BuildingBuilder

Namespace
S1MAPI.Building
Assembly
S1MAPI_Mono.dll

Fluent builder for constructing buildings with a clean, chainable API. Delegates to specialized builders (WallBuilder, FurnitureBuilder, etc.).

public sealed class BuildingBuilder
Inheritance
BuildingBuilder
Inherited Members

Examples

var building = new BuildingBuilder("MyShop") .WithConfig(BuildingConfig.Dispensary) .AddFloor() .AddCeiling() .AddWalls(southDoor: true, eastDoor: true, westWindow: true) .AddLights() .AddFurniture(FurnitureType.Counter, "north") .Build();

Constructors

BuildingBuilder(string)

Create a new building builder.

public BuildingBuilder(string name)

Parameters

name string

Name for the building GameObject

Properties

Config

Get the current configuration.

public BuildingConfig Config { get; }

Property Value

BuildingConfig

GridCellSize

Grid cell size computed from room dimensions. Furniture placement and interior pathfinding both use this value so the two grids are always aligned.

public float GridCellSize { get; }

Property Value

float

InteriorDoorways

Doorway positions recorded from all interior walls. Each entry provides center, dimensions, and orientation for future NavMesh link generation.

public IReadOnlyList<DoorwayInfo> InteriorDoorways { get; }

Property Value

IReadOnlyList<DoorwayInfo>

Registry

Post-build registry for targeting specific building parts (walls, floor, trim, etc.).

public BuildingPartRegistry Registry { get; }

Property Value

BuildingPartRegistry

RoomSize

Get the current room size.

public Vector3 RoomSize { get; }

Property Value

Vector3

Root

Get the root GameObject before Build() is called.

public GameObject Root { get; }

Property Value

GameObject

Methods

AddAmbientLighting(float)

Add ambient fill lighting.

public BuildingBuilder AddAmbientLighting(float intensity = 0.3)

Parameters

intensity float

Ambient light intensity

Returns

BuildingBuilder

This builder for chaining

AddBaseMolding(float, float, Material?, IEnumerable<WallSide>?)

Add base molding around the bottom of the building.

public BuildingBuilder AddBaseMolding(float height = 0.3, float depth = 0.1, Material? material = null, IEnumerable<WallSide>? skipWalls = null)

Parameters

height float

Molding height in meters

depth float

Molding depth in meters

material Material

Optional material override

skipWalls IEnumerable<WallSide>

Wall sides to omit molding from (null = include all walls)

Returns

BuildingBuilder

This builder for chaining

AddCeiling(Color?, Material?)

Add ceiling to the room.

public BuildingBuilder AddCeiling(Color? color = null, Material? material = null)

Parameters

color Color?

Optional color override

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddCornerPillars(float, Material?)

Add structural pillars at corners.

public BuildingBuilder AddCornerPillars(float width = 0.4, Material? material = null)

Parameters

width float

Pillar width in meters

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddCornerTrim(float, float, Material?)

Add thin vertical trim strips at the four corners of the building. Each corner gets two perpendicular strips forming a right angle that seamlessly connects with horizontal trims (AddRoofTrim(float, Material?), AddBaseMolding(float, float, Material?, IEnumerable<WallSide>?)).

public BuildingBuilder AddCornerTrim(float width = 0.3, float depth = 0.1, Material? material = null)

Parameters

width float

Visible width of each trim strip on the wall face in meters

depth float

How far the trim protrudes past the wall surface in meters

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddDoorFrames(Material?)

Add trim-style door frames around door openings. Must be called after AddWalls.

public BuildingBuilder AddDoorFrames(Material? material = null)

Parameters

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddFloor(Color?, Material?)

Add floor to the room.

public BuildingBuilder AddFloor(Color? color = null, Material? material = null)

Parameters

color Color?

Optional color override

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddFoundation(float, float, float, Color?, Material?)

Add foundation beneath the building.

public BuildingBuilder AddFoundation(float height = 2, float expandX = 0, float expandZ = 0, Color? color = null, Material? material = null)

Parameters

height float

Foundation depth in meters

expandX float

Extra expansion on X axis

expandZ float

Extra expansion on Z axis

color Color?

Optional color override (defaults to grey)

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddFurniture(FurnitureType, string, Color?)

Add furniture at a semantic position.

public BuildingBuilder AddFurniture(FurnitureType type, string position, Color? color = null)

Parameters

type FurnitureType

Type of furniture

position string

Semantic position (center, north, south, east, west, northeast, etc.)

color Color?

Optional color override

Returns

BuildingBuilder

This builder for chaining

AddFurniture(FurnitureType, Vector3, Quaternion, Color?)

Add furniture at exact coordinates.

public BuildingBuilder AddFurniture(FurnitureType type, Vector3 position, Quaternion rotation, Color? color = null)

Parameters

type FurnitureType

Type of furniture

position Vector3

Local position

rotation Quaternion

Local rotation

color Color?

Optional color override

Returns

BuildingBuilder

This builder for chaining

AddHipRoof(float, float, bool?, Color?, Material?, float)

Add a hip (four-slope) roof using custom mesh geometry. All four sides slope inward to a central ridge that is shorter than the building length. For square buildings, the ridge collapses to a point (pyramid roof). A base slab sits at ceiling height giving the roof visible thickness from below. For interior ceilings, use AddCeiling(Color?, Material?) separately — the ceiling sits just below the roof slab with no overlap.

public BuildingBuilder AddHipRoof(float ridgeHeight = 2, float overhang = 0.3, bool? ridgeAlongX = null, Color? roofColor = null, Material? roofMaterial = null, float baseSlabHeight = 0.15)

Parameters

ridgeHeight float

Height of the ridge peak above the ceiling in meters.

overhang float

How far the roof eaves extend past the walls in meters.

ridgeAlongX bool?

If true, ridge runs along X axis. If false, along Z. Null auto-selects the longer axis.

roofColor Color?

Color for the sloped roof planes.

roofMaterial Material

Material for the sloped roof planes. Null uses fallback color.

baseSlabHeight float

Height of the 3D base slab beneath the slopes. 0 disables the slab.

Returns

BuildingBuilder

This builder for chaining

AddInteriorDoorFrames(Material?)

Add trim-style door frames around interior doorway openings. Must be called after AddInteriorWall.

public BuildingBuilder AddInteriorDoorFrames(Material? material = null)

Parameters

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddInteriorWall(InteriorWallAxis, float, WallOpening?, Color?, Material?)

Add an interior wall spanning the full room width along the specified axis.

public BuildingBuilder AddInteriorWall(InteriorWallAxis axis, float position, WallOpening? opening = null, Color? color = null, Material? material = null)

Parameters

axis InteriorWallAxis

Axis the wall runs along (X or Z)

position float

Position on the perpendicular axis (Z for X-axis walls, X for Z-axis walls)

opening WallOpening

Optional opening (door or window) centered in the wall

color Color?

Optional wall color override (defaults to palette wall color)

material Material

Optional wall material override (defaults to palette wall material)

Returns

BuildingBuilder

This builder for chaining

AddInteriorWall(InteriorWallAxis, float, float, float, WallOpening?, Color?, Material?)

Add an interior wall spanning a sub-region of the room.

public BuildingBuilder AddInteriorWall(InteriorWallAxis axis, float position, float from, float to, WallOpening? opening = null, Color? color = null, Material? material = null)

Parameters

axis InteriorWallAxis

Axis the wall runs along (X or Z)

position float

Position on the perpendicular axis (Z for X-axis walls, X for Z-axis walls)

from float

Start coordinate along the wall's axis

to float

End coordinate along the wall's axis

opening WallOpening

Optional opening (door or window) centered in the wall

color Color?

Optional wall color override (defaults to palette wall color)

material Material

Optional wall material override (defaults to palette wall material)

Returns

BuildingBuilder

This builder for chaining

AddLights(float?, Color?)

Add ceiling lights distributed across the room.

public BuildingBuilder AddLights(float? intensity = null, Color? color = null)

Parameters

intensity float?

Light intensity

color Color?

Light color

Returns

BuildingBuilder

This builder for chaining

AddParapetRoof(ParapetPreset, float?, float?, float?, float?, Color?, Material?, Color?, Material?)

Add a parapet roof (raised wall and cap above the roofline). The cap extends past the parapet wall by the overhang amount, creating a ledge. Includes a thin roof slab at ceiling height. For interior ceilings, use AddCeiling(Color?, Material?) separately — the ceiling sits just below the roof slab with no overlap. Use Deep for a prominent commercial look or Shallow for a subtler profile.

public BuildingBuilder AddParapetRoof(ParapetPreset preset = ParapetPreset.Deep, float? parapetHeight = null, float? parapetDepth = null, float? capHeight = null, float? capOverhang = null, Color? parapetColor = null, Material? parapetMaterial = null, Color? capColor = null, Material? capMaterial = null)

Parameters

preset ParapetPreset

Sizing preset (Deep or Shallow). Overridden by explicit dimensions.

parapetHeight float?

Height of the parapet wall in meters. Null uses preset default.

parapetDepth float?

Depth of the parapet wall. Null uses wall thickness + padding.

capHeight float?

Height of the cap. Null uses preset default.

capOverhang float?

How far the cap extends past the parapet wall on each side. Null uses preset default.

parapetColor Color?

Color override for the parapet wall.

parapetMaterial Material

Material override for the parapet wall.

capColor Color?

Color override for the cap.

capMaterial Material

Material override for the cap.

Returns

BuildingBuilder

This builder for chaining

AddPrefab(PrefabRef, Vector3, Quaternion, Action<GameObject>?)

Place a game prefab at the specified position.

public BuildingBuilder AddPrefab(PrefabRef prefab, Vector3 position, Quaternion rotation, Action<GameObject>? onCreated = null)

Parameters

prefab PrefabRef

Prefab reference from GamePrefabs

position Vector3

Local position

rotation Quaternion

Local rotation

onCreated Action<GameObject>

Optional callback invoked with the instantiated GameObject

Returns

BuildingBuilder

This builder for chaining

AddRoofTrim(float, Material?)

Add decorative trim around the roofline. Not needed when using AddParapetRoof(ParapetPreset, float?, float?, float?, float?, Color?, Material?, Color?, Material?) or AddHipRoof(float, float, bool?, Color?, Material?, float), which include their own roof structure. Useful for custom roof designs with AddCeiling(Color?, Material?).

public BuildingBuilder AddRoofTrim(float height = 0.3, Material? material = null)

Parameters

height float

Trim height in meters

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddSecondaryRoofTrim(float, Material?)

Add a secondary decorative trim above the roofline. Not needed when using AddParapetRoof(ParapetPreset, float?, float?, float?, float?, Color?, Material?, Color?, Material?) or AddHipRoof(float, float, bool?, Color?, Material?, float), which include their own roof structure. Useful for custom roof designs with AddCeiling(Color?, Material?).

public BuildingBuilder AddSecondaryRoofTrim(float height = 0.15, Material? material = null)

Parameters

height float

Trim height in meters

material Material

Optional material override

Returns

BuildingBuilder

This builder for chaining

AddSlidingDoors(Vector3, Quaternion, string, Action<GameObject>?)

Add sliding double doors at a door opening. Server only — returns the builder unchanged on clients (the door is replicated via FishNet).

public BuildingBuilder AddSlidingDoors(Vector3 position, Quaternion rotation, string openingHours = "6AM-6PM", Action<GameObject>? onCreated = null)

Parameters

position Vector3

Local position for doors

rotation Quaternion

Local rotation

openingHours string

Text for opening hours sign

onCreated Action<GameObject>

Optional callback invoked with the instantiated door GameObject before activation. Runs after internal customization (material, opening hours text) but before Awake/OnEnable fire, so sensors see configured values. Only fires on the server — will NOT fire on clients.

Returns

BuildingBuilder

This builder for chaining

Remarks

Multiplayer behavior:

  • Server/host: Instantiates and network-spawns the door. FishNet replicates it to all clients. The onCreated callback fires.
  • Client: Returns immediately — the door is not created locally. The server-spawned door arrives via FishNet replication and is automatically parented to the building hierarchy with material/text customization applied.

DoorController server-gating: The game's DoorController gates ALL proximity sensor callbacks (PlayerVicinityEnter/Exit, NPCVicinityEnter/Exit) and auto-close logic behind InstanceFinder.IsServer. This means on clients:

  • Doors will NOT auto-open when players/NPCs approach
  • Doors will NOT auto-close when players/NPCs leave
  • Manual interaction (clicking the door handle) DOES work via ServerRpc

S1MAPI cannot implement client-side auto-open/close because it requires game assembly types (DoorController, EDoorSide, Player) that S1MAPI intentionally does not reference. Consumer mods that need this behavior must implement their own proximity polling using DoorController.SetIsOpen_Server (public, RequireOwnership=false, RunLocally=true).

AddStairs(WallSide, float, float, float, float, Color?, Material?, StairStyle, bool, float)

Add stairs from ground level up to the building floor on the specified wall. Automatically aligns with the door opening offset on the specified wall. Supports multiple visual styles: Solid (default concrete box steps), ClosedRiser (two-tone wood with risers), or OpenStringer (plank treads on diagonal stringer beams).

public BuildingBuilder AddStairs(WallSide wall, float foundationHeight = 2, float maxStepHeight = 0.2, float width = 2.5, float stepDepth = 0.3, Color? color = null, Material? material = null, StairStyle style = StairStyle.Solid, bool flushWithFloor = false, float gap = 0)

Parameters

wall WallSide

Which wall the stairs attach to

foundationHeight float

Foundation height in meters (must match AddFoundation height)

maxStepHeight float

Maximum height per step. Lower values create more, shallower steps. (Solid only)

width float

Step width in meters (Solid only)

stepDepth float

Step depth (tread) in meters. Controls how far stairs extend outward. (Solid only)

color Color?

Optional color override — defaults to palette floor color (Solid only)

material Material

Optional material override — defaults to palette floor material (Solid only)

style StairStyle

Visual style of stairs to generate

flushWithFloor bool

If true, topmost step is flush with floor level. If false (default), topmost step is one step below floor. (Solid only)

gap float

Vertical gap between foundation edge and top step. ClosedRiser/OpenStringer default to 0 (flush).

Returns

BuildingBuilder

This builder for chaining

AddWalls(WallOpening?, WallOpening?, WallOpening?, WallOpening?)

Add walls with fine-grained control over openings.

public BuildingBuilder AddWalls(WallOpening? north = null, WallOpening? south = null, WallOpening? east = null, WallOpening? west = null)

Parameters

north WallOpening

North wall opening configuration

south WallOpening

South wall opening configuration

east WallOpening

East wall opening configuration

west WallOpening

West wall opening configuration

Returns

BuildingBuilder

This builder for chaining

AddWalls(WallOpening?, WallOpening?, WallOpening?, WallOpening?, IReadOnlyDictionary<WallSide, WallAppearance>)

Add walls with fine-grained control over openings and per-wall appearance. Walls without an appearance override use the palette defaults.

public BuildingBuilder AddWalls(WallOpening? north, WallOpening? south, WallOpening? east, WallOpening? west, IReadOnlyDictionary<WallSide, WallAppearance> wallAppearances)

Parameters

north WallOpening

North wall opening configuration

south WallOpening

South wall opening configuration

east WallOpening

East wall opening configuration

west WallOpening

West wall opening configuration

wallAppearances IReadOnlyDictionary<WallSide, WallAppearance>

Per-wall material/color overrides keyed by wall side

Returns

BuildingBuilder

This builder for chaining

AddWalls(bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, Color?, Material?)

Add walls with specified openings.

public BuildingBuilder AddWalls(bool northDoor = false, bool southDoor = false, bool eastDoor = false, bool westDoor = false, bool northWindow = false, bool southWindow = false, bool eastWindow = false, bool westWindow = false, bool northDoorWindows = false, bool southDoorWindows = false, bool eastDoorWindows = false, bool westDoorWindows = false, Color? color = null, Material? material = null)

Parameters

northDoor bool

Add door on north wall

southDoor bool

Add door on south wall

eastDoor bool

Add door on east wall

westDoor bool

Add door on west wall

northWindow bool

Add window on north wall

southWindow bool

Add window on south wall

eastWindow bool

Add window on east wall

westWindow bool

Add window on west wall

northDoorWindows bool

Add windows alongside north door (requires northDoor)

southDoorWindows bool

Add windows alongside south door (requires southDoor)

eastDoorWindows bool

Add windows alongside east door (requires eastDoor)

westDoorWindows bool

Add windows alongside west door (requires westDoor)

color Color?

Optional wall color override

material Material

Optional wall material override

Returns

BuildingBuilder

This builder for chaining

Build()

Finalize and return the building GameObject.

public GameObject Build()

Returns

GameObject

The completed building

Build(Action<GameObject>)

Finalize and return the building, then execute a post-build action.

public GameObject Build(Action<GameObject> postBuild)

Parameters

postBuild Action<GameObject>

Action to execute with the completed building

Returns

GameObject

The completed building

CreateNavigationBuilder()

Create a NavigationBuilder configured for this building. Collects exterior and interior doorway positions, stair geometry, and building dimensions. Call Build() on the returned instance after positioning the building.

public NavigationBuilder CreateNavigationBuilder()

Returns

NavigationBuilder

A configured builder ready to build

DefineRoom(float, float, float)

Define room dimensions directly.

public BuildingBuilder DefineRoom(float width, float height, float depth)

Parameters

width float

Room width (X axis) in meters

height float

Room height (Y axis) in meters

depth float

Room depth (Z axis) in meters

Returns

BuildingBuilder

This builder for chaining

FlattenTerrain(float, bool, float)

Flatten terrain under the building footprint. Must be called after the building is positioned in the scene.

public BuildingBuilder FlattenTerrain(float padding = 0.5, bool clearDetails = true, float blendDistance = 3)

Parameters

padding float

Extra padding around the footprint in meters.

clearDetails bool

Clear grass and detail layers in the flattened region.

blendDistance float

Distance for smooth transition back to natural terrain.

Returns

BuildingBuilder

WithConfig(BuildingConfig)

Apply a building configuration preset.

public BuildingBuilder WithConfig(BuildingConfig config)

Parameters

config BuildingConfig

Building configuration

Returns

BuildingBuilder

This builder for chaining

WithInteriorWallLayer(int)

Set the physics layer for interior wall GameObjects. Use this to place interior walls on a layer outside the placement raycast mask so the ghost model passes through them while players still physically collide.

public BuildingBuilder WithInteriorWallLayer(int layer)

Parameters

layer int

Unity layer index (0–31). -1 leaves walls on the default layer.

Returns

BuildingBuilder

This builder for chaining

WithPalette(BuildingPalette)

Apply a palette to the current config.

public BuildingBuilder WithPalette(BuildingPalette palette)

Parameters

palette BuildingPalette

Building palette

Returns

BuildingBuilder

This builder for chaining