@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.
Files changed (65) hide show
  1. package/CHANGELOG.md +40 -11
  2. package/README.md +3 -0
  3. package/package.json +12 -2
  4. package/src/configs/index.d.ts +38 -0
  5. package/src/configs/modinfo.d.ts +751 -0
  6. package/src/configs/patches.d.ts +195 -0
  7. package/src/sandkit/api/action.d.ts +5 -0
  8. package/src/sandkit/api/blueprints.d.ts +5 -3
  9. package/src/sandkit/api/camera.d.ts +5 -0
  10. package/src/sandkit/api/effects.d.ts +28 -7
  11. package/src/sandkit/api/elements.d.ts +124 -39
  12. package/src/sandkit/api/energy.d.ts +8 -0
  13. package/src/sandkit/api/entities.d.ts +15 -8
  14. package/src/sandkit/api/events.d.ts +139 -2
  15. package/src/sandkit/api/excavation.d.ts +33 -3
  16. package/src/sandkit/api/factory.d.ts +6 -4
  17. package/src/sandkit/api/fire.d.ts +7 -4
  18. package/src/sandkit/api/game.d.ts +8 -2
  19. package/src/sandkit/api/grid.d.ts +72 -23
  20. package/src/sandkit/api/hooks.d.ts +362 -2
  21. package/src/sandkit/api/i18n.d.ts +65 -20
  22. package/src/sandkit/api/input.d.ts +15 -0
  23. package/src/sandkit/api/items.d.ts +7 -0
  24. package/src/sandkit/api/lights.d.ts +55 -8
  25. package/src/sandkit/api/maps.d.ts +10 -1
  26. package/src/sandkit/api/patterns.d.ts +22 -0
  27. package/src/sandkit/api/pickups.d.ts +14 -8
  28. package/src/sandkit/api/pipes.d.ts +9 -5
  29. package/src/sandkit/api/player.d.ts +29 -15
  30. package/src/sandkit/api/progression.d.ts +8 -0
  31. package/src/sandkit/api/reactions.d.ts +11 -0
  32. package/src/sandkit/api/rendering.d.ts +25 -2
  33. package/src/sandkit/api/resources.d.ts +5 -0
  34. package/src/sandkit/api/schedule.d.ts +7 -0
  35. package/src/sandkit/api/settings.d.ts +7 -0
  36. package/src/sandkit/api/shared.d.ts +13 -3
  37. package/src/sandkit/api/signals.d.ts +29 -0
  38. package/src/sandkit/api/sound.d.ts +14 -8
  39. package/src/sandkit/api/structureBehaviors.d.ts +8 -0
  40. package/src/sandkit/api/structures.d.ts +353 -43
  41. package/src/sandkit/api/tech.d.ts +73 -9
  42. package/src/sandkit/api/terrains.d.ts +25 -13
  43. package/src/sandkit/api/triggers.d.ts +10 -0
  44. package/src/sandkit/api/ui.d.ts +146 -1
  45. package/src/sandkit/api/upgrades.d.ts +2 -1
  46. package/src/sandkit/api/utils.d.ts +10 -5
  47. package/src/sandkit/api/world.d.ts +30 -25
  48. package/src/sandkit/index.d.ts +12 -1
  49. package/src/shared/api/elements.d.ts +36 -22
  50. package/src/shared/api/grid.d.ts +11 -6
  51. package/src/shared/api/player.d.ts +8 -4
  52. package/src/shared/api/shared.d.ts +2 -1
  53. package/src/shared/api/structures.d.ts +55 -17
  54. package/src/shared/api/terrains.d.ts +39 -23
  55. package/src/shared/api/ui.d.ts +5 -0
  56. package/src/shared/api/world.d.ts +9 -9
  57. package/src/worker/api/effects.d.ts +11 -3
  58. package/src/worker/api/elements.d.ts +54 -19
  59. package/src/worker/api/events.d.ts +31 -2
  60. package/src/worker/api/fire.d.ts +4 -2
  61. package/src/worker/api/grid.d.ts +10 -2
  62. package/src/worker/api/hooks.d.ts +68 -2
  63. package/src/worker/api/lights.d.ts +13 -3
  64. package/src/worker/api/shared.d.ts +12 -2
  65. package/src/worker/sandkit-api.d.ts +2 -1
@@ -5,7 +5,7 @@ import type { terrains } from "../../shared/api/terrains";
5
5
  * `sandkit.api.excavation` — register custom excavation tool dig profiles.
6
6
  * Main thread only.
