@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
|
@@ -15,7 +15,7 @@ export namespace terrains {
|
|
|
15
15
|
/**
|
|
16
16
|
* Terrain definition shape for {@link register} and {@link getDefinitionByType}.
|
|
17
17
|
*
|
|
18
|
-
* @see https://sandustry.com/sandkit.html
|
|
18
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
19
19
|
*/
|
|
20
20
|
export interface TerrainDefinition {
|
|
21
21
|
/** Unique mod-scoped terrain id. */
|
|
@@ -45,7 +45,7 @@ export namespace terrains {
|
|
|
45
45
|
/**
|
|
46
46
|
* Terrain cell data returned by {@link getDataAtCell}.
|
|
47
47
|
*
|
|
48
|
-
* @see https://sandustry.com/sandkit.html
|
|
48
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
49
49
|
*/
|
|
50
50
|
export interface TerrainDataAtCell {
|
|
51
51
|
/** Numeric terrain cell type. */
|
|
@@ -53,12 +53,13 @@ export namespace terrains {
|
|
|
53
53
|
/**
|
|
54
54
|
* Current hit points, or null when the terrain has no hp.
|
|
55
55
|
*
|
|
56
|
-
* @see https://sandustry.com/sandkit.html
|
|
56
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
57
57
|
*/
|
|
58
58
|
hitPoints: number | null;
|
|
59
59
|
/**
|
|
60
60
|
* @deprecated Use {@link hitPoints} instead.
|
|
61
|
-
*
|
|
61
|
+
*
|
|
62
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
62
63
|
*/
|
|
63
64
|
hp?: number | null;
|
|
64
65
|
}
|
|
@@ -67,7 +68,8 @@ export namespace terrains {
|
|
|
67
68
|
* Return the mod string id for a numeric terrain type.
|
|
68
69
|
*
|
|
69
70
|
* @param terrainType - Numeric terrain cell type.
|
|
70
|
-
*
|
|
71
|
+
*
|
|
72
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
71
73
|
*/
|
|
72
74
|
export function getIdByType(terrainType: TerrainType): TerrainId;
|
|
73
75
|
|
|
@@ -75,13 +77,15 @@ export namespace terrains {
|
|
|
75
77
|
* Resolve a terrain string id to a numeric cell type.
|
|
76
78
|
*
|
|
77
79
|
* @param terrainId - Mod-registered or built-in terrain id.
|
|
78
|
-
*
|
|
80
|
+
*
|
|
81
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
79
82
|
*/
|
|
80
83
|
export function getTypeById(terrainId: TerrainId): TerrainType;
|
|
81
84
|
|
|
82
85
|
/**
|
|
83
86
|
* @deprecated Use {@link getTypeById} instead.
|
|
84
|
-
*
|
|
87
|
+
*
|
|
88
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
85
89
|
*/
|
|
86
90
|
export function getTypeFromId(terrainId: TerrainId): TerrainType;
|
|
87
91
|
|
|
@@ -89,7 +93,8 @@ export namespace terrains {
|
|
|
89
93
|
* Look up the definition for a terrain type.
|
|
90
94
|
*
|
|
91
95
|
* @param terrainType - Numeric terrain cell type.
|
|
92
|
-
*
|
|
96
|
+
*
|
|
97
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
93
98
|
*/
|
|
94
99
|
export function getDefinitionByType(terrainType: TerrainType): TerrainDefinition | undefined;
|
|
95
100
|
|
|
@@ -98,7 +103,8 @@ export namespace terrains {
|
|
|
98
103
|
*
|
|
99
104
|
* @param cellX - Grid column of the target cell.
|
|
100
105
|
* @param cellY - Grid row of the target cell.
|
|
101
|
-
*
|
|
106
|
+
*
|
|
107
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
102
108
|
*/
|
|
103
109
|
export function getTypeAtCell(...args: CellCoordinates): TerrainType | null;
|
|
104
110
|
|
|
@@ -108,7 +114,8 @@ export namespace terrains {
|
|
|
108
114
|
* @param cellX - Grid column of the target cell.
|
|
109
115
|
* @param cellY - Grid row of the target cell.
|
|
110
116
|
* @returns Cell type and hit points, or null when the cell is not terrain.
|
|
111
|
-
*
|
|
117
|
+
*
|
|
118
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
112
119
|
*/
|
|
113
120
|
export function getDataAtCell(...args: CellCoordinates): TerrainDataAtCell | null;
|
|
114
121
|
|
|
@@ -117,7 +124,8 @@ export namespace terrains {
|
|
|
117
124
|
*
|
|
118
125
|
* @param cellX - Grid column of the target cell.
|
|
119
126
|
* @param cellY - Grid row of the target cell.
|
|
120
|
-
*
|
|
127
|
+
*
|
|
128
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
121
129
|
*/
|
|
122
130
|
export function isAtCell(...args: CellCoordinates): boolean;
|
|
123
131
|
|
|
@@ -127,7 +135,8 @@ export namespace terrains {
|
|
|
127
135
|
* @param cellX - Grid column of the target cell.
|
|
128
136
|
* @param cellY - Grid row of the target cell.
|
|
129
137
|
* @param terrainId - Terrain string id to compare.
|
|
130
|
-
*
|
|
138
|
+
*
|
|
139
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
131
140
|
*/
|
|
132
141
|
export function isTypeAtCell(...args: [...CellCoordinates, terrainId: TerrainId]): boolean;
|
|
133
142
|
|
|
@@ -135,7 +144,8 @@ export namespace terrains {
|
|
|
135
144
|
* Return true when a packed cell id refers to terrain.
|
|
136
145
|
*
|
|
137
146
|
* @param cellId - Packed cell id from {@link world.getCellIdAtCell}.
|
|
138
|
-
*
|
|
147
|
+
*
|
|
148
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
139
149
|
*/
|
|
140
150
|
export function isCellIdTerrain(cellId: CellId): boolean;
|
|
141
151
|
|
|
@@ -145,7 +155,8 @@ export namespace terrains {
|
|
|
145
155
|
* @param cellX - Grid column of the target cell.
|
|
146
156
|
* @param cellY - Grid row of the target cell.
|
|
147
157
|
* @param damage - Damage amount to apply.
|
|
148
|
-
*
|
|
158
|
+
*
|
|
159
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
149
160
|
*/
|
|
150
161
|
export function damageAtCell(...args: [...CellCoordinates, damage: number]): void;
|
|
151
162
|
|
|
@@ -156,7 +167,8 @@ export namespace terrains {
|
|
|
156
167
|
* @param cellY - Grid row of the target cell.
|
|
157
168
|
* @param terrainTypeOrId - Numeric cell type or terrain string id.
|
|
158
169
|
* @param options - Optional mutation flags.
|
|
159
|
-
*
|
|
170
|
+
*
|
|
171
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
160
172
|
*/
|
|
161
173
|
export function createAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
|
|
162
174
|
|
|
@@ -167,7 +179,8 @@ export namespace terrains {
|
|
|
167
179
|
* @param cellY - Grid row of the target cell.
|
|
168
180
|
* @param terrainTypeOrId - Numeric cell type or terrain string id.
|
|
169
181
|
* @param options - Optional mutation flags.
|
|
170
|
-
*
|
|
182
|
+
*
|
|
183
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
171
184
|
*/
|
|
172
185
|
export function replaceAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
|
|
173
186
|
|
|
@@ -177,7 +190,8 @@ export namespace terrains {
|
|
|
177
190
|
* @param cellX - Grid column of the target cell.
|
|
178
191
|
* @param cellY - Grid row of the target cell.
|
|
179
192
|
* @param options - Optional mutation flags.
|
|
180
|
-
*
|
|
193
|
+
*
|
|
194
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
181
195
|
*/
|
|
182
196
|
export function removeAtCell(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
|
|
183
197
|
|
|
@@ -188,20 +202,22 @@ export namespace terrains {
|
|
|
188
202
|
* @param cellY - Grid row of the target cell.
|
|
189
203
|
* @param hitPoints - New hit point value.
|
|
190
204
|
* @returns True when hit points changed or the terrain was removed.
|
|
191
|
-
*
|
|
205
|
+
*
|
|
206
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
192
207
|
*/
|
|
193
208
|
export function setHitPointsAtCell(...args: [...CellCoordinates, hitPoints: number]): boolean;
|
|
194
209
|
|
|
195
210
|
/**
|
|
196
211
|
* @deprecated Use {@link setHitPointsAtCell} instead.
|
|
197
|
-
*
|
|
212
|
+
*
|
|
213
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
198
214
|
*/
|
|
199
215
|
export function setHpAtCell(...args: [...CellCoordinates, hitPoints: number]): boolean;
|
|
200
216
|
|
|
201
217
|
/**
|
|
202
218
|
* Options for terrain create, replace, or remove calls.
|
|
203
219
|
*
|
|
204
|
-
* @see https://sandustry.com/sandkit.html
|
|
220
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
205
221
|
*/
|
|
206
222
|
export interface TerrainMutationOptions {
|
|
207
223
|
/** Skip shadow updates around the changed cell. */
|
|
@@ -211,21 +227,21 @@ export namespace terrains {
|
|
|
211
227
|
/**
|
|
212
228
|
* Numeric terrain / {@link CellTypeEnum} handle.
|
|
213
229
|
*
|
|
214
|
-
* @see https://sandustry.com/sandkit.html
|
|
230
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
215
231
|
*/
|
|
216
232
|
export type TerrainType = CellTypeEnum | TaggedNumber<"terrainType">;
|
|
217
233
|
|
|
218
234
|
/**
|
|
219
235
|
* Mod or built-in terrain string id.
|
|
220
236
|
*
|
|
221
|
-
* @see https://sandustry.com/sandkit.html
|
|
237
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
222
238
|
*/
|
|
223
239
|
export type TerrainId = LooseString<never>;
|
|
224
240
|
|
|
225
241
|
/**
|
|
226
242
|
* Type handle or string id accepted by mutation helpers.
|
|
227
243
|
*
|
|
228
|
-
* @see https://sandustry.com/sandkit.html
|
|
244
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
229
245
|
*/
|
|
230
246
|
export type TerrainRef = TerrainType | TerrainId;
|
|
231
247
|
}
|
package/src/shared/api/ui.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export namespace ui {
|
|
|
10
10
|
* Show a short on-screen toast message.
|
|
11
11
|
* @param message - Plain text, translation key, or translatable value.
|
|
12
12
|
* @param options - Cooldown, style, and auto-dismiss options.
|
|
13
|
+
*
|
|
14
|
+
* @example Worker entry
|
|
15
|
+
* ```ts
|
|
16
|
+
* api.ui.toast({ key: "mods|example|workerToast" });
|
|
17
|
+
* ```
|
|
13
18
|
*/
|
|
14
19
|
export function toast(message: LocalizedText, options?: ToastOptions): void;
|
|
15
20
|
|
|
@@ -11,33 +11,33 @@ import { grid as gridNs } from "./grid";
|
|
|
11
11
|
*/
|
|
12
12
|
export namespace world {
|
|
13
13
|
/**
|
|
14
|
-
* @see https://sandustry.com/sandkit.html
|
|
14
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
15
15
|
*/
|
|
16
16
|
export import getCellIdAtCell = gridNs.getCellIdAtCell;
|
|
17
17
|
/**
|
|
18
|
-
* @see https://sandustry.com/sandkit.html
|
|
18
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
19
19
|
*/
|
|
20
20
|
export import isCellEmptyAtCell = gridNs.isCellEmptyAtCell;
|
|
21
21
|
/**
|
|
22
|
-
* @see https://sandustry.com/sandkit.html
|
|
22
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
23
23
|
*/
|
|
24
24
|
export import isTerrainAtCell = gridNs.isTerrainAtCell;
|
|
25
25
|
/**
|
|
26
|
-
* @see https://sandustry.com/sandkit.html
|
|
26
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
27
27
|
*/
|
|
28
28
|
export import reportActivityAtCell = gridNs.reportActivityAtCell;
|
|
29
29
|
/**
|
|
30
|
-
* @see https://sandustry.com/sandkit.html
|
|
30
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
31
31
|
*/
|
|
32
32
|
export import excavateAtCell = gridNs.excavateAtCell;
|
|
33
33
|
/**
|
|
34
|
-
* @see https://sandustry.com/sandkit.html
|
|
34
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
35
35
|
*/
|
|
36
36
|
export import getDimensions = gridNs.getDimensions;
|
|
37
|
-
/** @see https://sandustry.com/sandkit.html
|
|
37
|
+
/** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
|
|
38
38
|
export import ExcavateOptions = gridNs.ExcavateOptions;
|
|
39
|
-
/** @see https://sandustry.com/sandkit.html
|
|
39
|
+
/** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
|
|
40
40
|
export import CellId = gridNs.CellId;
|
|
41
|
-
/** @see https://sandustry.com/sandkit.html
|
|
41
|
+
/** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
|
|
42
42
|
export import GridDimensions = gridNs.GridDimensions;
|
|
43
43
|
}
|
|
@@ -20,7 +20,8 @@ export namespace effects {
|
|
|
20
20
|
* @param worldX - World x position in pixels.
|
|
21
21
|
* @param worldY - World y position in pixels.
|
|
22
22
|
* @param options - Duration, radius, and intensity settings.
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
24
25
|
*/
|
|
25
26
|
export function createAtWorld(
|
|
26
27
|
effectId: string,
|
|
@@ -31,7 +32,8 @@ export namespace effects {
|
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* @deprecated Use {@link createAtWorld} instead.
|
|
34
|
-
*
|
|
35
|
+
*
|
|
36
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
35
37
|
*/
|
|
36
38
|
export function createEffectAtWorld(
|
|
37
39
|
effectId: string,
|
|
@@ -46,7 +48,13 @@ export namespace effects {
|
|
|
46
48
|
* @param worldX - World x position in pixels.
|
|
47
49
|
* @param worldY - World y position in pixels.
|
|
48
50
|
* @param options - Count, velocity, colour, and lifetime settings.
|
|
49
|
-
*
|
|
51
|
+
*
|
|
52
|
+
* @example Worker entry
|
|
53
|
+
* ```ts
|
|
54
|
+
* api.effects.createParticlesAtWorld(worldX, worldY, { count: 8 });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
50
58
|
*/
|
|
51
59
|
export import createParticlesAtWorld = shared.api.effects.createParticlesAtWorld;
|
|
52
60
|
}
|
|
@@ -10,7 +10,7 @@ import { shared } from "../../shared";
|
|
|
10
10
|
* @internal Worker extension; not interchangeable with main-thread
|
|
11
11
|
* `sandkit.api.elements`.
|
|
12
12
|
*
|
|
13
|
-
* @see https://sandustry.com/sandkit.html#mutations-heading
|
|
13
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
14
14
|
*/
|
|
15
15
|
export namespace elements {
|
|
16
16
|
/** Numeric id for a registered element type. */
|
|
@@ -34,7 +34,8 @@ export namespace elements {
|
|
|
34
34
|
export import getTypeById = shared.api.elements.getTypeById;
|
|
35
35
|
/**
|
|
36
36
|
* @deprecated Use {@link getTypeById} instead.
|
|
37
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
38
39
|
*/
|
|
39
40
|
export import getTypeFromId = shared.api.elements.getTypeFromId;
|
|
40
41
|
/** Returns the definition for an element type. */
|
|
@@ -65,7 +66,15 @@ export namespace elements {
|
|
|
65
66
|
* @param cellY - Grid row of the target cell.
|
|
66
67
|
* @param elementTypeOrId - Numeric type or string id.
|
|
67
68
|
* @param options - Optional spawn overrides.
|
|
68
|
-
*
|
|
69
|
+
*
|
|
70
|
+
* @example Worker entry
|
|
71
|
+
* ```ts
|
|
72
|
+
* api.elements.createAtCell(cellX, cellY, "water", {
|
|
73
|
+
* durationTicks: 60,
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
69
78
|
*/
|
|
70
79
|
export function createAtCell(
|
|
71
80
|
...args: [...CellCoordinates, elementTypeOrId: ElementRef, options?: ElementCreateOptions]
|
|
@@ -78,7 +87,8 @@ export namespace elements {
|
|
|
78
87
|
* @param cellY - Grid row of the target cell.
|
|
79
88
|
* @param elementTypeOrId - Numeric type or string id.
|
|
80
89
|
* @param options - Optional spawn overrides.
|
|
81
|
-
*
|
|
90
|
+
*
|
|
91
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
82
92
|
*/
|
|
83
93
|
export function replaceAtCell(
|
|
84
94
|
...args: [...CellCoordinates, elementTypeOrId: ElementRef, options?: ElementCreateOptions]
|
|
@@ -90,7 +100,8 @@ export namespace elements {
|
|
|
90
100
|
* @param cellX - Grid column of the target cell.
|
|
91
101
|
* @param cellY - Grid row of the target cell.
|
|
92
102
|
* @param options - Optional removal flags.
|
|
93
|
-
*
|
|
103
|
+
*
|
|
104
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
94
105
|
*/
|
|
95
106
|
export function removeAtCell(
|
|
96
107
|
...args: [...CellCoordinates, options?: ElementRemovalOptions]
|
|
@@ -104,7 +115,8 @@ export namespace elements {
|
|
|
104
115
|
* @param toCellX - Destination cell column.
|
|
105
116
|
* @param toCellY - Destination cell row.
|
|
106
117
|
* @returns True when the move succeeded.
|
|
107
|
-
*
|
|
118
|
+
*
|
|
119
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
108
120
|
*/
|
|
109
121
|
export function moveBetweenCells(
|
|
110
122
|
fromCellX: number,
|
|
@@ -120,7 +132,8 @@ export namespace elements {
|
|
|
120
132
|
* @param fromCellY - Source cell row.
|
|
121
133
|
* @param toCellX - Destination cell column.
|
|
122
134
|
* @param toCellY - Destination cell row.
|
|
123
|
-
*
|
|
135
|
+
*
|
|
136
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
124
137
|
*/
|
|
125
138
|
export function teleportBetweenCells(
|
|
126
139
|
fromCellX: number,
|
|
@@ -137,7 +150,8 @@ export namespace elements {
|
|
|
137
150
|
* @param secondCellX - Second cell column.
|
|
138
151
|
* @param secondCellY - Second cell row.
|
|
139
152
|
* @returns True when the swap succeeded.
|
|
140
|
-
*
|
|
153
|
+
*
|
|
154
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
141
155
|
*/
|
|
142
156
|
export function swapBetweenCells(
|
|
143
157
|
firstCellX: number,
|
|
@@ -148,7 +162,8 @@ export namespace elements {
|
|
|
148
162
|
|
|
149
163
|
/**
|
|
150
164
|
* @deprecated Use {@link swapBetweenCells} instead.
|
|
151
|
-
*
|
|
165
|
+
*
|
|
166
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
152
167
|
*/
|
|
153
168
|
export function swapCells(
|
|
154
169
|
firstCellX: number,
|
|
@@ -161,13 +176,15 @@ export namespace elements {
|
|
|
161
176
|
* Mark an element index as movement-blocked for this tick.
|
|
162
177
|
*
|
|
163
178
|
* @param elementIndex - Element index from {@link getInfoAtCell}.
|
|
164
|
-
*
|
|
179
|
+
*
|
|
180
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
165
181
|
*/
|
|
166
182
|
export function markMovementBlockedByIndex(elementIndex: number): void;
|
|
167
183
|
|
|
168
184
|
/**
|
|
169
185
|
* @deprecated Use {@link markMovementBlockedByIndex} instead.
|
|
170
|
-
*
|
|
186
|
+
*
|
|
187
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
171
188
|
*/
|
|
172
189
|
export function markMovementBlockedByElementIndex(elementIndex: number): void;
|
|
173
190
|
|
|
@@ -178,7 +195,8 @@ export namespace elements {
|
|
|
178
195
|
* @param cellY - Grid row of the target cell.
|
|
179
196
|
* @param velocity - New velocity vector.
|
|
180
197
|
* @returns True when velocity was set.
|
|
181
|
-
*
|
|
198
|
+
*
|
|
199
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
182
200
|
*/
|
|
183
201
|
export function setVelocityAtCell(...args: [...CellCoordinates, velocity: Vector2]): boolean;
|
|
184
202
|
|
|
@@ -190,7 +208,8 @@ export namespace elements {
|
|
|
190
208
|
* @param velocity - Velocity delta to add.
|
|
191
209
|
* @param maxSpeedCellsPerSecond - Optional speed cap after the addition.
|
|
192
210
|
* @returns True when velocity was updated.
|
|
193
|
-
*
|
|
211
|
+
*
|
|
212
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
194
213
|
*/
|
|
195
214
|
export function addParticleVelocityAtCell(
|
|
196
215
|
...args: [...CellCoordinates, velocity: Vector2, maxSpeedCellsPerSecond?: number]
|
|
@@ -203,7 +222,8 @@ export namespace elements {
|
|
|
203
222
|
* @param cellY - Grid row of the target cell.
|
|
204
223
|
* @param velocity - Initial particle velocity.
|
|
205
224
|
* @returns True when conversion succeeded.
|
|
206
|
-
*
|
|
225
|
+
*
|
|
226
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
207
227
|
*/
|
|
208
228
|
export function convertToParticleAtCell(...args: [...CellCoordinates, velocity: Vector2]): boolean;
|
|
209
229
|
|
|
@@ -213,7 +233,8 @@ export namespace elements {
|
|
|
213
233
|
* @param cellX - Grid column of the target cell.
|
|
214
234
|
* @param cellY - Grid row of the target cell.
|
|
215
235
|
* @returns True when conversion succeeded.
|
|
216
|
-
*
|
|
236
|
+
*
|
|
237
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
217
238
|
*/
|
|
218
239
|
export function convertFromParticleAtCell(...args: CellCoordinates): boolean;
|
|
219
240
|
|
|
@@ -225,7 +246,8 @@ export namespace elements {
|
|
|
225
246
|
* @param fieldNumber - Data field index (1–4).
|
|
226
247
|
* @param value - New field value.
|
|
227
248
|
* @returns True when the field was set.
|
|
228
|
-
*
|
|
249
|
+
*
|
|
250
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
229
251
|
*/
|
|
230
252
|
export function setDataFieldAtCell(
|
|
231
253
|
...args: [...CellCoordinates, fieldNumber: 1 | 2 | 3 | 4, value: number]
|
|
@@ -236,7 +258,8 @@ export namespace elements {
|
|
|
236
258
|
*
|
|
237
259
|
* @param cellX - Grid column of the target cell.
|
|
238
260
|
* @param cellY - Grid row of the target cell.
|
|
239
|
-
*
|
|
261
|
+
*
|
|
262
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
240
263
|
*/
|
|
241
264
|
export function refreshColorAtCell(...args: CellCoordinates): void;
|
|
242
265
|
|
|
@@ -246,7 +269,8 @@ export namespace elements {
|
|
|
246
269
|
* @param cellX - Grid column of the target cell.
|
|
247
270
|
* @param cellY - Grid row of the target cell.
|
|
248
271
|
* @param physicsState - Physics skip flags for the element.
|
|
249
|
-
*
|
|
272
|
+
*
|
|
273
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
250
274
|
*/
|
|
251
275
|
export function setPhysicsAtCell(...args: [...CellCoordinates, physicsState: number]): void;
|
|
252
276
|
|
|
@@ -258,7 +282,18 @@ export namespace elements {
|
|
|
258
282
|
* @param durationTicks - Duration in simulation ticks.
|
|
259
283
|
* @param options - When `updateMax` is true, also update max duration.
|
|
260
284
|
* @returns True when duration was updated.
|
|
261
|
-
*
|
|
285
|
+
*
|
|
286
|
+
* @example Worker entry
|
|
287
|
+
* ```ts
|
|
288
|
+
* const updated = api.elements.setDurationAtCell(
|
|
289
|
+
* cellX,
|
|
290
|
+
* cellY,
|
|
291
|
+
* 120,
|
|
292
|
+
* { updateMax: true },
|
|
293
|
+
* );
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
262
297
|
*/
|
|
263
298
|
export function setDurationAtCell(
|
|
264
299
|
...args: [...CellCoordinates, durationTicks: number, options?: { updateMax?: boolean; }]
|
|
@@ -13,7 +13,35 @@ export namespace events {
|
|
|
13
13
|
* @param eventId - Registered event name.
|
|
14
14
|
* @param callback - Called when the event is emitted.
|
|
15
15
|
* @param options - Required guard for filtered events.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @example element:moved
|
|
18
|
+
* ```ts
|
|
19
|
+
* api.events.on(
|
|
20
|
+
* "element:moved",
|
|
21
|
+
* (payload) => handleElementMoved(payload),
|
|
22
|
+
* { guard: { elementType } },
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example terrain:updated
|
|
27
|
+
* ```ts
|
|
28
|
+
* api.events.on(
|
|
29
|
+
* "terrain:updated",
|
|
30
|
+
* (payload) => {
|
|
31
|
+
* handleTerrainUpdate(payload);
|
|
32
|
+
* },
|
|
33
|
+
* { guard: { terrainType } },
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example worker:update:post
|
|
38
|
+
* ```ts
|
|
39
|
+
* api.events.on("worker:update:post", (payload) => {
|
|
40
|
+
* runPostUpdate(payload);
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
17
45
|
*/
|
|
18
46
|
export function on<K extends EventId>(
|
|
19
47
|
eventId: K,
|
|
@@ -27,7 +55,8 @@ export namespace events {
|
|
|
27
55
|
* @param eventId - Registered event name.
|
|
28
56
|
* @param payload - Serializable payload passed to listeners.
|
|
29
57
|
* @param options - Optional guard forwarded to filtered listeners.
|
|
30
|
-
*
|
|
58
|
+
*
|
|
59
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
31
60
|
*/
|
|
32
61
|
export function emit<K extends EventId>(
|
|
33
62
|
eventId: K,
|
package/src/worker/api/fire.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export namespace fire {
|
|
|
13
13
|
*
|
|
14
14
|
* @param cellX - Grid column of the target cell.
|
|
15
15
|
* @param cellY - Grid row of the target cell.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
17
18
|
*/
|
|
18
19
|
export function canBurnElementAtCell(...args: CellCoordinates): boolean;
|
|
19
20
|
|
|
@@ -23,7 +24,8 @@ export namespace fire {
|
|
|
23
24
|
* @param cellX - Grid column of the target cell.
|
|
24
25
|
* @param cellY - Grid row of the target cell.
|
|
25
26
|
* @returns True when the burn succeeded.
|
|
26
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
27
29
|
*/
|
|
28
30
|
export function burnElementAtCell(...args: CellCoordinates): boolean;
|
|
29
31
|
}
|
package/src/worker/api/grid.d.ts
CHANGED
|
@@ -18,7 +18,14 @@ export namespace grid {
|
|
|
18
18
|
export import reportActivityAtCell = sharedGrid.reportActivityAtCell;
|
|
19
19
|
/** Apply excavation damage and eject velocity at a cell. */
|
|
20
20
|
export import excavateAtCell = sharedGrid.excavateAtCell;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Return the world grid size in cells.
|
|
23
|
+
*
|
|
24
|
+
* @example Worker entry
|
|
25
|
+
* ```ts
|
|
26
|
+
* const { widthCells, heightCells } = api.grid.getDimensions();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
22
29
|
export import getDimensions = sharedGrid.getDimensions;
|
|
23
30
|
/** Options for {@link excavateAtCell}. */
|
|
24
31
|
export import ExcavateOptions = sharedGrid.ExcavateOptions;
|
|
@@ -30,7 +37,8 @@ export namespace grid {
|
|
|
30
37
|
|
|
31
38
|
/**
|
|
32
39
|
* @deprecated Use {@link grid} instead.
|
|
33
|
-
*
|
|
40
|
+
*
|
|
41
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
34
42
|
*/
|
|
35
43
|
export namespace world {
|
|
36
44
|
export import getCellIdAtCell = grid.getCellIdAtCell;
|