Table of Contents

Class WeedDefinitionBuilder

Namespace
S1API.Products
Assembly
S1API.dll

Builds marijuana-family weed variants through the game's native CreateWeed_Server lifecycle.

public sealed class WeedDefinitionBuilder
Inheritance
WeedDefinitionBuilder
Inherited Members
Extension Methods

Remarks

Call Build() after the save has loaded, such as from GameLifecycle.OnLoadComplete. Native creation owns product registration, pricing, discovery, icon generation, persistence, and network replication.

Constructors

WeedDefinitionBuilder(string)

Creates a builder for a marijuana-family weed variant.

public WeedDefinitionBuilder(string id)

Parameters

id string

A stable namespaced ID in the form mod-id:product-id.

Methods

Build()

Creates or resolves the weed variant through the native product creator.

public WeedDefinition Build()

Returns

WeedDefinition

The existing S1API typed wrapper around the native weed definition.

Exceptions

InvalidOperationException

Thrown when a name is not configured, when called before the product runtime is available, when properties do not resolve, when the ID collides with another item family, or when native creation fails.

WithAppearance(WeedAppearanceSettings)

Sets explicit native weed colors. When omitted, the game generates an appearance from the configured properties.

public WeedDefinitionBuilder WithAppearance(WeedAppearanceSettings appearance)

Parameters

appearance WeedAppearanceSettings

The four native weed color channels.

Returns

WeedDefinitionBuilder

This builder.

WithName(string)

Sets the display name used by the native product definition and save representation.

public WeedDefinitionBuilder WithName(string name)

Parameters

name string

The non-empty display name.

Returns

WeedDefinitionBuilder

This builder.

WithProperties(params PropertyBase[])

Replaces the weed variant's properties.

public WeedDefinitionBuilder WithProperties(params PropertyBase[] properties)

Parameters

properties PropertyBase[]

Vanilla property tokens or registered custom properties.

Returns

WeedDefinitionBuilder

This builder.

WithProperty(PropertyBase)

Adds one property to the weed variant.

public WeedDefinitionBuilder WithProperty(PropertyBase property)

Parameters

property PropertyBase

A vanilla property token or registered custom property.

Returns

WeedDefinitionBuilder

This builder.