@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.
Files changed (68) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/LICENSE +21 -0
  3. package/README.md +8 -19
  4. package/package.json +65 -5
  5. package/src/configs/index.d.ts +38 -0
  6. package/src/configs/modinfo.d.ts +751 -0
  7. package/src/configs/patches.d.ts +195 -0
  8. package/src/sandkit/api/action.d.ts +5 -0
  9. package/src/sandkit/api/blueprints.d.ts +5 -3
  10. package/src/sandkit/api/camera.d.ts +5 -0
  11. package/src/sandkit/api/effects.d.ts +28 -7
  12. package/src/sandkit/api/elements.d.ts +124 -39
  13. package/src/sandkit/api/energy.d.ts +8 -0
  14. package/src/sandkit/api/entities.d.ts +15 -8
  15. package/src/sandkit/api/events.d.ts +139 -2
  16. package/src/sandkit/api/excavation.d.ts +33 -3
  17. package/src/sandkit/api/factory.d.ts +6 -4
  18. package/src/sandkit/api/fire.d.ts +7 -4
  19. package/src/sandkit/api/game.d.ts +8 -2
  20. package/src/sandkit/api/grid.d.ts +72 -23
  21. package/src/sandkit/api/hooks.d.ts +362 -2
  22. package/src/sandkit/api/i18n.d.ts +65 -20
  23. package/src/sandkit/api/input.d.ts +15 -0
  24. package/src/sandkit/api/items.d.ts +7 -0
  25. package/src/sandkit/api/lights.d.ts +55 -8
  26. package/src/sandkit/api/maps.d.ts +10 -1
  27. package/src/sandkit/api/patterns.d.ts +22 -0
  28. package/src/sandkit/api/pickups.d.ts +14 -8
  29. package/src/sandkit/api/pipes.d.ts +9 -5
  30. package/src/sandkit/api/player.d.ts +29 -15
  31. package/src/sandkit/api/progression.d.ts +8 -0
  32. package/src/sandkit/api/reactions.d.ts +11 -0
  33. package/src/sandkit/api/rendering.d.ts +25 -2
  34. package/src/sandkit/api/resources.d.ts +5 -0
  35. package/src/sandkit/api/schedule.d.ts +7 -0
  36. package/src/sandkit/api/settings.d.ts +7 -0
  37. package/src/sandkit/api/shared.d.ts +13 -3
  38. package/src/sandkit/api/signals.d.ts +29 -0
  39. package/src/sandkit/api/sound.d.ts +14 -8
  40. package/src/sandkit/api/structureBehaviors.d.ts +8 -0
  41. package/src/sandkit/api/structures.d.ts +353 -43
  42. package/src/sandkit/api/tech.d.ts +73 -9
  43. package/src/sandkit/api/terrains.d.ts +25 -13
  44. package/src/sandkit/api/triggers.d.ts +10 -0
  45. package/src/sandkit/api/ui.d.ts +146 -1
  46. package/src/sandkit/api/upgrades.d.ts +2 -1
  47. package/src/sandkit/api/utils.d.ts +10 -5
  48. package/src/sandkit/api/world.d.ts +30 -25
  49. package/src/sandkit/index.d.ts +12 -1
  50. package/src/shared/api/elements.d.ts +36 -22
  51. package/src/shared/api/grid.d.ts +11 -6
  52. package/src/shared/api/player.d.ts +8 -4
  53. package/src/shared/api/shared.d.ts +2 -1
  54. package/src/shared/api/structures.d.ts +55 -17
  55. package/src/shared/api/terrains.d.ts +39 -23
  56. package/src/shared/api/ui.d.ts +5 -0
  57. package/src/shared/api/world.d.ts +9 -9
  58. package/src/worker/api/effects.d.ts +11 -3
  59. package/src/worker/api/elements.d.ts +54 -19
  60. package/src/worker/api/events.d.ts +31 -2
  61. package/src/worker/api/fire.d.ts +4 -2
  62. package/src/worker/api/grid.d.ts +10 -2
  63. package/src/worker/api/hooks.d.ts +68 -2
  64. package/src/worker/api/lights.d.ts +13 -3
  65. package/src/worker/api/shared.d.ts +12 -2
  66. package/src/worker/sandkit-api.d.ts +2 -1
  67. package/docs/Changelog.md +0 -46
  68. package/docs/README.md +0 -62
