Profectus / features/conversion / setupPassiveGeneration
Function: setupPassiveGeneration() ​
setupPassiveGeneration(
layer
,conversion
,rate
,cap
):void
This will automatically increase the value of conversion.gainResource without lowering the value of the input resource. It will by default perform 100% of a conversion's currentGain per second. If you use a ref for the rate you can set it's value to 0 when passive generation should be disabled.
Parameters ​
layer ​
The layer this passive generation will be associated with. Typically this
when calling this function from inside a layer's options function.
conversion ​
The conversion that will determine how much generation there is.
rate ​
MaybeRefOrGetter
<DecimalSource
> = 1
A multiplier to multiply against the conversion's currentGain.
cap ​
MaybeRefOrGetter
<DecimalSource
> = Decimal.dInf
A value that should not be passed via passive generation.
Returns ​
void