import{_ as e,c as t,o as r,N as a}from"./chunks/framework.0799945b.js";const b=JSON.parse('{"title":"Module: features/resources/resource","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/features/resource.md","lastUpdated":null}'),o={name:"api/modules/features/resource.md"},c=a('

Module: features/resources/resource

Interfaces

Resource

Resource<T>: Object

An object that represents a named and quantifiable resource in the game.

Type parameters

NameType
TDecimalSource
NameTypeDescription
[RefSymbol]trueType differentiator only. We need this to be in public d.ts but don't want it to show up in IDE autocomplete, so we use a private Symbol instead.
displayNamestringThe name of this resource.
precisionnumberWhen displaying the value of this resource, how many significant digits to display.
small?booleanWhether or not to display very small values using scientific notation, or rounding to 0.
valueT-

Defined in

profectus/src/features/resources/resource.ts:12

Functions

createResource

createResource<T>(defaultValue, displayName?, precision?, small?): Resource<T> & Persistent<T> & { [NonPersistent]: Resource<T> }

Creates a resource.

Type parameters

NameType
Textends State

Parameters

NameTypeDescription
defaultValueTThe initial value of the resource
displayName?stringThe human readable name of this resource
precision?numberThe number of significant digits to display by default
small?booleanWhether or not to display very small values or round to 0, by default

Returns

Resource<T> & Persistent<T> & { [NonPersistent]: Resource<T> }

Defined in

profectus/src/features/resources/resource.ts:28

createResource<T>(defaultValue, displayName?, precision?, small?): Resource<T>

Type parameters

NameType
Textends State

Parameters

NameType
defaultValueRef<T>
displayName?string
precision?number
small?boolean

Returns

Resource<T>

Defined in

profectus/src/features/resources/resource.ts:34

createResource: <T>(defaultValue: T, displayName?: string, precision?: number, small?: boolean) => Resource<T> & Persistent<T> & { [NonPersistent]: Resource<T> }<T>(defaultValue: Ref<T>, displayName?: string, precision?: number, small?: boolean) => Resource<T>

Defined in

profectus/src/features/resources/resource.ts:28

profectus/src/features/resources/resource.ts:34

profectus/src/features/resources/resource.ts:40


displayResource

displayResource(resource, overrideAmount?): string

Utility for displaying a resource with the correct precision.

Parameters

NameType
resourceResource<DecimalSource>
overrideAmount?DecimalSource

Returns

string

Defined in

profectus/src/features/resources/resource.ts:153

displayResource: (resource: Resource<DecimalSource>, overrideAmount?: DecimalSource) => string

Defined in

profectus/src/features/resources/resource.ts:153


trackBest

trackBest(resource): Ref<DecimalSource>

Returns a reference to the highest amount of the resource ever owned, which is updated automatically.

Parameters

NameType
resourceResource<DecimalSource>

Returns

Ref<DecimalSource>

Defined in

profectus/src/features/resources/resource.ts:64

trackBest: (resource: Resource<DecimalSource>) => Ref<DecimalSource>

Defined in

profectus/src/features/resources/resource.ts:64


trackOOMPS

trackOOMPS(resource, pointGain?): Ref<string>

Returns a reference to the amount of resource being gained in terms of orders of magnitude per second, calcualted over the last tick. Useful for situations where the gain rate is increasing very rapidly.

Parameters

NameType
resourceResource<DecimalSource>
pointGain?ComputedRef<DecimalSource>

Returns

Ref<string>

Defined in

profectus/src/features/resources/resource.ts:94

trackOOMPS: (resource: Resource<DecimalSource>, pointGain?: ComputedRef<DecimalSource>) => Ref<string>

Defined in

profectus/src/features/resources/resource.ts:94


trackTotal

trackTotal(resource): Ref<DecimalSource>

Returns a reference to the total amount of the resource gained, updated automatically. "Refunds" count as gain.

Parameters

NameType
resourceResource<DecimalSource>

Returns

Ref<DecimalSource>

Defined in

profectus/src/features/resources/resource.ts:78

trackTotal: (resource: Resource<DecimalSource>) => Ref<DecimalSource>

Defined in

profectus/src/features/resources/resource.ts:78


unwrapResource

unwrapResource(resource): Resource

Utility for unwrapping a resource that may or may not be inside a ref.

Parameters

NameType
resourceProcessedComputable<Resource<DecimalSource>>

Returns

Resource

Defined in

profectus/src/features/resources/resource.ts:162

unwrapResource: (resource: ProcessedComputable<Resource<DecimalSource>>) => Resource

Defined in

profectus/src/features/resources/resource.ts:162

Components

MainDisplay Component

Props

NameType
resource*Resource
colorstring
classesRecord
styleStyleValue
effectDisplayCoercableComponent

Resource Component

Props

NameType
resource*Resource
color*string
',108),s=[c];function d(l,i,n,u,h,f){return r(),t("div",null,s)}const g=e(o,[["render",d]]);export{b as __pageData,g as default};