@sandustry-modding/types 0.3.0 → 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 +88 -0
- package/LICENSE +21 -0
- package/README.md +8 -19
- package/package.json +65 -5
- 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
- package/docs/Changelog.md +0 -46
- package/docs/README.md +0 -62
|
@@ -5,7 +5,7 @@ import { shared } from "../../shared";
|
|
|
5
5
|
* `sandkit.api.elements` — register elements and read or change cells on the main thread.
|
|
6
6
|
* Main thread only.
|
|
7
7
|
*
|
|
8
|
-
* @see https://sandustry.com/sandkit.html
|
|
8
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
9
9
|
*/
|
|
10
10
|
export namespace elements {
|
|
11
11
|
|
|
@@ -13,43 +13,43 @@ export namespace elements {
|
|
|
13
13
|
/**
|
|
14
14
|
* Numeric id for a registered element type.
|
|
15
15
|
*
|
|
16
|
-
* @see https://sandustry.com/sandkit.html
|
|
16
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
17
17
|
*/
|
|
18
18
|
export import ElementType = shared.api.elements.ElementType;
|
|
19
19
|
/**
|
|
20
20
|
* Mod or built-in element string id.
|
|
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 ElementId = shared.api.elements.ElementId;
|
|
25
25
|
/**
|
|
26
26
|
* Type handle or string id accepted by lookup helpers.
|
|
27
27
|
*
|
|
28
|
-
* @see https://sandustry.com/sandkit.html
|
|
28
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
29
29
|
*/
|
|
30
30
|
export import ElementRef = shared.api.elements.ElementRef;
|
|
31
31
|
/**
|
|
32
32
|
* Matter category for element physics behavior.
|
|
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 MatterType = shared.api.elements.MatterType;
|
|
37
37
|
/**
|
|
38
38
|
* Full definition used to register a custom element.
|
|
39
39
|
*
|
|
40
|
-
* @see https://sandustry.com/sandkit.html
|
|
40
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
41
41
|
*/
|
|
42
42
|
export import ElementDefinition = shared.api.elements.ElementDefinition;
|
|
43
43
|
/**
|
|
44
44
|
* Options for create and replace calls.
|
|
45
45
|
*
|
|
46
|
-
* @see https://sandustry.com/sandkit.html
|
|
46
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
47
47
|
*/
|
|
48
48
|
export import ElementCreateOptions = shared.api.elements.ElementCreateOptions;
|
|
49
49
|
/**
|
|
50
50
|
* Options for element removal.
|
|
51
51
|
*
|
|
52
|
-
* @see https://sandustry.com/sandkit.html
|
|
52
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
53
53
|
*/
|
|
54
54
|
export import ElementRemovalOptions = shared.api.elements.ElementRemovalOptions;
|
|
55
55
|
|
|
@@ -59,7 +59,8 @@ export namespace elements {
|
|
|
59
59
|
export import getTypeById = shared.api.elements.getTypeById;
|
|
60
60
|
/**
|
|
61
61
|
* @deprecated Use {@link getTypeById} instead.
|
|
62
|
-
*
|
|
62
|
+
*
|
|
63
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
63
64
|
*/
|
|
64
65
|
export import getTypeFromId = shared.api.elements.getTypeFromId;
|
|
65
66
|
/** Returns the definition for an element type. */
|
|
@@ -137,7 +138,7 @@ export namespace elements {
|
|
|
137
138
|
/**
|
|
138
139
|
* Returns all registered element type ids.
|
|
139
140
|
*
|
|
140
|
-
* @see https://sandustry.com/sandkit.html
|
|
141
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
141
142
|
*/
|
|
142
143
|
export function getRegisteredTypes(): ElementType[];
|
|
143
144
|
|
|
@@ -146,7 +147,8 @@ export namespace elements {
|
|
|
146
147
|
*
|
|
147
148
|
* @param definition - Full element definition to register.
|
|
148
149
|
* @returns Object with the assigned `elementType`.
|
|
149
|
-
*
|
|
150
|
+
*
|
|
151
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
150
152
|
*/
|
|
151
153
|
export function register(definition: ElementDefinition): { elementType: ElementType; };
|
|
152
154
|
|
|
@@ -155,7 +157,15 @@ export namespace elements {
|
|
|
155
157
|
*
|
|
156
158
|
* @param elementTypeOrId - Numeric type or string id.
|
|
157
159
|
* @param partial - Fields to merge onto the definition.
|
|
158
|
-
*
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* api.elements.updateDefinition("exampleElement", {
|
|
164
|
+
* showInFilterPicker: false,
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
159
169
|
*/
|
|
160
170
|
export function updateDefinition(elementTypeOrId: ElementRef, partial: Partial<ElementDefinition>): void;
|
|
161
171
|
|
|
@@ -164,7 +174,8 @@ export namespace elements {
|
|
|
164
174
|
*
|
|
165
175
|
* @param elementTypeOrId - Numeric type or string id.
|
|
166
176
|
* @param interaction - Interaction entry to append.
|
|
167
|
-
*
|
|
177
|
+
*
|
|
178
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
168
179
|
*/
|
|
169
180
|
export function addInteractionInfo(elementTypeOrId: ElementRef, interaction: Interaction): void;
|
|
170
181
|
|
|
@@ -172,7 +183,8 @@ export namespace elements {
|
|
|
172
183
|
* Returns the display name for an element type.
|
|
173
184
|
*
|
|
174
185
|
* @param elementType - Numeric element type.
|
|
175
|
-
*
|
|
186
|
+
*
|
|
187
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
176
188
|
*/
|
|
177
189
|
export function getNameByType(elementType: ElementType): string;
|
|
178
190
|
|
|
@@ -183,7 +195,8 @@ export namespace elements {
|
|
|
183
195
|
* @param structureCellY - Structure anchor cell row.
|
|
184
196
|
* @param structureSizeCells - Structure footprint size in cells.
|
|
185
197
|
* @returns Cell coordinates of a free cell, or null when none.
|
|
186
|
-
*
|
|
198
|
+
*
|
|
199
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
187
200
|
*/
|
|
188
201
|
export function findFreeCellInStructure(structureCellX: number, structureCellY: number, structureSizeCells: number): Vector2 | null;
|
|
189
202
|
|
|
@@ -194,13 +207,29 @@ export namespace elements {
|
|
|
194
207
|
* @param cellY - Grid row of the target cell.
|
|
195
208
|
* @param elementTypeOrId - Numeric type or string id.
|
|
196
209
|
* @param options - Optional spawn overrides.
|
|
197
|
-
*
|
|
210
|
+
*
|
|
211
|
+
* @example Main entry
|
|
212
|
+
* ```ts
|
|
213
|
+
* api.elements.createAtCell(cellX, cellY, "water", {
|
|
214
|
+
* durationTicks: 60,
|
|
215
|
+
* });
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* @example options.durationTicks
|
|
219
|
+
* ```ts
|
|
220
|
+
* api.elements.createAtCell(cellX, cellY, "steam", {
|
|
221
|
+
* durationTicks: 120,
|
|
222
|
+
* });
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
198
226
|
*/
|
|
199
227
|
export function createAtCell(...args: [...CellCoordinates, elementTypeOrId: ElementRef, options?: ElementCreateOptions]): void;
|
|
200
228
|
|
|
201
229
|
/**
|
|
202
230
|
* @deprecated Use {@link createAtCell} instead.
|
|
203
|
-
*
|
|
231
|
+
*
|
|
232
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
204
233
|
*/
|
|
205
234
|
export function createAtCellWhenIdle(...args: [...CellCoordinates, elementTypeOrId: ElementRef, options?: ElementCreateOptions]): void;
|
|
206
235
|
|
|
@@ -211,13 +240,15 @@ export namespace elements {
|
|
|
211
240
|
* @param cellY - Grid row of the target cell.
|
|
212
241
|
* @param elementTypeOrId - Numeric type or string id.
|
|
213
242
|
* @param options - Optional spawn overrides.
|
|
214
|
-
*
|
|
243
|
+
*
|
|
244
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
215
245
|
*/
|
|
216
246
|
export function replaceAtCell(...args: [...CellCoordinates, elementTypeOrId: ElementRef, options?: ElementCreateOptions]): void;
|
|
217
247
|
|
|
218
248
|
/**
|
|
219
249
|
* @deprecated Use {@link replaceAtCell} instead.
|
|
220
|
-
*
|
|
250
|
+
*
|
|
251
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
221
252
|
*/
|
|
222
253
|
export function replaceAtCellWhenIdle(...args: [...CellCoordinates, elementTypeOrId: ElementRef, options?: ElementCreateOptions]): void;
|
|
223
254
|
|
|
@@ -227,13 +258,15 @@ export namespace elements {
|
|
|
227
258
|
* @param cellX - Grid column of the target cell.
|
|
228
259
|
* @param cellY - Grid row of the target cell.
|
|
229
260
|
* @param options - Optional removal flags.
|
|
230
|
-
*
|
|
261
|
+
*
|
|
262
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
231
263
|
*/
|
|
232
264
|
export function removeAtCell(...args: [...CellCoordinates, options?: ElementRemovalOptions]): void;
|
|
233
265
|
|
|
234
266
|
/**
|
|
235
267
|
* @deprecated Use {@link removeAtCell} instead.
|
|
236
|
-
*
|
|
268
|
+
*
|
|
269
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
237
270
|
*/
|
|
238
271
|
export function removeAtCellWhenIdle(...args: [...CellCoordinates, options?: ElementRemovalOptions]): void;
|
|
239
272
|
|
|
@@ -244,13 +277,15 @@ export namespace elements {
|
|
|
244
277
|
* @param fromCellY - Source cell row.
|
|
245
278
|
* @param toCellX - Destination cell column.
|
|
246
279
|
* @param toCellY - Destination cell row.
|
|
247
|
-
*
|
|
280
|
+
*
|
|
281
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
248
282
|
*/
|
|
249
283
|
export function teleportBetweenCells(fromCellX: number, fromCellY: number, toCellX: number, toCellY: number): void;
|
|
250
284
|
|
|
251
285
|
/**
|
|
252
286
|
* @deprecated Use {@link teleportBetweenCells} instead.
|
|
253
|
-
*
|
|
287
|
+
*
|
|
288
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
254
289
|
*/
|
|
255
290
|
export function teleportBetweenCellsWhenIdle(fromCellX: number, fromCellY: number, toCellX: number, toCellY: number): void;
|
|
256
291
|
|
|
@@ -260,13 +295,20 @@ export namespace elements {
|
|
|
260
295
|
* @param cellX - Grid column of the target cell.
|
|
261
296
|
* @param cellY - Grid row of the target cell.
|
|
262
297
|
* @param velocity - New velocity vector.
|
|
263
|
-
*
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* api.elements.setVelocityAtCell(cellX, cellY, { x: 0, y: -120 });
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
264
305
|
*/
|
|
265
306
|
export function setVelocityAtCell(...args: [...CellCoordinates, velocity: Vector2]): void;
|
|
266
307
|
|
|
267
308
|
/**
|
|
268
309
|
* @deprecated Use {@link setVelocityAtCell} instead.
|
|
269
|
-
*
|
|
310
|
+
*
|
|
311
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
270
312
|
*/
|
|
271
313
|
export function setVelocityAtCellWhenIdle(...args: [...CellCoordinates, velocity: Vector2]): void;
|
|
272
314
|
|
|
@@ -277,13 +319,25 @@ export namespace elements {
|
|
|
277
319
|
* @param cellY - Grid row of the target cell.
|
|
278
320
|
* @param velocity - Velocity delta to add.
|
|
279
321
|
* @param maxSpeedCellsPerSecond - Optional speed cap after the addition.
|
|
280
|
-
*
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```ts
|
|
325
|
+
* api.elements.addParticleVelocityAtCell(
|
|
326
|
+
* cellX,
|
|
327
|
+
* cellY,
|
|
328
|
+
* { x: 4, y: -8 },
|
|
329
|
+
* 120,
|
|
330
|
+
* );
|
|
331
|
+
* ```
|
|
332
|
+
*
|
|
333
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
281
334
|
*/
|
|
282
335
|
export function addParticleVelocityAtCell(...args: [...CellCoordinates, velocity: Vector2, maxSpeedCellsPerSecond?: number]): void;
|
|
283
336
|
|
|
284
337
|
/**
|
|
285
338
|
* @deprecated Use {@link addParticleVelocityAtCell} instead.
|
|
286
|
-
*
|
|
339
|
+
*
|
|
340
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
287
341
|
*/
|
|
288
342
|
export function addParticleVelocityAtCellWhenIdle(...args: [...CellCoordinates, velocity: Vector2, maxSpeedCellsPerSecond?: number]): void;
|
|
289
343
|
|
|
@@ -293,13 +347,24 @@ export namespace elements {
|
|
|
293
347
|
* @param cellX - Grid column of the target cell.
|
|
294
348
|
* @param cellY - Grid row of the target cell.
|
|
295
349
|
* @param velocity - Initial particle velocity.
|
|
296
|
-
*
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* api.elements.convertToParticleAtCell(
|
|
354
|
+
* cellX,
|
|
355
|
+
* cellY,
|
|
356
|
+
* { x: 0, y: -120 },
|
|
357
|
+
* );
|
|
358
|
+
* ```
|
|
359
|
+
*
|
|
360
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
297
361
|
*/
|
|
298
362
|
export function convertToParticleAtCell(...args: [...CellCoordinates, velocity: Vector2]): void;
|
|
299
363
|
|
|
300
364
|
/**
|
|
301
365
|
* @deprecated Use {@link convertToParticleAtCell} instead.
|
|
302
|
-
*
|
|
366
|
+
*
|
|
367
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
303
368
|
*/
|
|
304
369
|
export function convertToParticleAtCellWhenIdle(...args: [...CellCoordinates, velocity: Vector2]): void;
|
|
305
370
|
|
|
@@ -308,13 +373,15 @@ export namespace elements {
|
|
|
308
373
|
*
|
|
309
374
|
* @param cellX - Grid column of the target cell.
|
|
310
375
|
* @param cellY - Grid row of the target cell.
|
|
311
|
-
*
|
|
376
|
+
*
|
|
377
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
312
378
|
*/
|
|
313
379
|
export function convertFromParticleAtCell(...args: CellCoordinates): void;
|
|
314
380
|
|
|
315
381
|
/**
|
|
316
382
|
* @deprecated Use {@link convertFromParticleAtCell} instead.
|
|
317
|
-
*
|
|
383
|
+
*
|
|
384
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
318
385
|
*/
|
|
319
386
|
export function convertFromParticleAtCellWhenIdle(...args: CellCoordinates): void;
|
|
320
387
|
|
|
@@ -325,13 +392,15 @@ export namespace elements {
|
|
|
325
392
|
* @param cellY - Grid row of the target cell.
|
|
326
393
|
* @param fieldNumber - Data field index (1–4).
|
|
327
394
|
* @param value - New field value.
|
|
328
|
-
*
|
|
395
|
+
*
|
|
396
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
329
397
|
*/
|
|
330
398
|
export function setDataFieldAtCell(...args: [...CellCoordinates, fieldNumber: 1 | 2 | 3 | 4, value: number]): void;
|
|
331
399
|
|
|
332
400
|
/**
|
|
333
401
|
* @deprecated Use {@link setDataFieldAtCell} instead.
|
|
334
|
-
*
|
|
402
|
+
*
|
|
403
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
335
404
|
*/
|
|
336
405
|
export function setDataFieldAtCellWhenIdle(...args: [...CellCoordinates, fieldNumber: 1 | 2 | 3 | 4, value: number]): void;
|
|
337
406
|
|
|
@@ -340,13 +409,15 @@ export namespace elements {
|
|
|
340
409
|
*
|
|
341
410
|
* @param cellX - Grid column of the target cell.
|
|
342
411
|
* @param cellY - Grid row of the target cell.
|
|
343
|
-
*
|
|
412
|
+
*
|
|
413
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
344
414
|
*/
|
|
345
415
|
export function refreshColorAtCell(...args: CellCoordinates): void;
|
|
346
416
|
|
|
347
417
|
/**
|
|
348
418
|
* @deprecated Use {@link refreshColorAtCell} instead.
|
|
349
|
-
*
|
|
419
|
+
*
|
|
420
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
350
421
|
*/
|
|
351
422
|
export function refreshColorAtCellWhenIdle(...args: CellCoordinates): void;
|
|
352
423
|
|
|
@@ -356,13 +427,15 @@ export namespace elements {
|
|
|
356
427
|
* @param cellX - Grid column of the target cell.
|
|
357
428
|
* @param cellY - Grid row of the target cell.
|
|
358
429
|
* @param physicsState - Physics skip flags for the element.
|
|
359
|
-
*
|
|
430
|
+
*
|
|
431
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
360
432
|
*/
|
|
361
433
|
export function setPhysicsAtCell(...args: [...CellCoordinates, physicsState: number]): void;
|
|
362
434
|
|
|
363
435
|
/**
|
|
364
436
|
* @deprecated Use {@link setPhysicsAtCell} instead.
|
|
365
|
-
*
|
|
437
|
+
*
|
|
438
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
366
439
|
*/
|
|
367
440
|
export function setPhysicsAtCellWhenIdle(...args: [...CellCoordinates, physicsState: number]): void;
|
|
368
441
|
|
|
@@ -373,13 +446,25 @@ export namespace elements {
|
|
|
373
446
|
* @param cellY - Grid row of the target cell.
|
|
374
447
|
* @param durationTicks - Duration in simulation ticks.
|
|
375
448
|
* @param options - When `updateMax` is true, also update max duration.
|
|
376
|
-
*
|
|
449
|
+
*
|
|
450
|
+
* @example Main entry
|
|
451
|
+
* ```ts
|
|
452
|
+
* api.elements.setDurationAtCell(
|
|
453
|
+
* cellX,
|
|
454
|
+
* cellY,
|
|
455
|
+
* 120,
|
|
456
|
+
* { updateMax: true },
|
|
457
|
+
* );
|
|
458
|
+
* ```
|
|
459
|
+
*
|
|
460
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
377
461
|
*/
|
|
378
462
|
export function setDurationAtCell(...args: [...CellCoordinates, durationTicks: number, options?: { updateMax?: boolean; }]): void;
|
|
379
463
|
|
|
380
464
|
/**
|
|
381
465
|
* @deprecated Use {@link setDurationAtCell} instead.
|
|
382
|
-
*
|
|
466
|
+
*
|
|
467
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
|
|
383
468
|
*/
|
|
384
469
|
export function setDurationAtCellWhenIdle(...args: [...CellCoordinates, durationTicks: number, options?: { updateMax?: boolean; }]): void;
|
|
385
470
|
}
|
|
@@ -39,6 +39,14 @@ export namespace energy {
|
|
|
39
39
|
* Returns energy network nodes connected at the cell.
|
|
40
40
|
* @param cellX - Grid cell X coordinate.
|
|
41
41
|
* @param cellY - Grid cell Y coordinate.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const network = api.energy.getNetworkAtCell(cellX, cellY);
|
|
46
|
+
* for (const entry of network) {
|
|
47
|
+
* useNetworkCell(entry.cellX, entry.cellY, entry.type);
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
42
50
|
*/
|
|
43
51
|
export function getNetworkAtCell(...args: CellCoordinates): {
|
|
44
52
|
x: number;
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Available as `sandkit.api.entities`.
|
|
5
5
|
*
|
|
6
|
-
* @see https://sandustry.com/sandkit.html
|
|
6
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
7
7
|
*/
|
|
8
8
|
export namespace entities {
|
|
9
9
|
/**
|
|
10
10
|
* Return one live entity by runtime id.
|
|
11
11
|
*
|
|
12
12
|
* @param entityId - Runtime entity id.
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
14
15
|
*/
|
|
15
16
|
export function getById(entityId: number): Entity | undefined;
|
|
16
17
|
|
|
@@ -18,7 +19,8 @@ export namespace entities {
|
|
|
18
19
|
* Return all live entities of one type.
|
|
19
20
|
*
|
|
20
21
|
* @param entityTypeId - Registered entity type string id.
|
|
21
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
22
24
|
*/
|
|
23
25
|
export function getAllByType(entityTypeId: string): Entity[];
|
|
24
26
|
|
|
@@ -29,7 +31,8 @@ export namespace entities {
|
|
|
29
31
|
* @param worldX - Spawn x position in world pixels.
|
|
30
32
|
* @param worldY - Spawn y position in world pixels.
|
|
31
33
|
* @returns The spawned entity instance.
|
|
32
|
-
*
|
|
34
|
+
*
|
|
35
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
33
36
|
*/
|
|
34
37
|
export function spawnAtWorld(entityTypeId: string, worldX: number, worldY: number): Entity;
|
|
35
38
|
|
|
@@ -37,7 +40,8 @@ export namespace entities {
|
|
|
37
40
|
* Remove an entity from the world.
|
|
38
41
|
*
|
|
39
42
|
* @param entityId - Runtime entity id.
|
|
40
|
-
*
|
|
43
|
+
*
|
|
44
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
41
45
|
*/
|
|
42
46
|
export function remove(entityId: number): void;
|
|
43
47
|
|
|
@@ -47,7 +51,8 @@ export namespace entities {
|
|
|
47
51
|
* @param entityId - Runtime entity id.
|
|
48
52
|
* @param angleRadians - Launch angle in radians.
|
|
49
53
|
* @param speed - Optional launch speed.
|
|
50
|
-
*
|
|
54
|
+
*
|
|
55
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
51
56
|
*/
|
|
52
57
|
export function launch(entityId: number, angleRadians: number, speed?: number): void;
|
|
53
58
|
|
|
@@ -55,7 +60,8 @@ export namespace entities {
|
|
|
55
60
|
* Start capture for an entity (for example vacuum capture).
|
|
56
61
|
*
|
|
57
62
|
* @param entityId - Runtime entity id.
|
|
58
|
-
*
|
|
63
|
+
*
|
|
64
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
59
65
|
*/
|
|
60
66
|
export function startCapture(entityId: number): void;
|
|
61
67
|
|
|
@@ -63,7 +69,8 @@ export namespace entities {
|
|
|
63
69
|
* Collect an entity (for example into inventory or storage).
|
|
64
70
|
*
|
|
65
71
|
* @param entityId - Runtime entity id.
|
|
66
|
-
*
|
|
72
|
+
*
|
|
73
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
67
74
|
*/
|
|
68
75
|
export function collect(entityId: number): void;
|
|
69
76
|
|
|
@@ -10,7 +10,143 @@ export namespace events {
|
|
|
10
10
|
*
|
|
11
11
|
* @param eventId - Registered event name.
|
|
12
12
|
* @param callback - Called when the event is emitted.
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
|
+
* @example item:used
|
|
15
|
+
* ```ts
|
|
16
|
+
* const unsubscribe = api.events.on("item:used", (payload) => {
|
|
17
|
+
* if (payload.itemId !== "laser") return;
|
|
18
|
+
*
|
|
19
|
+
* spawnSparklesAtCell(payload.cellX, payload.cellY);
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example frame:render
|
|
24
|
+
* ```ts
|
|
25
|
+
* api.events.on("frame:render", () => {
|
|
26
|
+
* drawOverlay();
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example scene:game:started
|
|
31
|
+
* ```ts
|
|
32
|
+
* api.events.on("scene:game:started", () => {
|
|
33
|
+
* initializeGameScene();
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example earlyAccess:completed
|
|
38
|
+
* ```ts
|
|
39
|
+
* api.events.on("earlyAccess:completed", (payload) => {
|
|
40
|
+
* onEarlyAccessCompleted(payload);
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example terrain:destroyed
|
|
45
|
+
* ```ts
|
|
46
|
+
* api.events.on("terrain:destroyed", (payload) => {
|
|
47
|
+
* onTerrainDestroyed(payload.cellX, payload.cellY, payload.cellType);
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example fog:cellRevealed
|
|
52
|
+
* ```ts
|
|
53
|
+
* api.events.on("fog:cellRevealed", (payload) => {
|
|
54
|
+
* onFogCellRevealed(payload.cellX, payload.cellY);
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example upgrade:levelSelected
|
|
59
|
+
* ```ts
|
|
60
|
+
* api.events.on("upgrade:levelSelected", (payload) => {
|
|
61
|
+
* onLevelSelected(payload.itemId, payload.upgradeId, payload.level);
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example building:placed
|
|
66
|
+
* ```ts
|
|
67
|
+
* api.events.on("building:placed", (payload) => {
|
|
68
|
+
* onBuildingPlaced(payload.structure, payload.x, payload.y);
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example building:removed
|
|
73
|
+
* ```ts
|
|
74
|
+
* api.events.on("building:removed", (payload) => {
|
|
75
|
+
* onBuildingRemoved(payload.structureId, payload.x, payload.y);
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example structures:placed
|
|
80
|
+
* ```ts
|
|
81
|
+
* api.events.on("structures:placed", (payload) => {
|
|
82
|
+
* onStructuresPlaced(payload.structures);
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @example structures:removed
|
|
87
|
+
* ```ts
|
|
88
|
+
* api.events.on("structures:removed", (payload) => {
|
|
89
|
+
* onStructuresRemoved(payload.removed, payload.byMove);
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example structures:moved
|
|
94
|
+
* ```ts
|
|
95
|
+
* api.events.on("structures:moved", (payload) => {
|
|
96
|
+
* onStructuresMoved(payload.moved, payload.failedToPlace);
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example game:ready
|
|
101
|
+
* ```ts
|
|
102
|
+
* api.events.on("game:ready", () => {
|
|
103
|
+
* initializeExample();
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example game:started
|
|
108
|
+
* ```ts
|
|
109
|
+
* api.events.on("game:started", () => {
|
|
110
|
+
* startExample();
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @example tutorial:stepChanged
|
|
115
|
+
* ```ts
|
|
116
|
+
* api.events.on("tutorial:stepChanged", (payload) => {
|
|
117
|
+
* onTutorialStepChanged(payload.step);
|
|
118
|
+
* });
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @example tutorial:completed
|
|
122
|
+
* ```ts
|
|
123
|
+
* api.events.on("tutorial:completed", (payload) => {
|
|
124
|
+
* onTutorialCompleted(payload.skipped);
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @example tech:unlocked
|
|
129
|
+
* ```ts
|
|
130
|
+
* api.events.on("tech:unlocked", (payload) => {
|
|
131
|
+
* onTechUnlocked(payload.techId, payload.suppressMusic);
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @example worldItem:pickedUp
|
|
136
|
+
* ```ts
|
|
137
|
+
* api.events.on("worldItem:pickedUp", (payload) => {
|
|
138
|
+
* onPickup(payload.worldItemId, payload.type);
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @example resource:collected
|
|
143
|
+
* ```ts
|
|
144
|
+
* api.events.on("resource:collected", (payload) => {
|
|
145
|
+
* onResourceCollected(payload.resourceId, payload.amount);
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
14
150
|
*/
|
|
15
151
|
export function on<K extends EventId>(eventId: K, callback: (payload: EventPayload<K>) => void): () => void;
|
|
16
152
|
|
|
@@ -19,7 +155,8 @@ export namespace events {
|
|
|
19
155
|
*
|
|
20
156
|
* @param eventId - Registered event name.
|
|
21
157
|
* @param payload - Serializable payload passed to listeners.
|
|
22
|
-
*
|
|
158
|
+
*
|
|
159
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
23
160
|
*/
|
|
24
161
|
export function emit<K extends EventId>(eventId: K, payload: EventPayload<K>): void;
|
|
25
162
|
|