@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
|
@@ -14,7 +14,16 @@ import type { elements } from "./elements";
|
|
|
14
14
|
|
|
15
15
|
export namespace structures {
|
|
16
16
|
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Call callback for each structure of the given type.
|
|
19
|
+
*
|
|
20
|
+
* @example Main entry
|
|
21
|
+
* ```ts
|
|
22
|
+
* api.structures.forEachOfType("exampleStructure", (structure) => {
|
|
23
|
+
* api.structures.updateData(structure, { active: true });
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
18
27
|
export import forEachOfType = shared.api.structures.forEachOfType;
|
|
19
28
|
/** Return the structure at a cell, or null. */
|
|
20
29
|
export import getAtCell = shared.api.structures.getAtCell;
|
|
@@ -32,13 +41,56 @@ export namespace structures {
|
|
|
32
41
|
export import setSpritesheetIndex = shared.api.structures.setSpritesheetIndex;
|
|
33
42
|
/** Set spritesheet index on the structure at a cell. */
|
|
34
43
|
export import setSpritesheetIndexAtCell = shared.api.structures.setSpritesheetIndexAtCell;
|
|
35
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Map a value through thresholds to a spritesheet index on a structure.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* api.structures.setSpritesheetIndexByValue(
|
|
50
|
+
* structure,
|
|
51
|
+
* pressure,
|
|
52
|
+
* [0, 25, 50, 75],
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
36
56
|
export import setSpritesheetIndexByValue = shared.api.structures.setSpritesheetIndexByValue;
|
|
37
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Map a value through thresholds to a spritesheet index at a cell.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* api.structures.setSpritesheetIndexByValueAtCell(
|
|
63
|
+
* cellX,
|
|
64
|
+
* cellY,
|
|
65
|
+
* pressure,
|
|
66
|
+
* [0, 25, 50, 75],
|
|
67
|
+
* );
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
38
70
|
export import setSpritesheetIndexByValueAtCell = shared.api.structures.setSpritesheetIndexByValueAtCell;
|
|
39
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Push structure state updates to the game and workers.
|
|
73
|
+
*
|
|
74
|
+
* @example Main entry
|
|
75
|
+
* ```ts
|
|
76
|
+
* api.structures.update(structure, {
|
|
77
|
+
* propagateToWorkers: true,
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
40
81
|
export import update = shared.api.structures.update;
|
|
41
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Merge partial data onto a structure instance.
|
|
84
|
+
*
|
|
85
|
+
* @example Main entry
|
|
86
|
+
* ```ts
|
|
87
|
+
* api.structures.updateData(
|
|
88
|
+
* structure,
|
|
89
|
+
* { mode: "allow" },
|
|
90
|
+
* { propagateToWorkers: true },
|
|
91
|
+
* );
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
42
94
|
export import updateData = shared.api.structures.updateData;
|
|
43
95
|
/** Structure instance in the world. */
|
|
44
96
|
export import Structure = shared.api.structures.Structure;
|
|
@@ -51,13 +103,15 @@ export namespace structures {
|
|
|
51
103
|
|
|
52
104
|
/**
|
|
53
105
|
* @deprecated Use {@link getTypeById} instead.
|
|
54
|
-
*
|
|
106
|
+
*
|
|
107
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
55
108
|
*/
|
|
56
109
|
export import getTypeFromId = shared.api.structures.getTypeFromId;
|
|
57
110
|
|
|
58
111
|
/**
|
|
59
112
|
* @deprecated Use {@link updateData} instead.
|
|
60
|
-
*
|
|
113
|
+
*
|
|
114
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
61
115
|
*/
|
|
62
116
|
export import setData = shared.api.structures.setData;
|
|
63
117
|
|
|
@@ -66,7 +120,35 @@ export namespace structures {
|
|
|
66
120
|
*
|
|
67
121
|
* @param definition - Full structure definition.
|
|
68
122
|
* @param options - When `useRawShape` is true, keep the shape matrix as-is.
|
|
69
|
-
*
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* api.structures.register({
|
|
127
|
+
* id: "exampleJunction",
|
|
128
|
+
* name: "Example Junction",
|
|
129
|
+
* nameKey: "structures|exampleJunction|name",
|
|
130
|
+
* description: "Links two fixed-span endpoints.",
|
|
131
|
+
* descriptionKey: "structures|exampleJunction|description",
|
|
132
|
+
* categoryKey: "logistics",
|
|
133
|
+
* buildModes: [{
|
|
134
|
+
* type: "line",
|
|
135
|
+
* directions: ["horizontal", "vertical"],
|
|
136
|
+
* spanTiles: 4,
|
|
137
|
+
* }],
|
|
138
|
+
* linkedClearance: "allOrNothing",
|
|
139
|
+
* tooltipHover,
|
|
140
|
+
* variants: [{
|
|
141
|
+
* id: "exampleJunction",
|
|
142
|
+
* angles: [-180, -90, 0, 90, 180],
|
|
143
|
+
* }],
|
|
144
|
+
* render: {
|
|
145
|
+
* imageName: "exampleJunction",
|
|
146
|
+
* size: { width: 16, height: 16 },
|
|
147
|
+
* },
|
|
148
|
+
* });
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
70
152
|
*/
|
|
71
153
|
export function register(definition: SandkitStructureDefinition, options?: { useRawShape?: boolean; }): void;
|
|
72
154
|
|
|
@@ -76,7 +158,19 @@ export namespace structures {
|
|
|
76
158
|
* @param structureTypeOrId - Structure type value or string id.
|
|
77
159
|
* @param partial - Fields to merge onto the definition.
|
|
78
160
|
* @param options - When `useRawShape` is true, keep the shape matrix as-is.
|
|
79
|
-
*
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* api.structures.updateDefinition("exampleJunction", {
|
|
165
|
+
* buildModes: [{
|
|
166
|
+
* type: "line",
|
|
167
|
+
* directions: ["horizontal", "vertical"],
|
|
168
|
+
* spanTiles: 6,
|
|
169
|
+
* }],
|
|
170
|
+
* });
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
80
174
|
*/
|
|
81
175
|
export function updateDefinition(structureTypeOrId: StructureRef, partial: Partial<SandkitStructureDefinition>, options?: { useRawShape?: boolean; }): void;
|
|
82
176
|
|
|
@@ -86,13 +180,33 @@ export namespace structures {
|
|
|
86
180
|
* @param baseStructureTypeOrId - Base structure type or id.
|
|
87
181
|
* @param variant - Variant id and supported rotation angles.
|
|
88
182
|
* @param options - Optional build-mode wiring for the variant.
|
|
89
|
-
*
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* api.structures.registerVariant(
|
|
187
|
+
* "exampleStructure",
|
|
188
|
+
* {
|
|
189
|
+
* id: "exampleStructureVertical",
|
|
190
|
+
* angles: [-90, 90],
|
|
191
|
+
* },
|
|
192
|
+
* {
|
|
193
|
+
* addBuildMode: {
|
|
194
|
+
* type: "line",
|
|
195
|
+
* directions: ["vertical"],
|
|
196
|
+
* spanTiles: 4,
|
|
197
|
+
* },
|
|
198
|
+
* },
|
|
199
|
+
* );
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
90
203
|
*/
|
|
91
204
|
export function registerVariant(baseStructureTypeOrId: StructureRef, variant: { id: StructureRef; angles: number[]; }, options?: { addBuildMode?: unknown; }): void;
|
|
92
205
|
|
|
93
206
|
/**
|
|
94
207
|
* @deprecated Use {@link registerVariant} instead.
|
|
95
|
-
*
|
|
208
|
+
*
|
|
209
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
96
210
|
*/
|
|
97
211
|
export function addVariant(baseStructureTypeOrId: StructureRef, variant: { id: StructureRef; angles: number[]; }, options?: { addBuildMode?: unknown; }): void;
|
|
98
212
|
|
|
@@ -100,20 +214,49 @@ export namespace structures {
|
|
|
100
214
|
* Register placement rules for a structure.
|
|
101
215
|
*
|
|
102
216
|
* @param definition - Hotbar placement field configuration.
|
|
103
|
-
*
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* api.structures.registerPlacementConfig({
|
|
221
|
+
* structureId: "exampleStructure",
|
|
222
|
+
* fields: [
|
|
223
|
+
* {
|
|
224
|
+
* type: "integer",
|
|
225
|
+
* id: "channel",
|
|
226
|
+
* label: "Channel",
|
|
227
|
+
* default: 1,
|
|
228
|
+
* min: 1,
|
|
229
|
+
* max: 8,
|
|
230
|
+
* },
|
|
231
|
+
* {
|
|
232
|
+
* type: "choice",
|
|
233
|
+
* id: "mode",
|
|
234
|
+
* labelKey: "structures|exampleStructure|mode",
|
|
235
|
+
* default: "input",
|
|
236
|
+
* options: [
|
|
237
|
+
* { value: "input", label: "Input" },
|
|
238
|
+
* { value: "output", labelKey: "structures|exampleStructure|output" },
|
|
239
|
+
* ],
|
|
240
|
+
* },
|
|
241
|
+
* ],
|
|
242
|
+
* });
|
|
243
|
+
* ```
|
|
244
|
+
*
|
|
245
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
104
246
|
*/
|
|
105
247
|
export function registerPlacementConfig(definition: PlacementConfigDefinition): void;
|
|
106
248
|
|
|
107
249
|
/**
|
|
108
250
|
* Return structure types available for building.
|
|
109
251
|
*
|
|
110
|
-
* @see https://sandustry.com/sandkit.html
|
|
252
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
111
253
|
*/
|
|
112
254
|
export function getAvailableTypes(): Set<StructureRef>;
|
|
113
255
|
|
|
114
256
|
/**
|
|
115
257
|
* @deprecated Use {@link getAvailableTypes} instead.
|
|
116
|
-
*
|
|
258
|
+
*
|
|
259
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
117
260
|
*/
|
|
118
261
|
export function getUnlockedTypes(): Set<StructureRef>;
|
|
119
262
|
|
|
@@ -122,7 +265,8 @@ export namespace structures {
|
|
|
122
265
|
*
|
|
123
266
|
* @param cellX - Grid column of the target cell.
|
|
124
267
|
* @param cellY - Grid row of the target cell.
|
|
125
|
-
*
|
|
268
|
+
*
|
|
269
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
126
270
|
*/
|
|
127
271
|
export function isBlockedByPlayerAtCell(...args: CellCoordinates): boolean;
|
|
128
272
|
|
|
@@ -131,7 +275,8 @@ export namespace structures {
|
|
|
131
275
|
*
|
|
132
276
|
* @param cellX - Grid column of the target cell.
|
|
133
277
|
* @param cellY - Grid row of the target cell.
|
|
134
|
-
*
|
|
278
|
+
*
|
|
279
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
135
280
|
*/
|
|
136
281
|
export function isLauncherAtCell(...args: CellCoordinates): boolean;
|
|
137
282
|
|
|
@@ -142,13 +287,15 @@ export namespace structures {
|
|
|
142
287
|
* function (same implementation and return value; names differ only).
|
|
143
288
|
*
|
|
144
289
|
* @param structureType - Structure type value or string id.
|
|
145
|
-
*
|
|
290
|
+
*
|
|
291
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
146
292
|
*/
|
|
147
293
|
export function isLockedByType(structureType: StructureRef): boolean;
|
|
148
294
|
|
|
149
295
|
/**
|
|
150
296
|
* @deprecated Use {@link isLockedByType} instead. Same function as {@link isLockedByType}; return value is not inverted.
|
|
151
|
-
*
|
|
297
|
+
*
|
|
298
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
152
299
|
*/
|
|
153
300
|
export function isUnlockedByType(structureType: StructureRef): boolean;
|
|
154
301
|
|
|
@@ -158,7 +305,16 @@ export namespace structures {
|
|
|
158
305
|
* @param value - Numeric value to map.
|
|
159
306
|
* @param thresholds - Ascending threshold values.
|
|
160
307
|
* @returns Spritesheet frame index.
|
|
161
|
-
*
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* const index = api.structures.mapValueToSpritesheetIndex(
|
|
312
|
+
* pressure,
|
|
313
|
+
* [0, 25, 50, 75],
|
|
314
|
+
* );
|
|
315
|
+
* ```
|
|
316
|
+
*
|
|
317
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
162
318
|
*/
|
|
163
319
|
export function mapValueToSpritesheetIndex(value: number, thresholds: number[]): number;
|
|
164
320
|
|
|
@@ -169,13 +325,15 @@ export namespace structures {
|
|
|
169
325
|
* @param cellY - Grid row of the target cell.
|
|
170
326
|
* @param structureTypeOrId - Structure type or string id to build.
|
|
171
327
|
* @param options - Optional build overrides.
|
|
172
|
-
*
|
|
328
|
+
*
|
|
329
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
173
330
|
*/
|
|
174
331
|
export function buildAtCell(...args: [...CellCoordinates, structureTypeOrId: StructureRef, options?: StructureBuildOptions]): void;
|
|
175
332
|
|
|
176
333
|
/**
|
|
177
334
|
* @deprecated Use {@link buildAtCell} instead.
|
|
178
|
-
*
|
|
335
|
+
*
|
|
336
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
179
337
|
*/
|
|
180
338
|
export function buildAtCellWhenIdle(...args: [...CellCoordinates, structureTypeOrId: StructureRef, options?: StructureBuildOptions]): void;
|
|
181
339
|
|
|
@@ -185,13 +343,15 @@ export namespace structures {
|
|
|
185
343
|
* @param cellX - Grid column of the target cell.
|
|
186
344
|
* @param cellY - Grid row of the target cell.
|
|
187
345
|
* @param options - Optional removal flags.
|
|
188
|
-
*
|
|
346
|
+
*
|
|
347
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
189
348
|
*/
|
|
190
349
|
export function removeAtCell(...args: [...CellCoordinates, options?: StructureRemovalOptions]): void;
|
|
191
350
|
|
|
192
351
|
/**
|
|
193
352
|
* @deprecated Use {@link removeAtCell} instead.
|
|
194
|
-
*
|
|
353
|
+
*
|
|
354
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
195
355
|
*/
|
|
196
356
|
export function removeAtCellWhenIdle(...args: [...CellCoordinates, options?: StructureRemovalOptions]): void;
|
|
197
357
|
|
|
@@ -203,13 +363,15 @@ export namespace structures {
|
|
|
203
363
|
* @param endCellX - End cell column.
|
|
204
364
|
* @param endCellY - End cell row.
|
|
205
365
|
* @param options - Optional bulk-removal flags.
|
|
206
|
-
*
|
|
366
|
+
*
|
|
367
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
207
368
|
*/
|
|
208
369
|
export function removeBetweenCells(startCellX: number, startCellY: number, endCellX: number, endCellY: number, options?: StructureBulkRemovalOptions): void;
|
|
209
370
|
|
|
210
371
|
/**
|
|
211
372
|
* @deprecated Use {@link removeBetweenCells} instead.
|
|
212
|
-
*
|
|
373
|
+
*
|
|
374
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
213
375
|
*/
|
|
214
376
|
export function removeBetweenCellsWhenIdle(startCellX: number, startCellY: number, endCellX: number, endCellY: number, options?: StructureBulkRemovalOptions): void;
|
|
215
377
|
|
|
@@ -218,19 +380,30 @@ export namespace structures {
|
|
|
218
380
|
*
|
|
219
381
|
* @param positions - Cell positions to clear.
|
|
220
382
|
* @param options - Optional bulk-removal flags.
|
|
221
|
-
*
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```ts
|
|
386
|
+
* api.structures.removeAtCells([
|
|
387
|
+
* { x: firstCellX, y: firstCellY },
|
|
388
|
+
* { x: secondCellX, y: secondCellY },
|
|
389
|
+
* ]);
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
222
393
|
*/
|
|
223
394
|
export function removeAtCells(positions: Vector2[], options?: StructureBulkRemovalOptions): void;
|
|
224
395
|
|
|
225
396
|
/**
|
|
226
397
|
* @deprecated Use {@link removeAtCells} instead.
|
|
227
|
-
*
|
|
398
|
+
*
|
|
399
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
228
400
|
*/
|
|
229
401
|
export function removeAtCellsWhenIdle(positions: Vector2[], options?: StructureBulkRemovalOptions): void;
|
|
230
402
|
|
|
231
403
|
/**
|
|
232
404
|
* @deprecated Use {@link processing.register} instead.
|
|
233
|
-
*
|
|
405
|
+
*
|
|
406
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
234
407
|
*/
|
|
235
408
|
export function addProcessor(structureId: StructureRef, definition: StructureProcessorDefinitionV1): void;
|
|
236
409
|
|
|
@@ -241,7 +414,19 @@ export namespace structures {
|
|
|
241
414
|
*
|
|
242
415
|
* @param id - Machine recipe slot id.
|
|
243
416
|
* @param definition - Grower recipe definition.
|
|
244
|
-
*
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```ts
|
|
420
|
+
* api.structures.recipes.register("kineticPress", {
|
|
421
|
+
* input: "sand",
|
|
422
|
+
* outputs: [
|
|
423
|
+
* { elementType: "compressedSand", chance: 1 },
|
|
424
|
+
* ],
|
|
425
|
+
* minimumDownwardVelocityCellsPerSecond: 20,
|
|
426
|
+
* });
|
|
427
|
+
* ```
|
|
428
|
+
*
|
|
429
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
245
430
|
*/
|
|
246
431
|
export function register(id: 'planterBox', definition: PlanterBoxRecipeDefinitionV1): void;
|
|
247
432
|
|
|
@@ -250,7 +435,8 @@ export namespace structures {
|
|
|
250
435
|
*
|
|
251
436
|
* @param id - Machine recipe slot id.
|
|
252
437
|
* @param definition - Shaker recipe definition.
|
|
253
|
-
*
|
|
438
|
+
*
|
|
439
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
254
440
|
*/
|
|
255
441
|
export function register(id: 'shaker', definition: ShakerRecipeDefinitionV1): void;
|
|
256
442
|
|
|
@@ -259,7 +445,8 @@ export namespace structures {
|
|
|
259
445
|
*
|
|
260
446
|
* @param id - Machine recipe slot id.
|
|
261
447
|
* @param definition - Kinetic press recipe definition.
|
|
262
|
-
*
|
|
448
|
+
*
|
|
449
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
263
450
|
*/
|
|
264
451
|
export function register(id: 'kineticPress', definition: KineticPressRecipeDefinitionV1): void;
|
|
265
452
|
|
|
@@ -268,7 +455,8 @@ export namespace structures {
|
|
|
268
455
|
*
|
|
269
456
|
* @param id - Refinery machine id.
|
|
270
457
|
* @param definition - Weighted input/output recipe.
|
|
271
|
-
*
|
|
458
|
+
*
|
|
459
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
272
460
|
*/
|
|
273
461
|
export function register(id: 'condenser' | 'steamDryer' | 'synthesizer' | 'snowmaker' | 'smelter', definition: WeightedRefineryRecipeDefinitionV1): void;
|
|
274
462
|
}
|
|
@@ -280,7 +468,8 @@ export namespace structures {
|
|
|
280
468
|
|
|
281
469
|
/**
|
|
282
470
|
* @deprecated Use {@link isEnabledAtCell} instead.
|
|
283
|
-
*
|
|
471
|
+
*
|
|
472
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
284
473
|
*/
|
|
285
474
|
export import isEnabledAt = shared.api.structures.processing.isEnabledAt;
|
|
286
475
|
|
|
@@ -289,7 +478,25 @@ export namespace structures {
|
|
|
289
478
|
*
|
|
290
479
|
* @param id - Unique processing registration id.
|
|
291
480
|
* @param definition - Structure type, interval, and callback.
|
|
292
|
-
*
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```ts
|
|
484
|
+
* api.structures.processing.register(
|
|
485
|
+
* "exampleStructure:process",
|
|
486
|
+
* {
|
|
487
|
+
* structureType: "exampleStructure",
|
|
488
|
+
* intervalMs: 250,
|
|
489
|
+
* process: (structure, context) => {
|
|
490
|
+
* const empty = context.isCellEmptyAtCell(
|
|
491
|
+
* structure.x,
|
|
492
|
+
* structure.y,
|
|
493
|
+
* );
|
|
494
|
+
* },
|
|
495
|
+
* },
|
|
496
|
+
* );
|
|
497
|
+
* ```
|
|
498
|
+
*
|
|
499
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
293
500
|
*/
|
|
294
501
|
export function register(id: StructureId, definition: StructureProcessingDefinitionV1): void;
|
|
295
502
|
|
|
@@ -300,13 +507,15 @@ export namespace structures {
|
|
|
300
507
|
* @param cellY - Grid row of the target cell.
|
|
301
508
|
* @param enabled - Desired processing enabled state.
|
|
302
509
|
* @returns True when the enabled state changed.
|
|
303
|
-
*
|
|
510
|
+
*
|
|
511
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
304
512
|
*/
|
|
305
513
|
export function setEnabledAtCell(...args: [...CellCoordinates, enabled: boolean]): boolean;
|
|
306
514
|
|
|
307
515
|
/**
|
|
308
516
|
* @deprecated Use {@link setEnabledAtCell} instead.
|
|
309
|
-
*
|
|
517
|
+
*
|
|
518
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
310
519
|
*/
|
|
311
520
|
export function setEnabledAt(...args: [...CellCoordinates, enabled: boolean]): boolean;
|
|
312
521
|
}
|
|
@@ -315,6 +524,12 @@ export namespace structures {
|
|
|
315
524
|
export interface StructureBuildMode {
|
|
316
525
|
type: string;
|
|
317
526
|
directions?: string[];
|
|
527
|
+
/**
|
|
528
|
+
* Fixed span length in tiles for line-linked structures.
|
|
529
|
+
*
|
|
530
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
531
|
+
*/
|
|
532
|
+
spanTiles?: number;
|
|
318
533
|
}
|
|
319
534
|
|
|
320
535
|
/** Rotated variant entry for a structure definition. */
|
|
@@ -323,17 +538,90 @@ export namespace structures {
|
|
|
323
538
|
angles: number[];
|
|
324
539
|
}
|
|
325
540
|
|
|
541
|
+
/**
|
|
542
|
+
* Custom hover tooltip driven by structure `data` fields.
|
|
543
|
+
*
|
|
544
|
+
* @example Official example
|
|
545
|
+
* ```ts
|
|
546
|
+
* tooltipHover: {
|
|
547
|
+
* type: "custom",
|
|
548
|
+
* dataFieldMessage: {
|
|
549
|
+
* message: "Mode {mode}; channel {channel}.",
|
|
550
|
+
* messageKey: "mods|example|machineTooltip",
|
|
551
|
+
* fields: [
|
|
552
|
+
* {
|
|
553
|
+
* param: "mode",
|
|
554
|
+
* field: "mode",
|
|
555
|
+
* valueLabels: { input: "Receiving", output: "Sending" },
|
|
556
|
+
* valueKeys: {
|
|
557
|
+
* input: "mods|example|receiving",
|
|
558
|
+
* output: "mods|example|sending",
|
|
559
|
+
* },
|
|
560
|
+
* },
|
|
561
|
+
* { param: "channel", field: "channel", fallback: 1, round: true },
|
|
562
|
+
* ],
|
|
563
|
+
* },
|
|
564
|
+
* }
|
|
565
|
+
* ```
|
|
566
|
+
*
|
|
567
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
568
|
+
*/
|
|
569
|
+
export interface StructureTooltipHover {
|
|
570
|
+
type: "custom";
|
|
571
|
+
dataFieldMessage: {
|
|
572
|
+
message?: string;
|
|
573
|
+
messageKey?: string;
|
|
574
|
+
fields: readonly StructureTooltipHoverField[];
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/** One interpolated field in a {@link StructureTooltipHover} message. */
|
|
579
|
+
export interface StructureTooltipHoverField {
|
|
580
|
+
param: string;
|
|
581
|
+
field: string;
|
|
582
|
+
fallback?: string | number;
|
|
583
|
+
round?: boolean;
|
|
584
|
+
valueLabels?: Record<string, string>;
|
|
585
|
+
valueKeys?: Record<string, string>;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/** Spritesheet animation on a structure render block. */
|
|
589
|
+
export interface StructureSpritesheet {
|
|
590
|
+
frameSize: { width: number; height: number };
|
|
591
|
+
frames: number;
|
|
592
|
+
intervalMs: number;
|
|
593
|
+
/** When set, frame row follows this structure `data` field. */
|
|
594
|
+
rowDataField?: string;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/** Hotbar / build-menu UI sprite settings. */
|
|
598
|
+
export interface StructureRenderUi {
|
|
599
|
+
imageName?: string;
|
|
600
|
+
size?: { width: number; height: number };
|
|
601
|
+
offset?: { x: number; y: number };
|
|
602
|
+
outline?: boolean;
|
|
603
|
+
width?: string;
|
|
604
|
+
height?: string;
|
|
605
|
+
clipToBounds?: boolean;
|
|
606
|
+
}
|
|
607
|
+
|
|
326
608
|
/** Render settings for a structure definition. */
|
|
327
609
|
export interface StructureRender {
|
|
328
610
|
imageName?: string;
|
|
329
611
|
size?: { width: number; height: number };
|
|
330
612
|
offset?: { x: number; y: number };
|
|
613
|
+
z?: number;
|
|
614
|
+
ambienceGroup?: string;
|
|
615
|
+
ui?: StructureRenderUi;
|
|
616
|
+
spritesheet?: StructureSpritesheet;
|
|
331
617
|
}
|
|
332
618
|
|
|
333
619
|
/** Full structure definition registered with the game. */
|
|
334
620
|
export interface SandkitStructureDefinition {
|
|
335
621
|
id: StructureId;
|
|
622
|
+
name?: string;
|
|
336
623
|
nameKey?: string;
|
|
624
|
+
description?: string;
|
|
337
625
|
descriptionKey?: string;
|
|
338
626
|
categoryKey?: string;
|
|
339
627
|
order?: number;
|
|
@@ -342,6 +630,24 @@ export namespace structures {
|
|
|
342
630
|
variants?: StructureVariant[];
|
|
343
631
|
render?: StructureRender;
|
|
344
632
|
defaultData?: Record<string, unknown>;
|
|
633
|
+
/**
|
|
634
|
+
* Linked placement clearance mode (for example `"allOrNothing"`).
|
|
635
|
+
*
|
|
636
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
637
|
+
*/
|
|
638
|
+
linkedClearance?: string;
|
|
639
|
+
/**
|
|
640
|
+
* Custom hover tooltip over the built structure.
|
|
641
|
+
*
|
|
642
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
643
|
+
*/
|
|
644
|
+
tooltipHover?: StructureTooltipHover;
|
|
645
|
+
/** Reject placement when the footprint is blocked. */
|
|
646
|
+
rejectWhenBlocked?: boolean;
|
|
647
|
+
/** Show in the build menu without research unlock. */
|
|
648
|
+
alwaysUnlocked?: boolean;
|
|
649
|
+
/** Values interpolated into the structure description string. */
|
|
650
|
+
descriptionParams?: Record<string, string | number>;
|
|
345
651
|
[key: string]: unknown;
|
|
346
652
|
}
|
|
347
653
|
|
|
@@ -370,32 +676,34 @@ export namespace structures {
|
|
|
370
676
|
/**
|
|
371
677
|
* Context passed to structure processing callbacks.
|
|
372
678
|
*
|
|
373
|
-
* @see https://sandustry.com/sandkit.html
|
|
679
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
374
680
|
*/
|
|
375
681
|
export interface StructureProcessingContext {
|
|
376
682
|
/**
|
|
377
683
|
* Return the resolved element type at a cell, or null.
|
|
378
684
|
*
|
|
379
|
-
* @see https://sandustry.com/sandkit.html
|
|
685
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
380
686
|
*/
|
|
381
687
|
getResolvedTypeAtCell(...args: CellCoordinates): elements.ElementType | null;
|
|
382
688
|
|
|
383
689
|
/**
|
|
384
690
|
* @deprecated Use {@link getResolvedTypeAtCell} instead.
|
|
385
|
-
*
|
|
691
|
+
*
|
|
692
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
386
693
|
*/
|
|
387
694
|
getElementTypeAtCell(...args: CellCoordinates): elements.ElementType | null;
|
|
388
695
|
|
|
389
696
|
/**
|
|
390
697
|
* Return true when the cell has no element or terrain.
|
|
391
698
|
*
|
|
392
|
-
* @see https://sandustry.com/sandkit.html
|
|
699
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
393
700
|
*/
|
|
394
701
|
isCellEmptyAtCell(...args: CellCoordinates): boolean;
|
|
395
702
|
|
|
396
703
|
/**
|
|
397
704
|
* @deprecated Use {@link isCellEmptyAtCell} instead.
|
|
398
|
-
*
|
|
705
|
+
*
|
|
706
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
399
707
|
*/
|
|
400
708
|
isCellEmpty(...args: CellCoordinates): boolean;
|
|
401
709
|
|
|
@@ -403,14 +711,16 @@ export namespace structures {
|
|
|
403
711
|
* Commit batched grid mutations from the processing callback.
|
|
404
712
|
*
|
|
405
713
|
* @param mutations - Mutation writer payload accepted by the runtime.
|
|
406
|
-
*
|
|
714
|
+
*
|
|
715
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
407
716
|
*/
|
|
408
717
|
commit(mutations: unknown): void;
|
|
409
718
|
}
|
|
410
719
|
|
|
411
720
|
/**
|
|
412
721
|
* @deprecated Use {@link StructureProcessingDefinitionV1} with {@link processing.register} instead.
|
|
413
|
-
*
|
|
722
|
+
*
|
|
723
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
414
724
|
*/
|
|
415
725
|
export interface StructureProcessorDefinitionV1 {
|
|
416
726
|
/** Tick interval in milliseconds. Must be > 0. */
|