@wayward/types 2.15.0-beta.dev.20250927.1 → 2.15.0-beta.dev.20250930.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -56,7 +56,7 @@ declare namespace Translation {
|
|
|
56
56
|
* @param index Optional. The index of the translation in the given dictionary entry, for instance `ItemTranslation.Description`,
|
|
57
57
|
* or `"random"` to return any of the translations in this entry.
|
|
58
58
|
*/
|
|
59
|
-
export function get<DICT extends Dictionary>(dictionary: DICT, entry: Dictionary extends DICT ? string | number : DictionaryEntryEnums[DICT], index?: "random" | number): Translation;
|
|
59
|
+
export function get<DICT extends Dictionary>(dictionary: DICT | undefined, entry: Dictionary extends DICT ? string | number : DictionaryEntryEnums[DICT], index?: "random" | number): Translation;
|
|
60
60
|
/**
|
|
61
61
|
* Gets a translation by its translation id. Entry matching is done by changing the case-style of the inputted
|
|
62
62
|
* translation id, so if you provide an all lower-case string it will not work!
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import "@wayward/game/IGlobal";
|
|
12
12
|
import BaseMod from "@wayward/game/mod/BaseMod";
|
|
13
|
+
import type { ModInformation } from "@wayward/game/mod/ModInformation";
|
|
13
14
|
import Log from "@wayward/utilities/Log";
|
|
14
15
|
declare abstract class Mod extends BaseMod {
|
|
15
16
|
/**
|
|
@@ -44,6 +45,20 @@ declare namespace Mod {
|
|
|
44
45
|
* @param name Given a mod name, the decorated field will be injected with the enabled/loaded instance of the mod by that name.
|
|
45
46
|
*/
|
|
46
47
|
function instance<M extends Mod>(name: string): <K extends string | number | symbol, T extends Record<K, M extends (new (index: number) => infer I) ? I : Mod>>(target: T, key: K) => void;
|
|
48
|
+
/**
|
|
49
|
+
* A function usable exclusively in the *top level* of a mod script, or within synchronous code called by the top level of the mod script.
|
|
50
|
+
* Returns a container for the mod's instance, its `ModInformation`, or `undefined` if it can't be found or this is used in the wrong context.
|
|
51
|
+
*/
|
|
52
|
+
function get<M extends Mod>(): ModInformation & {
|
|
53
|
+
instance: M;
|
|
54
|
+
} | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Given a mod name, returns a container (its `ModInformation`) for the enabled/loaded instance of the mod by that name,
|
|
57
|
+
* or `undefined` if it can't be found.
|
|
58
|
+
*/
|
|
59
|
+
function get<M extends Mod>(name: string): ModInformation & {
|
|
60
|
+
instance: M;
|
|
61
|
+
} | undefined;
|
|
47
62
|
/**
|
|
48
63
|
* Injects the decorated field with this mod's log.
|
|
49
64
|
*/
|
package/package.json
CHANGED