Class ProductPopulator
Utility methods for populating storage with product instances.
public static class ProductPopulator
- Inheritance
-
ProductPopulator
- Inherited Members
Methods
CreatePackagedProduct(ProductDefinition, PackagingDefinition, int)
Creates a packaged product instance.
public static ProductInstance? CreatePackagedProduct(ProductDefinition productDef, PackagingDefinition packaging, int quantity)
Parameters
productDefProductDefinitionThe product definition.
packagingPackagingDefinitionThe packaging definition.
quantityintThe quantity of the product.
Returns
- ProductInstance
The created product instance, or null if failed.
GetAllProductDefinitions()
Gets all available product definitions from the game registry.
public static List<ProductDefinition> GetAllProductDefinitions()
Returns
- List<ProductDefinition>
A list of product definitions.
GetCocaineDefinitions()
Gets cocaine product definitions from the game registry.
public static List<CocaineDefinition> GetCocaineDefinitions()
Returns
- List<CocaineDefinition>
A list of cocaine product definitions.
GetMethDefinitions()
Gets meth product definitions from the game registry.
public static List<MethDefinition> GetMethDefinitions()
Returns
- List<MethDefinition>
A list of meth product definitions.
GetPackaging(string)
Gets a packaging definition by its ID.
public static PackagingDefinition? GetPackaging(string packagingId)
Parameters
packagingIdstringThe ID of the packaging (e.g., "baggie", "jar", "brick").
Returns
- PackagingDefinition
The packaging definition, or null if not found.
GetShroomDefinitions()
Gets shroom product definitions from the game registry.
public static List<ShroomDefinition> GetShroomDefinitions()
Returns
- List<ShroomDefinition>
A list of shroom product definitions.
GetWeedDefinitions()
Gets weed product definitions from the game registry.
public static List<WeedDefinition> GetWeedDefinitions()
Returns
- List<WeedDefinition>
A list of weed product definitions.
PopulateFromGameObject(GameObject, string, int)
Populates a storage container by finding it from a GameObject. Fills all slots with packaged products in the specified packaging.
public static int PopulateFromGameObject(GameObject gameObject, string packagingId, int quantityPerItem = 1)
Parameters
gameObjectGameObjectThe GameObject with a StorageEntity component.
packagingIdstringThe ID of the packaging to use (e.g., "baggie", "jar", "brick").
quantityPerItemintThe quantity of each product item.
Returns
- int
The number of items successfully added, or -1 if storage not found.
PopulateWithPackagedProducts(StorageInstance, string, int)
Populates a storage container with packaged products.
public static int PopulateWithPackagedProducts(StorageInstance storage, string packagingId, int quantityPerItem = 1)
Parameters
storageStorageInstanceThe storage instance to populate.
packagingIdstringThe ID of the packaging to use (e.g., "baggie", "jar", "brick").
quantityPerItemintThe quantity of each product item.
Returns
- int
The number of items successfully added.
PopulateWithSpecificPackagedProducts(StorageInstance, List<string>, string, int)
Populates a storage container with specific packaged products by ID.
public static int PopulateWithSpecificPackagedProducts(StorageInstance storage, List<string> productIds, string packagingId, int quantityPerProduct = 1)
Parameters
storageStorageInstanceThe storage instance to populate.
productIdsList<string>List of product IDs to add.
packagingIdstringThe ID of the packaging to use (e.g., "baggie", "jar", "brick").
quantityPerProductintQuantity of each product to add (default 1).
Returns
- int
The number of items successfully added.
PopulateWithSpecificProducts(StorageInstance, List<string>, int)
Populates a storage container with specific non-packaged products by ID.
public static int PopulateWithSpecificProducts(StorageInstance storage, List<string> productIds, int quantityPerProduct = 1)
Parameters
storageStorageInstanceThe storage instance to populate.
productIdsList<string>List of product IDs to add.
quantityPerProductintQuantity of each product to add (default 1).
Returns
- int
The number of items successfully added.
PopulateWithUnpackagedProducts(StorageInstance, int)
Populates a storage container with non-packaged products.
public static int PopulateWithUnpackagedProducts(StorageInstance storage, int quantityPerItem = 1)
Parameters
storageStorageInstanceThe storage instance to populate.
quantityPerItemintThe quantity of each product item.
Returns
- int
The number of items successfully added.
PopulateWithWeedProducts(StorageInstance)
Populates a storage container with packaged weed products in jars. Fills all available slots with 20 units (4 jars) of each product.
public static int PopulateWithWeedProducts(StorageInstance storage)
Parameters
storageStorageInstanceThe storage instance to populate.
Returns
- int
The number of items successfully added.