@sandustry-modding/types 0.1.0 → 0.3.1

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 (152) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/LICENSE +21 -0
  3. package/README.md +28 -18
  4. package/package.json +62 -11
  5. package/src/sandkit/api/blueprints.d.ts +33 -0
  6. package/src/sandkit/api/effects.d.ts +127 -0
  7. package/src/sandkit/api/elements.d.ts +385 -0
  8. package/src/sandkit/api/entities.d.ts +79 -0
  9. package/src/sandkit/api/events.d.ts +137 -0
  10. package/src/sandkit/api/excavation.d.ts +58 -0
  11. package/src/sandkit/api/factory.d.ts +38 -0
  12. package/src/sandkit/api/fire.d.ts +33 -0
  13. package/src/sandkit/api/game.d.ts +22 -0
  14. package/src/sandkit/api/grid.d.ts +180 -0
  15. package/src/sandkit/api/hooks.d.ts +357 -0
  16. package/{sandkit → src/sandkit}/api/i18n.d.ts +80 -4
  17. package/{sandkit → src/sandkit}/api/index.d.ts +6 -0
  18. package/src/sandkit/api/lights.d.ts +101 -0
  19. package/{sandkit → src/sandkit}/api/maps.d.ts +15 -0
  20. package/src/sandkit/api/pickups.d.ts +89 -0
  21. package/src/sandkit/api/pipes.d.ts +54 -0
  22. package/src/sandkit/api/player.d.ts +141 -0
  23. package/{sandkit → src/sandkit}/api/rendering.d.ts +8 -0
  24. package/{sandkit → src/sandkit}/api/sandkit-api.d.ts +19 -2
  25. package/src/sandkit/api/shared.d.ts +41 -0
  26. package/{sandkit → src/sandkit}/api/sound.d.ts +32 -2
  27. package/{sandkit → src/sandkit}/api/structures.d.ts +171 -18
  28. package/{sandkit → src/sandkit}/api/tech.d.ts +54 -1
  29. package/src/sandkit/api/terrains.d.ts +147 -0
  30. package/{sandkit → src/sandkit}/api/upgrades.d.ts +9 -0
  31. package/{sandkit → src/sandkit}/api/utils.d.ts +19 -2
  32. package/src/sandkit/api/world.d.ts +105 -0
  33. package/{sandkit → src/sandkit}/enums/index.d.ts +14 -0
  34. package/{shared → src/shared}/api/elements.d.ts +84 -12
  35. package/{shared/api/world.d.ts → src/shared/api/grid.d.ts} +29 -3
  36. package/{shared → src/shared}/api/player.d.ts +12 -0
  37. package/{shared → src/shared}/api/shared.d.ts +5 -3
  38. package/{shared → src/shared}/api/structures.d.ts +46 -0
  39. package/src/shared/api/terrains.d.ts +231 -0
  40. package/src/shared/api/world.d.ts +43 -0
  41. package/{shared → src/shared}/index.d.ts +2 -0
  42. package/src/worker/api/effects.d.ts +52 -0
  43. package/src/worker/api/elements.d.ts +266 -0
  44. package/src/worker/api/events.d.ts +75 -0
  45. package/src/worker/api/fire.d.ts +29 -0
  46. package/src/worker/api/grid.d.ts +45 -0
  47. package/src/worker/api/hooks.d.ts +111 -0
  48. package/src/worker/api/lights.d.ts +43 -0
  49. package/{worker → src/worker}/api/shared.d.ts +8 -3
  50. package/{worker → src/worker}/index.d.ts +8 -5
  51. package/{worker → src/worker}/sandkit-api.d.ts +12 -3
  52. package/sandkit/api/effects.d.ts +0 -76
  53. package/sandkit/api/elements.d.ts +0 -237
  54. package/sandkit/api/events.d.ts +0 -53
  55. package/sandkit/api/excavation.d.ts +0 -34
  56. package/sandkit/api/fire.d.ts +0 -26
  57. package/sandkit/api/grid.d.ts +0 -26
  58. package/sandkit/api/hooks.d.ts +0 -52
  59. package/sandkit/api/lights.d.ts +0 -66
  60. package/sandkit/api/player.d.ts +0 -84
  61. package/sandkit/api/shared.d.ts +0 -27
  62. package/sandkit/api/terrains.d.ts +0 -125
  63. package/sandkit/api/world.d.ts +0 -107
  64. package/shared/api/terrains.d.ts +0 -100
  65. package/worker/api/elements.d.ts +0 -60
  66. /package/{global.d.ts → src/global.d.ts} +0 -0
  67. /package/{sandkit → src/sandkit}/api/action.d.ts +0 -0
  68. /package/{sandkit → src/sandkit}/api/assets.d.ts +0 -0
  69. /package/{sandkit → src/sandkit}/api/authorization.d.ts +0 -0
  70. /package/{sandkit → src/sandkit}/api/building.d.ts +0 -0
  71. /package/{sandkit → src/sandkit}/api/camera.d.ts +0 -0
  72. /package/{sandkit → src/sandkit}/api/collector.d.ts +0 -0
  73. /package/{sandkit → src/sandkit}/api/constants.d.ts +0 -0
  74. /package/{sandkit → src/sandkit}/api/cooldown.d.ts +0 -0
  75. /package/{sandkit → src/sandkit}/api/discoveries.d.ts +0 -0
  76. /package/{sandkit → src/sandkit}/api/energy.d.ts +0 -0
  77. /package/{sandkit → src/sandkit}/api/gameconfig.d.ts +0 -0
  78. /package/{sandkit → src/sandkit}/api/input.d.ts +0 -0
  79. /package/{sandkit → src/sandkit}/api/items.d.ts +0 -0
  80. /package/{sandkit → src/sandkit}/api/mods.d.ts +0 -0
  81. /package/{sandkit → src/sandkit}/api/patterns.d.ts +0 -0
  82. /package/{sandkit → src/sandkit}/api/processing.d.ts +0 -0
  83. /package/{sandkit → src/sandkit}/api/progression.d.ts +0 -0
  84. /package/{sandkit → src/sandkit}/api/projectiles.d.ts +0 -0
  85. /package/{sandkit → src/sandkit}/api/random.d.ts +0 -0
  86. /package/{sandkit → src/sandkit}/api/raycast.d.ts +0 -0
  87. /package/{sandkit → src/sandkit}/api/reactions.d.ts +0 -0
  88. /package/{sandkit → src/sandkit}/api/resources.d.ts +0 -0
  89. /package/{sandkit → src/sandkit}/api/scene.d.ts +0 -0
  90. /package/{sandkit → src/sandkit}/api/schedule.d.ts +0 -0
  91. /package/{sandkit → src/sandkit}/api/settings.d.ts +0 -0
  92. /package/{sandkit → src/sandkit}/api/signals.d.ts +0 -0
  93. /package/{sandkit → src/sandkit}/api/sprites.d.ts +0 -0
  94. /package/{sandkit → src/sandkit}/api/storage.d.ts +0 -0
  95. /package/{sandkit → src/sandkit}/api/structureBehaviors.d.ts +0 -0
  96. /package/{sandkit → src/sandkit}/api/time.d.ts +0 -0
  97. /package/{sandkit → src/sandkit}/api/tools.d.ts +0 -0
  98. /package/{sandkit → src/sandkit}/api/triggers.d.ts +0 -0
  99. /package/{sandkit → src/sandkit}/api/ui.d.ts +0 -0
  100. /package/{sandkit → src/sandkit}/api/workers.d.ts +0 -0
  101. /package/{sandkit → src/sandkit}/engine/api/augments.d.ts +0 -0
  102. /package/{sandkit → src/sandkit}/engine/api/auralite.d.ts +0 -0
  103. /package/{sandkit → src/sandkit}/engine/api/blueprints.d.ts +0 -0
  104. /package/{sandkit → src/sandkit}/engine/api/clipboard.d.ts +0 -0
  105. /package/{sandkit → src/sandkit}/engine/api/colorPicker.d.ts +0 -0
  106. /package/{sandkit → src/sandkit}/engine/api/coloringTool.d.ts +0 -0
  107. /package/{sandkit → src/sandkit}/engine/api/conveyors.d.ts +0 -0
  108. /package/{sandkit → src/sandkit}/engine/api/debug.d.ts +0 -0
  109. /package/{sandkit → src/sandkit}/engine/api/drones.d.ts +0 -0
  110. /package/{sandkit → src/sandkit}/engine/api/entities.d.ts +0 -0
  111. /package/{sandkit → src/sandkit}/engine/api/extensions.d.ts +0 -0
  112. /package/{sandkit → src/sandkit}/engine/api/factory.d.ts +0 -0
  113. /package/{sandkit → src/sandkit}/engine/api/foliage.d.ts +0 -0
  114. /package/{sandkit → src/sandkit}/engine/api/foundationColorPicker.d.ts +0 -0
  115. /package/{sandkit → src/sandkit}/engine/api/game.d.ts +0 -0
  116. /package/{sandkit → src/sandkit}/engine/api/heatTransfer.d.ts +0 -0
  117. /package/{sandkit → src/sandkit}/engine/api/index.d.ts +0 -0
  118. /package/{sandkit → src/sandkit}/engine/api/launchers.d.ts +0 -0
  119. /package/{sandkit → src/sandkit}/engine/api/lightColorPicker.d.ts +0 -0
  120. /package/{sandkit → src/sandkit}/engine/api/matters.d.ts +0 -0
  121. /package/{sandkit → src/sandkit}/engine/api/misc.d.ts +0 -0
  122. /package/{sandkit → src/sandkit}/engine/api/portals.d.ts +0 -0
  123. /package/{sandkit → src/sandkit}/engine/api/prefabData.d.ts +0 -0
  124. /package/{sandkit → src/sandkit}/engine/api/prefabDecor.d.ts +0 -0
  125. /package/{sandkit → src/sandkit}/engine/api/prefabulator.d.ts +0 -0
  126. /package/{sandkit → src/sandkit}/engine/api/prismaline.d.ts +0 -0
  127. /package/{sandkit → src/sandkit}/engine/api/prismite.d.ts +0 -0
  128. /package/{sandkit → src/sandkit}/engine/api/queue.d.ts +0 -0
  129. /package/{sandkit → src/sandkit}/engine/api/shadows.d.ts +0 -0
  130. /package/{sandkit → src/sandkit}/engine/api/strataform.d.ts +0 -0
  131. /package/{sandkit → src/sandkit}/engine/api/swarmConsole.d.ts +0 -0
  132. /package/{sandkit → src/sandkit}/engine/api/sweeperDrone.d.ts +0 -0
  133. /package/{sandkit → src/sandkit}/engine/api/teleportZones.d.ts +0 -0
  134. /package/{sandkit → src/sandkit}/engine/api/tutorialBuild.d.ts +0 -0
  135. /package/{sandkit → src/sandkit}/engine/api/usageTracker.d.ts +0 -0
  136. /package/{sandkit → src/sandkit}/engine/api/wall.d.ts +0 -0
  137. /package/{sandkit → src/sandkit}/engine/api/workerLocal.d.ts +0 -0
  138. /package/{sandkit → src/sandkit}/engine/index.d.ts +0 -0
  139. /package/{sandkit → src/sandkit}/engine/retro-console.d.ts +0 -0
  140. /package/{sandkit → src/sandkit}/engine/state.d.ts +0 -0
  141. /package/{sandkit → src/sandkit}/index.d.ts +0 -0
  142. /package/{sandkit → src/sandkit}/react.d.ts +0 -0
  143. /package/{shared → src/shared}/api/effects.d.ts +0 -0
  144. /package/{shared → src/shared}/api/maps.d.ts +0 -0
  145. /package/{shared → src/shared}/api/ui.d.ts +0 -0
  146. /package/{shared → src/shared}/asset.d.ts +0 -0
  147. /package/{shared → src/shared}/engine.d.ts +0 -0
  148. /package/{shared → src/shared}/jsonvalue.d.ts +0 -0
  149. /package/{shared → src/shared}/nominal.d.ts +0 -0
  150. /package/{shared → src/shared}/player.d.ts +0 -0
  151. /package/{worker → src/worker}/api/main.d.ts +0 -0
  152. /package/{worker → src/worker}/api/worker.d.ts +0 -0
@@ -8,24 +8,36 @@ import type { CellCoordinates, Vector2 } from "../../shared/player";
8
8
  export namespace player {
9
9
  /**
10
10
  * Return the player center position in world pixels.
11
+ *
11
12
  * @returns World position as `{ x, y }` in pixels.
13
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.getPositionAtWorld`
14
+ */
15
+ export function getPositionAtWorld(): Vector2;
16
+
17
+ /**
18
+ * @deprecated Use {@link getPositionAtWorld} instead.
19
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.player.getPositionAtWorld`
12
20
  */
13
21
  export function getWorldPosition(): Vector2;
14
22
 
15
23
  /**
16
24
  * Return true when the player hitbox overlaps the cell.
25
+ *
17
26
  * @param cellX - Grid column of the cell.
18
27
  * @param cellY - Grid row of the cell.
19
28
  * @returns True when the player overlaps the cell.
29
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.isCollidingWithCell`
20
30
  */
21
31
  export function isCollidingWithCell(...args: CellCoordinates): boolean;
22
32
 
23
33
  /**
24
34
  * Return true when the player is within `radius` cells of the point.
35
+ *
25
36
  * @param cellX - Grid column of the reference cell.
26
37
  * @param cellY - Grid row of the reference cell.
27
38
  * @param radius - Maximum distance in cells (inclusive).
28
39
  * @returns True when the player is inside the radius.
40
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.player.isWithinRadiusOfCell`
29
41
  */
30
42
  export function isWithinRadiusOfCell(...args: [...CellCoordinates, radius: number]): boolean;
31
43
  }
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * Shared `sandkit.api.shared` base — cross-thread shared memory buffers.
3
3
  *
4
- * Main thread uses {@link shared.buffers.get} and `create`. Workers extend this
5
- * with `require` in worker `sandkit.api.shared`.
4
+ * Main thread uses {@link shared.buffers.get} and {@link shared.buffers.ensure}.
5
+ * Workers extend this with `require` in worker `sandkit.api.shared`.
6
6
  *
7
7
  * @internal Base namespace reused by main and worker declarations.
8
8
  */
9
9
  export namespace shared {
10
- /** Named shared memory buffers (`create` / `get` on main; `require` on workers). */
10
+ /** Named shared memory buffers (`ensure` / `get` on main; `require` on workers). */
11
11
  export namespace buffers {
12
12
  /**
13
13
  * Look up a named shared buffer without creating it.
14
+ *
14
15
  * @param key - Buffer name shared across threads.
15
16
  * @returns The typed array, or `undefined` when the buffer does not exist.
17
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.shared.buffers.get`
16
18
  */
17
19
  export function get(key: string): SharedArray | undefined;
18
20
  }
@@ -10,96 +10,134 @@ import type { StructureType as StructureTypeEnum } from "../../sandkit/enums/ind
10
10
  export namespace structures {
11
11
  /**
12
12
  * Invoke a callback for every structure of the given type.
13
+ *
13
14
  * @param structureTypeOrId - Structure type value or string id.
14
15
  * @param callback - Called once per matching structure instance.
16
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.forEachOfType`
15
17
  */
16
18
  export function forEachOfType(structureTypeOrId: StructureRef, callback: (structure: Structure) => void): void;
17
19
 
18
20
  /**
19
21
  * Return the structure at a cell, or null when none.
22
+ *
20
23
  * @param cellX - Grid column of the target cell.
21
24
  * @param cellY - Grid row of the target cell.
25
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.getAtCell`
22
26
  */
23
27
  export function getAtCell(...args: CellCoordinates): Structure | null;
24
28
 
25
29
  /**
26
30
  * Return the mod-registered or built-in definition for a structure type.
31
+ *
27
32
  * @param structureType - Structure type value or string id.
33
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.getDefinitionByType`
28
34
  */
29
35
  export function getDefinitionByType(structureType: StructureRef): any;
30
36
 
31
37
  /**
32
38
  * Map a structure string id to its runtime type value.
39
+ *
33
40
  * @param structureId - Structure string id.
41
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.getTypeById`
42
+ */
43
+ export function getTypeById(structureId: StructureId): StructureType;
44
+
45
+ /**
46
+ * @deprecated Use {@link getTypeById} instead.
47
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.getTypeById`
34
48
  */
35
49
  export function getTypeFromId(structureId: StructureId): StructureType;
36
50
 
37
51
  /**
38
52
  * Return true when a completed structure occupies the cell.
53
+ *
39
54
  * @param cellX - Grid column of the target cell.
40
55
  * @param cellY - Grid row of the target cell.
56
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.hasBuiltAtCell`
41
57
  */
42
58
  export function hasBuiltAtCell(...args: CellCoordinates): boolean;
43
59
 
44
60
  /**
45
61
  * Return true when the structure matches the given id.
62
+ *
46
63
  * @param structure - Structure instance, or null.
47
64
  * @param structureId - Structure string id to compare.
65
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.isType`
48
66
  */
49
67
  export function isType(structure: Structure | null, structureId: StructureId): boolean;
50
68
 
51
69
  /**
52
70
  * Return true when the cell structure matches the given id.
71
+ *
53
72
  * @param cellX - Grid column of the target cell.
54
73
  * @param cellY - Grid row of the target cell.
55
74
  * @param structureId - Structure string id to compare.
75
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.isTypeAtCell`
56
76
  */
57
77
  export function isTypeAtCell(...args: [...CellCoordinates, structureId: StructureId]): boolean;
58
78
 
59
79
  /**
60
80
  * Set the spritesheet frame index on a structure instance.
81
+ *
61
82
  * @param structure - Target structure instance.
62
83
  * @param index - Spritesheet frame index.
84
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.setSpritesheetIndex`
63
85
  */
64
86
  export function setSpritesheetIndex(structure: Structure, index: number): void;
65
87
 
66
88
  /**
67
89
  * Set spritesheet frame index for the structure at a cell.
90
+ *
68
91
  * @param cellX - Grid column of the target cell.
69
92
  * @param cellY - Grid row of the target cell.
70
93
  * @param index - Spritesheet frame index.
94
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.setSpritesheetIndexAtCell`
71
95
  */
72
96
  export function setSpritesheetIndexAtCell(...args: [...CellCoordinates, index: number]): void;
73
97
 
74
98
  /**
75
99
  * Pick spritesheet index from a value and threshold table on a structure.
100
+ *
76
101
  * @param structure - Target structure instance.
77
102
  * @param value - Numeric value mapped through thresholds.
78
103
  * @param thresholds - Ascending threshold values.
104
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.setSpritesheetIndexByValue`
79
105
  */
80
106
  export function setSpritesheetIndexByValue(structure: Structure, value: number, thresholds: number[]): void;
81
107
 
82
108
  /**
83
109
  * Same as {@link setSpritesheetIndexByValue} for the structure at a cell.
110
+ *
84
111
  * @param cellX - Grid column of the target cell.
85
112
  * @param cellY - Grid row of the target cell.
86
113
  * @param value - Numeric value mapped through thresholds.
87
114
  * @param thresholds - Ascending threshold values.
115
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.setSpritesheetIndexByValueAtCell`
88
116
  */
89
117
  export function setSpritesheetIndexByValueAtCell(...args: [...CellCoordinates, value: number, thresholds: number[]]): void;
90
118
 
91
119
  /**
92
120
  * Push structure field changes to simulation.
121
+ *
93
122
  * @param structure - Structure instance to update.
94
123
  * @param options - When `propagateToWorkers` is true, sync to worker threads.
124
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.update`
95
125
  */
96
126
  export function update(structure: Structure, options?: { propagateToWorkers?: boolean; }): void;
97
127
 
98
128
  /**
99
129
  * Merge partial data onto a structure.
130
+ *
100
131
  * @param structure - Structure instance to update.
101
132
  * @param partial - Fields to merge onto `structure.data`.
102
133
  * @param options - When `propagateToWorkers` is true, sync to worker threads.
134
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.updateData`
135
+ */
136
+ export function updateData(structure: Structure, partial: any, options?: { propagateToWorkers?: boolean; }): void;
137
+
138
+ /**
139
+ * @deprecated Use {@link updateData} instead.
140
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.updateData`
103
141
  */
104
142
  export function setData(structure: Structure, partial: any, options?: { propagateToWorkers?: boolean; }): void;
105
143
 
@@ -107,8 +145,16 @@ export namespace structures {
107
145
  export namespace processing {
108
146
  /**
109
147
  * Return true when processing is enabled at the cell.
148
+ *
110
149
  * @param cellX - Grid column of the target cell.
111
150
  * @param cellY - Grid row of the target cell.
151
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Worker entry `api.structures.processing.isEnabledAtCell`
152
+ */
153
+ export function isEnabledAtCell(...args: CellCoordinates): boolean;
154
+
155
+ /**
156
+ * @deprecated Use {@link isEnabledAtCell} instead.
157
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.processing.isEnabledAtCell`
112
158
  */
113
159
  export function isEnabledAt(...args: CellCoordinates): boolean;
114
160
  }
@@ -0,0 +1,231 @@
1
+ import type { CellCoordinates } from "../../shared/player";
2
+ import type { CellId, LooseString, TaggedNumber } from "../nominal";
3
+ import type { CellType as CellTypeEnum } from "../../sandkit/enums/index";
4
+ import type { elements } from "./elements";
5
+
6
+ /**
7
+ * Shared `sandkit.api.terrains` base — terrain type lookup and cell mutation.
8
+ *
9
+ * Worker-entry mutations are immediate. Main thread defers matching helpers in
10
+ * `sandkit.api.terrains`.
11
+ *
12
+ * @internal Base namespace reused by main and worker declarations.
13
+ */
14
+ export namespace terrains {
15
+ /**
16
+ * Terrain definition shape for {@link register} and {@link getDefinitionByType}.
17
+ *
18
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.register`
19
+ */
20
+ export interface TerrainDefinition {
21
+ /** Unique mod-scoped terrain id. */
22
+ id: string;
23
+ /** i18n key for the terrain display name. */
24
+ nameKey?: string;
25
+ /** Default terrain hit points. */
26
+ hp?: number;
27
+ /** Material id used for rendering. Must be > obstacle breakpoint and < 150. */
28
+ materialId?: number;
29
+ /** UI/meta color as 0xRRGGBB. */
30
+ metaColor?: number;
31
+ /** Base terrain color as HSL components. */
32
+ colorHSL?: [number, number, number];
33
+ /** Tool item ids required to excavate this terrain. */
34
+ excavationRequirements?: readonly string[];
35
+ /** Tooltip interactions shown for this terrain. */
36
+ interactions?: readonly { kind: string; [key: string]: unknown }[];
37
+ /** Default element drop when the terrain is destroyed. */
38
+ output?: {
39
+ elementType: elements.ElementType;
40
+ chance: number;
41
+ };
42
+ [key: string]: unknown;
43
+ }
44
+
45
+ /**
46
+ * Terrain cell data returned by {@link getDataAtCell}.
47
+ *
48
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.getDataAtCell`
49
+ */
50
+ export interface TerrainDataAtCell {
51
+ /** Numeric terrain cell type. */
52
+ cellType: TerrainType;
53
+ /**
54
+ * Current hit points, or null when the terrain has no hp.
55
+ *
56
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.getDataAtCell`
57
+ */
58
+ hitPoints: number | null;
59
+ /**
60
+ * @deprecated Use {@link hitPoints} instead.
61
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `result.hitPoints`
62
+ */
63
+ hp?: number | null;
64
+ }
65
+
66
+ /**
67
+ * Return the mod string id for a numeric terrain type.
68
+ *
69
+ * @param terrainType - Numeric terrain cell type.
70
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.getIdByType`
71
+ */
72
+ export function getIdByType(terrainType: TerrainType): TerrainId;
73
+
74
+ /**
75
+ * Resolve a terrain string id to a numeric cell type.
76
+ *
77
+ * @param terrainId - Mod-registered or built-in terrain id.
78
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.getTypeById`
79
+ */
80
+ export function getTypeById(terrainId: TerrainId): TerrainType;
81
+
82
+ /**
83
+ * @deprecated Use {@link getTypeById} instead.
84
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.getTypeById`
85
+ */
86
+ export function getTypeFromId(terrainId: TerrainId): TerrainType;
87
+
88
+ /**
89
+ * Look up the definition for a terrain type.
90
+ *
91
+ * @param terrainType - Numeric terrain cell type.
92
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.getDefinitionByType`
93
+ */
94
+ export function getDefinitionByType(terrainType: TerrainType): TerrainDefinition | undefined;
95
+
96
+ /**
97
+ * Return the terrain cell type at a cell, or null when none.
98
+ *
99
+ * @param cellX - Grid column of the target cell.
100
+ * @param cellY - Grid row of the target cell.
101
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.getTypeAtCell`
102
+ */
103
+ export function getTypeAtCell(...args: CellCoordinates): TerrainType | null;
104
+
105
+ /**
106
+ * Return terrain cell type and hit points at a cell.
107
+ *
108
+ * @param cellX - Grid column of the target cell.
109
+ * @param cellY - Grid row of the target cell.
110
+ * @returns Cell type and hit points, or null when the cell is not terrain.
111
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.getDataAtCell`
112
+ */
113
+ export function getDataAtCell(...args: CellCoordinates): TerrainDataAtCell | null;
114
+
115
+ /**
116
+ * Return true when any terrain occupies the cell.
117
+ *
118
+ * @param cellX - Grid column of the target cell.
119
+ * @param cellY - Grid row of the target cell.
120
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.isAtCell`
121
+ */
122
+ export function isAtCell(...args: CellCoordinates): boolean;
123
+
124
+ /**
125
+ * Return true when the cell terrain matches the given id.
126
+ *
127
+ * @param cellX - Grid column of the target cell.
128
+ * @param cellY - Grid row of the target cell.
129
+ * @param terrainId - Terrain string id to compare.
130
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.isTypeAtCell`
131
+ */
132
+ export function isTypeAtCell(...args: [...CellCoordinates, terrainId: TerrainId]): boolean;
133
+
134
+ /**
135
+ * Return true when a packed cell id refers to terrain.
136
+ *
137
+ * @param cellId - Packed cell id from {@link world.getCellIdAtCell}.
138
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.isCellIdTerrain`
139
+ */
140
+ export function isCellIdTerrain(cellId: CellId): boolean;
141
+
142
+ /**
143
+ * Apply damage to terrain at a cell.
144
+ *
145
+ * @param cellX - Grid column of the target cell.
146
+ * @param cellY - Grid row of the target cell.
147
+ * @param damage - Damage amount to apply.
148
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.damageAtCell`
149
+ */
150
+ export function damageAtCell(...args: [...CellCoordinates, damage: number]): void;
151
+
152
+ /**
153
+ * Place terrain at an empty cell. Worker-entry writes are immediate.
154
+ *
155
+ * @param cellX - Grid column of the target cell.
156
+ * @param cellY - Grid row of the target cell.
157
+ * @param terrainTypeOrId - Numeric cell type or terrain string id.
158
+ * @param options - Optional mutation flags.
159
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Worker entry `api.terrains.createAtCell`
160
+ */
161
+ export function createAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
162
+
163
+ /**
164
+ * Replace existing terrain at a cell. Worker-entry writes are immediate.
165
+ *
166
+ * @param cellX - Grid column of the target cell.
167
+ * @param cellY - Grid row of the target cell.
168
+ * @param terrainTypeOrId - Numeric cell type or terrain string id.
169
+ * @param options - Optional mutation flags.
170
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Worker entry `api.terrains.replaceAtCell`
171
+ */
172
+ export function replaceAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
173
+
174
+ /**
175
+ * Remove terrain from a cell. Worker-entry writes are immediate.
176
+ *
177
+ * @param cellX - Grid column of the target cell.
178
+ * @param cellY - Grid row of the target cell.
179
+ * @param options - Optional mutation flags.
180
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Worker entry `api.terrains.removeAtCell`
181
+ */
182
+ export function removeAtCell(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
183
+
184
+ /**
185
+ * Set terrain hit points at a cell. Worker-entry writes are immediate.
186
+ *
187
+ * @param cellX - Grid column of the target cell.
188
+ * @param cellY - Grid row of the target cell.
189
+ * @param hitPoints - New hit point value.
190
+ * @returns True when hit points changed or the terrain was removed.
191
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Worker entry `api.terrains.setHitPointsAtCell`
192
+ */
193
+ export function setHitPointsAtCell(...args: [...CellCoordinates, hitPoints: number]): boolean;
194
+
195
+ /**
196
+ * @deprecated Use {@link setHitPointsAtCell} instead.
197
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.setHitPointsAtCell`
198
+ */
199
+ export function setHpAtCell(...args: [...CellCoordinates, hitPoints: number]): boolean;
200
+
201
+ /**
202
+ * Options for terrain create, replace, or remove calls.
203
+ *
204
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.createAtCell`
205
+ */
206
+ export interface TerrainMutationOptions {
207
+ /** Skip shadow updates around the changed cell. */
208
+ skipShadow?: boolean;
209
+ }
210
+
211
+ /**
212
+ * Numeric terrain / {@link CellTypeEnum} handle.
213
+ *
214
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains`
215
+ */
216
+ export type TerrainType = CellTypeEnum | TaggedNumber<"terrainType">;
217
+
218
+ /**
219
+ * Mod or built-in terrain string id.
220
+ *
221
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains`
222
+ */
223
+ export type TerrainId = LooseString<never>;
224
+
225
+ /**
226
+ * Type handle or string id accepted by mutation helpers.
227
+ *
228
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains`
229
+ */
230
+ export type TerrainRef = TerrainType | TerrainId;
231
+ }
@@ -0,0 +1,43 @@
1
+ import { grid as gridNs } from "./grid";
2
+
3
+ /**
4
+ * Shared `sandkit.api.world` base — deprecated alias of {@link grid}.
5
+ *
6
+ * Cell queries, excavation, and dimensions are re-exported from {@link grid} so
7
+ * existing `shared.api.world` imports keep working.
8
+ *
9
+ * @deprecated Use {@link grid} instead.
10
+ * @internal Base namespace reused by main and worker declarations.
11
+ */
12
+ export namespace world {
13
+ /**
14
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.getCellIdAtCell`
15
+ */
16
+ export import getCellIdAtCell = gridNs.getCellIdAtCell;
17
+ /**
18
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.isCellEmptyAtCell`
19
+ */
20
+ export import isCellEmptyAtCell = gridNs.isCellEmptyAtCell;
21
+ /**
22
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.isTerrainAtCell`
23
+ */
24
+ export import isTerrainAtCell = gridNs.isTerrainAtCell;
25
+ /**
26
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.reportActivityAtCell`
27
+ */
28
+ export import reportActivityAtCell = gridNs.reportActivityAtCell;
29
+ /**
30
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.excavateAtCell`
31
+ */
32
+ export import excavateAtCell = gridNs.excavateAtCell;
33
+ /**
34
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.getDimensions`
35
+ */
36
+ export import getDimensions = gridNs.getDimensions;
37
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.ExcavateOptions` */
38
+ export import ExcavateOptions = gridNs.ExcavateOptions;
39
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.CellId` */
40
+ export import CellId = gridNs.CellId;
41
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.GridDimensions` */
42
+ export import GridDimensions = gridNs.GridDimensions;
43
+ }
@@ -1,5 +1,6 @@
1
1
  import { ui as uiNs } from "./api/ui";
2
2
  import { player as playerNs } from "./api/player";
3
+ import { grid as gridNs } from "./api/grid";
3
4
  import { world as worldNs } from "./api/world";
4
5
  import { terrains as terrainsNs } from "./api/terrains";
5
6
  import { structures as structuresNs } from "./api/structures";
@@ -13,6 +14,7 @@ export namespace shared {
13
14
  export namespace api {
14
15
  export import ui = uiNs;
15
16
  export import player = playerNs;
17
+ export import grid = gridNs;
16
18
  export import world = worldNs;
17
19
  export import terrains = terrainsNs;
18
20
  export import structures = structuresNs;
@@ -0,0 +1,52 @@
1
+ import { shared } from "../../shared";
2
+
3
+ /**
4
+ * Worker-thread `sandkit.api.effects` — world-space visual effects on workers.
5
+ *
6
+ * Temporary lights live under {@link lights.temporary}, not here.
7
+ *
8
+ * @internal Worker-only surface; main thread exposes additional effect helpers.
9
+ */
10
+ export namespace effects {
11
+ /** Options for generic screen effects. */
12
+ export import EffectOptions = shared.api.effects.EffectOptions;
13
+ /** Options for particle effects. */
14
+ export import ParticleEffectOptions = shared.api.effects.ParticleEffectOptions;
15
+
16
+ /**
17
+ * Spawn a named screen-space or world effect.
18
+ *
19
+ * @param effectId - Registered effect id.
20
+ * @param worldX - World x position in pixels.
21
+ * @param worldY - World y position in pixels.
22
+ * @param options - Duration, radius, and intensity settings.
23
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Worker entry `api.effects.createAtWorld`
24
+ */
25
+ export function createAtWorld(
26
+ effectId: string,
27
+ worldX: number,
28
+ worldY: number,
29
+ options?: EffectOptions,
30
+ ): void;
31
+
32
+ /**
33
+ * @deprecated Use {@link createAtWorld} instead.
34
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.effects.createAtWorld`
35
+ */
36
+ export function createEffectAtWorld(
37
+ effectId: string,
38
+ worldX: number,
39
+ worldY: number,
40
+ options?: EffectOptions,
41
+ ): void;
42
+
43
+ /**
44
+ * Emit particles at world coordinates.
45
+ *
46
+ * @param worldX - World x position in pixels.
47
+ * @param worldY - World y position in pixels.
48
+ * @param options - Count, velocity, colour, and lifetime settings.
49
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Worker entry `api.effects.createParticlesAtWorld`
50
+ */
51
+ export import createParticlesAtWorld = shared.api.effects.createParticlesAtWorld;
52
+ }