@sandustry-modding/types 0.3.1 → 0.4.0
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/CHANGELOG.md +40 -11
- package/README.md +3 -0
- package/package.json +12 -2
- package/src/configs/index.d.ts +38 -0
- package/src/configs/modinfo.d.ts +751 -0
- package/src/configs/patches.d.ts +195 -0
- package/src/sandkit/api/action.d.ts +5 -0
- package/src/sandkit/api/blueprints.d.ts +5 -3
- package/src/sandkit/api/camera.d.ts +5 -0
- package/src/sandkit/api/effects.d.ts +28 -7
- package/src/sandkit/api/elements.d.ts +124 -39
- package/src/sandkit/api/energy.d.ts +8 -0
- package/src/sandkit/api/entities.d.ts +15 -8
- package/src/sandkit/api/events.d.ts +139 -2
- package/src/sandkit/api/excavation.d.ts +33 -3
- package/src/sandkit/api/factory.d.ts +6 -4
- package/src/sandkit/api/fire.d.ts +7 -4
- package/src/sandkit/api/game.d.ts +8 -2
- package/src/sandkit/api/grid.d.ts +72 -23
- package/src/sandkit/api/hooks.d.ts +362 -2
- package/src/sandkit/api/i18n.d.ts +65 -20
- package/src/sandkit/api/input.d.ts +15 -0
- package/src/sandkit/api/items.d.ts +7 -0
- package/src/sandkit/api/lights.d.ts +55 -8
- package/src/sandkit/api/maps.d.ts +10 -1
- package/src/sandkit/api/patterns.d.ts +22 -0
- package/src/sandkit/api/pickups.d.ts +14 -8
- package/src/sandkit/api/pipes.d.ts +9 -5
- package/src/sandkit/api/player.d.ts +29 -15
- package/src/sandkit/api/progression.d.ts +8 -0
- package/src/sandkit/api/reactions.d.ts +11 -0
- package/src/sandkit/api/rendering.d.ts +25 -2
- package/src/sandkit/api/resources.d.ts +5 -0
- package/src/sandkit/api/schedule.d.ts +7 -0
- package/src/sandkit/api/settings.d.ts +7 -0
- package/src/sandkit/api/shared.d.ts +13 -3
- package/src/sandkit/api/signals.d.ts +29 -0
- package/src/sandkit/api/sound.d.ts +14 -8
- package/src/sandkit/api/structureBehaviors.d.ts +8 -0
- package/src/sandkit/api/structures.d.ts +353 -43
- package/src/sandkit/api/tech.d.ts +73 -9
- package/src/sandkit/api/terrains.d.ts +25 -13
- package/src/sandkit/api/triggers.d.ts +10 -0
- package/src/sandkit/api/ui.d.ts +146 -1
- package/src/sandkit/api/upgrades.d.ts +2 -1
- package/src/sandkit/api/utils.d.ts +10 -5
- package/src/sandkit/api/world.d.ts +30 -25
- package/src/sandkit/index.d.ts +12 -1
- package/src/shared/api/elements.d.ts +36 -22
- package/src/shared/api/grid.d.ts +11 -6
- package/src/shared/api/player.d.ts +8 -4
- package/src/shared/api/shared.d.ts +2 -1
- package/src/shared/api/structures.d.ts +55 -17
- package/src/shared/api/terrains.d.ts +39 -23
- package/src/shared/api/ui.d.ts +5 -0
- package/src/shared/api/world.d.ts +9 -9
- package/src/worker/api/effects.d.ts +11 -3
- package/src/worker/api/elements.d.ts +54 -19
- package/src/worker/api/events.d.ts +31 -2
- package/src/worker/api/fire.d.ts +4 -2
- package/src/worker/api/grid.d.ts +10 -2
- package/src/worker/api/hooks.d.ts +68 -2
- package/src/worker/api/lights.d.ts +13 -3
- package/src/worker/api/shared.d.ts +12 -2
- package/src/worker/sandkit-api.d.ts +2 -1
|
@@ -13,7 +13,65 @@ export namespace hooks {
|
|
|
13
13
|
* @param hookId - Registered hook identifier.
|
|
14
14
|
* @param callback - Called with hook arguments and context; may cancel the hook.
|
|
15
15
|
* @param options - Optional guard and priority.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @example cell:process
|
|
18
|
+
* ```ts
|
|
19
|
+
* api.hooks.intercept("cell:process", handleCell, {
|
|
20
|
+
* guard: { elementType },
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example element:update
|
|
25
|
+
* ```ts
|
|
26
|
+
* api.hooks.intercept("element:update", handleUpdate, {
|
|
27
|
+
* guard: { elementType },
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example element:move
|
|
32
|
+
* ```ts
|
|
33
|
+
* api.hooks.intercept("element:move", (args, context) => {
|
|
34
|
+
* handleElementMove(args, context);
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example element:move:blocked
|
|
39
|
+
* ```ts
|
|
40
|
+
* api.hooks.intercept(
|
|
41
|
+
* "element:move:blocked",
|
|
42
|
+
* (args, context) => {
|
|
43
|
+
* handleBlockedMovement(args, context);
|
|
44
|
+
* },
|
|
45
|
+
* { guard: { elementType } },
|
|
46
|
+
* );
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example element:duration:expire
|
|
50
|
+
* ```ts
|
|
51
|
+
* api.hooks.intercept(
|
|
52
|
+
* "element:duration:expire",
|
|
53
|
+
* (args, context) => {
|
|
54
|
+
* handleDurationExpiry(args, context);
|
|
55
|
+
* },
|
|
56
|
+
* { guard: { elementType } },
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example fire:element:burn
|
|
61
|
+
* ```ts
|
|
62
|
+
* api.hooks.intercept("fire:element:burn", (args, context) => {
|
|
63
|
+
* handleElementBurn(args, context);
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example shaker:elementOn
|
|
68
|
+
* ```ts
|
|
69
|
+
* api.hooks.intercept("shaker:elementOn", (args, context) => {
|
|
70
|
+
* handleShakerElement(args, context);
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
17
75
|
*/
|
|
18
76
|
export function intercept<K extends InterceptHookId>(
|
|
19
77
|
hookId: K,
|
|
@@ -27,7 +85,15 @@ export namespace hooks {
|
|
|
27
85
|
* @param hookId - Registered hook identifier.
|
|
28
86
|
* @param callback - Called with hook arguments; may mutate hook payload.
|
|
29
87
|
* @param options - Optional guard and priority.
|
|
30
|
-
*
|
|
88
|
+
*
|
|
89
|
+
* @example Worker entry
|
|
90
|
+
* ```ts
|
|
91
|
+
* api.hooks.modify("example:prepare", (args) => {
|
|
92
|
+
* args.value *= 2;
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
31
97
|
*/
|
|
32
98
|
export function modify<K extends ModifyHookId>(
|
|
33
99
|
hookId: K,
|
|
@@ -9,7 +9,7 @@ export namespace lights {
|
|
|
9
9
|
/**
|
|
10
10
|
* Short-lived visual effect lights.
|
|
11
11
|
*
|
|
12
|
-
* @see https://sandustry.com/sandkit.html
|
|
12
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
13
13
|
*/
|
|
14
14
|
export namespace temporary {
|
|
15
15
|
/** Options for {@link createAtWorld}. */
|
|
@@ -21,7 +21,8 @@ export namespace lights {
|
|
|
21
21
|
lightId: number | null;
|
|
22
22
|
/**
|
|
23
23
|
* @deprecated Use {@link lightId} instead.
|
|
24
|
-
*
|
|
24
|
+
*
|
|
25
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
25
26
|
*/
|
|
26
27
|
index?: number | null;
|
|
27
28
|
}
|
|
@@ -32,7 +33,16 @@ export namespace lights {
|
|
|
32
33
|
* @param worldX - World x position in pixels.
|
|
33
34
|
* @param worldY - World y position in pixels.
|
|
34
35
|
* @param options - Brightness, duration, colour, and dedup settings.
|
|
35
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* @example Worker entry
|
|
38
|
+
* ```ts
|
|
39
|
+
* const light = api.lights.temporary.createAtWorld(worldX, worldY, {
|
|
40
|
+
* durationTicks: 15,
|
|
41
|
+
* });
|
|
42
|
+
* const lightId = light.lightId;
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
36
46
|
*/
|
|
37
47
|
export function createAtWorld(
|
|
38
48
|
worldX: number,
|
|
@@ -23,7 +23,16 @@ export namespace shared {
|
|
|
23
23
|
*
|
|
24
24
|
* @param key - Buffer name shared across threads.
|
|
25
25
|
* @param config - Expected array type and length for validation.
|
|
26
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const counts = api.shared.buffers.require("counts", {
|
|
30
|
+
* type: "uint32",
|
|
31
|
+
* length: 4,
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
27
36
|
*/
|
|
28
37
|
export function require(key: string, config: { type: SharedArrayType; length: number; }): SharedArray;
|
|
29
38
|
|
|
@@ -31,7 +40,8 @@ export namespace shared {
|
|
|
31
40
|
* Read an existing buffer without validating type or length.
|
|
32
41
|
*
|
|
33
42
|
* @param key - Buffer name shared across threads.
|
|
34
|
-
*
|
|
43
|
+
*
|
|
44
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
35
45
|
*/
|
|
36
46
|
export import get = sharedApi.api.shared.buffers.get;
|
|
37
47
|
}
|
|
@@ -34,7 +34,8 @@ export type WorkerSandkitApi = {
|
|
|
34
34
|
worker: typeof import("./api/worker").worker;
|
|
35
35
|
/**
|
|
36
36
|
* @deprecated Use {@link grid} instead.
|
|
37
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
38
39
|
*/
|
|
39
40
|
world: typeof import("./api/grid").world;
|
|
40
41
|
};
|