Skip to content

@vttforge/core / SystemSetting

Function: SystemSetting()

SystemSetting<T>(options): (_target, context) => ClassAccessorDecoratorResult<unknown, T>

Experimental

Register a setting, and read and write it through a static accessor.

ts
class Settings {
  @SystemSetting({ namespace: 'my-system', scope: 'world', config: true, type: Boolean })
  static accessor homebrew = false;
}

Settings.homebrew;         // game.settings.get('my-system', 'homebrew')
Settings.homebrew = true;  // game.settings.set('my-system', 'homebrew', true)

The registration waits for init, like every other decorator here. The setter cannot be awaited, because assignment has no result: when you need to know the write landed, call game.settings.set yourself.

Only static accessors: a setting has one value for the world or the client, not one per instance.

New in 0.15, and no consumer has used it yet. The shape can change in a minor.

Type Parameters

T

T

Parameters

options

SystemSettingOptions<T>

Returns

(_target, context) => ClassAccessorDecoratorResult<unknown, T>

MIT licensed.