Table of Contents

Class BuildableItemDefinitionBuilder

Namespace
S1API.Items.Buildable
Assembly
S1API.dll

Builder for composing buildable item definitions at runtime. Use fluent methods to configure buildable item properties before calling Build().

public class BuildableItemDefinitionBuilder : StorableItemDefinitionBuilderBase<BuildableItemDefinitionBuilder>
Inheritance
BuildableItemDefinitionBuilder
Inherited Members
Extension Methods

Methods

Build()

Builds the item definition, registers it with the game's registry, and returns a wrapper.

public BuildableItemDefinition Build()

Returns

BuildableItemDefinition

A wrapper around the created buildable item definition.

CopyPropertiesFrom(StorableItemDefinition)

Copies all properties from a source definition to the current definition.

protected override void CopyPropertiesFrom(StorableItemDefinition source)

Parameters

source StorableItemDefinition

The source definition to copy from.

CreateWrapper(StorableItemDefinition)

Creates a wrapper around the given item definition. Subclasses can override this to return a more specific wrapper type.

protected override StorableItemDefinition CreateWrapper(StorableItemDefinition definition)

Parameters

definition StorableItemDefinition

The item definition to wrap.

Returns

StorableItemDefinition

A wrapper around the given item definition.

WithBuildSound(BuildSoundType)

Sets the sound type played when this item is built.

public BuildableItemDefinitionBuilder WithBuildSound(BuildSoundType soundType)

Parameters

soundType BuildSoundType

The build sound type.

Returns

BuildableItemDefinitionBuilder

The builder instance for fluent chaining.

WithGhostVisual(Func<Transform, GameObject>, bool)

Configures an optional visual created whenever the native placement system creates this buildable's ghost. The factory runs on Unity's main thread and must return the created visual. S1API parents and activates it under the supplied ghost transform.

public BuildableItemDefinitionBuilder WithGhostVisual(Func<Transform, GameObject> visualFactory, bool replaceExistingVisual = false)

Parameters

visualFactory Func<Transform, GameObject>

Creates the visual under the supplied placement-ghost transform.

replaceExistingVisual bool

Whether S1API should hide renderers inherited from the native buildable before creating the visual.

Returns

BuildableItemDefinitionBuilder

The builder instance for fluent chaining.