Table of Contents

Class StorableItemDefinitionBuilder

Namespace
S1API.Items
Assembly
S1API.dll

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

[Obsolete("Use S1API.Items.Storable.StorableItemDefinitionBuilder instead")]
public sealed class StorableItemDefinitionBuilder
Inheritance
StorableItemDefinitionBuilder
Inherited Members
Extension Methods

Remarks

All items in Schedule One are StorableItemDefinition (or subclasses thereof). The base ItemDefinition class is never used directly in the game.

Methods

Build()

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

public StorableItemDefinition Build()

Returns

StorableItemDefinition

A wrapper around the created storable item definition.

WithBasicInfo(string, string, string, ItemCategory)

Sets the basic information for the item.

public StorableItemDefinitionBuilder WithBasicInfo(string id, string name, string description, ItemCategory category)

Parameters

id string

Unique identifier for the item (e.g., "my_custom_tool").

name string

Display name shown in UI.

description string

Item description shown in tooltips.

category ItemCategory

Item category for inventory organization.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithDemoAvailability(bool)

Sets whether this item is available in the demo version of the game.

public StorableItemDefinitionBuilder WithDemoAvailability(bool available)

Parameters

available bool

True if available in demo, false otherwise.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithEquippable(Equippable)

Attaches an equippable component to this item, allowing it to be equipped by the player.

public StorableItemDefinitionBuilder WithEquippable(Equippable equippable)

Parameters

equippable Equippable

The equippable wrapper to attach.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithIcon(Sprite)

Sets the icon sprite displayed for this item in UI.

public StorableItemDefinitionBuilder WithIcon(Sprite icon)

Parameters

icon Sprite

The sprite to use as the item icon.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithLegalStatus(LegalStatus)

Sets the legal status of the item.

public StorableItemDefinitionBuilder WithLegalStatus(LegalStatus status)

Parameters

status LegalStatus

Whether the item is legal or illegal.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithPricing(float, float)

Configures the economic properties of the item.

public StorableItemDefinitionBuilder WithPricing(float basePurchasePrice, float resellMultiplier = 0.5)

Parameters

basePurchasePrice float

Base price when buying from shops.

resellMultiplier float

Fraction of purchase price recovered when selling (0.0 to 1.0).

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithRequiredRank(FullRank?)

Assigns a level requirement for purchasing this item in shops.

public StorableItemDefinitionBuilder WithRequiredRank(FullRank? rank)

Parameters

rank FullRank?

The required rank to purchase this item, or null to remove level requirement.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithStackLimit(int)

Sets the maximum stack size for this item.

public StorableItemDefinitionBuilder WithStackLimit(int limit)

Parameters

limit int

Maximum quantity per inventory slot (1-999).

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithStationItem(GameObject)

Assigns a StationItem prefab to this item definition so it can be used as a station/minigame ingredient (e.g., Chemistry Station).

public StorableItemDefinitionBuilder WithStationItem(GameObject stationItemPrefab)

Parameters

stationItemPrefab GameObject

A prefab GameObject that has a StationItem component.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

Remarks

S1API clones and caches the prefab under a hidden DontDestroyOnLoad root by default. This avoids mutating shared prefabs and helps keep the reference stable across scene loads.

Exceptions

ArgumentNullException

Thrown if stationItemPrefab is null.

ArgumentException

Thrown if stationItemPrefab does not have a StationItem component.

WithStoredItem(GameObject)

Assigns a custom StoredItem prefab for this definition.

public StorableItemDefinitionBuilder WithStoredItem(GameObject storedItemPrefab)

Parameters

storedItemPrefab GameObject

Prefab containing a StoredItem component.

Returns

StorableItemDefinitionBuilder

The builder instance for fluent chaining.

WithoutStationItem()

Clears the StationItem reference for this definition.

public StorableItemDefinitionBuilder WithoutStationItem()

Returns

StorableItemDefinitionBuilder