Class StorableItemDefinitionBuilder
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
idstringUnique identifier for the item (e.g., "my_custom_tool").
namestringDisplay name shown in UI.
descriptionstringItem description shown in tooltips.
categoryItemCategoryItem 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
availableboolTrue 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
equippableEquippableThe 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
iconSpriteThe 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
statusLegalStatusWhether 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
basePurchasePricefloatBase price when buying from shops.
resellMultiplierfloatFraction 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
rankFullRank?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
limitintMaximum 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
stationItemPrefabGameObjectA 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
stationItemPrefabis null.- ArgumentException
Thrown if
stationItemPrefabdoes not have a StationItem component.
WithStoredItem(GameObject)
Assigns a custom StoredItem prefab for this definition.
public StorableItemDefinitionBuilder WithStoredItem(GameObject storedItemPrefab)
Parameters
storedItemPrefabGameObjectPrefab containing a StoredItem component.
Returns
- StorableItemDefinitionBuilder
The builder instance for fluent chaining.
WithoutStationItem()
Clears the StationItem reference for this definition.
public StorableItemDefinitionBuilder WithoutStationItem()