7
7
  *
8
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.excavation`
8
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
9
9
  */
10
10
  export namespace excavation {
11
11
  /**
@@ -13,7 +13,36 @@ export namespace excavation {
13
13
  *
14
14
  * @param id - Unique profile id (1–128 chars: letters, numbers, `.`, `_`, `:`, `-`).
15
15
  * @param definition - Pattern, power, terrain rules, and profile options.
16
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.excavation.registerProfile`
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const profileId = "example:voidGun";
20
+ * const duneType = api.terrains.getTypeById("dune");
21
+ * const sandType = api.elements.getTypeById("sand");
22
+ *
23
+ * api.excavation.registerProfile(profileId, {
24
+ * power: 8,
25
+ * terrainRules: [
26
+ * {
27
+ * cellType: duneType,
28
+ * outputElementType: sandType,
29
+ * },
30
+ * ],
31
+ * });
32
+ *
33
+ * api.hooks.modify("excavation:prepare", (args) => {
34
+ * if (
35
+ * args.sourceKind !== "projectile"
36
+ * || args.sourceId !== "implosionGun"
37
+ * ) {
38
+ * return;
39
+ * }
40
+ *
41
+ * args.profileId = profileId;
42
+ * });
43
+ * ```
44
+ *
45
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
17
46
  */
18
47
  export function registerProfile(id: string, definition: ExcavationProfileDefinitionV1): void;
19
48
 
@@ -47,7 +76,8 @@ export namespace excavation {
47
76
  cellType: terrains.TerrainRef;
48
77
  /**
49
78
  * @deprecated Use {@link cellType} instead.
50
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias in `api.excavation.registerProfile` terrain rules
79
+ *
80
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
51
81
  */
52
82
  terrainType?: terrains.TerrainRef;
53
83
  /** Damage applied when this rule matches. */
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * Available as `sandkit.api.factory`.
5
5
  *
6
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.factory`
6
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
7
7
  */
