Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

defineResource

defineResource(name, settings): ResourceKey

Defines a resource once, at module scope, in a module the room and every page import, and returns its key: mana, rage, stamina, a shield, or a hidden count such as a combo. Only maximum is required: left out, it starts full, never regenerates and is labelled with its name as words, "Lantern charges" for "lanternCharges". The name is camelCase, and the dump and a room’s stream write the resource under it, so a name another trait dumps under throws, as does "health", the engine’s. Defining a name again replaces its settings, as a reload of its module does. As Unreal’s ability system defines an attribute.

Parameter Type
name string
settings ResourceSettings

ResourceKey