@sandustry-modding/types 0.1.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 (124) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +66 -0
  3. package/global.d.ts +38 -0
  4. package/package.json +44 -0
  5. package/sandkit/api/action.d.ts +28 -0
  6. package/sandkit/api/assets.d.ts +30 -0
  7. package/sandkit/api/authorization.d.ts +54 -0
  8. package/sandkit/api/building.d.ts +92 -0
  9. package/sandkit/api/camera.d.ts +23 -0
  10. package/sandkit/api/collector.d.ts +36 -0
  11. package/sandkit/api/constants.d.ts +21 -0
  12. package/sandkit/api/cooldown.d.ts +26 -0
  13. package/sandkit/api/discoveries.d.ts +18 -0
  14. package/sandkit/api/effects.d.ts +76 -0
  15. package/sandkit/api/elements.d.ts +237 -0
  16. package/sandkit/api/energy.d.ts +70 -0
  17. package/sandkit/api/events.d.ts +53 -0
  18. package/sandkit/api/excavation.d.ts +34 -0
  19. package/sandkit/api/fire.d.ts +26 -0
  20. package/sandkit/api/gameconfig.d.ts +15 -0
  21. package/sandkit/api/grid.d.ts +26 -0
  22. package/sandkit/api/hooks.d.ts +52 -0
  23. package/sandkit/api/i18n.d.ts +101 -0
  24. package/sandkit/api/index.d.ts +66 -0
  25. package/sandkit/api/input.d.ts +119 -0
  26. package/sandkit/api/items.d.ts +60 -0
  27. package/sandkit/api/lights.d.ts +66 -0
  28. package/sandkit/api/maps.d.ts +33 -0
  29. package/sandkit/api/mods.d.ts +18 -0
  30. package/sandkit/api/patterns.d.ts +32 -0
  31. package/sandkit/api/player.d.ts +84 -0
  32. package/sandkit/api/processing.d.ts +66 -0
  33. package/sandkit/api/progression.d.ts +22 -0
  34. package/sandkit/api/projectiles.d.ts +80 -0
  35. package/sandkit/api/random.d.ts +21 -0
  36. package/sandkit/api/raycast.d.ts +19 -0
  37. package/sandkit/api/reactions.d.ts +30 -0
  38. package/sandkit/api/rendering.d.ts +26 -0
  39. package/sandkit/api/resources.d.ts +23 -0
  40. package/sandkit/api/sandkit-api.d.ts +117 -0
  41. package/sandkit/api/scene.d.ts +15 -0
  42. package/sandkit/api/schedule.d.ts +14 -0
  43. package/sandkit/api/settings.d.ts +29 -0
  44. package/sandkit/api/shared.d.ts +27 -0
  45. package/sandkit/api/signals.d.ts +25 -0
  46. package/sandkit/api/sound.d.ts +91 -0
  47. package/sandkit/api/sprites.d.ts +45 -0
  48. package/sandkit/api/storage.d.ts +55 -0
  49. package/sandkit/api/structureBehaviors.d.ts +22 -0
  50. package/sandkit/api/structures.d.ts +320 -0
  51. package/sandkit/api/tech.d.ts +66 -0
  52. package/sandkit/api/terrains.d.ts +125 -0
  53. package/sandkit/api/time.d.ts +13 -0
  54. package/sandkit/api/tools.d.ts +35 -0
  55. package/sandkit/api/triggers.d.ts +24 -0
  56. package/sandkit/api/ui.d.ts +175 -0
  57. package/sandkit/api/upgrades.d.ts +63 -0
  58. package/sandkit/api/utils.d.ts +35 -0
  59. package/sandkit/api/workers.d.ts +14 -0
  60. package/sandkit/api/world.d.ts +107 -0
  61. package/sandkit/engine/api/augments.d.ts +96 -0
  62. package/sandkit/engine/api/auralite.d.ts +21 -0
  63. package/sandkit/engine/api/blueprints.d.ts +47 -0
  64. package/sandkit/engine/api/clipboard.d.ts +46 -0
  65. package/sandkit/engine/api/colorPicker.d.ts +74 -0
  66. package/sandkit/engine/api/coloringTool.d.ts +56 -0
  67. package/sandkit/engine/api/conveyors.d.ts +16 -0
  68. package/sandkit/engine/api/debug.d.ts +16 -0
  69. package/sandkit/engine/api/drones.d.ts +21 -0
  70. package/sandkit/engine/api/entities.d.ts +66 -0
  71. package/sandkit/engine/api/extensions.d.ts +16 -0
  72. package/sandkit/engine/api/factory.d.ts +56 -0
  73. package/sandkit/engine/api/foliage.d.ts +31 -0
  74. package/sandkit/engine/api/foundationColorPicker.d.ts +16 -0
  75. package/sandkit/engine/api/game.d.ts +26 -0
  76. package/sandkit/engine/api/heatTransfer.d.ts +46 -0
  77. package/sandkit/engine/api/index.d.ts +47 -0
  78. package/sandkit/engine/api/launchers.d.ts +16 -0
  79. package/sandkit/engine/api/lightColorPicker.d.ts +16 -0
  80. package/sandkit/engine/api/matters.d.ts +26 -0
  81. package/sandkit/engine/api/misc.d.ts +16 -0
  82. package/sandkit/engine/api/portals.d.ts +16 -0
  83. package/sandkit/engine/api/prefabData.d.ts +36 -0
  84. package/sandkit/engine/api/prefabDecor.d.ts +21 -0
  85. package/sandkit/engine/api/prefabulator.d.ts +21 -0
  86. package/sandkit/engine/api/prismaline.d.ts +26 -0
  87. package/sandkit/engine/api/prismite.d.ts +26 -0
  88. package/sandkit/engine/api/queue.d.ts +41 -0
  89. package/sandkit/engine/api/shadows.d.ts +26 -0
  90. package/sandkit/engine/api/strataform.d.ts +36 -0
  91. package/sandkit/engine/api/swarmConsole.d.ts +71 -0
  92. package/sandkit/engine/api/sweeperDrone.d.ts +16 -0
  93. package/sandkit/engine/api/teleportZones.d.ts +46 -0
  94. package/sandkit/engine/api/tutorialBuild.d.ts +66 -0
  95. package/sandkit/engine/api/usageTracker.d.ts +26 -0
  96. package/sandkit/engine/api/wall.d.ts +31 -0
  97. package/sandkit/engine/api/workerLocal.d.ts +30 -0
  98. package/sandkit/engine/index.d.ts +135 -0
  99. package/sandkit/engine/retro-console.d.ts +52 -0
  100. package/sandkit/engine/state.d.ts +31 -0
  101. package/sandkit/enums/index.d.ts +444 -0
  102. package/sandkit/index.d.ts +47 -0
  103. package/sandkit/react.d.ts +49 -0
  104. package/shared/api/effects.d.ts +76 -0
  105. package/shared/api/elements.d.ts +162 -0
  106. package/shared/api/maps.d.ts +30 -0
  107. package/shared/api/player.d.ts +31 -0
  108. package/shared/api/shared.d.ts +46 -0
  109. package/shared/api/structures.d.ts +138 -0
  110. package/shared/api/terrains.d.ts +100 -0
  111. package/shared/api/ui.d.ts +54 -0
  112. package/shared/api/world.d.ts +71 -0
  113. package/shared/asset.d.ts +14 -0
  114. package/shared/engine.d.ts +17 -0
  115. package/shared/index.d.ts +25 -0
  116. package/shared/jsonvalue.d.ts +30 -0
  117. package/shared/nominal.d.ts +31 -0
  118. package/shared/player.d.ts +173 -0
  119. package/worker/api/elements.d.ts +60 -0
  120. package/worker/api/main.d.ts +16 -0
  121. package/worker/api/shared.d.ts +38 -0
  122. package/worker/api/worker.d.ts +20 -0
  123. package/worker/index.d.ts +29 -0
  124. package/worker/sandkit-api.d.ts +31 -0
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Main-thread `sandkit.api` barrel.
3
+ *
4
+ * Re-exports all namespaces available as `sandkit.api.*` on the main thread.
5
+ * Prefer these methods over {@link sandkit.engine} when both exist.
6
+ *
7
+ * @module
8
+ */
9
+
10
+ export * from "./action"
11
+ export * from "./assets"
12
+ export * from "./authorization"
13
+ export * from "./building"
14
+ export * from "./camera"
15
+ export * from "./collector"
16
+ export * from "./constants"
17
+ export * from "./cooldown"
18
+ export * from "./discoveries"
19
+ export * from "./effects"
20
+ export * from "./elements"
21
+ export * from "./energy"
22
+ export * from "./events"
23
+ export * from "./excavation"
24
+ export * from "./fire"
25
+ export * from "./gameconfig"
26
+ export * from "./grid"
27
+ export * from "./hooks"
28
+ export * from "./i18n"
29
+ export * from "./input"
30
+ export * from "./items"
31
+ export * from "./lights"
32
+ export * from "./maps"
33
+ export * from "./mods"
34
+ export * from "./patterns"
35
+ export * from "./player"
36
+ export * from "./processing"
37
+ export * from "./progression"
38
+ export * from "./projectiles"
39
+ export * from "./random"
40
+ export * from "./raycast"
41
+ export * from "./reactions"
42
+ export * from "./rendering"
43
+ export * from "./resources"
44
+ export * from "./scene"
45
+ export * from "./schedule"
46
+ export * from "./settings"
47
+ export * from "./shared"
48
+ export * from "./signals"
49
+ export * from "./sound"
50
+ export * from "./sprites"
51
+ export * from "./storage"
52
+ export * from "./structureBehaviors"
53
+ export * from "./structures"
54
+ export * from "./tech"
55
+ export * from "./terrains"
56
+ export * from "./time"
57
+ export * from "./tools"
58
+ export * from "./triggers"
59
+ export * from "./ui"
60
+ export * from "./upgrades"
61
+ export * from "./utils"
62
+ export * from "./workers"
63
+ export * from "./world"
64
+
65
+ /** Composed type of the main-thread `sandkit.api` object. */
66
+ export type { SandkitApi } from "./sandkit-api"
@@ -0,0 +1,119 @@
1
+ import type { KeyBinding as KeyBindingEnum } from "../enums/index";
2
+ import type { LooseString } from "../../shared/nominal";
3
+
4
+ /**
5
+ * `sandkit.api.input` — key bindings, mouse position, and modifier keys.
6
+ * Main thread only.
7
+ */
8
+ export namespace input {
9
+ /**
10
+ * Register a key binding and return its binding id.
11
+ * @param bindingId - Unique id for the binding (also used in settings).
12
+ * @param defaultKeys - Default key codes (for example `"Control+KeyC"`).
13
+ * @param definition - Display metadata and press/release handlers.
14
+ * @returns The registered binding id.
15
+ */
16
+ export function registerBinding(bindingId: BindingId, defaultKeys: KeyCode[], definition: InputBindingDefinition): BindingId;
17
+
18
+ /**
19
+ * Return the mouse position in cell coordinates.
20
+ * @returns Cell `{ x, y }` under the cursor.
21
+ */
22
+ export function getMouseCellPosition(): { x: number; y: number; };
23
+
24
+ /**
25
+ * Return the keys currently bound to a binding id.
26
+ * @param bindingId - Registered binding id.
27
+ * @returns Key strings from settings (for example `"KeyA"` or `"Shift"`).
28
+ * Session `input.keys` is keyed by `KeyboardEvent.code`. Modifier aliases
29
+ * (`Shift`, `Alt`, `Control`, `Meta`) expand to `ShiftLeft` / `ShiftRight` and the same for the other modifiers.
30
+ */
31
+ export function getBoundKeys(bindingId: BindingId): KeyCode[];
32
+
33
+ /**
34
+ * Return a display label for the bound key.
35
+ * @param bindingId - Registered binding id.
36
+ * @param defaultLabel - Fallback label when no key is bound.
37
+ * @returns Human-readable key label for UI.
38
+ */
39
+ export function getDisplayKey(bindingId: BindingId, defaultLabel?: string): string;
40
+
41
+ /**
42
+ * Fire the binding down handler as if the key was pressed.
43
+ * @param bindingId - Registered binding id.
44
+ */
45
+ export function triggerBinding(bindingId: BindingId): void;
46
+
47
+ /**
48
+ * Fire the binding down handler without a matching release.
49
+ * @param bindingId - Registered binding id.
50
+ */
51
+ export function pressBinding(bindingId: BindingId): void;
52
+
53
+ /**
54
+ * Fire the binding up handler.
55
+ * @param bindingId - Registered binding id.
56
+ */
57
+ export function releaseBinding(bindingId: BindingId): void;
58
+
59
+ /** Clear internal mouse button state. */
60
+ export function resetMouseState(): void;
61
+
62
+ /**
63
+ * Return true when Ctrl is held.
64
+ * @returns True when the Ctrl modifier is down.
65
+ */
66
+ export function isCtrlHeld(): boolean;
67
+
68
+ /**
69
+ * Return true when Alt is held.
70
+ * @returns True when the Alt modifier is down.
71
+ */
72
+ export function isAltHeld(): boolean;
73
+
74
+ /**
75
+ * Binding id. Vanilla {@link KeyBindingEnum} names autocomplete; custom ids are allowed.
76
+ */
77
+ export type BindingId = LooseString<`${KeyBindingEnum}`>;
78
+
79
+ /**
80
+ * KeyboardEvent.code, a modifier alias (`Shift`), or a chord (`Control+KeyC`).
81
+ */
82
+ export type KeyCode = LooseString<
83
+ | "Shift"
84
+ | "Alt"
85
+ | "Control"
86
+ | "Meta"
87
+ | "ShiftLeft"
88
+ | "ShiftRight"
89
+ | "AltLeft"
90
+ | "AltRight"
91
+ | "ControlLeft"
92
+ | "ControlRight"
93
+ | "MetaLeft"
94
+ | "MetaRight"
95
+ >;
96
+
97
+ /** Handlers invoked when a binding is pressed or released. */
98
+ export interface InputBindingHandlers {
99
+ /** Called when the binding is pressed. */
100
+ down?: () => void;
101
+ /** Called when the binding is released. */
102
+ up?: () => void;
103
+ }
104
+
105
+ /** Definition for a registered input binding. */
106
+ export interface InputBindingDefinition {
107
+ /** Display name shown in settings. */
108
+ displayName: string;
109
+ /** i18n key for the display name (overrides displayName when set). */
110
+ displayNameKey?: string;
111
+ /** Settings category for grouping. */
112
+ category: string;
113
+ /** Press and release handlers. */
114
+ handlers: InputBindingHandlers;
115
+
116
+ // Temporary until we're sure we have the full definition.
117
+ [key: string]: unknown;
118
+ }
119
+ }
@@ -0,0 +1,60 @@
1
+ import type { ItemId as ItemIdEnum, ItemType as ItemTypeEnum } from "../enums/index";
2
+ import type { LooseString, TaggedNumber } from "../../shared/nominal";
3
+
4
+ /**
5
+ * `sandkit.api.items` — register custom inventory items and query active items.
6
+ * Main thread only.
7
+ */
8
+ export namespace items {
9
+ /** Definition for a mod-registered inventory item. */
10
+ export interface ItemDefinition<State = unknown, Action = unknown> {
11
+ /** Handles item use actions. */
12
+ handleAction?: (state: State, action: Action) => unknown;
13
+ /** Called after the item is rendered each frame. */
14
+ afterRender?: (state: State) => void;
15
+ [key: string]: unknown;
16
+ }
17
+
18
+ /**
19
+ * Registers a new item definition.
20
+ * @param definition - Item id, handlers, and display metadata.
21
+ */
22
+ export function register(definition: ItemDefinition): void;
23
+ /**
24
+ * Updates fields on an existing item definition.
25
+ * @param itemId - Registered item id.
26
+ * @param partial - Fields to merge into the definition.
27
+ */
28
+ export function updateDefinition(itemId: ItemId, partial: Partial<ItemDefinition>): void;
29
+ /**
30
+ * Returns the item definition for an id, or undefined.
31
+ * @param itemId - Registered item id.
32
+ */
33
+ export function getDefinitionById(itemId: ItemId): ItemDefinition | undefined;
34
+ /**
35
+ * Creates a runtime item instance from an id.
36
+ * @param itemId - Registered item id.
37
+ */
38
+ export function createFromId(itemId: ItemId): ModItem;
39
+ /** Returns the item definition for the active hotbar slot. */
40
+ export function getActive(): ItemDefinition | undefined;
41
+ /**
42
+ * Returns true when the given item is the active hotbar item.
43
+ * @param itemId - Item id or numeric type to compare.
44
+ * @param itemType - Optional item type discriminator.
45
+ */
46
+ export function isActiveById(itemId: ItemId, itemType?: ItemType): boolean;
47
+
48
+ /**
49
+ * Inventory item id.
50
+ * Built-in {@link ItemIdEnum} values autocomplete; custom string ids are allowed.
51
+ */
52
+ export type ItemId = ItemIdEnum | LooseString<never>;
53
+ /**
54
+ * Item category handle.
55
+ * Built-in {@link ItemTypeEnum} values autocomplete.
56
+ */
57
+ export type ItemType = ItemTypeEnum | TaggedNumber<"itemType">;
58
+ /** Runtime item instance (not yet typed in declarations). */
59
+ export type ModItem = unknown;
60
+ }
@@ -0,0 +1,66 @@
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
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Map selection and session start.
3
+ *
4
+ * Available as `sandkit.api.maps`.
5
+ *
6
+ * @module
7
+ */
8
+ import { shared } from "../../shared";
9
+
10
+ export namespace maps {
11
+ // Shared
12
+ /** Return the active map for this session. */
13
+ export import getActive = shared.api.maps.getActive
14
+ /** Active map data shape. */
15
+ export import ActiveMapV1 = shared.api.maps.ActiveMapV1
16
+
17
+ /** Return maps the player can start. */
18
+ export function getAvailable(): readonly Readonly<AvailableMapV1>[];
19
+ /**
20
+ * Start a map by id. Return true when start succeeds.
21
+ * @param mapId - Custom map identifier.
22
+ */
23
+ export function start(mapId: string): boolean;
24
+
25
+ /** Available map entry shape. */
26
+ export interface AvailableMapV1 {
27
+ /** Map identifier passed to {@link start}. */
28
+ id: string;
29
+ /** Display name or translation key. */
30
+ name?: string;
31
+ [key: string]: unknown;
32
+ }
33
+ }
@@ -0,0 +1,18 @@
1
+ import type { assets } from "./assets";
2
+
3
+ /**
4
+ * Mod asset provider lookup.
5
+ *
6
+ * Available as `sandkit.api.mods`.
7
+ *
8
+ * @module
9
+ */
10
+ export namespace mods {
11
+ /**
12
+ * Return asset providers registered for a kind string.
13
+ * @param kind - Asset kind identifier (e.g. texture pack category).
14
+ */
15
+ export function getProviders(kind: string): readonly AssetProviderV1[];
16
+ /** Asset provider entry shape. */
17
+ export type AssetProviderV1 = assets.AssetProviderV1
18
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Excavation patterns and cell-pattern helpers.
3
+ *
4
+ * Available as `sandkit.api.patterns`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { CellCoordinates, Vector2 } from "../../shared/player";
9
+ import type { shared } from "../../shared";
10
+
11
+ export namespace patterns {
12
+ /**
13
+ * Build a circular excavation pattern matrix for the given size.
14
+ * @param size - Pattern width and height in cells.
15
+ * @returns Square matrix with `1` inside the circle and `0` outside.
16
+ */
17
+ export function createCircle(size: number): number[][];
18
+
19
+ /**
20
+ * Excavate at a cell using a pattern matrix and output velocity.
21
+ * @param cellX - Anchor cell column for the pattern.
22
+ * @param cellY - Anchor cell row for the pattern.
23
+ * @param pattern - Excavation pattern matrix.
24
+ * @param outVelocity - Ejection velocity written into this vector.
25
+ * @param power - Dig strength applied to matched cells.
26
+ * @param options - Optional excavation source flags.
27
+ */
28
+ export function excavateAtCell(...args: [...CellCoordinates, pattern: number[][], outVelocity: Vector2, power: number, options?: PatternExcavateOptions]): void;
29
+
30
+ /** Options for pattern-based excavation. Same shape as {@link shared.api.world.ExcavateOptions}. */
31
+ export type PatternExcavateOptions = shared.api.world.ExcavateOptions;
32
+ }
@@ -0,0 +1,84 @@
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
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Register processing recipes for grower, shaker, and kinetic press structures.
3
+ *
4
+ * Available as `sandkit.api.processing`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { elements } from "./elements";
9
+
10
+ export namespace processing {
11
+ /**
12
+ * Register a planter box grower recipe.
13
+ * @param definition - Grower input/output recipe.
14
+ */
15
+ export function registerGrower(definition: PlanterBoxRecipeDefinitionV1): void;
16
+
17
+ /**
18
+ * Register a shaker recipe.
19
+ * @param definition - Shaker input and weighted outputs.
20
+ */
21
+ export function registerShaker(definition: ShakerRecipeDefinitionV1): void;
22
+
23
+ /**
24
+ * Register a kinetic press recipe.
25
+ * @param definition - Press input, velocity threshold, and outputs.
26
+ */
27
+ export function registerKineticPress(definition: KineticPressRecipeDefinitionV1): void;
28
+
29
+ /** Weighted element output entry shared by machine recipes. */
30
+ export interface WeightedRecipeOutput {
31
+ /** Output element type (1–255). */
32
+ elementType: elements.ElementType;
33
+ /** Output probability from 0 to 1. */
34
+ chance: number;
35
+ }
36
+
37
+ /** Planter box grower recipe definition. */
38
+ export interface PlanterBoxRecipeDefinitionV1 {
39
+ /** Input element type placed on the grower. */
40
+ input: elements.ElementType;
41
+ /** Output element type produced by the grower. */
42
+ output: elements.ElementType;
43
+ /** Success chance from 0 to 1. Default 1. */
44
+ chance?: number;
45
+ }
46
+
47
+ /** Shaker recipe definition. */
48
+ export interface ShakerRecipeDefinitionV1 {
49
+ /** Input element type dropped on the shaker. */
50
+ input: elements.ElementType;
51
+ /** Weighted outputs ejected upward. */
52
+ outputsAbove: WeightedRecipeOutput[];
53
+ /** Weighted outputs ejected downward. */
54
+ outputsBelow: WeightedRecipeOutput[];
55
+ }
56
+
57
+ /** Kinetic press recipe definition. */
58
+ export interface KineticPressRecipeDefinitionV1 {
59
+ /** Input element type processed by the press. */
60
+ input: elements.ElementType;
61
+ /** Minimum downward velocity required to trigger the press. */
62
+ minimumDownwardVelocity: number;
63
+ /** Weighted outputs produced by the press. */
64
+ outputs: WeightedRecipeOutput[];
65
+ }
66
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Story and quest progression completion.
3
+ *
4
+ * Available as `sandkit.api.progression`.
5
+ *
6
+ * @module
7
+ */
8
+
9
+ export namespace progression {
10
+ /**
11
+ * Mark a progression step complete. Return true when completion succeeds.
12
+ * @param request - Progression id and optional metadata for the step.
13
+ */
14
+ export function complete(request: ProgressionCompletionRequestV1): boolean;
15
+
16
+ /** Progression completion request shape. */
17
+ export interface ProgressionCompletionRequestV1 {
18
+ /** Progression step or quest identifier. */
19
+ id: string;
20
+ [key: string]: unknown;
21
+ }
22
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Projectile definitions, spawning, and lifecycle.
3
+ *
4
+ * Available as `sandkit.api.projectiles`.
5
+ *
6
+ * @module
7
+ */
8
+ export namespace projectiles {
9
+ /**
10
+ * Register a projectile definition.
11
+ * @param definition - Projectile id, sprite, and runtime options factory.
12
+ */
13
+ export function register(definition: ProjectileDefinition): void;
14
+
15
+ /**
16
+ * Return a projectile definition by string id.
17
+ * @param projectileId - Registered projectile id.
18
+ */
19
+ export function getDefinitionById(projectileId: string): ProjectileDefinition | undefined;
20
+
21
+ /**
22
+ * Build a spawn blueprint from a projectile string id.
23
+ * @param projectileId - Registered projectile id.
24
+ * @returns Blueprint passed to {@link spawnAtWorld}.
25
+ */
26
+ export function createBlueprintFromId(projectileId: string): ProjectileBlueprint;
27
+
28
+ /** Return all active projectiles. */
29
+ export function getAll(): Projectile[];
30
+
31
+ /**
32
+ * Return a projectile by numeric id.
33
+ * @param projectileId - Runtime projectile id.
34
+ */
35
+ export function getById(projectileId: number): Projectile | undefined;
36
+
37
+ /**
38
+ * Remove a projectile from the world.
39
+ * @param projectile - Projectile instance to remove.
40
+ */
41
+ export function remove(projectile: Projectile): void;
42
+
43
+ /**
44
+ * Spawn a projectile at world position with angle and blueprint.
45
+ * @param worldX - Spawn x position in world pixels.
46
+ * @param worldY - Spawn y position in world pixels.
47
+ * @param angle - Launch angle in radians.
48
+ * @param blueprint - Blueprint from {@link createBlueprintFromId}.
49
+ * @returns The spawned projectile instance.
50
+ */
51
+ export function spawnAtWorld(worldX: number, worldY: number, angle: number, blueprint: ProjectileBlueprint): Projectile;
52
+
53
+ /** Mod-registered projectile definition. */
54
+ export interface ProjectileDefinition {
55
+ id: string;
56
+ sprite: {
57
+ id: string;
58
+ tint?: number;
59
+ };
60
+ /** Returns spawn-time physics and visual options. */
61
+ getOptions: () => Record<string, unknown>;
62
+ /** Optional per-projectile mutable data factory. */
63
+ getModData?: (state: unknown, projectile: Projectile) => Record<string, unknown>;
64
+ [key: string]: unknown;
65
+ }
66
+
67
+ /** Blueprint used to spawn a projectile. */
68
+ export interface ProjectileBlueprint {
69
+ opts: Record<string, unknown>;
70
+ type: unknown;
71
+ }
72
+
73
+ /** Active projectile instance. */
74
+ export interface Projectile {
75
+ id: number;
76
+ x: number;
77
+ y: number;
78
+ [key: string]: unknown;
79
+ }
80
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Deterministic game random number helpers.
3
+ *
4
+ * Available as `sandkit.api.random`.
5
+ *
6
+ * @module
7
+ */
8
+ export namespace random {
9
+ /**
10
+ * Return a random integer in the inclusive range.
11
+ * @param min - Minimum value (inclusive).
12
+ * @param max - Maximum value (inclusive).
13
+ */
14
+ export function int(min: number, max: number): number;
15
+ /**
16
+ * Return a random float in the inclusive range.
17
+ * @param min - Minimum value (inclusive).
18
+ * @param max - Maximum value (inclusive).
19
+ */
20
+ export function float(min: number, max: number): number;
21
+ }