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

readResource

readResource(world, handle): object

The settings of the resource on world, as its list or a plugin’s setup installed them, with regen, start and label filled in where its definition left them out, and for health the world’s registerHealth, or the engine’s where it registered none. A kind the world has not installed throws, naming the list to add it to.

Parameter Type
world World
handle ResourceHandle
Name Type Description
color? string The fill every bar draws it in, such as "#4aa3ff": any CSS colour. One bar may draw it in another. Left out, a bar draws in Bar’s own fill.
label string What a player reads for it, such as "Mana": a bar’s name and a refused cast’s line. Left out, it is the name as words: "Combo" for "combo", "Lantern charges" for "lanternCharges".
maximum number What it holds when full: the base of the character’s max<Name> stat, maxMana for "mana", which items and cards raise.
regen number What it gains a second, up to its maximum; a negative regen decays it toward 0, as rage does. A character’s <name>Regen stat, where it has one, takes its place. Left out, it never regenerates.
regenDelaySeconds? number Seconds it stops regenerating after a spend, as stamina does. Left out, it regenerates at once.
saved? boolean Whether a save keeps what a character has of it. False leaves it out, and a load starts it from start, as a game that refills it on each load wants. Left out, it is saved.
start number | "empty" | "full" | Full | Empty Where it starts when a character is given it: full, empty, or a number, capped at maximum. Its text too, so "full" reads as the enum does.