@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
@@ -1,76 +0,0 @@
1
- import { shared } from "../../shared";
2
-
3
- /**
4
- * `sandkit.api.effects` — visual effects, particles, lights, and lasers at world positions.
5
- * Main thread only.
6
- */
7
- declare namespace effects {
8
- // Shared functions
9
- /** Creates a short-lived light at world coordinates. */
10
- export import createLightAtWorld = shared.api.effects.createLightAtWorld
11
- /** Spawns particles at world coordinates. */
12
- export import createParticlesAtWorld = shared.api.effects.createParticlesAtWorld
13
- /** Creates a named screen effect at world coordinates. */
14
- export import createEffectAtWorld = shared.api.effects.createEffectAtWorld
15
- // Shared types
16
- /** Options for generic screen effects. */
17
- export import EffectOptions = shared.api.effects.EffectOptions
18
- /** Options for temporary lights. */
19
- export import TemporaryLightOptions = shared.api.effects.TemporaryLightOptions
20
- /** Options for particle effects. */
21
- export import ParticleEffectOptions = shared.api.effects.ParticleEffectOptions
22
-
23
- /**
24
- * Creates a distortion wave effect at world coordinates.
25
- * @param worldX - World X coordinate in pixels.
26
- * @param worldY - World Y coordinate in pixels.
27
- * @param options - Style, duration, radius, intensity, and color.
28
- */
29
- export function createDistortionWaveAtWorld(worldX: number, worldY: number, options?: DistortionEffectOptions): void;
30
- /**
31
- * Creates a laser beam between two world points. Returns a handle to destroy it.
32
- * @param startWorldX - Beam start world X in pixels.
33
- * @param startWorldY - Beam start world Y in pixels.
34
- * @param endWorldX - Beam end world X in pixels.
35
- * @param endWorldY - Beam end world Y in pixels.
36
- * @param options - Width, brightness, color, and glow options.
37
- */
38
- export function createLaserAtWorld(startWorldX: number, startWorldY: number, endWorldX: number, endWorldY: number, options?: LaserEffectOptions): LaserEffectHandle;
39
- /**
40
- * Removes a temporary light by its id.
41
- * @param lightId - Light index from {@link createLightAtWorld}.
42
- */
43
- export function removeLightById(lightId: number): void;
44
-
45
- /** Options for laser beam effects. */
46
- export interface LaserEffectOptions {
47
- /** Beam width in pixels. */
48
- width?: number;
49
- /** Beam brightness multiplier. */
50
- brightness?: number;
51
- /** Beam color as a packed integer. */
52
- color?: number;
53
- /** When true, draws a glow around the beam. */
54
- glow?: boolean;
55
- }
56
-
57
- /** Handle returned by createLaserAtWorld. */
58
- export interface LaserEffectHandle {
59
- /** Removes the laser from the scene. */
60
- destroy(): void;
61
- }
62
-
63
- /** Options for distortion wave effects. */
64
- export interface DistortionEffectOptions {
65
- /** Distortion style: implode or explode. */
66
- style?: 'implode' | 'explode';
67
- /** Effect duration in seconds. */
68
- duration?: number;
69
- /** Maximum radius of the wave. */
70
- maxRadius?: number;
71
- /** Visual intensity of the distortion. */
72
- intensity?: number;
73
- /** RGBA color components for the effect. */
74
- color?: [number, number, number, number];
75
- }
76
- }
@@ -1,237 +0,0 @@
1
- import { CellCoordinates, Vector2 } from "../../shared/player";
2
- import { shared } from "../../shared";
3
-
4
- /**
5
- * `sandkit.api.elements` — register elements and read or change cells when idle.
6
- * Main thread only.
7
- */
8
- export namespace elements {
9
-
10
- // Shared types
11
- /** Numeric id for a registered element type. */
12
- export import ElementType = shared.api.elements.ElementType;
13
- /** Mod or built-in element string id. */
14
- export import ElementId = shared.api.elements.ElementId;
15
- /** Type handle or string id accepted by lookup helpers. */
16
- export import ElementRef = shared.api.elements.ElementRef;
17
- /** Matter category for element physics behavior. */
18
- export import MatterType = shared.api.elements.MatterType;
19
- /** Full definition used to register a custom element. */
20
- export import ElementDefinition = shared.api.elements.ElementDefinition;
21
- /** Options for create and replace calls. */
22
- export import ElementCreateOptions = shared.api.elements.ElementCreateOptions;
23
- /** Options for element removal. */
24
- export import ElementRemovalOptions = shared.api.elements.ElementRemovalOptions;
25
- /** Resolves a string element id to its numeric type. */
26
- export import getTypeFromId = shared.api.elements.getTypeFromId;
27
- /** Returns the definition for an element type. */
28
- export import getDefinitionByType = shared.api.elements.getDefinitionByType;
29
- /** Returns the element type at a cell, or null. */
30
- export import getTypeAtCell = shared.api.elements.getTypeAtCell;
31
- /** Returns the resolved element type at a cell, or null. */
32
- export import getResolvedTypeAtCell = shared.api.elements.getResolvedTypeAtCell;
33
- /** Returns the resolved element type from a cell id, or null. */
34
- export import getResolvedTypeFromCellId = shared.api.elements.getResolvedTypeFromCellId;
35
- /** Returns element info at a cell, or null. */
36
- export import getInfoAtCell = shared.api.elements.getInfoAtCell;
37
- /** Returns the matter type at a cell, or null. */
38
- export import getMatterTypeAtCell = shared.api.elements.getMatterTypeAtCell;
39
- /** Returns true when the cell contains the given element type. */
40
- export import isTypeAtCell = shared.api.elements.isTypeAtCell;
41
- /** Returns true when the element at the cell is free-falling. */
42
- export import isFreeFallingAtCell = shared.api.elements.isFreeFallingAtCell;
43
- /** Returns particle velocity at a cell, or null. */
44
- export import getVelocityAtCell = shared.api.elements.getVelocityAtCell;
45
- /** Returns a data field value at a cell, or null. */
46
- export import getDataFieldAtCell = shared.api.elements.getDataFieldAtCell;
47
-
48
- /** Optional tooltip metadata on structure interactions. */
49
- export interface InteractionStructureMetadata {
50
- /** i18n key for custom interaction label text. */
51
- textKey?: string;
52
- /** Hide the label when a data field matches a value. */
53
- crossedOutWhen?: { dataField: number; equals: number; };
54
- /** Show the label only when a data field matches a value. */
55
- visibleWhen?: { dataField: number; equals: number; };
56
- /** Require the text key to exist in the active locale. */
57
- onlyWhenTranslated?: boolean;
58
- }
59
-
60
- /** Interaction that destroys specific items. */
61
- export type InteractionDestroyer = {
62
- kind: "destroyer";
63
- /** Item ids removed by this interaction (for example `"drill"`). */
64
- items: readonly string[];
65
- };
66
-
67
- /** Interaction that affects specific structures. */
68
- export type InteractionStructure = InteractionStructureMetadata & {
69
- kind: "structure";
70
- /** Structure ids shown in the interaction tooltip. */
71
- structures: readonly string[];
72
- };
73
-
74
- /** Interaction that affects specific entities. */
75
- export type InteractionEntity = {
76
- kind: "entity";
77
- /** Entity type ids referenced by the interaction. */
78
- entities: readonly string[];
79
- };
80
-
81
- /** Interaction that marks the element as flammable. */
82
- export type InteractionFlammable = { kind: "flammable" };
83
- /** Interaction that marks the element as meltable. */
84
- export type InteractionMeltable = { kind: "meltable" };
85
- /** Interaction that marks the element as freezable. */
86
- export type InteractionFreezable = { kind: "freezable" };
87
- /** Interaction handled by custom mod logic and tooltip text. */
88
- export type InteractionCustom = InteractionStructureMetadata & { kind: "custom" };
89
-
90
- /** Union of element interaction kinds for tool and structure logic. */
91
- export type Interaction = InteractionDestroyer
92
- | InteractionStructure
93
- | InteractionEntity
94
- | InteractionFlammable
95
- | InteractionMeltable
96
- | InteractionFreezable
97
- | InteractionCustom;
98
-
99
- /** Returns all registered element type ids. */
100
- export function getRegisteredTypes(): ElementType[];
101
-
102
- /**
103
- * Registers a new element and returns its assigned type id.
104
- * @param definition - Full element definition to register.
105
- * @returns Object with the assigned `elementType`.
106
- */
107
- export function register(definition: ElementDefinition): { elementType: ElementType; };
108
-
109
- /**
110
- * Updates fields on an existing element definition.
111
- * @param elementTypeOrId - Numeric type or string id.
112
- * @param partial - Fields to merge onto the definition.
113
- */
114
- export function updateDefinition(elementTypeOrId: ElementRef, partial: Partial<ElementDefinition>): void;
115
-
116
- /**
117
- * Adds an interaction entry to an element definition.
118
- * @param elementTypeOrId - Numeric type or string id.
119
- * @param interaction - Interaction entry to append.
120
- */
121
- export function addInteractionInfo(elementTypeOrId: ElementRef, interaction: Interaction): void;
122
-
123
- /**
124
- * Returns the display name for an element type.
125
- * @param elementType - Numeric element type.
126
- */
127
- export function getNameByType(elementType: ElementType): string;
128
-
129
- /**
130
- * Finds a free cell inside a structure footprint, or null.
131
- * @param structureCellX - Structure anchor cell column.
132
- * @param structureCellY - Structure anchor cell row.
133
- * @param structureSize - Structure footprint size in cells.
134
- * @returns Cell coordinates of a free cell, or null when none.
135
- */
136
- export function findFreeCellInStructure(structureCellX: number, structureCellY: number, structureSize: number): Vector2 | null;
137
-
138
- /**
139
- * Creates an element at a cell when the simulation is idle.
140
- * @param cellX - Grid column of the target cell.
141
- * @param cellY - Grid row of the target cell.
142
- * @param elementType - Element type to place.
143
- * @param options - Optional spawn overrides.
144
- */
145
- export function createAtCellWhenIdle(...args: [...CellCoordinates, elementType: ElementType, options?: ElementCreateOptions]): void;
146
-
147
- /**
148
- * Replaces the element at a cell when the simulation is idle.
149
- * @param cellX - Grid column of the target cell.
150
- * @param cellY - Grid row of the target cell.
151
- * @param elementType - Element type to place.
152
- * @param options - Optional spawn overrides.
153
- */
154
- export function replaceAtCellWhenIdle(...args: [...CellCoordinates, elementType: ElementType, options?: ElementCreateOptions]): void;
155
-
156
- /**
157
- * Removes the element at a cell when the simulation is idle.
158
- * @param cellX - Grid column of the target cell.
159
- * @param cellY - Grid row of the target cell.
160
- * @param options - Optional removal flags.
161
- */
162
- export function removeAtCellWhenIdle(...args: [...CellCoordinates, options?: ElementRemovalOptions]): void;
163
-
164
- /**
165
- * Moves an element between cells when the simulation is idle.
166
- * @param fromCellX - Source cell column.
167
- * @param fromCellY - Source cell row.
168
- * @param toCellX - Destination cell column.
169
- * @param toCellY - Destination cell row.
170
- */
171
- export function teleportBetweenCellsWhenIdle(fromCellX: number, fromCellY: number, toCellX: number, toCellY: number): void;
172
-
173
- /**
174
- * Sets particle velocity at a cell when the simulation is idle.
175
- * @param cellX - Grid column of the target cell.
176
- * @param cellY - Grid row of the target cell.
177
- * @param velocity - New velocity vector.
178
- */
179
- export function setVelocityAtCellWhenIdle(...args: [...CellCoordinates, velocity: Vector2]): void;
180
-
181
- /**
182
- * Adds velocity to a particle at a cell when the simulation is idle.
183
- * @param cellX - Grid column of the target cell.
184
- * @param cellY - Grid row of the target cell.
185
- * @param velocity - Velocity delta to add.
186
- * @param maxSpeed - Optional speed cap after the addition.
187
- */
188
- export function addParticleVelocityAtCellWhenIdle(...args: [...CellCoordinates, velocity: Vector2, maxSpeed?: number]): void;
189
-
190
- /**
191
- * Converts a cell element to a particle when the simulation is idle.
192
- * @param cellX - Grid column of the target cell.
193
- * @param cellY - Grid row of the target cell.
194
- * @param velocity - Initial particle velocity.
195
- */
196
- export function convertToParticleAtCellWhenIdle(...args: [...CellCoordinates, velocity: Vector2]): void;
197
-
198
- /**
199
- * Converts a particle back to a solid element when the simulation is idle.
200
- * @param cellX - Grid column of the target cell.
201
- * @param cellY - Grid row of the target cell.
202
- */
203
- export function convertFromParticleAtCellWhenIdle(...args: CellCoordinates): void;
204
-
205
- /**
206
- * Sets a data field on the element at a cell when the simulation is idle.
207
- * @param cellX - Grid column of the target cell.
208
- * @param cellY - Grid row of the target cell.
209
- * @param fieldNumber - Data field index (1–4).
210
- * @param value - New field value.
211
- */
212
- export function setDataFieldAtCellWhenIdle(...args: [...CellCoordinates, fieldNumber: 1 | 2 | 3 | 4, value: number]): void;
213
-
214
- /**
215
- * Refreshes the rendered color at a cell when the simulation is idle.
216
- * @param cellX - Grid column of the target cell.
217
- * @param cellY - Grid row of the target cell.
218
- */
219
- export function refreshColorAtCellWhenIdle(...args: CellCoordinates): void;
220
-
221
- /**
222
- * Sets the physics skip mode at a cell when the simulation is idle.
223
- * @param cellX - Grid column of the target cell.
224
- * @param cellY - Grid row of the target cell.
225
- * @param physicsState - Physics skip flags for the element.
226
- */
227
- export function setPhysicsAtCellWhenIdle(...args: [...CellCoordinates, physicsState: number]): void;
228
-
229
- /**
230
- * Sets element duration at a cell when the simulation is idle.
231
- * @param cellX - Grid column of the target cell.
232
- * @param cellY - Grid row of the target cell.
233
- * @param duration - Duration in simulation units.
234
- * @param options - When `updateMax` is true, also update max duration.
235
- */
236
- export function setDurationAtCellWhenIdle(...args: [...CellCoordinates, duration: number, options?: { updateMax?: boolean; }]): void;
237
- }
@@ -1,53 +0,0 @@
1
- import type { LooseString } from "../../shared/nominal";
2
-
3
- /**
4
- * `sandkit.api.events` — subscribe to and emit named game events.
5
- * Main thread only. The `events` object is frozen; do not replace `on` or `emit`.
6
- */
7
- export namespace events {
8
- /**
9
- * Subscribes to an event. Returns an unsubscribe function.
10
- * @param eventId - Registered event name.
11
- * @param callback - Called when the event is emitted.
12
- */
13
- export function on<K extends EventId>(eventId: K, callback: (payload: EventPayload<K>) => void): () => void;
14
- /**
15
- * Emits an event with a payload to all subscribers.
16
- * @param eventId - Registered event name.
17
- * @param payload - Serializable payload passed to listeners.
18
- */
19
- export function emit<K extends EventId>(eventId: K, payload: EventPayload<K>): void;
20
-
21
- /**
22
- * Mutable payload for `player:collision:prepare`.
23
- * Listeners may change `maxStepCells` (clamped 1–8) and phasing flags.
24
- */
25
- export interface PlayerCollisionPreparePayload {
26
- /** When true, terrain collision is skipped this sub-step. */
27
- phaseThroughTerrain: boolean;
28
- /** When true, structure collision is skipped this sub-step. */
29
- phaseThroughStructures: boolean;
30
- /** Max cells the player can step up when blocked horizontally (1–8). */
31
- maxStepCells: number;
32
- }
33
-
34
- /** Known event payloads. Unlisted ids still use `unknown`. */
35
- export interface EventPayloadMap {
36
- "player:collision:prepare": PlayerCollisionPreparePayload;
37
- "player:moved": {
38
- /**
39
- * Simulation step duration in seconds.
40
- * `0` on teleports. The event runs after collision; landing already
41
- * zeroes `velocity.y`. Vanilla gravity is applied after this event.
42
- */
43
- dt?: number;
44
- state?: unknown;
45
- };
46
- }
47
-
48
- /** Known event names plus any custom string id. */
49
- export type EventId = LooseString<keyof EventPayloadMap>;
50
-
51
- /** Event payload type for a given event id. */
52
- export type EventPayload<K> = K extends keyof EventPayloadMap ? EventPayloadMap[K] : unknown;
53
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * `sandkit.api.excavation` — register custom excavation tool dig profiles.
3
- * Main thread only.
4
- */
5
- export namespace excavation {
6
- /**
7
- * Registers an excavation profile by id.
8
- * @param id - Unique profile id (1–128 chars: letters, numbers, `.`, `_`, `:`, `-`).
9
- * @param definition - Pattern, power, and profile options.
10
- */
11
- export function registerProfile(id: string, definition: ExcavationProfileDefinitionV1): void;
12
-
13
- /** Excavation tool profile definition. */
14
- export interface ExcavationProfileDefinitionV1 {
15
- /** Dig pattern grid; non-zero cells are removed. */
16
- pattern: number[][];
17
- /** Dig strength applied to matched cells. Clamped to 0–1000. */
18
- power: number;
19
- /** Optional profile-specific excavation flags. */
20
- options?: ExcavationProfileOptions;
21
- }
22
-
23
- /** Options attached to an excavation profile definition. */
24
- export interface ExcavationProfileOptions {
25
- fromGun?: boolean;
26
- fromRocketExplosion?: boolean;
27
- fromDrill?: boolean;
28
- useLiteralOutVelocity?: boolean;
29
- destroyNonDestructible?: boolean;
30
- forceRemoveAll?: boolean;
31
- /** Clamped to 0–1000 when set. */
32
- drillTierDamage?: number;
33
- }
34
- }
@@ -1,26 +0,0 @@
1
- import { CellCoordinates } from "../../shared/player";
2
-
3
- /**
4
- * `sandkit.api.fire` — ignite and burn elements at grid cells.
5
- * Main thread only.
6
- */
7
- export namespace fire {
8
- /**
9
- * Returns true when the element at the cell can burn.
10
- * @param cellX - Grid cell X coordinate.
11
- * @param cellY - Grid cell Y coordinate.
12
- */
13
- export function canBurnElementAtCell(...args: CellCoordinates): boolean;
14
- /**
15
- * Queues a burn at the cell when the simulation is idle.
16
- * @param cellX - Grid cell X coordinate.
17
- * @param cellY - Grid cell Y coordinate.
18
- */
19
- export function burnElementAtCellWhenIdle(...args: CellCoordinates): void;
20
- /**
21
- * Burns the element at the cell immediately. Returns true on success.
22
- * @param cellX - Grid cell X coordinate.
23
- * @param cellY - Grid cell Y coordinate.
24
- */
25
- export function burnElementAtCell(...args: CellCoordinates): boolean;
26
- }
@@ -1,26 +0,0 @@
1
- import { CellCoordinates } from "../../shared/player";
2
-
3
- /**
4
- * `sandkit.api.grid` — iterate cells in rectangular and circular regions.
5
- * Main thread only.
6
- */
7
- export namespace grid {
8
- /**
9
- * Calls the callback for each cell in a rectangle.
10
- * @param cellX - Origin cell column (top-left).
11
- * @param cellY - Origin cell row (top-left).
12
- * @param width - Rectangle width in cells.
13
- * @param height - Rectangle height in cells.
14
- * @param callback - Invoked for each cell with `(cellX, cellY)`.
15
- */
16
- export function forEachCellInRect(...args: [...CellCoordinates, width: number, height: number, callback: (...args: CellCoordinates) => void]): void;
17
-
18
- /**
19
- * Calls the callback for each cell inside a circle.
20
- * @param centerCellX - Circle center cell column.
21
- * @param centerCellY - Circle center cell row.
22
- * @param radius - Circle radius in cells.
23
- * @param callback - Invoked for each cell with `(cellX, cellY)`.
24
- */
25
- export function forEachCellInCircle(centerCellX: number, centerCellY: number, radius: number, callback: (...args: CellCoordinates) => void): void;
26
- }
@@ -1,52 +0,0 @@
1
- /**
2
- * `sandkit.api.hooks` — intercept and modify internal game hook points.
3
- * Main thread only.
4
- */
5
- export namespace hooks {
6
- /**
7
- * Registers an intercept hook. Returns an unsubscribe function.
8
- * @param hookId - Registered hook identifier.
9
- * @param callback - Called with hook arguments and context; may cancel the hook.
10
- * @param options - Optional priority and filter options.
11
- */
12
- export function intercept<K extends keyof InterceptHookMap>(hookId: K, callback: (args: InterceptHookMap[K], context: HookContext) => void, options?: HookOptions): () => void;
13
- /**
14
- * Registers a modifier hook. Returns an unsubscribe function.
15
- * @param hookId - Registered hook identifier.
16
- * @param callback - Called with hook arguments; may mutate hook payload.
17
- * @param options - Optional priority and filter options.
18
- */
19
- export function modify<K extends keyof ModifierHookMap>(hookId: K, callback: (args: ModifierHookMap[K]) => void, options?: HookOptions): () => void;
20
-
21
- /** Map of intercept hook ids to argument shapes (not yet typed in declarations). */
22
- export interface InterceptHookMap {
23
- "input:boost-down": Record<string, never>;
24
- "input:descend-down": Record<string, never>;
25
- "input:keydown": {
26
- key?: string;
27
- code?: string;
28
- event?: Event;
29
- };
30
- "input:keyup": {
31
- key?: string;
32
- code?: string;
33
- event?: Event;
34
- };
35
- "input:escape": Record<string, never>;
36
- "input:scroll": Record<string, unknown>;
37
- }
38
-
39
- /** Context passed to intercept hook callbacks. */
40
- export interface HookContext {
41
- /** When called, the intercepted action is skipped. */
42
- cancel(): void;
43
- }
44
- /** Map of modifier hook ids to argument shapes (not yet typed in declarations). */
45
- export type ModifierHookMap = unknown
46
- /** Options for hook registration. */
47
- export interface HookOptions {
48
- /** Run this hook before others with lower priority. */
49
- priority?: number;
50
- [key: string]: unknown;
51
- }
52
- }
@@ -1,66 +0,0 @@
1
- import type { shared } from "../../shared";
2
-
3
- /**
4
- * `sandkit.api.lights` — temporary VFX lights and persistent world lights.
5
- * Main thread only.
6
- */
7
- export namespace lights {
8
- /** Short-lived visual effect lights. */
9
- export namespace vfx {
10
- /**
11
- * Creates a temporary light at world coordinates.
12
- * @param worldX - World X coordinate in pixels.
13
- * @param worldY - World Y coordinate in pixels.
14
- * @param options - Brightness, duration, color, and dedup options.
15
- */
16
- export function createAtWorld(worldX: number, worldY: number, options?: TemporaryLightOptions): { index: number | null; };
17
- /**
18
- * Removes a temporary light by its id.
19
- * @param lightId - Light index returned from {@link createAtWorld}.
20
- */
21
- export function removeById(lightId: number): void;
22
- }
23
-
24
- /** Lights that persist in the world save. */
25
- export namespace persistent {
26
- /**
27
- * Creates a persistent light at world coordinates.
28
- * @param worldX - World X coordinate in pixels.
29
- * @param worldY - World Y coordinate in pixels.
30
- * @param options - Brightness, size, color, and persistence options.
31
- */
32
- export function createAtWorld(worldX: number, worldY: number, options?: PersistentLightOptions): PersistentLightHandle;
33
- /**
34
- * Removes the persistent light at world coordinates.
35
- * @param worldX - World X coordinate in pixels.
36
- * @param worldY - World Y coordinate in pixels.
37
- */
38
- export function removeAtWorld(worldX: number, worldY: number): void;
39
- /**
40
- * Fades out the persistent light at world coordinates over durationMs.
41
- * @param worldX - World X coordinate in pixels.
42
- * @param worldY - World Y coordinate in pixels.
43
- * @param durationMs - Fade duration in milliseconds.
44
- */
45
- export function fadeAtWorld(worldX: number, worldY: number, durationMs?: number): void;
46
- /** Marks persistent lights dirty so they are saved on the next flush. */
47
- export function markDirty(): void;
48
- }
49
-
50
- /** Options for temporary VFX lights. */
51
- export type TemporaryLightOptions = shared.api.effects.TemporaryLightOptions;
52
-
53
- /** Options for persistent world lights. */
54
- export interface PersistentLightOptions {
55
- /** Light brightness multiplier. */
56
- brightness?: number;
57
- /** Light radius in pixels. */
58
- size?: number;
59
- /** RGBA color components. */
60
- color?: [number, number, number, number];
61
- [key: string]: unknown;
62
- }
63
-
64
- /** Handle returned from {@link persistent.createAtWorld}. */
65
- export type PersistentLightHandle = unknown
66
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * Player position, movement, inventory, and building unlocks.
3
- *
4
- * Available as `sandkit.api.player`.
5
- *
6
- * @module
7
- */
8
- import { shared } from "../../shared";
9
-
10
- export namespace player {
11
-
12
- // Shared
13
- /** Return the player world position. */
14
- export import getWorldPosition = shared.api.player.getWorldPosition
15
- /** Return true when the player overlaps the given cell. */
16
- export import isCollidingWithCell = shared.api.player.isCollidingWithCell
17
- /** Return true when the player is within radius of the given cell. */
18
- export import isWithinRadiusOfCell = shared.api.player.isWithinRadiusOfCell
19
-
20
- /**
21
- * Set the player world position.
22
- * @param worldX - World x position in pixels.
23
- * @param worldY - World y position in pixels.
24
- */
25
- export function setWorldPosition(worldX: number, worldY: number): void;
26
-
27
- /**
28
- * Set the player velocity.
29
- * @param velocityX - Horizontal velocity in pixels per second.
30
- * @param velocityY - Vertical velocity in pixels per second.
31
- */
32
- export function setVelocity(velocityX: number, velocityY: number): void;
33
-
34
- /**
35
- * Set the movement speed multiplier.
36
- * @param multiplier - Speed scale factor (`1` is default walk). `0` freezes movement.
37
- * Vanilla Sprint Boost (Shift burst + meter) only runs when this value is exactly `1`.
38
- */
39
- export function setMovementSpeedMultiplier(multiplier: number): void;
40
-
41
- /**
42
- * Set movement mode to normal or hover.
43
- * @param mode - `"normal"` for default physics, or `"hover"` for hover flight.
44
- * @returns True when the mode changes.
45
- */
46
- export function setMovementMode(mode: 'normal' | 'hover'): boolean;
47
-
48
- /**
49
- * Return true when the player is on ground.
50
- * Tests solid cells 1 pixel below the hitbox. Do not use `player.onGround`
51
- * on the store snapshot — that flag is not updated during play.
52
- * @returns True when the player touches solid ground.
53
- */
54
- export function isOnGround(): boolean;
55
-
56
- /** Move the player down until ground is found. */
57
- export function teleportToGround(): void;
58
-
59
- /**
60
- * Return true when the world position has no collision.
61
- * @param worldX - World x position in pixels to test.
62
- * @param worldY - World y position in pixels to test.
63
- * @returns True when the player hitbox fits at the position.
64
- */
65
- export function isWorldPositionClear(worldX: number, worldY: number): boolean;
66
-
67
- /** Player inventory helpers. */
68
- export namespace inventory {
69
- /**
70
- * Add an item to inventory by item id.
71
- * @param itemId - Registered item id string.
72
- */
73
- export function addFromId(itemId: string): void;
74
- }
75
-
76
- /** Player building unlock helpers. */
77
- export namespace buildings {
78
- /**
79
- * Unlock a structure type for building.
80
- * @param structureId - Registered structure id string.
81
- */
82
- export function unlockByType(structureId: string): void;
83
- }
84
- }