@wayward/types 2.15.3-beta.dev.20260116.1 → 2.15.3-beta.dev.20260118.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.
- package/definitions/game/game/entity/data/DataComponent.d.ts +5 -0
- package/definitions/game/game/island/automation/IAutomation.d.ts +1 -0
- package/definitions/game/mod/ModRegistry.d.ts +12 -1
- package/definitions/test/suite/unitTests/game/Items.spec.d.ts +13 -0
- package/definitions/utilities/enum/IEnum.d.ts +2 -1
- package/package.json +1 -1
|
@@ -27,13 +27,18 @@ interface DataComponent<T, DEFAULT_VALUE extends T | undefined = undefined> {
|
|
|
27
27
|
modify(entity: Entity, modify: (current: T | DEFAULT_VALUE) => T): T;
|
|
28
28
|
remove(entity: Entity): void;
|
|
29
29
|
}
|
|
30
|
+
declare function DataComponent<T>(moddedDataTypeName: string, defaultValue: T): DataComponent<T, T>;
|
|
31
|
+
declare function DataComponent<T>(moddedDataTypeName: string, defaultValue?: T): DataComponent<T>;
|
|
30
32
|
declare function DataComponent<T>(type: DataComponentType, defaultValue: T): DataComponent<T, T>;
|
|
31
33
|
declare function DataComponent<T>(type: DataComponentType, defaultValue?: T): DataComponent<T>;
|
|
34
|
+
type RegisterToMod = (moddedDataTypeName: string) => DataComponentType;
|
|
32
35
|
declare namespace DataComponent {
|
|
36
|
+
function initModSupport(register: RegisterToMod): void;
|
|
33
37
|
interface Live<T> {
|
|
34
38
|
get(entity: Entity): T;
|
|
35
39
|
update(entity: Entity): void;
|
|
36
40
|
}
|
|
41
|
+
function Live<T>(moddedDataTypeName: string, compute: (entity: Entity, current: T | undefined) => T): Live<T>;
|
|
37
42
|
function Live<T>(type: DataComponentType, compute: (entity: Entity, current: T | undefined) => T): Live<T>;
|
|
38
43
|
}
|
|
39
44
|
export default DataComponent;
|
|
@@ -73,6 +73,7 @@ import type { HelpArticle, IHelpArticle } from "@wayward/game/ui/screen/screens/
|
|
|
73
73
|
import type { ModOptionSectionInitializer } from "@wayward/game/ui/screen/screens/menu/menus/options/TabMods";
|
|
74
74
|
import type WorldZ from "@wayward/utilities/game/WorldZ";
|
|
75
75
|
import Objects from "@wayward/utilities/object/Objects";
|
|
76
|
+
import type { DataComponentType } from "@wayward/game/game/entity/data/DataComponent";
|
|
76
77
|
export interface IModdable {
|
|
77
78
|
/**
|
|
78
79
|
* Do not provide or modify this value, only reference it. This is set by the modding system during the process of registration.
|
|
@@ -137,7 +138,8 @@ export declare enum ModRegistrationType {
|
|
|
137
138
|
UsableActions = 53,
|
|
138
139
|
UsableActionType = 54,
|
|
139
140
|
UsableActionTypePlaceholder = 55,
|
|
140
|
-
WorldLayer = 56
|
|
141
|
+
WorldLayer = 56,
|
|
142
|
+
DataComponentType = 57
|
|
141
143
|
}
|
|
142
144
|
export interface ILanguageRegistration extends IBaseModRegistration {
|
|
143
145
|
type: ModRegistrationType.Language;
|
|
@@ -364,6 +366,10 @@ export interface IWorldLayerRegistration extends IBaseModRegistration {
|
|
|
364
366
|
type: ModRegistrationType.WorldLayer;
|
|
365
367
|
name: string;
|
|
366
368
|
}
|
|
369
|
+
export interface IDataComponentTypeRegistration extends IBaseModRegistration {
|
|
370
|
+
type: ModRegistrationType.DataComponentType;
|
|
371
|
+
name: string;
|
|
372
|
+
}
|
|
367
373
|
export interface ITileLayerTypeRegistration extends IBaseModRegistration {
|
|
368
374
|
type: ModRegistrationType.TileLayerType;
|
|
369
375
|
name: string;
|
|
@@ -782,6 +788,10 @@ declare namespace Register {
|
|
|
782
788
|
* @param description The definition of the equip slot.
|
|
783
789
|
*/
|
|
784
790
|
function equipType(name: string, description: IEquipTypeDescription): <K extends string | number | symbol, T extends Record<K, EquipType>>(target: T, key: K) => void;
|
|
791
|
+
/**
|
|
792
|
+
* Registers a DataComponentType, allowing you to store custom, strongly-typed data on entities.
|
|
793
|
+
*/
|
|
794
|
+
function dataComponentType(name: string): <K extends string | number | symbol, T extends Record<K, DataComponentType>>(target: T, key: K) => void;
|
|
785
795
|
function interModRegistry<V>(name: string): <K extends string | number | symbol, T extends Record<K, InterModRegistry<V>>>(target: T, key: K) => void;
|
|
786
796
|
function interModRegistration<V>(modName: string, registryName: string, value: V): <K extends string | number | symbol, T extends Record<K, InterModRegistration<V>>>(target: T, key: K) => void;
|
|
787
797
|
/**
|
|
@@ -912,6 +922,7 @@ export declare namespace Registry {
|
|
|
912
922
|
* Used internally for `Registry<H, T>.get(key)`
|
|
913
923
|
*/
|
|
914
924
|
class Registered implements Objects.ICloneable {
|
|
925
|
+
static get<T>(value: T | Registered): T | undefined;
|
|
915
926
|
readonly mod?: string | ModInformation;
|
|
916
927
|
readonly type: RegistryRegisteredIntermediateType;
|
|
917
928
|
readonly path: PropertyKey[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2011-2025 Unlok
|
|
3
|
+
* https://www.unlok.ca
|
|
4
|
+
*
|
|
5
|
+
* Credits & Thanks:
|
|
6
|
+
* https://www.unlok.ca/credits-thanks/
|
|
7
|
+
*
|
|
8
|
+
* Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide:
|
|
9
|
+
* https://github.com/WaywardGame/types/wiki
|
|
10
|
+
*/
|
|
11
|
+
import type { TestConfig } from "@wayward/test";
|
|
12
|
+
import type { IPaths } from "@wayward/test/interfaces";
|
|
13
|
+
export default function (paths: IPaths, config: TestConfig): void;
|
package/package.json
CHANGED