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

defineResource

defineResource(name, settings): ResourceHandle

Defines a resource once, at module scope, and returns its handle, a value that carries its name and its settings and touches no world: mana, rage, stamina, a shield, or a hidden count such as a combo. A world installs it from the plugin’s list, resources({ kinds: [mana] }), or from registerResource in a plugin’s setup, and a character is given it with addResource or the spawn’s resources. 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 its trait and its max<Name> stat are keyed by the name for every world: two files that define one name share them and differ in their settings alone, and one world installs one of the two. A name another trait dumps under throws, as does "health", the engine’s. As Unreal’s ability system defines an attribute.

Parameter Type
name string
settings ResourceSettings

ResourceHandle