8
8
  export namespace factory {
9
9
  /**
10
10
  * Return the current factory level.
11
11
  *
12
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.factory.getLevel`
12
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
13
13
  */
14
14
  export function getLevel(): number;
15
15
 
@@ -17,7 +17,8 @@ export namespace factory {
17
17
  * Return completed count for a factory process.
18
18
  *
19
19
  * @param processId - Built-in factory process id.
20
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.factory.getProcessCount`
20
+ *
21
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
21
22
  */
22
23
  export function getProcessCount(processId: FactoryProcessId): number;
23
24
 
@@ -25,7 +26,8 @@ export namespace factory {
25
26
  * Return completion rate for a factory process.
26
27
  *
27
28
  * @param processId - Built-in factory process id.
28
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.factory.getProcessRate`
29
+ *
30
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
29
31
  */
30
32
  export function getProcessRate(processId: FactoryProcessId): number;
31
33
 
@@ -4,7 +4,7 @@ import { CellCoordinates } from "../../shared/player";
4
4
  * `sandkit.api.fire` — ignite and burn elements at grid cells.
5
5
  * Main thread only.
6
6
  *
7
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.fire`
7
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
8
8
  */
9
9
  export namespace fire {
10
10
  /**
@@ -12,7 +12,8 @@ export namespace fire {
12
12
  *
13
13
  * @param cellX - Grid cell X coordinate.
14
14
  * @param cellY - Grid cell Y coordinate.
15
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.fire.canBurnElementAtCell`
15
+ *
16
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
16
17
  */
17
18
  export function canBurnElementAtCell(...args: CellCoordinates): boolean;
18
19
 
@@ -21,13 +22,15 @@ export namespace fire {
21
22
  *
22
23
  * @param cellX - Grid cell X coordinate.
23
24
  * @param cellY - Grid cell Y coordinate.
24
- * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.fire.burnElementAtCell`
25
+ *
26
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
25
27
  */
26
28
  export function burnElementAtCell(...args: CellCoordinates): void;
27
29
 
28
30
  /**
29
31
  * @deprecated Use {@link burnElementAtCell} instead.
30
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.fire.burnElementAtCell`
32
+ *
33
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
31
34
  */
32
35
  export function burnElementAtCellWhenIdle(...args: CellCoordinates): void;
33
36
  }
@@ -3,14 +3,20 @@
3
3
  *
4
4
  * Available as `sandkit.api.game`.
5
5
  *
6
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.game`
6
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
7
7
  */
8
8
  export namespace game {
9
9
  /**
10
10
  * Start or restart the game session.
11
11
  *
12
12
  * @param options - Optional session start flags.
13
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.game.start`
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * api.game.start({ skipIntro: true });
17
+ * ```
18
+ *
19
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
14
20
  */
15
21
  export function start(options?: GameStartOptions): void;
16
22
 
@@ -8,38 +8,53 @@ import type { terrains } from "./terrains";
8
8
  *
9
9
  * Main thread only.
10
10
  *
11
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid`
11
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
12
12
  */
13
13
  export namespace grid {
14
14
  /**
15
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.getCellIdAtCell`
15
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
16
16
  */
17
17
  export import getCellIdAtCell = shared.api.grid.getCellIdAtCell;
18
18
  /**
19
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.isCellEmptyAtCell`
19
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
20
20
  */
21
21
  export import isCellEmptyAtCell = shared.api.grid.isCellEmptyAtCell;
22
22
  /**
23
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.isTerrainAtCell`
23
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
24
24
  */
25
25
  export import isTerrainAtCell = shared.api.grid.isTerrainAtCell;
26
26
  /**
27
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.reportActivityAtCell`
27
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
28
28
  */
29
29
  export import reportActivityAtCell = shared.api.grid.reportActivityAtCell;
30
30
  /**
31
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.excavateAtCell`
31
+ * @example
32
+ * ```ts
33
+ * api.grid.excavateAtCell(
34
+ * cellX,
35
+ * cellY,
36
+ * { x: 0, y: -120 },
37
+ * 25,
38
+ * );
39
+ * ```
40
+ *
41
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
32
42
  */
33
43
  export import excavateAtCell = shared.api.grid.excavateAtCell;
34
44
  /**
35
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.getDimensions`
45
+ * @example Main entry
46
+ * ```ts
47
+ * const { widthCells, heightCells } = api.grid.getDimensions();
48
+ * ```
49
+ *
50
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
36
51
  */
37
52
  export import getDimensions = shared.api.grid.getDimensions;
38
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.ExcavateOptions` */
53
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
39
54
  export import ExcavateOptions = shared.api.grid.ExcavateOptions;
40
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.CellId` */
55
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
41
56
  export import CellId = shared.api.grid.CellId;
42
- /** @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.GridDimensions` */
57
+ /** @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading) */
43
58
  export import GridDimensions = shared.api.grid.GridDimensions;
44
59
 
45
60
  /**
@@ -47,8 +62,31 @@ export namespace grid {
47
62
  * mutations apply.
48
63
  *
49
64
  * @param callback - Receives a writer for element and terrain cell mutations.
50
- * @see https://sandustry.com/sandkit.html#mutations-heading
51
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.mutate`
65
+ *
66
+ * @example Deferred main-thread mutations
67
+ * ```ts
68
+ * api.grid.mutate((writer) => {
69
+ * if (api.terrains.isTypeAtCell(cellX, cellY, "ice")) {
70
+ * writer.elements.replaceAtCell(cellX, cellY, "water");
71
+ * }
72
+ * });
73
+ * ```
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const waterType = api.elements.getTypeById("water");
78
+ *
79
+ * api.events.on("item:used", ({ itemId, cellX, cellY }) => {
80
+ * if (itemId !== "laser") return;
81
+ *
82
+ * api.grid.mutate((writer) => {
83
+ * if (!api.terrains.isTypeAtCell(cellX, cellY, "ice")) return;
84
+ * writer.elements.replaceAtCell(cellX, cellY, waterType);
85
+ * });
86
+ * });
87
+ * ```
88
+ *
89
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
52
90
  */
53
91
  export function mutate(callback: (writer: GridMutationWriter) => void): void;
54
92
 
@@ -57,7 +95,8 @@ export namespace grid {
57
95
  *
58
96
  * @param cellX - Grid column of the target cell.
59
97
  * @param cellY - Grid row of the target cell.
60
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.revealFogAtCell`
98
+ *
99
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
61
100
  */
62
101
  export function revealFogAtCell(...args: CellCoordinates): void;
63
102
 
@@ -67,7 +106,8 @@ export namespace grid {
67
106
  * @param cellX - Grid column of the target cell.
68
107
  * @param cellY - Grid row of the target cell.
69
108
  * @param rangeCells - Radius in cells to redraw.
70
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.redrawAroundCell`
109
+ *
110
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
71
111
  */
72
112
  export function redrawAroundCell(...args: [...CellCoordinates, rangeCells: number]): void;
73
113
 
@@ -78,7 +118,8 @@ export namespace grid {
78
118
  * @param centerCellY - Circle center cell row.
79
119
  * @param radiusCells - Circle radius in cells.
80
120
  * @param callback - Invoked for each cell with `(cellX, cellY)`.
81
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.forEachCellInCircle`
121
+ *
122
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
82
123
  */
83
124
  export function forEachCellInCircle(centerCellX: number, centerCellY: number, radiusCells: number, callback: (...args: CellCoordinates) => void): void;
84
125
 
@@ -90,13 +131,15 @@ export namespace grid {
90
131
  * @param widthCells - Rectangle width in cells.
91
132
  * @param heightCells - Rectangle height in cells.
92
133
  * @param callback - Invoked for each cell with `(cellX, cellY)`.
93
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.forEachCellInRectangle`
134
+ *
135
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
94
136
  */
95
137
  export function forEachCellInRectangle(...args: [...CellCoordinates, widthCells: number, heightCells: number, callback: (...args: CellCoordinates) => void]): void;
96
138
 
97
139
  /**
98
140
  * @deprecated Use {@link forEachCellInRectangle} instead.
99
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.forEachCellInRectangle`
141
+ *
142
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
100
143
  */
101
144
  export function forEachCellInRect(...args: [...CellCoordinates, widthCells: number, heightCells: number, callback: (...args: CellCoordinates) => void]): void;
102
145
 
@@ -117,7 +160,8 @@ export namespace grid {
117
160
  * @param cellY - Grid row of the target cell.
118
161
  * @param elementTypeOrId - Numeric element type or string id.
119
162
  * @param options - Optional create flags.
120
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.mutate` writer `elements.createAtCell`
163
+ *
164
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
121
165
  */
122
166
  createAtCell(...args: [...CellCoordinates, elementTypeOrId: elements.ElementRef, options?: elements.ElementCreateOptions]): void;
123
167
 
@@ -128,7 +172,8 @@ export namespace grid {
128
172
  * @param cellY - Grid row of the target cell.
129
173
  * @param elementTypeOrId - Numeric element type or string id.
130
174
  * @param options - Optional create flags.
131
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.mutate` writer `elements.replaceAtCell`
175
+ *
176
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
132
177
  */
133
178
  replaceAtCell(...args: [...CellCoordinates, elementTypeOrId: elements.ElementRef, options?: elements.ElementCreateOptions]): void;
134
179
 
@@ -138,7 +183,8 @@ export namespace grid {
138
183
  * @param cellX - Grid column of the target cell.
139
184
  * @param cellY - Grid row of the target cell.
140
185
  * @param options - Optional removal flags.
141
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.mutate` writer `elements.removeAtCell`
186
+ *
187
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
142
188
  */
143
189
  removeAtCell(...args: [...CellCoordinates, options?: elements.ElementRemovalOptions]): void;
144
190
  }
@@ -152,7 +198,8 @@ export namespace grid {
152
198
  * @param cellY - Grid row of the target cell.
153
199
  * @param terrainTypeOrId - Numeric terrain type or string id.
154
200
  * @param options - Optional mutation flags.
155
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.mutate` writer `terrains.createAtCell`
201
+ *
202
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
156
203
  */
157
204
  createAtCell(...args: [...CellCoordinates, terrainTypeOrId: terrains.TerrainRef, options?: terrains.TerrainMutationOptions]): void;
158
205
 
@@ -163,7 +210,8 @@ export namespace grid {
163
210
  * @param cellY - Grid row of the target cell.
164
211
  * @param terrainTypeOrId - Numeric terrain type or string id.
165
212
  * @param options - Optional mutation flags.
166
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.mutate` writer `terrains.replaceAtCell`
213
+ *
214
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
167
215
  */
168
216
  replaceAtCell(...args: [...CellCoordinates, terrainTypeOrId: terrains.TerrainRef, options?: terrains.TerrainMutationOptions]): void;
169
217
 
@@ -173,7 +221,8 @@ export namespace grid {
173
221
  * @param cellX - Grid column of the target cell.
174
222
  * @param cellY - Grid row of the target cell.
175
223
  * @param options - Optional mutation flags.
176
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.mutate` writer `terrains.removeAtCell`
224
+ *
225
+ * @see [Official docs](https://sandustry.com/sandkit.html#mutations-heading)
177
226
  */
178
227
  removeAtCell(...args: [...CellCoordinates, options?: terrains.TerrainMutationOptions]): void;
179
228
  }