@@ -13,7 +13,32 @@ export namespace lights {
13
13
  * @param worldX - World X coordinate in pixels.
14
14
  * @param worldY - World Y coordinate in pixels.
15
15
  * @param options - Brightness, duration, color, and dedup options.
16
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.lights.temporary.createAtWorld`
16
+ *
17
+ * @example Main entry
18
+ * ```ts
19
+ * const light = api.lights.temporary.createAtWorld(worldX, worldY, {
20
+ * brightness: 1,
21
+ * durationMs: 250,
22
+ * size: 80,
23
+ * });
24
+ * const lightId = light.lightId;
25
+ * ```
26
+ *
27
+ * @example options.durationTicks
28
+ * ```ts
29
+ * api.lights.temporary.createAtWorld(worldX, worldY, {
30
+ * durationTicks: 15,
31
+ * });
32
+ * ```
33
+ *
34
+ * @example options.durationMs
35
+ * ```ts
36
+ * api.lights.temporary.createAtWorld(worldX, worldY, {
37
+ * durationMs: 250,
38
+ * });
39
+ * ```
40
+ *
41
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
17
42
  */
18
43
  export function createAtWorld(worldX: number, worldY: number, options?: TemporaryLightOptions): TemporaryLightHandle;
19
44
 
@@ -21,14 +46,23 @@ export namespace lights {
21
46
  * Remove a temporary light by its id.
22
47
  *
23
48
  * @param lightId - Light id returned from {@link createAtWorld}.
24
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.lights.temporary.removeById`
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * if (light.lightId !== null) {
53
+ * api.lights.temporary.removeById(light.lightId);
54
+ * }
55
+ * ```
56
+ *
57
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
25
58
  */
26
59
  export function removeById(lightId: number): void;
27
60
  }
28
61
 
29
62
  /**
30
63
  * @deprecated Use {@link temporary} instead.
31
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.lights.temporary`
64
+ *
65
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
32
66
  */
33
67
  export import vfx = temporary;
34
68
 
@@ -40,7 +74,17 @@ export namespace lights {
40
74
  * @param worldX - World X coordinate in pixels.
41
75
  * @param worldY - World Y coordinate in pixels.
42
76
  * @param options - Brightness, size, color, and persistence options.
43
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.lights.persistent.createAtWorld`
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const light = api.lights.persistent.createAtWorld(
81
+ * worldX,
82
+ * worldY,
83
+ * { brightness: 1, size: 80 },
84
+ * );
85
+ * ```
86
+ *
87
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
44
88
  */
45
89
  export function createAtWorld(worldX: number, worldY: number, options?: PersistentLightOptions): PersistentLightHandle;
46
90
 
@@ -49,7 +93,8 @@ export namespace lights {
49
93
  *
50
94
  * @param worldX - World X coordinate in pixels.
51
95
  * @param worldY - World Y coordinate in pixels.
52
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.lights.persistent.removeAtWorld`
96
+ *
97
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
53
98
  */
54
99
  export function removeAtWorld(worldX: number, worldY: number): void;
55
100
 
@@ -59,14 +104,15 @@ export namespace lights {
59
104
  * @param worldX - World X coordinate in pixels.
60
105
  * @param worldY - World Y coordinate in pixels.
61
106
  * @param durationMs - Fade duration in milliseconds.
62
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.lights.persistent.fadeAtWorld`
107
+ *
108
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
63
109
  */
64
110
  export function fadeAtWorld(worldX: number, worldY: number, durationMs?: number): void;
65
111
 
66
112
  /**
67
113
  * Mark persistent lights dirty so they are saved on the next flush.
68
114
  *
69
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.lights.persistent.markDirty`
115
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
70
116
  */
71
117
  export function markDirty(): void;
72
118
  }
@@ -77,7 +123,8 @@ export namespace lights {
77
123
  lightId: number | null;
78
124
  /**
79
125
  * @deprecated Use {@link lightId} instead.
80
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias on `api.lights.temporary.createAtWorld` return value
126
+ *
127
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
81
128
  */
82
129
  index: number | null;
83
130
  }
@@ -25,7 +25,16 @@ export namespace maps {
25
25
  /**
26
26
  * Return artifact marker locations for the active map.
27
27
  *
28
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.maps.getArtifactLocations`
28
+ * @example
29
+ * ```ts
30
+ * api.events.on("game:ready", () => {
31
+ * api.maps.getArtifactLocations().forEach(({ cellX, cellY, name }) => {
32
+ * addMarker(cellX, cellY, name);
33
+ * });
34
+ * });
35
+ * ```
36
+ *
37
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
29
38
  */
30
39
  export function getArtifactLocations(): readonly ArtifactLocation[];
31
40
 
@@ -24,6 +24,28 @@ export namespace patterns {
24
24
  * @param outVelocity - Ejection velocity written into this vector.
25
25
  * @param power - Dig strength applied to matched cells.
26
26
  * @param options - Optional excavation source flags.
27
+ *
28
+ * @example Main entry
29
+ * ```ts
30
+ * api.patterns.excavateAtCell(
31
+ * cellX,
32
+ * cellY,
33
+ * api.patterns.createCircle(5),
34
+ * { x: 0, y: -120 },
35
+ * 2,
36
+ * );
37
+ * ```
38
+ *
39
+ * @example Worker entry
40
+ * ```ts
41
+ * api.patterns.excavateAtCell(
42
+ * cellX,
43
+ * cellY,
44
+ * pattern,
45
+ * { x: 0, y: -1 },
46
+ * 10,
47
+ * );
48
+ * ```
27
49
  */
28
50
  export function excavateAtCell(...args: [...CellCoordinates, pattern: number[][], outVelocity: Vector2, power: number, options?: PatternExcavateOptions]): void;
29
51
 
@@ -5,7 +5,7 @@ import type { PickupType as PickupTypeEnum } from "../enums/index";
5
5
  *
6
6
  * Available as `sandkit.api.pickups`.
7
7
  *
8
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pickups`
8
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
9
9
  */
10
10
  export namespace pickups {
11
11
  /** Official pickup type discriminator. */
@@ -13,7 +13,8 @@ export namespace pickups {
13
13
 
14
14
  /**
15
15
  * @deprecated Use {@link PickupType} instead.
16
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.PickupType`
16
+ *
17
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
17
18
  */
18
19
  export type WorldItemType = PickupType;
19
20
 
@@ -45,7 +46,8 @@ export namespace pickups {
45
46
  * @param data - Optional per-item data bag copied onto the instance.
46
47
  * @param light - Optional point light spawned with the pickup.
47
48
  * @returns The spawned pickup instance.
48
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pickups.spawnAtWorld`
49
+ *
50
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
49
51
  */
50
52
  export function spawnAtWorld(type: PickupType, worldX: number, worldY: number, data?: Record<string, unknown>, light?: WorldItemLight): WorldItem;
51
53
 
@@ -53,13 +55,15 @@ export namespace pickups {
53
55
  * Remove a pickup instance from the world.
54
56
  *
55
57
  * @param pickup - Pickup returned from spawn or lookup helpers.
56
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pickups.remove`
58
+ *
59
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
57
60
  */
58
61
  export function remove(pickup: WorldItem): void;
59
62
 
60
63
  /**
61
64
  * @deprecated Use {@link remove} instead.
62
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.remove`
65
+ *
66
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
63
67
  */
64
68
  export function destroy(pickup: WorldItem): void;
65
69
 
@@ -68,14 +72,15 @@ export namespace pickups {
68
72
  *
69
73
  * @param pickup - Pickup to collect.
70
74
  * @returns True when the item was collected.
71
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pickups.pickUp`
75
+ *
76
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
72
77
  */
73
78
  export function pickUp(pickup: WorldItem): boolean;
74
79
 
75
80
  /**
76
81
  * Return all active pickups.
77
82
  *
78
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pickups.getAll`
83
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
79
84
  */
80
85
  export function getAll(): WorldItem[];
81
86
 
@@ -83,7 +88,8 @@ export namespace pickups {
83
88
  * Return a pickup by numeric id.
84
89
  *
85
90
  * @param pickupId - Runtime pickup id.
86
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pickups.getById`
91
+ *
92
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
87
93
  */
88
94
  export function getById(pickupId: number): WorldItem | undefined;
89
95
  }
@@ -5,7 +5,7 @@ import type { CellCoordinates } from "../../shared/player";
5
5
  *
6
6
  * Available as `sandkit.api.pipes`.
7
7
  *
8
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pipes`
8
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
9
9
  */
10
10
  export namespace pipes {
11
11
  /**
@@ -13,7 +13,8 @@ export namespace pipes {
13
13
  *
14
14
  * @param cellX - Grid column of the target cell.
15
15
  * @param cellY - Grid row of the target cell.
16
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pipes.isAtCell`
16
+ *
17
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
17
18
  */
18
19
  export function isAtCell(...args: CellCoordinates): boolean;
19
20
 
@@ -22,7 +23,8 @@ export namespace pipes {
22
23
  *
23
24
  * @param cellX - Grid column of the target cell.
24
25
  * @param cellY - Grid row of the target cell.
25
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pipes.isEnabledAtCell`
26
+ *
27
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
26
28
  */
27
29
  export function isEnabledAtCell(...args: CellCoordinates): boolean;
28
30
 
@@ -31,7 +33,8 @@ export namespace pipes {
31
33
  *
32
34
  * @param cellX - Grid column of the target cell.
33
35
  * @param cellY - Grid row of the target cell.
34
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pipes.getConnectedVentsAtCell`
36
+ *
37
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
35
38
  */
36
39
  export function getConnectedVentsAtCell(...args: CellCoordinates): readonly PipeVentCell[];
37
40
 
@@ -41,7 +44,8 @@ export namespace pipes {
41
44
  * @param cellX - Grid column of the target cell.
42
45
  * @param cellY - Grid row of the target cell.
43
46
  * @param enabled - Desired enabled state.
44
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.pipes.setEnabledAtCell`
47
+ *
48
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
45
49
  */
46
50
  export function setEnabledAtCell(...args: [...CellCoordinates, enabled: boolean]): void;
47
51
 
@@ -18,7 +18,8 @@ export namespace player {
18
18
 
19
19
  /**
20
20
  * @deprecated Use {@link getPositionAtWorld} instead.
21
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.player.getPositionAtWorld`
21
+ *
22
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
22
23
  */
23
24
  export import getWorldPosition = shared.api.player.getWorldPosition;
24
25
 
@@ -27,13 +28,15 @@ export namespace player {
27
28
  *
28
29
  * @param worldX - World x position in pixels.
29
30
  * @param worldY - World y position in pixels.
30
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.setPositionAtWorld`
31
+ *
32
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
31
33
  */
32
34
  export function setPositionAtWorld(worldX: number, worldY: number): void;
33
35
 
34
36
  /**
35
37
  * @deprecated Use {@link setPositionAtWorld} instead.
36
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.player.setPositionAtWorld`
38
+ *
39
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
37
40
  */
38
41
  export function setWorldPosition(worldX: number, worldY: number): void;
39
42
 
@@ -42,7 +45,8 @@ export namespace player {
42
45
  *
43
46
  * @param velocityX - Horizontal velocity in pixels per second.
44
47
  * @param velocityY - Vertical velocity in pixels per second.
45
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.setVelocity`
48
+ *
49
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
46
50
  */
47
51
  export function setVelocity(velocityX: number, velocityY: number): void;
48
52
 
@@ -51,7 +55,8 @@ export namespace player {
51
55
  *
52
56
  * @param multiplier - Speed scale factor (`1` is default walk). `0` freezes movement.
53
57
  * Vanilla Sprint Boost (Shift burst + meter) only runs when this value is exactly `1`.
54
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.setMovementSpeedMultiplier`
58
+ *
59
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
55
60
  */
56
61
  export function setMovementSpeedMultiplier(multiplier: number): void;
57
62
 
@@ -60,7 +65,8 @@ export namespace player {
60
65
  *
61
66
  * @param mode - `"normal"` for default physics, or `"hover"` for hover flight.
62
67
  * @returns True when the mode changes.
63
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.setMovementMode`
68
+ *
69
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
64
70
  */
65
71
  export function setMovementMode(mode: 'normal' | 'hover'): boolean;
66
72
 
@@ -70,14 +76,15 @@ export namespace player {
70
76
  * on the store snapshot — that flag is not updated during play.
71
77
  *
72
78
  * @returns True when the player touches solid ground.
73
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.isOnGround`
79
+ *
80
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
74
81
  */
75
82
  export function isOnGround(): boolean;
76
83
 
77
84
  /**
78
85
  * Move the player down until ground is found.
79
86
  *
80
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.teleportToGround`
87
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
81
88
  */
82
89
  export function teleportToGround(): void;
83
90
 
@@ -87,13 +94,15 @@ export namespace player {
87
94
  * @param worldX - World x position in pixels to test.
88
95
  * @param worldY - World y position in pixels to test.
89
96
  * @returns True when the player hitbox fits at the position.
90
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.isPositionClearAtWorld`
97
+ *
98
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
91
99
  */
92
100
  export function isPositionClearAtWorld(worldX: number, worldY: number): boolean;
93
101
 
94
102
  /**
95
103
  * @deprecated Use {@link isPositionClearAtWorld} instead.
96
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.player.isPositionClearAtWorld`
104
+ *
105
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
97
106
  */
98
107
  export function isWorldPositionClear(worldX: number, worldY: number): boolean;
99
108
 
@@ -103,13 +112,15 @@ export namespace player {
103
112
  * Add an item to inventory by item id.
104
113
  *
105
114
  * @param itemId - Registered item id string.
106
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.inventory.addById`
115
+ *
116
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
107
117
  */
108
118
  export function addById(itemId: string): void;
109
119
 
110
120
  /**
111
121
  * @deprecated Use {@link addById} instead.
112
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.player.inventory.addById`
122
+ *
123
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
113
124
  */
114
125
  export function addFromId(itemId: string): void;
115
126
  }
@@ -120,13 +131,15 @@ export namespace player {
120
131
  * Unlock a structure type for building.
121
132
  *
122
133
  * @param structureId - Registered structure id string.
123
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.buildings.unlockById`
134
+ *
135
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
124
136
  */
125
137
  export function unlockById(structureId: string): void;
126
138
 
127
139
  /**
128
140
  * @deprecated Use {@link unlockById} instead.
129
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.player.buildings.unlockById`
141
+ *
142
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
130
143
  */
131
144
  export function unlockByType(structureId: string): void;
132
145
 
@@ -134,7 +147,8 @@ export namespace player {
134
147
  * Remove a structure unlock from the player.
135
148
  *
136
149
  * @param structureId - Registered structure id string.
137
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.buildings.removeById`
150
+ *
151
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
138
152
  */
139
153
  export function removeById(structureId: string): void;
140
154
  }
@@ -10,6 +10,14 @@ export namespace progression {
10
10
  /**
11
11
  * Mark a progression step complete. Return true when completion succeeds.
12
12
  * @param request - Progression id and optional metadata for the step.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const completed = api.progression.complete({
17
+ * domain: "objective",
18
+ * id: "all",
19
+ * });
20
+ * ```
13
21
  */
14
22
  export function complete(request: ProgressionCompletionRequestV1): boolean;
15
23
 
@@ -11,6 +11,17 @@ export namespace reactions {
11
11
  /**
12
12
  * Register a contact reaction between elements.
13
13
  * @param definition - Contact recipe inputs, outputs, and orientation.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * api.reactions.registerContact({
18
+ * inputA: "water",
19
+ * inputB: "examplePowder",
20
+ * outputA: "steam",
21
+ * outputB: null,
22
+ * orientation: "any",
23
+ * });
24
+ * ```
14
25
  */
15
26
  export function registerContact(definition: ContactRecipeDefinitionV1): void;
16
27
 
@@ -19,16 +19,39 @@ export namespace rendering {
19
19
  *
20
20
  * @param worldX - World x position in pixels.
21
21
  * @param worldY - World y position in pixels.
22
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.rendering.getDrawPositionAtWorld`
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * api.events.on("frame:render", () => {
26
+ * const drawPos = api.rendering.getDrawPositionAtWorld(worldX, worldY);
27
+ * drawMarker(drawPos.x, drawPos.y);
28
+ * });
29
+ * ```
30
+ *
31
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
23
32
  */
24
33
  export function getDrawPositionAtWorld(worldX: number, worldY: number): Vector2;
25
- /** Return cell size and snap grid metrics. */
34
+ /**
35
+ * Return cell size and snap grid metrics.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const { cellSize, snapGridCellSize } = api.rendering.getGridMetrics();
40
+ * ```
41
+ */
26
42
  export function getGridMetrics(): { cellSize: number; snapGridCellSize: number; };
27
43
  /** Return overlay viewport width and height in pixels. */
28
44
  export function getOverlayViewportSize(): { width: number; height: number; };
29
45
  /**
30
46
  * Run a callback with the overlay canvas context.
31
47
  * @param callback - Receives the overlay 2D context; return value is passed through.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * api.rendering.withOverlayContext((context) => {
52
+ * context.fillRect(0, 0, 16, 16);
53
+ * });
54
+ * ```
32
55
  */
33
56
  export function withOverlayContext<T>(callback: (context: CanvasRenderingContext2D) => T): T;
34
57
  }
@@ -18,6 +18,11 @@ export namespace resources {
18
18
  * Update stored energy by amount with optional UI deferral.
19
19
  * @param amount - Energy delta (positive or negative).
20
20
  * @param options - When `deferUi` is true, skip immediate UI refresh.
21
+ *
22
+ * @example Official `api.resources.adjustEnergy` (typed deprecated alias: updateEnergy)
23
+ * ```ts
24
+ * api.resources.adjustEnergy(100, { deferUi: true });
25
+ * ```
21
26
  */
22
27
  export function updateEnergy(amount: number, options?: { deferUi?: boolean; }): void;
23
28
  }
@@ -9,6 +9,13 @@ export namespace schedule {
9
9
  /**
10
10
  * Run a callback on the next game tick.
11
11
  * @param callback - Function invoked once on the next tick.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * api.schedule.nextTick(() => {
16
+ * runDeferredWork();
17
+ * });
18
+ * ```
12
19
  */
13
20
  export function nextTick(callback: () => void): void;
14
21
  }
@@ -18,6 +18,13 @@ export namespace settings {
18
18
  /**
19
19
  * Subscribe to settings changes. Return an unsubscribe function.
20
20
  * @param callback - Called with the full settings map after a change.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const unsubscribe = api.settings.onChange((values) => {
25
+ * applySettings(values);
26
+ * });
27
+ * ```
21
28
  */
22
29
  export function onChange(callback: (values: Readonly<Record<string, ConfigValueV1>>) => void): () => void;
23
30
 
@@ -16,20 +16,30 @@ export namespace shared {
16
16
  *
17
17
  * @param key - Buffer name shared across threads.
18
18
  * @param config - Typed array kind and element count.
19
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.shared.buffers.ensure`
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const counts = api.shared.buffers.ensure("counts", {
23
+ * type: "uint32",
24
+ * length: 4,
25
+ * });
26
+ * ```
27
+ *
28
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
20
29
  */
21
30
  export function ensure(key: string, config: { type: SharedArrayType; length: number; }): SharedArray;
22
31
 
23
32
  /**
24
33
  * @deprecated Use {@link ensure} instead.
25
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.shared.buffers.ensure`
34
+ *
35
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
26
36
  */
27
37
  export function create(key: string, config: { type: SharedArrayType; length: number; }): SharedArray;
28
38
 
29
39
  /**
30
40
  * Look up a named shared buffer without creating it.
31
41
  *
32
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.shared.buffers.get`
42
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
33
43
  */
34
44
  export import get = sharedApi.api.shared.buffers.get;
35
45
  }
@@ -4,6 +4,28 @@
4
4
  * Available as `sandkit.api.signals`.
5
5
  *
6
6
  * @module
7
+ *
8
+ * @example api.signals.interactables.register
9
+ * ```ts
10
+ * api.signals.interactables.register("exampleLever", (structure) => {
11
+ * structure.data.on = !structure.data.on;
12
+ * api.structures.update(structure);
13
+ * });
14
+ * ```
15
+ *
16
+ * @example api.signals.registerSenderType
17
+ * ```ts
18
+ * api.signals.registerSenderType("exampleSensor", (structure) => {
19
+ * return structure.data.charge >= structure.data.threshold;
20
+ * });
21
+ * ```
22
+ *
23
+ * @example api.signals.setOutputAtCell
24
+ * ```ts
25
+ * api.structures.forEachOfType("exampleSensor", (structure) => {
26
+ * api.signals.setOutputAtCell(structure.x, structure.y, structure.data.active);
27
+ * });
28
+ * ```
7
29
  */
8
30
  export namespace signals {
9
31
  /** Signal target registration for structure types. */
@@ -12,6 +34,13 @@ export namespace signals {
12
34
  * Register a handler when a signal targets a structure type.
13
35
  * @param structureTypeOrId - Structure type id or enum value.
14
36
  * @param apply - Called when a signal reaches a matching structure.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * api.signals.targets.register("exampleMachine", (structure, payload) => {
41
+ * api.structures.processing.setEnabledAtCell(structure.x, structure.y, payload.combined);
42
+ * });
43
+ * ```
15
44
  */
16
45
  export function register(structureTypeOrId: string | StructureType, apply: (structure: Structure, payload: SignalTargetPayloadV1) => void): void;
17
46
  }