Class CustomProductDefinition
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
DefaultQuality
Gets the quality used when an explicit quality is not supplied.
public Quality DefaultQuality { get; }
Property Value
NpcEffectDurationSeconds
Gets the configured NPC consumption-effect duration in seconds.
public int NpcEffectDurationSeconds { get; }
Property Value
PlayerEffectDurationSeconds
Gets the configured player consumption-effect duration in seconds.
public int PlayerEffectDurationSeconds { get; }
Property Value
ProductKind
Gets the stable logical product kind.
public ProductKind ProductKind { get; }
Property Value
ValidPackaging
Gets an immutable snapshot of packaging accepted by this product.
public IReadOnlyList<PackagingDefinition> ValidPackaging { get; }
Property Value
Methods
CreateInstance(int)
Creates a loose product instance using DefaultQuality.
public override ItemInstance CreateInstance(int quantity = 1)
Parameters
quantityintThe 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
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
quantityintThe native stack quantity.
packagingPackagingDefinitionPackaging 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
quantityintThe native stack quantity.
packagingPackagingDefinitionPackaging configured in ValidPackaging.
qualityQualityA 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
listForSaleboolWhether 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
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
packagingPackagingDefinitionThe packaging to test.