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

Module: features/resources/resource

Components

Interfaces

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


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


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


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


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


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

',76),c=[s];function d(l,i,n,u,h,f){return r(),t("div",null,c)}const b=e(o,[["render",d]]);export{m as __pageData,b as default};