Table of Contents

Class CustomProductDefinition

Namespace
S1API.Products
Assembly
S1API.dll

Represents a generic, non-mixable custom product registered through S1API.

public sealed class CustomProductDefinition : ProductDefinition
Inheritance
CustomProductDefinition
Inherited Members
Extension Methods

Remarks

The stable ID is used by native loose and packaged product-item save data and network serialization. The definition must be registered before restoration on every peer; missing-mod definition transfer is not supported by the game.

This type does not add native mixing, generated variants, custom presentation providers, packaged-content visuals, station recipes, or product-manager UI categories.

Properties

BaseAddictiveness

Gets the configured base addictiveness before property contributions.

public float BaseAddictiveness { get; }

Property Value

float

DefaultQuality

Gets the quality used when an explicit quality is not supplied.

public Quality DefaultQuality { get; }

Property Value

Quality

NpcEffectDurationSeconds

Gets the configured NPC consumption-effect duration in seconds.

public int NpcEffectDurationSeconds { get; }

Property Value

int

PlayerEffectDurationSeconds

Gets the configured player consumption-effect duration in seconds.

public int PlayerEffectDurationSeconds { get; }

Property Value

int

ProductKind

Gets the stable logical product kind.

public ProductKind ProductKind { get; }

Property Value

ProductKind

ValidPackaging

Gets an immutable snapshot of packaging accepted by this product.

public IReadOnlyList<PackagingDefinition> ValidPackaging { get; }

Property Value

IReadOnlyList<PackagingDefinition>

Methods

CreateInstance(int)

Creates a loose product instance using DefaultQuality.

public override ItemInstance CreateInstance(int quantity = 1)

Parameters

quantity int

The native stack quantity.

Returns

ItemInstance

A native-backed product item instance.

CreateInstance(int, Quality)

Creates a loose product instance with an explicit quality.

public ProductInstance CreateInstance(int quantity, Quality quality)

Parameters

quantity int

The native stack quantity.

quality Quality

A defined quality value.

Returns

ProductInstance

A native-backed product item instance.

CreatePackagedInstance(int, PackagingDefinition)

Creates a packaged product instance using DefaultQuality.

public ProductInstance? CreatePackagedInstance(int quantity, PackagingDefinition packaging)

Parameters

quantity int

The native stack quantity.

packaging PackagingDefinition

Packaging configured in ValidPackaging.

Returns

ProductInstance

A packaged instance, or null when the packaging is null, unsupported, or cannot be converted to its native definition.

CreatePackagedInstance(int, PackagingDefinition, Quality)

Creates a packaged product instance with an explicit quality.

public ProductInstance? CreatePackagedInstance(int quantity, PackagingDefinition packaging, Quality quality)

Parameters

quantity int

The native stack quantity.

packaging PackagingDefinition

Packaging configured in ValidPackaging.

quality Quality

A defined quality value.

Returns

ProductInstance

A packaged instance, or null when the packaging is null, unsupported, or cannot be converted to its native definition.

Discover(bool)

Explicitly discovers this product through the native host/server product manager.

public void Discover(bool listForSale = false)

Parameters

listForSale bool

Whether native discovery should also list the product. The default keeps listing opt-in.

Remarks

Call this from the host/server after the product manager is available. Build itself never discovers or lists the product.

SetListed(bool)

Explicitly changes native product-manager listing state.

public void SetListed(bool listed = true)

Parameters

listed bool

true to list the already discovered product; otherwise to unlist it.

Remarks

Call this from a network-active host/client after discovery. Shop inventory remains a separate explicit integration through ShopManager.

SupportsPackaging(PackagingDefinition)

Returns whether the supplied packaging is accepted by this definition.

public bool SupportsPackaging(PackagingDefinition packaging)

Parameters

packaging PackagingDefinition

The packaging to test.

Returns

bool

true for a configured packaging definition; otherwise false.