@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
@@ -1,27 +0,0 @@
1
- /**
2
- * Cross-thread shared memory buffers.
3
- *
4
- * Available as `sandkit.api.shared`.
5
- *
6
- * @module
7
- */
8
- // Aliased: this module declares its own `shared` namespace below.
9
- import { shared as sharedApi } from "../../shared";
10
-
11
- export namespace shared {
12
- /** Shared buffer create and lookup. */
13
- export namespace buffers {
14
- /**
15
- * Create a named shared buffer with type and length.
16
- * @param key - Buffer name shared across threads.
17
- * @param config - Typed array kind and element count.
18
- */
19
- export function create(key: string, config: { type: SharedArrayType; length: number; }): SharedArray;
20
- /** Look up a named shared buffer without creating it. */
21
- export import get = sharedApi.api.shared.buffers.get
22
- }
23
- /** Opaque shared array backing store. */
24
- export import SharedArray = sharedApi.api.shared.SharedArray
25
- /** Discriminator for the underlying typed array kind. */
26
- export import SharedArrayType = sharedApi.api.shared.SharedArrayType
27
- }
@@ -1,125 +0,0 @@
1
- /**
2
- * Terrain registration, queries, and idle 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
- /** Resolve a terrain string id to its cell type number. */
15
- export import getTypeFromId = shared.api.terrains.getTypeFromId;
16
- /** Return terrain cell type at a cell, or null. */
17
- export import getTypeAtCell = shared.api.terrains.getTypeAtCell;
18
- /** Return terrain data at a cell, or null. */
19
- export import getDataAtCell = shared.api.terrains.getDataAtCell;
20
- /** Return true when any terrain exists at the cell. */
21
- export import isAtCell = shared.api.terrains.isAtCell;
22
- /** Return true when terrain at the cell matches a string id. */
23
- export import isTypeAtCell = shared.api.terrains.isTypeAtCell;
24
- /** Return true when a cell id represents terrain. */
25
- export import isCellIdTerrain = shared.api.terrains.isCellIdTerrain;
26
- /** Apply damage to terrain at a cell. */
27
- export import damageAtCell = shared.api.terrains.damageAtCell;
28
- /** Create terrain at a cell immediately. */
29
- export import createAtCell = shared.api.terrains.createAtCell;
30
- /** Replace terrain at a cell immediately. */
31
- export import replaceAtCell = shared.api.terrains.replaceAtCell;
32
- /** Remove terrain at a cell immediately. */
33
- export import removeAtCell = shared.api.terrains.removeAtCell;
34
- /** Options for terrain create, replace, and remove calls. */
35
- export import TerrainMutationOptions = shared.api.terrains.TerrainMutationOptions;
36
- /** Numeric terrain cell type handle. */
37
- export import TerrainType = shared.api.terrains.TerrainType;
38
- /** Mod or built-in terrain string id. */
39
- export import TerrainId = shared.api.terrains.TerrainId;
40
- /** Type handle or string id accepted by mutation helpers. */
41
- export import TerrainRef = shared.api.terrains.TerrainRef;
42
-
43
- /**
44
- * Register a new terrain definition.
45
- * @param definition - Terrain definition to register.
46
- * @returns Object with the assigned `cellType`.
47
- */
48
- export function register(definition: TerrainDefinition): { cellType: TerrainType; };
49
-
50
- /**
51
- * Patch fields on an existing terrain definition.
52
- * @param cellTypeOrId - Numeric cell type or terrain string id.
53
- * @param partial - Fields to merge onto the definition.
54
- */
55
- export function updateDefinition(cellTypeOrId: TerrainRef, partial: Partial<TerrainDefinition>): void;
56
-
57
- /**
58
- * Create terrain at a cell when simulation is idle.
59
- * @param cellX - Grid column of the target cell.
60
- * @param cellY - Grid row of the target cell.
61
- * @param terrainTypeOrId - Numeric cell type or terrain string id.
62
- * @param options - Optional mutation flags.
63
- */
64
- export function createAtCellWhenIdle(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
65
-
66
- /**
67
- * Replace terrain at a cell when simulation is idle.
68
- * @param cellX - Grid column of the target cell.
69
- * @param cellY - Grid row of the target cell.
70
- * @param terrainTypeOrId - Numeric cell type or terrain string id.
71
- * @param options - Optional mutation flags.
72
- */
73
- export function replaceAtCellWhenIdle(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
74
-
75
- /**
76
- * Remove terrain at a cell when simulation is idle.
77
- * @param cellX - Grid column of the target cell.
78
- * @param cellY - Grid row of the target cell.
79
- * @param options - Optional mutation flags.
80
- */
81
- export function removeAtCellWhenIdle(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
82
-
83
- /**
84
- * Set terrain hit points at a cell when simulation is idle.
85
- * @param cellX - Grid column of the target cell.
86
- * @param cellY - Grid row of the target cell.
87
- * @param hp - New hit point value.
88
- */
89
- export function setHpAtCellWhenIdle(...args: [...CellCoordinates, hp: number]): void;
90
-
91
- /**
92
- * Set terrain hit points at a cell immediately.
93
- * @param cellX - Grid column of the target cell.
94
- * @param cellY - Grid row of the target cell.
95
- * @param hp - New hit point value.
96
- * @returns True when hp changed or the terrain was removed.
97
- */
98
- export function setHpAtCell(...args: [...CellCoordinates, hp: number]): boolean;
99
-
100
- /** Terrain definition shape for {@link register} and {@link updateDefinition}. */
101
- export interface TerrainDefinition {
102
- /** Unique mod-scoped terrain id. */
103
- id: string;
104
- /** i18n key for the terrain display name. */
105
- nameKey?: string;
106
- /** Default terrain hit points. */
107
- hp?: number;
108
- /** Material id used for rendering. Must be > obstacle breakpoint and < 150. */
109
- materialId?: number;
110
- /** UI/meta color as 0xRRGGBB. */
111
- metaColor?: number;
112
- /** Base terrain color as HSL components. */
113
- colorHSL?: [number, number, number];
114
- /** Tool item ids required to excavate this terrain. */
115
- excavationRequirements?: readonly string[];
116
- /** Tooltip interactions shown for this terrain. */
117
- interactions?: readonly elements.Interaction[];
118
- /** Default element drop when the terrain is destroyed. */
119
- output?: {
120
- elementType: elements.ElementType;
121
- chance: number;
122
- };
123
- [key: string]: unknown;
124
- }
125
- }
@@ -1,107 +0,0 @@
1
- /**
2
- * World cell queries, excavation, fog, redraw, and pickups.
3
- *
4
- * Available as `sandkit.api.world`.
5
- *
6
- * @module
7
- */
8
- import { CellCoordinates } from "../../shared/player";
9
- import { shared } from "../../shared";
10
- import type { WorldItemType as WorldItemTypeEnum } from "../enums/index";
11
-
12
- export namespace world {
13
-
14
- /** Return cell id at a grid cell. */
15
- export import getCellIdAtCell = shared.api.world.getCellIdAtCell;
16
- /** Return true when the cell is empty. */
17
- export import isCellEmptyAtCell = shared.api.world.isCellEmptyAtCell;
18
- /** Return true when the cell holds terrain. */
19
- export import isTerrainAtCell = shared.api.world.isTerrainAtCell;
20
- /** Mark a cell as active for simulation this tick. */
21
- export import reportActivityAtCell = shared.api.world.reportActivityAtCell;
22
- /** Excavate at a cell with output velocity and damage. */
23
- export import excavateAtCell = shared.api.world.excavateAtCell;
24
- /** Options for {@link excavateAtCell}. */
25
- export import ExcavateOptions = shared.api.world.ExcavateOptions;
26
- /** Packed cell id from {@link getCellIdAtCell}. */
27
- export import CellId = shared.api.world.CellId;
28
-
29
- /**
30
- * Run a callback when simulation is idle.
31
- * @param callback - Function invoked on the main thread when workers are idle.
32
- */
33
- export function runWhenSimulationIdle(callback: () => void): void;
34
-
35
- /**
36
- * Reveal fog of war at a cell.
37
- * @param cellX - Grid column of the target cell.
38
- * @param cellY - Grid row of the target cell.
39
- */
40
- export function revealFogAtCell(...args: CellCoordinates): void;
41
-
42
- /**
43
- * Request redraw around a cell when simulation is idle.
44
- * @param cellX - Grid column of the target cell.
45
- * @param cellY - Grid row of the target cell.
46
- * @param range - Radius in cells to redraw.
47
- */
48
- export function redrawAroundCellWhenIdle(...args: [...CellCoordinates, range: number]): void;
49
-
50
- /** World item spawn, pickup, and lookup. */
51
- export namespace pickups {
52
- /**
53
- * Spawn a world pickup at world position.
54
- * @param type - Pickup type discriminator.
55
- * @param worldX - World x position in pixels.
56
- * @param worldY - World y position in pixels.
57
- * @param data - Optional per-item data bag copied onto the instance.
58
- * @param light - Optional point light spawned with the pickup.
59
- * @returns The spawned world item instance.
60
- */
61
- export function spawnAtWorld(type: WorldItemType, worldX: number, worldY: number, data?: Record<string, unknown>, light?: WorldItemLight): WorldItem;
62
-
63
- /**
64
- * Destroy a world pickup instance.
65
- * @param worldItem - World item returned from spawn or lookup helpers.
66
- */
67
- export function destroy(worldItem: WorldItem): void;
68
-
69
- /**
70
- * Pick up a world item into inventory.
71
- * @param worldItem - World item to pick up.
72
- * @returns True when the item was collected.
73
- */
74
- export function pickUp(worldItem: WorldItem): boolean;
75
-
76
- /** Return all active world pickups. */
77
- export function getAll(): WorldItem[];
78
-
79
- /**
80
- * Return a world pickup by numeric id.
81
- * @param worldItemId - Runtime world item id.
82
- */
83
- export function getById(worldItemId: number): WorldItem | undefined;
84
- }
85
-
86
- /** World pickup type discriminator. */
87
- export type WorldItemType = WorldItemTypeEnum;
88
-
89
- /** Optional point light attached when spawning a pickup. */
90
- export interface WorldItemLight {
91
- /** Light brightness multiplier. Default 1. */
92
- brightness?: number;
93
- /** Light radius in world pixels. Default 100. */
94
- size?: number;
95
- /** RGB or RGBA color components in 0–1 range. */
96
- color?: [number, number, number] | [number, number, number, number];
97
- }
98
-
99
- /** Active world pickup instance. */
100
- export interface WorldItem {
101
- id: number;
102
- x: number;
103
- y: number;
104
- type: WorldItemType;
105
- data: Record<string, unknown>;
106
- }
107
- }
@@ -1,100 +0,0 @@
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
-
5
- /**
6
- * Shared `sandkit.api.terrains` base — terrain type lookup and cell mutation.
7
- *
8
- * @internal Base namespace reused by main and worker declarations.
9
- */
10
- export namespace terrains {
11
- /**
12
- * Resolve a terrain string id to a numeric cell type.
13
- * @param terrainId - Mod-registered or built-in terrain id.
14
- * @returns Numeric terrain cell type.
15
- */
16
- export function getTypeFromId(terrainId: TerrainId): TerrainType;
17
-
18
- /**
19
- * Return the terrain cell type at a cell, or null when none.
20
- * @param cellX - Grid column of the target cell.
21
- * @param cellY - Grid row of the target cell.
22
- */
23
- export function getTypeAtCell(...args: CellCoordinates): TerrainType | null;
24
-
25
- /**
26
- * Return terrain cell type and hit points at a cell.
27
- * @param cellX - Grid column of the target cell.
28
- * @param cellY - Grid row of the target cell.
29
- * @returns Cell type and hp, or null when the cell is not terrain.
30
- */
31
- export function getDataAtCell(...args: CellCoordinates): { cellType: TerrainType; hp: number | null; } | null;
32
-
33
- /**
34
- * Return true when any terrain occupies the cell.
35
- * @param cellX - Grid column of the target cell.
36
- * @param cellY - Grid row of the target cell.
37
- */
38
- export function isAtCell(...args: CellCoordinates): boolean;
39
-
40
- /**
41
- * Return true when the cell terrain matches the given id.
42
- * @param cellX - Grid column of the target cell.
43
- * @param cellY - Grid row of the target cell.
44
- * @param terrainId - Terrain string id to compare.
45
- */
46
- export function isTypeAtCell(...args: [...CellCoordinates, terrainId: TerrainId]): boolean;
47
-
48
- /**
49
- * Return true when a packed cell id refers to terrain.
50
- * @param cellId - Packed cell id from {@link world.getCellIdAtCell}.
51
- */
52
- export function isCellIdTerrain(cellId: CellId): boolean;
53
-
54
- /**
55
- * Apply damage to terrain at a cell.
56
- * @param cellX - Grid column of the target cell.
57
- * @param cellY - Grid row of the target cell.
58
- * @param damage - Damage amount to apply.
59
- */
60
- export function damageAtCell(...args: [...CellCoordinates, damage: number]): void;
61
-
62
- /**
63
- * Place terrain at an empty cell.
64
- * @param cellX - Grid column of the target cell.
65
- * @param cellY - Grid row of the target cell.
66
- * @param terrainTypeOrId - Numeric cell type or terrain string id.
67
- * @param options - Optional mutation flags.
68
- */
69
- export function createAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
70
-
71
- /**
72
- * Replace existing terrain at a cell.
73
- * @param cellX - Grid column of the target cell.
74
- * @param cellY - Grid row of the target cell.
75
- * @param terrainTypeOrId - Numeric cell type or terrain string id.
76
- * @param options - Optional mutation flags.
77
- */
78
- export function replaceAtCell(...args: [...CellCoordinates, terrainTypeOrId: TerrainRef, options?: TerrainMutationOptions]): void;
79
-
80
- /**
81
- * Remove terrain from a cell.
82
- * @param cellX - Grid column of the target cell.
83
- * @param cellY - Grid row of the target cell.
84
- * @param options - Optional mutation flags.
85
- */
86
- export function removeAtCell(...args: [...CellCoordinates, options?: TerrainMutationOptions]): void;
87
-
88
- /** Options for terrain create, replace, or remove calls. */
89
- export interface TerrainMutationOptions {
90
- /** Skip shadow updates around the changed cell. */
91
- skipShadow?: boolean;
92
- }
93
-
94
- /** Numeric terrain / {@link CellTypeEnum} handle. */
95
- export type TerrainType = CellTypeEnum | TaggedNumber<"terrainType">;
96
- /** Mod or built-in terrain string id. */
97
- export type TerrainId = LooseString<never>;
98
- /** Type handle or string id accepted by mutation helpers. */
99
- export type TerrainRef = TerrainType | TerrainId;
100
- }
@@ -1,60 +0,0 @@
1
- import type { CellCoordinates } from "../../shared/player";
2
- import { shared } from "../../shared";
3
-
4
- /**
5
- * Worker-thread `sandkit.api.elements` — shared reads plus direct mutations.
6
- *
7
- * Main thread uses `*WhenIdle` helpers instead of `createAtCell` /
8
- * `replaceAtCell` / `removeAtCell`. Built on {@link elements} base shapes.
9
- *
10
- * @internal Worker extension; not interchangeable with main-thread
11
- * `sandkit.api.elements`.
12
- */
13
- export namespace elements {
14
- /** Numeric id for a registered element type. */
15
- export import ElementType = shared.api.elements.ElementType;
16
- /** Mod or built-in element string id. */
17
- export import ElementId = shared.api.elements.ElementId;
18
- /** Type handle or string id accepted by lookup helpers. */
19
- export import ElementRef = shared.api.elements.ElementRef;
20
- /** Matter category for element physics behavior. */
21
- export import MatterType = shared.api.elements.MatterType;
22
- /** Full definition used to register a custom element. */
23
- export import ElementDefinition = shared.api.elements.ElementDefinition;
24
- /** Options for {@link createAtCell}. */
25
- export import ElementCreateOptions = shared.api.elements.ElementCreateOptions;
26
- /** Resolves a string element id to its numeric type. */
27
- export import getTypeFromId = shared.api.elements.getTypeFromId;
28
- /** Returns the definition for an element type. */
29
- export import getDefinitionByType = shared.api.elements.getDefinitionByType;
30
- /** Returns the element type at a cell, or null. */
31
- export import getTypeAtCell = shared.api.elements.getTypeAtCell;
32
- /** Returns the resolved element type at a cell, or null. */
33
- export import getResolvedTypeAtCell = shared.api.elements.getResolvedTypeAtCell;
34
- /** Returns the resolved element type from a cell id, or null. */
35
- export import getResolvedTypeFromCellId = shared.api.elements.getResolvedTypeFromCellId;
36
- /** Returns element info at a cell, or null. */
37
- export import getInfoAtCell = shared.api.elements.getInfoAtCell;
38
- /** Returns the matter type at a cell, or null. */
39
- export import getMatterTypeAtCell = shared.api.elements.getMatterTypeAtCell;
40
- /** Returns true when the cell contains the given element type. */
41
- export import isTypeAtCell = shared.api.elements.isTypeAtCell;
42
- /** Returns true when the element at the cell is free-falling. */
43
- export import isFreeFallingAtCell = shared.api.elements.isFreeFallingAtCell;
44
- /** Returns particle velocity at a cell, or null. */
45
- export import getVelocityAtCell = shared.api.elements.getVelocityAtCell;
46
- /** Returns a data field value at a cell, or null. */
47
- export import getDataFieldAtCell = shared.api.elements.getDataFieldAtCell;
48
-
49
- /**
50
- * Create an element at a cell immediately on this worker.
51
- * Main thread: use `createAtCellWhenIdle`.
52
- * @param cellX - Grid column of the target cell.
53
- * @param cellY - Grid row of the target cell.
54
- * @param elementType - Element type to place.
55
- * @param options - Optional spawn overrides.
56
- */
57
- export function createAtCell(
58
- ...args: [...CellCoordinates, elementType: ElementType, options?: ElementCreateOptions]
59
- ): void;
60
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes