Skip to content

Settings beta ​

Class of @v12-engine/client

ts
export declare class Settings implements SettingsLike

The settings of a running game: their definitions, their values as signals and their store, with the client's own and the game's after them

Members ​

constructor ​

ts
constructor(client: GameClientApi, 
    game: GameSettings | undefined, 
    store?: SettingsStore, 
    languages?: Languages);

Constructs a new instance of the Settings class

applyAll ​

ts
applyAll(): void;

Puts every value to use: the client does, once what they act on is there

def ​

ts
def(id: string): SettingDef | undefined;

The setting of an id, as it is defined

get ​

ts
get<V extends SettingValue = SettingValue>(id: string): V;

What a setting is set to now. A signal: what reads it follows it

list ​

ts
readonly list: Accessor<readonly SettingDef[]>;

Every setting there is, in order: the client's, the game's own after them

onChange ​

ts
onChange(listener: (id: string, value: SettingValue) => void): () => void;

Told each time a setting changes. Gives back what stops it

ready ​

ts
readonly ready: Promise<void>;

Done when what was kept is read and in use. Never rejects: a store that cannot be read leaves the defaults

reset ​

ts
reset(id?: string): void;

Puts one setting, or every one on the settings screen (not those that are hidden), back to what it is when nothing is set

set ​

ts
set(id: string, value: SettingValue): void;

Sets a setting: made to fit it, put to use, kept for the next games, and told to who listens

shown ​

ts
shown(def: SettingDef): boolean;

Whether the settings screen lists a setting: not hidden, and its own shown says yes for the client

snapshot ​

ts
snapshot(): Record<string, SettingValue>;

Every value, as plain data