Skip to content

@vttforge/core / resourceField

Function: resourceField()

resourceField(options?): ResourceFieldInstance

A SchemaField with value and max, both required, non-nullable numbers.

ts
const f = fields();
return {
  health: resourceField({ initial: 10 }),
  power: resourceField({ initial: 5, max: 5, label: 'MY_SYSTEM.Power' }),
};

Point the manifest's primaryTokenAttribute at the key, health here, and the token bar has what it needs.

Parameters

options?

ResourceFieldOptions = {}

Returns

ResourceFieldInstance

MIT licensed.