Settings
Settings a plugin registers, which Wraith stores and lists under the plugin in its Settings.
Setting
Section titled “Setting”get(): Wraith.Setting.Valueset(value: import("salamander").Given<Wraith.Setting.Value>): voidremove(): voidget(): Wraith.Setting.Valueset(value: Wraith.Setting.Value)remove()Wraith.Setting.Value Get()void Set(Wraith.Setting.Value value)void Remove()sal::Result<Wraith::Setting_Value, Wraith::SettingError> get() constsal::Result<void, Wraith::SettingError> set(Wraith::Setting_Value value) constvoid remove() constpub fn get(&self) -> Result<wraith::SettingValue, wraith::SettingError>pub fn set(&self, value: wraith::SettingValue) -> Result<(), wraith::SettingError>pub fn remove(&self)fn get(self: Wraith.Setting) (Wraith.SettingError || rt.Failure)!Wraith.Setting.Valuefn set(self: Wraith.Setting, value: Wraith.Setting.Value) (Wraith.SettingError || rt.Failure)!voidfn remove(self: Wraith.Setting) voiduint32_t Wraith_Setting_get(Wraith_Setting self, Wraith_Setting_Value *out)uint32_t Wraith_Setting_set(Wraith_Setting self, Wraith_Setting_Value value)void Wraith_Setting_remove(Wraith_Setting self)Text is good till this setting’s next get().
Fails with SettingError. Uses Setting.Value.
Saved, like picking it in Settings. Numbers get clamped.
Fails with SettingError. Uses Setting.Value.
remove
Section titled “remove”Gone from Settings. Its saved value stays.
Settings
Section titled “Settings”Get it with Api.settings().
add(definition: import("salamander").Given<Wraith.Setting.Definition>, changed: Wraith.Setting.Changed | null): Wraith.Settingadd(definition: Wraith.Setting.Definition, changed: Wraith.Setting.Changed|nil): Wraith.SettingWraith.Setting? Add(Wraith.Setting.Definition definition, Wraith.Setting.Changed? changed)sal::Result<Wraith::Setting, Wraith::SettingError> add(Wraith::Setting_Definition definition, Wraith::Setting_Changed changed) constpub fn add(&self, definition: wraith::SettingDefinition, changed: wraith::SettingChanged) -> Result<wraith::Setting, wraith::SettingError>fn add(self: Wraith.Settings, definition: Wraith.Setting.Definition, changed: ?Wraith.Setting.Changed) (Wraith.SettingError || rt.Failure)!Wraith.Settinguint32_t Wraith_Settings_add(Wraith_Settings self, Wraith_Setting_Definition definition, Wraith_Setting_Changed changed, Wraith_Setting *out)Gone with the plugin.
Fails with SettingError. Uses Setting.Definition, Setting.Changed, Setting.
Colour
Section titled “Colour”A struct, 0x10 bytes, aligned to 4.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | r |
f32 |
|
| 0x4 | g |
f32 |
|
| 0x8 | b |
f32 |
|
| 0xc | a |
f32 |
r: numberg: numberb: numbera: numberr: numberg: numberb: numbera: numberfloat Rfloat Gfloat Bfloat Afloat rfloat gfloat bfloat apub r: f32pub g: f32pub b: f32pub a: f32r: f32g: f32b: f32a: f32float rfloat gfloat bfloat aSettingError
Section titled “SettingError”What can go wrong, besides Cancelled, Unsupported and Gone.
| Code | Error | |
|---|---|---|
| 1 | Unavailable |
|
| 2 | InvalidDefinition |
|
| 3 | InvalidId |
|
| 4 | AlreadyAdded |
|
| 5 | InvalidValue |
|
| 6 | Failed |
Setting.Kind
Section titled “Setting.Kind”A path is a folder or file, picked or typed
An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | toggle |
|
| 1 | number |
|
| 2 | choice |
|
| 3 | text |
|
| 4 | colour |
|
| 5 | path |
Setting.Scope
Section titled “Setting.Scope”Where a value’s kept: for every game, or just this one.
An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | global |
|
| 1 | game |
Setting.Value
Section titled “Setting.Value”Only the setting’s kind’s field means anything. Choices and paths are text.
A struct, 0x30 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | toggle |
bool |
|
| 0x8 | number |
f64 |
|
| 0x10 | text |
string |
|
| 0x20 | colour |
Colour |
toggle: booleannumber: numbertext: stringcolour: Wraith.Colourtoggle: booleannumber: numbertext: stringcolour: Wraith.Colourbool Toggledouble Numberstring TextWraith.Colour Colourbool toggledouble numbersal::String textWraith::Colour colourpub toggle: boolpub number: f64pub text: salamander::Strpub colour: wraith::Colourtoggle: boolnumber: f64text: []const u8colour: Wraith.Colourbool toggledouble numbersal_string textWraith_Colour colourSetting.Definition
Section titled “Setting.Definition”A struct, 0xc8 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | id |
string |
Unique for the plugin. Letters, digits, _, - and .. |
| 0x10 | name |
string |
Defaults to the id |
| 0x20 | help |
string |
|
| 0x30 | section |
string |
A heading in the plugin’s part of Settings |
| 0x40 | scope |
Setting.Scope |
Where it starts; the player can switch it in Settings |
| 0x41 | restart |
bool |
Only takes effect next time the game starts |
| 0x42 | kind |
Setting.Kind |
|
| 0x43 | has_default |
bool |
Without one it’s the kind’s zero: false, min, the first option, “” or white |
| 0x48 | default_value |
Setting.Value |
|
| 0x78 | min |
f64 |
For numbers. 1 or more steps whole numbers. |
| 0x80 | max |
f64 |
|
| 0x88 | step |
f64 |
|
| 0x90 | options |
[]string |
For choices |
| 0xa0 | file |
bool |
For paths: a file, not a folder |
| 0xa8 | extension |
string |
For a file, like “.json” |
| 0xb8 | placeholder |
string |
For paths: what’s used while empty |
id: stringname: stringhelp: stringsection: stringscope: Wraith.Setting.Scope | Wraith.Setting.ScopeNamerestart: booleankind: Wraith.Setting.Kind | Wraith.Setting.KindNamehas_default: booleandefault_value: Wraith.Setting.Valuemin: numbermax: numberstep: numberoptions: Array<string>file: booleanextension: stringplaceholder: stringid: stringname: stringhelp: stringsection: stringscope: Wraith.Setting.Scope|Wraith.Setting.ScopeNamerestart: booleankind: Wraith.Setting.Kind|Wraith.Setting.KindNamehas_default: booleandefault_value: Wraith.Setting.Valuemin: numbermax: numberstep: numberoptions: (string)[]file: booleanextension: stringplaceholder: stringstring Idstring Namestring Helpstring SectionWraith.Setting.Scope Scopebool RestartWraith.Setting.Kind Kindbool HasDefaultWraith.Setting.Value DefaultValuedouble Mindouble Maxdouble Stepstring[] Optionsbool Filestring Extensionstring Placeholdersal::String idsal::String namesal::String helpsal::String sectionWraith::Setting_Scope scopebool restartWraith::Setting_Kind kindbool has_defaultWraith::Setting_Value default_valuedouble mindouble maxdouble stepsal::Slice<sal::String> optionsbool filesal::String extensionsal::String placeholderpub id: salamander::Strpub name: salamander::Strpub help: salamander::Strpub section: salamander::Strpub scope: wraith::SettingScopepub restart: boolpub kind: wraith::SettingKindpub has_default: boolpub default_value: wraith::SettingValuepub min: f64pub max: f64pub step: f64pub options: salamander::Slice<salamander::Str>pub file: boolpub extension: salamander::Strpub placeholder: salamander::Strid: []const u8name: []const u8help: []const u8section: []const u8scope: Wraith.Setting.Scoperestart: boolkind: Wraith.Setting.Kindhas_default: booldefault_value: Wraith.Setting.Valuemin: f64max: f64step: f64options: []const []const u8file: boolextension: []const u8placeholder: []const u8sal_string idsal_string namesal_string helpsal_string sectionWraith_Setting_Scope scopebool restartWraith_Setting_Kind kindbool has_defaultWraith_Setting_Value default_valuedouble mindouble maxdouble stepSlice_string optionsbool filesal_string extensionsal_string placeholderSetting.Changed
Section titled “Setting.Changed”After its value changes, on the thread that changed it (render thread from Settings).
Wraith.Setting.ChangedWraith.Setting.ChangedWraith.Setting.ChangedWraith::Setting_Changedwraith::SettingChangedWraith.Setting.ChangedWraith_Setting_Changedwraith.io · Mods on the Hub · Get Wraith
Made with ♥ by Asgard
