@sandustry-modding/types 0.1.0 → 0.3.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 (153) hide show
  1. package/README.md +36 -12
  2. package/docs/Changelog.md +46 -0
  3. package/docs/README.md +62 -0
  4. package/package.json +11 -10
  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/CHANGELOG.md +0 -19
  53. package/sandkit/api/effects.d.ts +0 -76
  54. package/sandkit/api/elements.d.ts +0 -237
  55. package/sandkit/api/events.d.ts +0 -53
  56. package/sandkit/api/excavation.d.ts +0 -34
  57. package/sandkit/api/fire.d.ts +0 -26
  58. package/sandkit/api/grid.d.ts +0 -26
  59. package/sandkit/api/hooks.d.ts +0 -52
  60. package/sandkit/api/lights.d.ts +0 -66
  61. package/sandkit/api/player.d.ts +0 -84
  62. package/sandkit/api/shared.d.ts +0 -27
  63. package/sandkit/api/terrains.d.ts +0 -125
  64. package/sandkit/api/world.d.ts +0 -107
  65. package/shared/api/terrains.d.ts +0 -100
  66. package/worker/api/elements.d.ts +0 -60
  67. /package/{global.d.ts → src/global.d.ts} +0 -0
  68. /package/{sandkit → src/sandkit}/api/action.d.ts +0 -0
  69. /package/{sandkit → src/sandkit}/api/assets.d.ts +0 -0
  70. /package/{sandkit → src/sandkit}/api/authorization.d.ts +0 -0
  71. /package/{sandkit → src/sandkit}/api/building.d.ts +0 -0
  72. /package/{sandkit → src/sandkit}/api/camera.d.ts +0 -0
  73. /package/{sandkit → src/sandkit}/api/collector.d.ts +0 -0
  74. /package/{sandkit → src/sandkit}/api/constants.d.ts +0 -0
  75. /package/{sandkit → src/sandkit}/api/cooldown.d.ts +0 -0
  76. /package/{sandkit → src/sandkit}/api/discoveries.d.ts +0 -0
  77. /package/{sandkit → src/sandkit}/api/energy.d.ts +0 -0
  78. /package/{sandkit → src/sandkit}/api/gameconfig.d.ts +0 -0
  79. /package/{sandkit → src/sandkit}/api/input.d.ts +0 -0
  80. /package/{sandkit → src/sandkit}/api/items.d.ts +0 -0
  81. /package/{sandkit → src/sandkit}/api/mods.d.ts +0 -0
  82. /package/{sandkit → src/sandkit}/api/patterns.d.ts +0 -0
  83. /package/{sandkit → src/sandkit}/api/processing.d.ts +0 -0
  84. /package/{sandkit → src/sandkit}/api/progression.d.ts +0 -0
  85. /package/{sandkit → src/sandkit}/api/projectiles.d.ts +0 -0
  86. /package/{sandkit → src/sandkit}/api/random.d.ts +0 -0
  87. /package/{sandkit → src/sandkit}/api/raycast.d.ts +0 -0
  88. /package/{sandkit → src/sandkit}/api/reactions.d.ts +0 -0
  89. /package/{sandkit → src/sandkit}/api/resources.d.ts +0 -0
  90. /package/{sandkit → src/sandkit}/api/scene.d.ts +0 -0
  91. /package/{sandkit → src/sandkit}/api/schedule.d.ts +0 -0
  92. /package/{sandkit → src/sandkit}/api/settings.d.ts +0 -0
  93. /package/{sandkit → src/sandkit}/api/signals.d.ts +0 -0
  94. /package/{sandkit → src/sandkit}/api/sprites.d.ts +0 -0
  95. /package/{sandkit → src/sandkit}/api/storage.d.ts +0 -0
  96. /package/{sandkit → src/sandkit}/api/structureBehaviors.d.ts +0 -0
  97. /package/{sandkit → src/sandkit}/api/time.d.ts +0 -0
  98. /package/{sandkit → src/sandkit}/api/tools.d.ts +0 -0
  99. /package/{sandkit → src/sandkit}/api/triggers.d.ts +0 -0
  100. /package/{sandkit → src/sandkit}/api/ui.d.ts +0 -0
  101. /package/{sandkit → src/sandkit}/api/workers.d.ts +0 -0
  102. /package/{sandkit → src/sandkit}/engine/api/augments.d.ts +0 -0
  103. /package/{sandkit → src/sandkit}/engine/api/auralite.d.ts +0 -0
  104. /package/{sandkit → src/sandkit}/engine/api/blueprints.d.ts +0 -0
  105. /package/{sandkit → src/sandkit}/engine/api/clipboard.d.ts +0 -0
  106. /package/{sandkit → src/sandkit}/engine/api/colorPicker.d.ts +0 -0
  107. /package/{sandkit → src/sandkit}/engine/api/coloringTool.d.ts +0 -0
  108. /package/{sandkit → src/sandkit}/engine/api/conveyors.d.ts +0 -0
  109. /package/{sandkit → src/sandkit}/engine/api/debug.d.ts +0 -0
  110. /package/{sandkit → src/sandkit}/engine/api/drones.d.ts +0 -0
  111. /package/{sandkit → src/sandkit}/engine/api/entities.d.ts +0 -0
  112. /package/{sandkit → src/sandkit}/engine/api/extensions.d.ts +0 -0
  113. /package/{sandkit → src/sandkit}/engine/api/factory.d.ts +0 -0
  114. /package/{sandkit → src/sandkit}/engine/api/foliage.d.ts +0 -0
  115. /package/{sandkit → src/sandkit}/engine/api/foundationColorPicker.d.ts +0 -0
  116. /package/{sandkit → src/sandkit}/engine/api/game.d.ts +0 -0
  117. /package/{sandkit → src/sandkit}/engine/api/heatTransfer.d.ts +0 -0
  118. /package/{sandkit → src/sandkit}/engine/api/index.d.ts +0 -0
  119. /package/{sandkit → src/sandkit}/engine/api/launchers.d.ts +0 -0
  120. /package/{sandkit → src/sandkit}/engine/api/lightColorPicker.d.ts +0 -0
  121. /package/{sandkit → src/sandkit}/engine/api/matters.d.ts +0 -0
  122. /package/{sandkit → src/sandkit}/engine/api/misc.d.ts +0 -0
  123. /package/{sandkit → src/sandkit}/engine/api/portals.d.ts +0 -0
  124. /package/{sandkit → src/sandkit}/engine/api/prefabData.d.ts +0 -0
  125. /package/{sandkit → src/sandkit}/engine/api/prefabDecor.d.ts +0 -0
  126. /package/{sandkit → src/sandkit}/engine/api/prefabulator.d.ts +0 -0
  127. /package/{sandkit → src/sandkit}/engine/api/prismaline.d.ts +0 -0
  128. /package/{sandkit → src/sandkit}/engine/api/prismite.d.ts +0 -0
  129. /package/{sandkit → src/sandkit}/engine/api/queue.d.ts +0 -0
  130. /package/{sandkit → src/sandkit}/engine/api/shadows.d.ts +0 -0
  131. /package/{sandkit → src/sandkit}/engine/api/strataform.d.ts +0 -0
  132. /package/{sandkit → src/sandkit}/engine/api/swarmConsole.d.ts +0 -0
  133. /package/{sandkit → src/sandkit}/engine/api/sweeperDrone.d.ts +0 -0
  134. /package/{sandkit → src/sandkit}/engine/api/teleportZones.d.ts +0 -0
  135. /package/{sandkit → src/sandkit}/engine/api/tutorialBuild.d.ts +0 -0
  136. /package/{sandkit → src/sandkit}/engine/api/usageTracker.d.ts +0 -0
  137. /package/{sandkit → src/sandkit}/engine/api/wall.d.ts +0 -0
  138. /package/{sandkit → src/sandkit}/engine/api/workerLocal.d.ts +0 -0
  139. /package/{sandkit → src/sandkit}/engine/index.d.ts +0 -0
  140. /package/{sandkit → src/sandkit}/engine/retro-console.d.ts +0 -0
  141. /package/{sandkit → src/sandkit}/engine/state.d.ts +0 -0
  142. /package/{sandkit → src/sandkit}/index.d.ts +0 -0
  143. /package/{sandkit → src/sandkit}/react.d.ts +0 -0
  144. /package/{shared → src/shared}/api/effects.d.ts +0 -0
  145. /package/{shared → src/shared}/api/maps.d.ts +0 -0
  146. /package/{shared → src/shared}/api/ui.d.ts +0 -0
  147. /package/{shared → src/shared}/asset.d.ts +0 -0
  148. /package/{shared → src/shared}/engine.d.ts +0 -0
  149. /package/{shared → src/shared}/jsonvalue.d.ts +0 -0
  150. /package/{shared → src/shared}/nominal.d.ts +0 -0
  151. /package/{shared → src/shared}/player.d.ts +0 -0
  152. /package/{worker → src/worker}/api/main.d.ts +0 -0
  153. /package/{worker → src/worker}/api/worker.d.ts +0 -0
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Terrain registration, queries, and deferred cell mutations.
3
+ *
4
+ * Available as `sandkit.api.terrains`.
5
+ *
6
+ * @module
7
+ */
8
+ import { CellCoordinates } from '../../shared/player';
9
+ import { shared } from '../../shared';
10
+ import type { elements } from './elements';
11
+
12
+ export namespace terrains {
13
+
14
+ /** Return the mod string id for a numeric terrain type. */
15
+ export import getIdByType = shared.api.terrains.getIdByType;
16
+ /** Resolve a terrain string id to its cell type number. */
17
+ export import getTypeById = shared.api.terrains.getTypeById;
18
+ /**
19
+ * @deprecated Use {@link getTypeById} instead.
20
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.getTypeById`
21
+ */
22
+ export import getTypeFromId = shared.api.terrains.getTypeFromId;
23
+ /** Look up the definition for a terrain type. */
24
+ export import getDefinitionByType = shared.api.terrains.getDefinitionByType;
25
+ /** Return terrain cell type at a cell, or null. */
26
+ export import getTypeAtCell = shared.api.terrains.getTypeAtCell;
27
+ /** Return terrain data at a cell, or null. */
28
+ export import getDataAtCell = shared.api.terrains.getDataAtCell;
29
+ /** Return true when any terrain exists at the cell. */
30
+ export import isAtCell = shared.api.terrains.isAtCell;
31
+ /** Return true when terrain at the cell matches a string id. */
32
+ export import isTypeAtCell = shared.api.terrains.isTypeAtCell;
33
+ /** Return true when a cell id represents terrain. */
34
+ export import isCellIdTerrain = shared.api.terrains.isCellIdTerrain;
35
+ /** Apply damage to terrain at a cell. */
36
+ export import damageAtCell = shared.api.terrains.damageAtCell;
37
+ /** Options for terrain create, replace, and remove calls. */
38
+ export import TerrainMutationOptions = shared.api.terrains.TerrainMutationOptions;
39
+ /** Numeric terrain cell type handle. */
40
+ export import TerrainType = shared.api.terrains.TerrainType;
41
+ /** Mod or built-in terrain string id. */
42
+ export import TerrainId = shared.api.terrains.TerrainId;
43
+ /** Type handle or string id accepted by mutation helpers. */
44
+ export import TerrainRef = shared.api.terrains.TerrainRef;
45
+ /** Terrain cell data returned by {@link getDataAtCell}. */
46
+ export import TerrainDataAtCell = shared.api.terrains.TerrainDataAtCell;
47
+
48
+ /**
49
+ * Terrain definition shape with typed element interactions.
50
+ *
51
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.register`
52
+ */
53
+ export interface TerrainDefinition extends Omit<shared.api.terrains.TerrainDefinition, "interactions"> {
54
+ /** Tooltip interactions shown for this terrain. */
55
+ interactions?: readonly elements.Interaction[];
56
+ }
57
+
58
+ /**
59
+ * Register a new terrain definition.
60
+ *
61
+ * @param definition - Terrain definition to register.
62
+ * @returns Object with the assigned `cellType`.
63
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.register`
64
+ */
65
+ export function register(definition: TerrainDefinition): { cellType: TerrainType; };
66
+
67
+ /**
68
+ * Patch fields on an existing terrain definition.
69
+ *
70
+ * @param cellTypeOrId - Numeric cell type or terrain string id.
71
+ * @param partial - Fields to merge onto the definition.
72
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.terrains.updateDefinition`
73
+ */
74
+ export function updateDefinition(cellTypeOrId: TerrainRef, partial: Partial<TerrainDefinition>): void;
75
+
76
+ /**
77
+ * Create terrain at a cell. Main-entry writes are deferred; reads see the old grid.
78
+ *
79
+ * @param cellX - Grid column of the target cell.
80
+ * @param cellY - Grid row of the target cell.
81
+ * @param terrainTypeOrId - Numeric cell type or terrain string id.
82
+ * @param options - Optional mutation flags.
83
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.createAtCell`
84
+ */
85
+ export function createAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
86
+
87
+ /**
88
+ * @deprecated Use {@link createAtCell} instead.
89
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.createAtCell`
90
+ */
91
+ export function createAtCellWhenIdle(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
92
+
93
+ /**
94
+ * Replace terrain at a cell. Main-entry writes are deferred; reads see the old grid.
95
+ *
96
+ * @param cellX - Grid column of the target cell.
97
+ * @param cellY - Grid row of the target cell.
98
+ * @param terrainTypeOrId - Numeric cell type or terrain string id.
99
+ * @param options - Optional mutation flags.
100
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.replaceAtCell`
101
+ */
102
+ export function replaceAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
103
+
104
+ /**
105
+ * @deprecated Use {@link replaceAtCell} instead.
106
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.replaceAtCell`
107
+ */
108
+ export function replaceAtCellWhenIdle(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
109
+
110
+ /**
111
+ * Remove terrain at a cell. Main-entry writes are deferred; reads see the old grid.
112
+ *
113
+ * @param cellX - Grid column of the target cell.
114
+ * @param cellY - Grid row of the target cell.
115
+ * @param options - Optional mutation flags.
116
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.removeAtCell`
117
+ */
118
+ export function removeAtCell(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
119
+
120
+ /**
121
+ * @deprecated Use {@link removeAtCell} instead.
122
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.removeAtCell`
123
+ */
124
+ export function removeAtCellWhenIdle(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
125
+
126
+ /**
127
+ * Set terrain hit points at a cell. Main-entry writes are deferred; reads see the old grid.
128
+ *
129
+ * @param cellX - Grid column of the target cell.
130
+ * @param cellY - Grid row of the target cell.
131
+ * @param hitPoints - New hit point value.
132
+ * @see https://sandustry.com/sandkit.html#mutations-heading Official Sandkit API — Main entry `api.terrains.setHitPointsAtCell`
133
+ */
134
+ export function setHitPointsAtCell(...args: [...CellCoordinates, hitPoints: number]): void;
135
+
136
+ /**
137
+ * @deprecated Use {@link setHitPointsAtCell} instead.
138
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.setHitPointsAtCell`
139
+ */
140
+ export function setHpAtCell(...args: [...CellCoordinates, hitPoints: number]): boolean;
141
+
142
+ /**
143
+ * @deprecated Use {@link setHitPointsAtCell} instead.
144
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.terrains.setHitPointsAtCell`
145
+ */
146
+ export function setHpAtCellWhenIdle(...args: [...CellCoordinates, hitPoints: number]): void;
147
+ }
@@ -35,6 +35,15 @@ export namespace upgrades {
35
35
  * @param upgradeId - Upgrade id within the item.
36
36
  */
37
37
  export function getAvailableLevelById(itemId: string, upgradeId: string): number;
38
+ /**
39
+ * Set the purchased level for an upgrade.
40
+ *
41
+ * @param itemId - Parent item id.
42
+ * @param upgradeId - Upgrade id within the item.
43
+ * @param level - Level to set.
44
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.upgrades.setLevelById`
45
+ */
46
+ export function setLevelById(itemId: string, upgradeId: string, level: number): void;
38
47
 
39
48
  /** Upgrade definition registered for an item. */
40
49
  export interface UpgradeDefinition {
@@ -10,26 +10,43 @@ import type { Vector2 } from "../../shared/player";
10
10
  export namespace utils {
11
11
  /**
12
12
  * Return distance between two points.
13
+ *
13
14
  * @param pointA - First point.
14
15
  * @param pointB - Second point.
16
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getDistance`
15
17
  */
16
18
  export function getDistance(pointA: Vector2, pointB: Vector2): number;
19
+
17
20
  /**
18
21
  * Return normalized direction from point A to point B.
22
+ *
19
23
  * @param pointA - Origin point.
20
24
  * @param pointB - Target point.
25
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getDirection`
21
26
  */
22
27
  export function getDirection(pointA: Vector2, pointB: Vector2): Vector2;
28
+
23
29
  /**
24
30
  * Return angle in radians from point A to point B.
31
+ *
25
32
  * @param pointA - Origin point.
26
33
  * @param pointB - Target point.
34
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getAngle`
27
35
  */
28
36
  export function getAngle(pointA: Vector2, pointB: Vector2): number;
37
+
29
38
  /**
30
39
  * Return grid cells along a line between two points.
31
- * @param pointA - Line start in cell or world coordinates.
32
- * @param pointB - Line end in cell or world coordinates.
40
+ *
41
+ * @param pointA - Line start in cell coordinates.
42
+ * @param pointB - Line end in cell coordinates.
43
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.utils.getCoordinatesBetweenCells`
44
+ */
45
+ export function getCoordinatesBetweenCells(pointA: Vector2, pointB: Vector2): Vector2[];
46
+
47
+ /**
48
+ * @deprecated Use {@link getCoordinatesBetweenCells} instead.
49
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.utils.getCoordinatesBetweenCells`
33
50
  */
34
51
  export function getCoordinatesBetweenPoints(pointA: Vector2, pointB: Vector2): Vector2[];
35
52
  }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * World cell queries, excavation, fog, redraw, and pickups.
3
+ *
4
+ * @deprecated Use {@link grid} and {@link pickups} instead.
5
+ *
6
+ * Available as `sandkit.api.world`.
7
+ *
8
+ * @module
9
+ */
10
+ import { CellCoordinates } from "../../shared/player";
11
+ import { grid } from "./grid";
12
+ import { pickups as pickupsNs } from "./pickups";
13
+
14
+ /**
15
+ * @deprecated Use {@link grid} instead.
16
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid`
17
+ */
18
+ export namespace world {
19
+ /**
20
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.getCellIdAtCell`
21
+ */
22
+ export import getCellIdAtCell = grid.getCellIdAtCell;
23
+ /**
24
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.isCellEmptyAtCell`
25
+ */
26
+ export import isCellEmptyAtCell = grid.isCellEmptyAtCell;
27
+ /**
28
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.isTerrainAtCell`
29
+ */
30
+ export import isTerrainAtCell = grid.isTerrainAtCell;
31
+ /**
32
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.reportActivityAtCell`
33
+ */
34
+ export import reportActivityAtCell = grid.reportActivityAtCell;
35
+ /**
36
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.excavateAtCell`
37
+ */
38
+ export import excavateAtCell = grid.excavateAtCell;
39
+ /**
40
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.getDimensions`
41
+ */
42
+ export import getDimensions = grid.getDimensions;
43
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.ExcavateOptions` */
44
+ export import ExcavateOptions = grid.ExcavateOptions;
45
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.CellId` */
46
+ export import CellId = grid.CellId;
47
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.GridDimensions` */
48
+ export import GridDimensions = grid.GridDimensions;
49
+
50
+ /**
51
+ * Reveal fog of war at a cell.
52
+ *
53
+ * @param cellX - Grid column of the target cell.
54
+ * @param cellY - Grid row of the target cell.
55
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.revealFogAtCell`
56
+ */
57
+ export import revealFogAtCell = grid.revealFogAtCell;
58
+
59
+ /**
60
+ * @deprecated Use {@link grid.mutate} instead.
61
+ * @see https://sandustry.com/sandkit.html#mutations-heading
62
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.mutate`
63
+ */
64
+ export function runWhenSimulationIdle(callback: () => void): void;
65
+
66
+ /**
67
+ * @deprecated Use {@link grid.redrawAroundCell} instead.
68
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.grid.redrawAroundCell`
69
+ */
70
+ export function redrawAroundCellWhenIdle(...args: [...CellCoordinates, range: number]): void;
71
+
72
+ /**
73
+ * @deprecated Use {@link pickups} instead.
74
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups`
75
+ */
76
+ export namespace pickups {
77
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.spawnAtWorld` */
78
+ export import spawnAtWorld = pickupsNs.spawnAtWorld;
79
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.remove` */
80
+ export import destroy = pickupsNs.destroy;
81
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.pickUp` */
82
+ export import pickUp = pickupsNs.pickUp;
83
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.getAll` */
84
+ export import getAll = pickupsNs.getAll;
85
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.getById` */
86
+ export import getById = pickupsNs.getById;
87
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.remove` */
88
+ export import remove = pickupsNs.remove;
89
+ }
90
+
91
+ /**
92
+ * @deprecated Use {@link pickups.PickupType} instead.
93
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.PickupType`
94
+ */
95
+ export import WorldItemType = pickupsNs.WorldItemType;
96
+
97
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.PickupType` */
98
+ export import PickupType = pickupsNs.PickupType;
99
+
100
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.WorldItemLight` */
101
+ export import WorldItemLight = pickupsNs.WorldItemLight;
102
+
103
+ /** @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.pickups.WorldItem` */
104
+ export import WorldItem = pickupsNs.WorldItem;
105
+ }
@@ -410,6 +410,16 @@ export enum TechStatus {
410
410
  }
411
411
 
412
412
  /** Pickups and interactable world items. */
413
+ export enum PickupType {
414
+ Artifact = 1,
415
+ GlyphKey = 2,
416
+ Stratacore = 3,
417
+ Orb = 4,
418
+ }
419
+
420
+ /**
421
+ * @deprecated Use {@link PickupType} instead.
422
+ */
413
423
  export enum WorldItemType {
414
424
  Artifact = 1,
415
425
  GlyphKey = 2,
@@ -440,5 +450,9 @@ export type SandkitEnums = {
440
450
  StructureType: typeof StructureType;
441
451
  Tech: typeof Tech;
442
452
  TechStatus: typeof TechStatus;
453
+ PickupType: typeof PickupType;
454
+ /**
455
+ * @deprecated Use {@link PickupType} instead.
456
+ */
443
457
  WorldItemType: typeof WorldItemType;
444
458
  };
@@ -6,23 +6,38 @@ import type { CellId, LooseString, TaggedNumber } from "../nominal";
6
6
  * Shared `sandkit.api.elements` base — element reads and definitions.
7
7
  *
8
8
  * Workers add direct mutation helpers on top of this shape. Main thread adds
9
- * idle-scheduled mutations and registration APIs.
9
+ * deferred grid mutations and registration APIs.
10
10
  *
11
11
  * @internal Base namespace reused by main and worker declarations.
12
12
  */
13
13
  export namespace elements {
14
14
  /**
15
15
  * Numeric element type handle.
16
- * Built-in {@link ElementTypeEnum} values autocomplete; `getTypeFromId` returns a tagged handle.
16
+ * Built-in {@link ElementTypeEnum} values autocomplete; {@link getTypeById} returns a tagged handle.
17
+ *
18
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements`
17
19
  */
18
20
  export type ElementType = ElementTypeEnum | TaggedNumber<"elementType">;
19
21
 
20
- /** Mod or built-in element string id. */
22
+ /**
23
+ * Mod or built-in element string id.
24
+ *
25
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements`
26
+ */
21
27
  export type ElementId = LooseString<never>;
22
- /** Type handle or string id accepted by lookup helpers. */
28
+
29
+ /**
30
+ * Type handle or string id accepted by lookup helpers.
31
+ *
32
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements`
33
+ */
23
34
  export type ElementRef = ElementType | ElementId;
24
35
 
25
- /** Physical behaviour category for an element. */
36
+ /**
37
+ * Physical behaviour category for an element.
38
+ *
39
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements`
40
+ */
26
41
  export enum MatterType {
27
42
  Solid = 1,
28
43
  Liquid = 2,
@@ -34,7 +49,11 @@ export namespace elements {
34
49
  Powder = 8,
35
50
  }
36
51
 
37
- /** Mod-registered element definition snapshot. */
52
+ /**
53
+ * Mod-registered element definition snapshot.
54
+ *
55
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.register`
56
+ */
38
57
  export type ElementDefinition = {
39
58
  id: string,
40
59
  nameKey: string,
@@ -53,13 +72,26 @@ export namespace elements {
53
72
  getExtraProps?: () => { data: Record<PropertyKey, any> }
54
73
  };
55
74
 
56
- /** Options for {@link createAtCell}, replace, and idle create helpers. */
75
+ /**
76
+ * Options for {@link createAtCell}, replace, and related create helpers.
77
+ *
78
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.createAtCell`
79
+ */
57
80
  export interface ElementCreateOptions {
58
81
  /** Initial element data bag. */
59
82
  data?: Record<string, unknown>;
60
83
  /** Override element density. */
61
84
  density?: number;
62
- /** Set both max and remaining duration. */
85
+ /**
86
+ * Set both max and remaining duration in simulation ticks.
87
+ *
88
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.createAtCell`
89
+ */
90
+ durationTicks?: number;
91
+ /**
92
+ * @deprecated Use {@link durationTicks} instead.
93
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `options.durationTicks`
94
+ */
63
95
  duration?: number;
64
96
  /** Override free-fall state on spawn. */
65
97
  isFreeFalling?: boolean;
@@ -78,85 +110,125 @@ export namespace elements {
78
110
  skipCollectorCheck?: boolean;
79
111
  }
80
112
 
81
- /** Options for element removal helpers. */
113
+ /**
114
+ * Options for element removal helpers.
115
+ *
116
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.removeAtCell`
117
+ */
82
118
  export interface ElementRemovalOptions {
83
119
  /** Skip collector accounting when removing the element. */
84
120
  skipCollectorCheck?: boolean;
85
121
  }
86
122
 
123
+ /**
124
+ * Return the mod string id for a numeric element type.
125
+ *
126
+ * @param elementType - Numeric element type.
127
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getIdByType`
128
+ */
129
+ export function getIdByType(elementType: ElementType): ElementId;
130
+
87
131
  /**
88
132
  * Resolve a mod element string id to a type handle.
133
+ *
89
134
  * @param elementId - Mod-registered element id.
135
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getTypeById`
136
+ */
137
+ export function getTypeById(elementId: ElementId): ElementType;
138
+
139
+ /**
140
+ * @deprecated Use {@link getTypeById} instead.
141
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.elements.getTypeById`
90
142
  */
91
143
  export function getTypeFromId(elementId: ElementId): ElementType;
92
144
 
93
145
  /**
94
146
  * Look up the definition for a type handle.
147
+ *
95
148
  * @param elementType - Numeric element type.
149
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getDefinitionByType`
96
150
  */
97
151
  export function getDefinitionByType(elementType: ElementType): ElementDefinition | undefined;
98
152
 
99
153
  /**
100
154
  * Return the raw element type at a cell (may differ from resolved type).
155
+ *
101
156
  * @param cellX - Grid column of the target cell.
102
157
  * @param cellY - Grid row of the target cell.
158
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getTypeAtCell`
103
159
  */
104
160
  export function getTypeAtCell(...args: CellCoordinates): ElementType | null;
105
161
 
106
162
  /**
107
163
  * Return the resolved element type after overlays and particles.
164
+ *
108
165
  * @param cellX - Grid column of the target cell.
109
166
  * @param cellY - Grid row of the target cell.
167
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getResolvedTypeAtCell`
110
168
  */
111
169
  export function getResolvedTypeAtCell(...args: CellCoordinates): ElementType | null;
112
170
 
113
171
  /**
114
172
  * Return the resolved element type from a packed cell id.
173
+ *
115
174
  * @param cellId - Packed cell id from {@link world.getCellIdAtCell}.
175
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getResolvedTypeFromCellId`
116
176
  */
117
177
  export function getResolvedTypeFromCellId(cellId: CellId): ElementType | null;
118
178
 
119
179
  /**
120
180
  * Return element index, particle flag, and ids at a cell.
181
+ *
121
182
  * @param cellX - Grid column of the target cell.
122
183
  * @param cellY - Grid row of the target cell.
184
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getInfoAtCell`
123
185
  */
124
186
  export function getInfoAtCell(...args: CellCoordinates): { elementType: ElementType; isParticle: boolean; cellId: CellId; elementIndex: number; } | null;
125
187
 
126
188
  /**
127
189
  * Return the matter category at a cell, or null when empty.
190
+ *
128
191
  * @param cellX - Grid column of the target cell.
129
192
  * @param cellY - Grid row of the target cell.
193
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getMatterTypeAtCell`
130
194
  */
131
195
  export function getMatterTypeAtCell(...args: CellCoordinates): MatterType | null;
132
196
 
133
197
  /**
134
- * Return true when the cell holds the given element type.
198
+ * Return true when the cell holds the given element type or id.
199
+ *
135
200
  * @param cellX - Grid column of the target cell.
136
201
  * @param cellY - Grid row of the target cell.
137
- * @param elementType - Element type to compare.
202
+ * @param elementTypeOrId - Numeric type or string id.
203
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.isTypeAtCell`
138
204
  */
139
- export function isTypeAtCell(...args: [...CellCoordinates, elementType: ElementType]): boolean;
205
+ export function isTypeAtCell(...args: [...CellCoordinates, elementTypeOrId: ElementRef]): boolean;
140
206
 
141
207
  /**
142
208
  * Return true when the element at the cell is falling.
209
+ *
143
210
  * @param cellX - Grid column of the target cell.
144
211
  * @param cellY - Grid row of the target cell.
212
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.isFreeFallingAtCell`
145
213
  */
146
214
  export function isFreeFallingAtCell(...args: CellCoordinates): boolean;
147
215
 
148
216
  /**
149
217
  * Return per-cell velocity for moving elements.
218
+ *
150
219
  * @param cellX - Grid column of the target cell.
151
220
  * @param cellY - Grid row of the target cell.
221
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getVelocityAtCell`
152
222
  */
153
223
  export function getVelocityAtCell(...args: CellCoordinates): { x: number; y: number; } | null;
154
224
 
155
225
  /**
156
226
  * Read element data field 1–4 at a cell.
227
+ *
157
228
  * @param cellX - Grid column of the target cell.
158
229
  * @param cellY - Grid row of the target cell.
159
230
  * @param fieldNumber - Data field index (1–4).
231
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.elements.getDataFieldAtCell`
160
232
  */
161
233
  export function getDataFieldAtCell(...args: [...CellCoordinates, fieldNumber: 1 | 2 | 3 | 4]): number | null;
162
234
  }
@@ -2,55 +2,81 @@ import type { CellCoordinates, Vector2 } from "../../shared/player";
2
2
  import type { CellId as PackedCellId } from "../nominal";
3
3
 
4
4
  /**
5
- * Shared `sandkit.api.world` base — cell and terrain queries plus excavation.
5
+ * Shared `sandkit.api.grid` base — cell queries, excavation, and dimensions.
6
6
  *
7
- * Main thread adds idle scheduling and fog helpers on top of this shape.
7
+ * Main thread adds deferred mutations, fog, redraw, and iteration helpers on
8
+ * top of this shape.
8
9
  *
9
10
  * @internal Base namespace reused by main and worker declarations.
10
11
  */
11
- export namespace world {
12
+ export namespace grid {
12
13
  /**
13
14
  * Return the packed cell id at grid coordinates.
15
+ *
14
16
  * @param cellX - Grid column of the target cell.
15
17
  * @param cellY - Grid row of the target cell.
16
18
  * @returns Packed cell id for the cell.
19
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.getCellIdAtCell` / Worker entry `api.grid.getCellIdAtCell`
17
20
  */
18
21
  export function getCellIdAtCell(...args: CellCoordinates): CellId;
19
22
 
20
23
  /**
21
24
  * Return true when the cell has no element or terrain content.
25
+ *
22
26
  * @param cellX - Grid column of the target cell.
23
27
  * @param cellY - Grid row of the target cell.
28
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.isCellEmptyAtCell` / Worker entry `api.grid.isCellEmptyAtCell`
24
29
  */
25
30
  export function isCellEmptyAtCell(...args: CellCoordinates): boolean;
26
31
 
27
32
  /**
28
33
  * Return true when the cell holds terrain (not an element).
34
+ *
29
35
  * @param cellX - Grid column of the target cell.
30
36
  * @param cellY - Grid row of the target cell.
37
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.isTerrainAtCell` / Worker entry `api.grid.isTerrainAtCell`
31
38
  */
32
39
  export function isTerrainAtCell(...args: CellCoordinates): boolean;
33
40
 
34
41
  /**
35
42
  * Mark the cell active for simulation this tick.
43
+ *
36
44
  * @param cellX - Grid column of the target cell.
37
45
  * @param cellY - Grid row of the target cell.
46
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.reportActivityAtCell` / Worker entry `api.grid.reportActivityAtCell`
38
47
  */
39
48
  export function reportActivityAtCell(...args: CellCoordinates): void;
40
49
 
41
50
  /**
42
51
  * Apply excavation damage and eject velocity at a cell.
52
+ *
43
53
  * @param cellX - Grid column of the target cell.
44
54
  * @param cellY - Grid row of the target cell.
45
55
  * @param outVelocity - Ejection velocity written into this vector.
46
56
  * @param damage - Damage applied to terrain in the pattern.
47
57
  * @param options - Optional excavation source flags.
58
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.excavateAtCell` / Worker entry `api.grid.excavateAtCell`
48
59
  */
49
60
  export function excavateAtCell(...args: [...CellCoordinates, outVelocity: Vector2, damage: number, options?: ExcavateOptions]): void;
50
61
 
62
+ /**
63
+ * Return the world grid size in cells.
64
+ *
65
+ * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.grid.getDimensions` / Worker entry `api.grid.getDimensions`
66
+ */
67
+ export function getDimensions(): GridDimensions;
68
+
51
69
  /** Packed cell id from {@link getCellIdAtCell}. */
52
70
  export type CellId = PackedCellId;
53
71
 
72
+ /** World grid width and height in cells. */
73
+ export interface GridDimensions {
74
+ /** Grid width in cells. */
75
+ widthCells: number;
76
+ /** Grid height in cells. */
77
+ heightCells: number;
78
+ }
79
+
54
80
  /** Flags that control how {@link excavateAtCell} resolves damage and drops. */
55
81
  export interface ExcavateOptions {
56
82
  /** Treat the dig as gun fire for terrain resistance checks. */