Arma Reforger Script API
Loading...
Searching...
No Matches
SCR_ResourceSystemHelper Interface Reference

Static Public Member Functions

static bool IsGlobalResourceTypeEnabled (EResourceType resourceType=EResourceType.SUPPLIES)
 
static bool GetStoredResources (notnull SCR_ResourceComponent resourceComponent, out float storedRescources, EResourceType resourceType=EResourceType.SUPPLIES)
 Get the amount of resources stored in the resource component.
 
static EResourceReason ConsumeResources (notnull SCR_ResourceComponent resourceComponent, float resourcesToConsume, bool failIfNotEnoughResources, EResourceType resourceType=EResourceType.SUPPLIES)
 Call this to consume resources.
 
static string SuppliesToString (float supplies)
 Function to unify the way supplies are displayed in UI.
 
static bool GetStoredAndMaxResources (notnull SCR_ResourceComponent resourceComponent, out float totalResources, out float maxResources, EResourceType resourceType=EResourceType.SUPPLIES)
 Get the amount of resources stored as well as the max amount that can be stored in the resource component.
 
static bool GetAvailableResources (notnull SCR_ResourceComponent resourceComponent, out float availableResources, EResourceGeneratorID resourceID=EResourceGeneratorID.DEFAULT, EResourceType resourceType=EResourceType.SUPPLIES)
 Get the amount of resources that are available to use for the given resource component.
 
static SCR_ResourceConsumer GetStorageConsumer (notnull SCR_ResourceComponent resourceComponent, EResourceType resourceType=EResourceType.SUPPLIES)
 Get the storage consumer from the given ResourceCompoment.
 
static SCR_ResourceConsumer GetAvailableResourceConsumer (notnull SCR_ResourceComponent resourceComponent, EResourceType resourceType=EResourceType.SUPPLIES)
 Get the consumer for that will grant you access to the available resources.
 
static SCR_ResourceConsumer GetFirstValidConsumer (notnull SCR_ResourceComponent resourceComponent, EResourceType resourceType=EResourceType.SUPPLIES)
 Get the first valid consumer that could be found.
 
static SCR_ResourceGenerator GetFirstValidGenerator (notnull SCR_ResourceComponent resourceComponent, EResourceType resourceType=EResourceType.SUPPLIES)
 Get the first valid generator that could be found.
 
static float RoundRefundSupplyAmount (float refundCost)
 Static function to make sure that all refunds are treated the same way return Correctly rounded refund amount.
 

Static Public Attributes

static const int DECIMALS_SUPPLIES = 1
 

Member Function Documentation

◆ ConsumeResources()

static EResourceReason SCR_ResourceSystemHelper.ConsumeResources ( notnull SCR_ResourceComponent resourceComponent,
float resourcesToConsume,
bool failIfNotEnoughResources,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Call this to consume resources.

Parameters
resourceComponentResourceComponent to get consume resources from
resourcesToConsumeHow much needs to be consumed
failIfNotEnoughResourcesIf true it will never remove resources if there aren't enough. If false it will remove either the given amount or, if not enough resources, it will remove all the resources it can
resourceTypeType of resources to find
Returns
EResourceReason, if it succeeded or not and the reason why

◆ GetAvailableResourceConsumer()

static SCR_ResourceConsumer SCR_ResourceSystemHelper.GetAvailableResourceConsumer ( notnull SCR_ResourceComponent resourceComponent,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Get the consumer for that will grant you access to the available resources.

Parameters
resourceComponentResourceComponent to get consumer from
resourceTypeType of resources the consumer has
Returns
Found consumer

◆ GetAvailableResources()

static bool SCR_ResourceSystemHelper.GetAvailableResources ( notnull SCR_ResourceComponent resourceComponent,
out float availableResources,
EResourceGeneratorID resourceID = EResourceGeneratorID::DEFAULT,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Get the amount of resources that are available to use for the given resource component.

Parameters
resourceComponentResourceComponent to get available resources from
[out]availableResourcesHow many resources are available
resourceIDType of resources it checks. By default this is DEFAULT
resourceTypeType of resources to find
Returns
Returns true if availabe resources were found (even if available resources is 0) returns false if no valid ResourceComponent or ResourceComponent setup

◆ GetFirstValidConsumer()

static SCR_ResourceConsumer SCR_ResourceSystemHelper.GetFirstValidConsumer ( notnull SCR_ResourceComponent resourceComponent,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Get the first valid consumer that could be found.

Parameters
resourceComponentResourceComponent to get consumer from
resourceTypeType of resources the consumer has
Returns
Found consumer

◆ GetFirstValidGenerator()

static SCR_ResourceGenerator SCR_ResourceSystemHelper.GetFirstValidGenerator ( notnull SCR_ResourceComponent resourceComponent,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Get the first valid generator that could be found.

Parameters
resourceComponentResourceComponent to get generator from
resourceTypeType of resources the generator has
Returns
Found generator

◆ GetStorageConsumer()

static SCR_ResourceConsumer SCR_ResourceSystemHelper.GetStorageConsumer ( notnull SCR_ResourceComponent resourceComponent,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Get the storage consumer from the given ResourceCompoment.

Parameters
resourceComponentResourceComponent to get consumer from
resourceTypeType of resources the consumer has
Returns
Found consumer

◆ GetStoredAndMaxResources()

static bool SCR_ResourceSystemHelper.GetStoredAndMaxResources ( notnull SCR_ResourceComponent resourceComponent,
out float totalResources,
out float maxResources,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Get the amount of resources stored as well as the max amount that can be stored in the resource component.

Parameters
resourceComponentResourceComponent to get stored resources from
[out]Currentstored resources (0 if no valid resources are found)
[out]Maxstored resources (0 if no valid resources are found)
resourceTypeType of resources to find
Returns
Returns true if resource storage were found (even if stored resources is 0) returns false if no valid ResourceComponent or ResourceComponent setup or if max resource amount is 0

◆ GetStoredResources()

static bool SCR_ResourceSystemHelper.GetStoredResources ( notnull SCR_ResourceComponent resourceComponent,
out float storedRescources,
EResourceType resourceType = EResourceType::SUPPLIES )
static

Get the amount of resources stored in the resource component.

Parameters
resourceComponentResourceComponent to get stored resources from
[out]storedRescourcesHow many resources were found
resourceTypeType of resources to find
Returns
Returns true if resource storage were found (even if stored resources is 0) returns false if no valid ResourceComponent or ResourceComponent setup

◆ IsGlobalResourceTypeEnabled()

static bool SCR_ResourceSystemHelper.IsGlobalResourceTypeEnabled ( EResourceType resourceType = EResourceType::SUPPLIES)
static
Parameters
[in]resourceTypeResource type
Returns
If supplies are enabled or not

◆ RoundRefundSupplyAmount()

static float SCR_ResourceSystemHelper.RoundRefundSupplyAmount ( float refundCost)
static

Static function to make sure that all refunds are treated the same way return Correctly rounded refund amount.

◆ SuppliesToString()

static string SCR_ResourceSystemHelper.SuppliesToString ( float supplies)
static

Function to unify the way supplies are displayed in UI.

Parameters
suppliesSupplies float to be converted to string
Returns
Float converted to supplies with the correct decimals

Member Data Documentation

◆ DECIMALS_SUPPLIES

const int SCR_ResourceSystemHelper.DECIMALS_SUPPLIES = 1
static

The documentation for this interface was generated from the following file: