Class FurnitureDefinitionBuilder
Composes a custom model into a native furniture definition, placement prefab, and inventory prefab.
public sealed class FurnitureDefinitionBuilder
- Inheritance
-
FurnitureDefinitionBuilder
- Inherited Members
- Extension Methods
Methods
Build()
Creates and registers the complete native buildable definition. Call this after the game's item registry and vanilla furniture definitions are available. Every multiplayer peer must perform the same registration.
public BuildableItemDefinition Build()
Returns
- BuildableItemDefinition
The registered custom furniture definition.
Exceptions
- InvalidOperationException
Thrown when required identity or model configuration is missing, or a native donor is unavailable.
ConfigureModel(Action<GameObject>)
Configures the isolated visual owned by a builder returned from CloneFrom(string). Renderer materials are independent from the donor before this callback runs.
public FurnitureDefinitionBuilder ConfigureModel(Action<GameObject> configure)
Parameters
configureAction<GameObject>A callback that modifies the builder-owned visual clone.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentNullException
Thrown when
configureis null.- InvalidOperationException
Thrown when this builder was not created by
CloneFrom, or the model was already configured.
WithBasicInfo(string, string, string)
Sets the stable registry ID and player-facing text.
public FurnitureDefinitionBuilder WithBasicInfo(string id, string name, string description)
Parameters
idstringThe stable item ID shared by every multiplayer peer.
namestringThe player-facing item name.
descriptionstringThe player-facing item description. An empty description is allowed.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
WithBuildSound(BuildSoundType)
Sets the sound family used when placement completes.
public FurnitureDefinitionBuilder WithBuildSound(BuildSoundType buildSound)
Parameters
buildSoundBuildSoundTypeThe public sound family. Plastic uses the native metal sound because the game has no plastic family.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentOutOfRangeException
Thrown for an undefined sound family.
WithFootprint(int, int)
Sets the floor-grid footprint in 0.5 metre tiles.
public FurnitureDefinitionBuilder WithFootprint(int width, int depth)
Parameters
widthintThe positive footprint width in grid tiles.
depthintThe positive footprint depth in grid tiles.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentOutOfRangeException
Thrown when either dimension is less than one.
WithGeneratedIcon(int)
Queues inventory-icon generation from the supplied model. The definition registers immediately, and S1API replaces its fallback icon when the gameplay rendering rig becomes available.
public FurnitureDefinitionBuilder WithGeneratedIcon(int resolution = 512)
Parameters
resolutionintThe square icon resolution from 64 through 2048 pixels.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentOutOfRangeException
Thrown when
resolutionis outside the supported range.
WithIcon(Sprite)
Uses an existing inventory icon.
public FurnitureDefinitionBuilder WithIcon(Sprite icon)
Parameters
iconSpriteThe icon to assign without using the native render rig.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentNullException
Thrown when
iconis null.
WithModel(GameObject)
Sets the model used for the placed object, placement ghost, stored item, and generated icon. The supplied object is cloned and is never modified by S1API.
public FurnitureDefinitionBuilder WithModel(GameObject model)
Parameters
modelGameObjectThe model root to clone. It must contain at least one mesh renderer.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentNullException
Thrown when
modelis null.
WithPlacement(FurniturePlacementMode)
Chooses the native placement family.
public FurnitureDefinitionBuilder WithPlacement(FurniturePlacementMode placementMode)
Parameters
placementModeFurniturePlacementModeThe grid or surface placement family to compose.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentOutOfRangeException
Thrown for an undefined placement mode.
WithPricing(float, float)
Sets the purchase and resale values.
public FurnitureDefinitionBuilder WithPricing(float basePurchasePrice, float resellMultiplier = 0.5)
Parameters
basePurchasePricefloatThe non-negative base purchase price.
resellMultiplierfloatThe resale fraction, clamped between zero and one.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
WithStackLimit(int)
Sets the inventory stack limit.
public FurnitureDefinitionBuilder WithStackLimit(int stackLimit)
Parameters
stackLimitintThe stack limit, clamped between 1 and 999.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
WithSurfacePlacement(FurnitureSurfaceType, bool)
Configures valid surfaces and rotation for surface-placed furniture.
public FurnitureDefinitionBuilder WithSurfacePlacement(FurnitureSurfaceType surfaceTypes, bool allowRotation = true)
Parameters
surfaceTypesFurnitureSurfaceTypeOne or more supported wall or roof surface flags.
allowRotationboolWhether the player can rotate the item during surface placement.
Returns
- FurnitureDefinitionBuilder
This builder for fluent chaining.
Exceptions
- ArgumentOutOfRangeException
Thrown when
surfaceTypesis empty or contains an unknown flag.