@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,19 @@
1
+ /**
2
+ * World raycast queries from a start point and angle.
3
+ *
4
+ * Available as `sandkit.api.raycast`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { Vector2 } from "../../shared/player";
9
+
10
+ export namespace raycast {
11
+ /**
12
+ * Cast a ray from world position. Return hit point and distance, or null.
13
+ * @param startWorldX - Ray origin world X in pixels.
14
+ * @param startWorldY - Ray origin world Y in pixels.
15
+ * @param angle - Ray direction in radians.
16
+ * @param maxDistance - Maximum ray length in pixels.
17
+ */
18
+ export function castFromWorld(startWorldX: number, startWorldY: number, angle: number, maxDistance: number): Vector2 & { distance: number; } | null;
19
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Element contact reaction recipe registration.
3
+ *
4
+ * Available as `sandkit.api.reactions`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { elements } from "./elements";
9
+
10
+ export namespace reactions {
11
+ /**
12
+ * Register a contact reaction between elements.
13
+ * @param definition - Contact recipe inputs, outputs, and orientation.
14
+ */
15
+ export function registerContact(definition: ContactRecipeDefinitionV1): void;
16
+
17
+ /** Contact reaction recipe definition. */
18
+ export interface ContactRecipeDefinitionV1 {
19
+ /** First reacting element type. */
20
+ inputA: elements.ElementType;
21
+ /** Second reacting element type. */
22
+ inputB: elements.ElementType;
23
+ /** Element type produced from input A, or null for no output. */
24
+ outputA: elements.ElementType | null;
25
+ /** Element type produced from input B, or null for no output. */
26
+ outputB: elements.ElementType | null;
27
+ /** Contact layout requirement. Default `"any"`. */
28
+ orientation?: "any" | "stacked";
29
+ }
30
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Screen-space drawing helpers and overlay canvas access.
3
+ *
4
+ * Available as `sandkit.api.rendering`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { CellCoordinates, Vector2 } from "../../shared/player";
9
+
10
+ export namespace rendering {
11
+ /**
12
+ * Return screen draw position for a grid cell.
13
+ * @param cellX - Grid cell X coordinate.
14
+ * @param cellY - Grid cell Y coordinate.
15
+ */
16
+ export function getDrawPositionAtCell(...args: CellCoordinates): Vector2;
17
+ /** Return cell size and snap grid metrics. */
18
+ export function getGridMetrics(): { cellSize: number; snapGridCellSize: number; };
19
+ /** Return overlay viewport width and height in pixels. */
20
+ export function getOverlayViewportSize(): { width: number; height: number; };
21
+ /**
22
+ * Run a callback with the overlay canvas context.
23
+ * @param callback - Receives the overlay 2D context; return value is passed through.
24
+ */
25
+ export function withOverlayContext<T>(callback: (context: CanvasRenderingContext2D) => T): T;
26
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Fluxite collection and energy updates.
3
+ *
4
+ * Available as `sandkit.api.resources`.
5
+ *
6
+ * @module
7
+ */
8
+ import { CellCoordinates } from "../../shared/player";
9
+
10
+ export namespace resources {
11
+ /**
12
+ * Collect fluxite at the given cell.
13
+ * @param cellX - Grid cell X coordinate.
14
+ * @param cellY - Grid cell Y coordinate.
15
+ */
16
+ export function collectFluxiteAtCell(...args: CellCoordinates): void;
17
+ /**
18
+ * Update stored energy by amount with optional UI deferral.
19
+ * @param amount - Energy delta (positive or negative).
20
+ * @param options - When `deferUi` is true, skip immediate UI refresh.
21
+ */
22
+ export function updateEnergy(amount: number, options?: { deferUi?: boolean; }): void;
23
+ }
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Composed main-thread `sandkit.api` object type.
3
+ *
4
+ * Each property matches a namespace under `sandkit.api.*`.
5
+ * Namespace members are documented in their module files.
6
+ * Use this type when typing the host `sandkit.api` value as a whole.
7
+ */
8
+ export type SandkitApi = {
9
+ /** Player action and custom action data. */
10
+ action: typeof import("./action").action;
11
+ /** Mod asset URLs and provider selection. */
12
+ assets: typeof import("./assets").assets;
13
+ /** Build authorization checks. */
14
+ authorization: typeof import("./authorization").authorization;
15
+ /** Building mode and placement. */
16
+ building: typeof import("./building").building;
17
+ /** Camera position and bounds. */
18
+ camera: typeof import("./camera").camera;
19
+ /** Collector machine helpers. */
20
+ collector: typeof import("./collector").collector;
21
+ /** Shared game constants. */
22
+ constants: typeof import("./constants").constants;
23
+ /** Cooldown timers. */
24
+ cooldown: typeof import("./cooldown").cooldown;
25
+ /** Discovery tracking. */
26
+ discoveries: typeof import("./discoveries").discoveries;
27
+ /** Visual and gameplay effects. */
28
+ effects: typeof import("./effects").effects;
29
+ /** Element types and cell mutations. */
30
+ elements: typeof import("./elements").elements;
31
+ /** Energy network helpers. */
32
+ energy: typeof import("./energy").energy;
33
+ /** Game event subscription. */
34
+ events: typeof import("./events").events;
35
+ /** Excavation helpers. */
36
+ excavation: typeof import("./excavation").excavation;
37
+ /** Fire and burning helpers. */
38
+ fire: typeof import("./fire").fire;
39
+ /** Game configuration values. */
40
+ gameConfig: typeof import("./gameconfig").gameConfig;
41
+ /** Grid metrics and cell helpers. */
42
+ grid: typeof import("./grid").grid;
43
+ /** Intercept and modify hooks. */
44
+ hooks: typeof import("./hooks").hooks;
45
+ /** Localization strings. */
46
+ i18n: typeof import("./i18n").i18n;
47
+ /** Input state and bindings. */
48
+ input: typeof import("./input").input;
49
+ /** Item definitions and inventory. */
50
+ items: typeof import("./items").items;
51
+ /** Dynamic light sources. */
52
+ lights: typeof import("./lights").lights;
53
+ /** Map selection and session start. */
54
+ maps: typeof import("./maps").maps;
55
+ /** Mod asset provider lookup. */
56
+ mods: typeof import("./mods").mods;
57
+ /** Excavation pattern helpers. */
58
+ patterns: typeof import("./patterns").patterns;
59
+ /** Player position, movement, and inventory. */
60
+ player: typeof import("./player").player;
61
+ /** Processing recipe registration. */
62
+ processing: typeof import("./processing").processing;
63
+ /** Story progression completion. */
64
+ progression: typeof import("./progression").progression;
65
+ /** Projectile spawn and lifecycle. */
66
+ projectiles: typeof import("./projectiles").projectiles;
67
+ /** Game random number helpers. */
68
+ random: typeof import("./random").random;
69
+ /** World raycast queries. */
70
+ raycast: typeof import("./raycast").raycast;
71
+ /** Element contact reactions. */
72
+ reactions: typeof import("./reactions").reactions;
73
+ /** Screen drawing and overlay canvas. */
74
+ rendering: typeof import("./rendering").rendering;
75
+ /** Fluxite and energy resources. */
76
+ resources: typeof import("./resources").resources;
77
+ /** Active game scene. */
78
+ scene: typeof import("./scene").scene;
79
+ /** Next-tick callback scheduling. */
80
+ schedule: typeof import("./schedule").schedule;
81
+ /** Game settings read and change events. */
82
+ settings: typeof import("./settings").settings;
83
+ /** Cross-thread shared buffers. */
84
+ shared: typeof import("./shared").shared;
85
+ /** Signal target registration. */
86
+ signals: typeof import("./signals").signals;
87
+ /** Sound playback and stop controls. */
88
+ sound: typeof import("./sound").sound;
89
+ /** Sprite load and transforms. */
90
+ sprites: typeof import("./sprites").sprites;
91
+ /** Per-mod and local storage. */
92
+ storage: typeof import("./storage").storage;
93
+ /** Conveyor and launcher behaviors. */
94
+ structureBehaviors: typeof import("./structureBehaviors").structureBehaviors;
95
+ /** Structure registration and queries. */
96
+ structures: typeof import("./structures").structures;
97
+ /** Tech tree definitions and locks. */
98
+ tech: typeof import("./tech").tech;
99
+ /** Terrain registration and mutations. */
100
+ terrains: typeof import("./terrains").terrains;
101
+ /** Game time and tick counter. */
102
+ time: typeof import("./time").time;
103
+ /** Tool-specific helpers. */
104
+ tools: typeof import("./tools").tools;
105
+ /** Interval trigger registration. */
106
+ triggers: typeof import("./triggers").triggers;
107
+ /** UI overlays, dialogs, and navigation. */
108
+ ui: typeof import("./ui").ui;
109
+ /** Upgrade categories and levels. */
110
+ upgrades: typeof import("./upgrades").upgrades;
111
+ /** Vector math helpers. */
112
+ utils: typeof import("./utils").utils;
113
+ /** Worker post-update control. */
114
+ workers: typeof import("./workers").workers;
115
+ /** World cells, fog, redraw, and pickups. */
116
+ world: typeof import("./world").world;
117
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Active game scene and scene enum.
3
+ *
4
+ * Available as `sandkit.api.scene`.
5
+ *
6
+ * @module
7
+ */
8
+ import { Scene as SceneEnum } from "../enums";
9
+
10
+ export namespace scene {
11
+ /** Scene enum values. */
12
+ export import Scene = SceneEnum;
13
+ /** Return the active scene. */
14
+ export function getActive(): SceneEnum;
15
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Deferred callback scheduling on the next tick.
3
+ *
4
+ * Available as `sandkit.api.schedule`.
5
+ *
6
+ * @module
7
+ */
8
+ export namespace schedule {
9
+ /**
10
+ * Run a callback on the next game tick.
11
+ * @param callback - Function invoked once on the next tick.
12
+ */
13
+ export function nextTick(callback: () => void): void;
14
+ }
@@ -0,0 +1,29 @@
1
+ import type { LooseString } from "../../shared/nominal";
2
+
3
+ /**
4
+ * Game settings read and change notifications.
5
+ *
6
+ * Available as `sandkit.api.settings`.
7
+ *
8
+ * @module
9
+ */
10
+ export namespace settings {
11
+ /**
12
+ * Return a settings field value by id.
13
+ * @param fieldId - Settings field identifier.
14
+ */
15
+ export function get(fieldId: FieldId): ConfigValueV1 | undefined;
16
+ /** Return all settings as a read-only map. */
17
+ export function getAll(): Readonly<Record<string, ConfigValueV1>>;
18
+ /**
19
+ * Subscribe to settings changes. Return an unsubscribe function.
20
+ * @param callback - Called with the full settings map after a change.
21
+ */
22
+ export function onChange(callback: (values: Readonly<Record<string, ConfigValueV1>>) => void): () => void;
23
+
24
+ /** Settings field id. Any string is allowed. */
25
+ export type FieldId = LooseString<never>;
26
+
27
+ /** Settings field value shape. */
28
+ export type ConfigValueV1 = string | number | boolean | null;
29
+ }
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Signal target registration for structures.
3
+ *
4
+ * Available as `sandkit.api.signals`.
5
+ *
6
+ * @module
7
+ */
8
+ export namespace signals {
9
+ /** Signal target registration for structure types. */
10
+ export namespace targets {
11
+ /**
12
+ * Register a handler when a signal targets a structure type.
13
+ * @param structureTypeOrId - Structure type id or enum value.
14
+ * @param apply - Called when a signal reaches a matching structure.
15
+ */
16
+ export function register(structureTypeOrId: string | StructureType, apply: (structure: Structure, payload: SignalTargetPayloadV1) => void): void;
17
+ }
18
+
19
+ /** Structure type id or enum value. */
20
+ export type StructureType = unknown
21
+ /** Structure instance in the world. */
22
+ export type Structure = unknown
23
+ /** Payload delivered to a signal target handler. */
24
+ export type SignalTargetPayloadV1 = unknown
25
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Sound playback, layers, and stop controls.
3
+ *
4
+ * Available as `sandkit.api.sound`.
5
+ *
6
+ * @module
7
+ */
8
+ export namespace sound {
9
+ /**
10
+ * Play a sound by id with optional options.
11
+ * @param soundId - Registered sound identifier.
12
+ * @param options - Volume, position, playback rate, and rate-limit options.
13
+ */
14
+ export function play(soundId: string, options?: SoundOptions): SoundHandle;
15
+ /**
16
+ * Play a sound on the active sound channel.
17
+ * @param soundId - Registered sound identifier.
18
+ * @param options - Volume, position, playback rate, and rate-limit options.
19
+ */
20
+ export function playActive(soundId: string, options?: SoundOptions): SoundHandle;
21
+ /**
22
+ * Play multiple sound layers with shared options.
23
+ * @param layers - Layer definitions (sound id, volume, delay, and per-layer options).
24
+ * @param options - Shared position, volume, and rate-limit options for all layers.
25
+ */
26
+ export function playLayers(layers: SoundLayer[], options?: SoundLayersOptions): SoundHandle[];
27
+ /**
28
+ * Build distance-based volume options for a world position.
29
+ * @param worldX - World X coordinate in pixels.
30
+ * @param worldY - World Y coordinate in pixels.
31
+ * @param baseVolume - Base volume before distance attenuation.
32
+ */
33
+ export function calculateDistanceOptionsAtWorld(worldX: number, worldY: number, baseVolume?: number): SoundOptions;
34
+ /**
35
+ * Stop a sound by id.
36
+ * @param soundId - Registered sound identifier to stop.
37
+ */
38
+ export function stopById(soundId: string): void;
39
+ /** Stop the active sound channel. */
40
+ export function stopActive(): void;
41
+ /** Stop all playing sounds. */
42
+ export function stopAll(): void;
43
+
44
+ /** Handle returned from a play call. */
45
+ export interface SoundHandle {
46
+ /** Stop this sound instance. */
47
+ stop(): void;
48
+ }
49
+
50
+ /** One layer in a layered sound. */
51
+ export interface SoundLayer {
52
+ /** Sound id for this layer. */
53
+ soundId: string;
54
+ /** Layer volume multiplier. */
55
+ volume?: number;
56
+ /** Delay in milliseconds before this layer plays. */
57
+ delay?: number;
58
+ /** Playback rate for this layer. */
59
+ playbackRate?: number;
60
+ [key: string]: unknown;
61
+ }
62
+
63
+ /** Options passed to sound play helpers. */
64
+ export interface SoundOptions {
65
+ /** Volume multiplier (0–1 typical). */
66
+ volume?: number;
67
+ /** Playback rate multiplier. */
68
+ playbackRate?: number;
69
+ /** World position for distance attenuation. */
70
+ position?: { x: number; y: number };
71
+ /** When true, loop until stopped. */
72
+ loop?: boolean;
73
+ /** Key used with rateLimitMs to dedupe rapid replays. */
74
+ rateLimitKey?: string;
75
+ /** Minimum ms between plays with the same rateLimitKey. */
76
+ rateLimitMs?: number;
77
+ [key: string]: unknown;
78
+ }
79
+
80
+ /** Shared options for {@link playLayers}. */
81
+ export interface SoundLayersOptions {
82
+ /** World position applied to all layers. */
83
+ position?: { x: number; y: number };
84
+ /** Volume multiplier applied to all layers. */
85
+ volume?: number;
86
+ /** Key used with rateLimitMs to dedupe rapid replays. */
87
+ rateLimitKey?: string;
88
+ /** Minimum ms between plays with the same rateLimitKey. */
89
+ rateLimitMs?: number;
90
+ }
91
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Sprite load, lookup, and player mod sprite transforms.
3
+ *
4
+ * Available as `sandkit.api.sprites`.
5
+ *
6
+ * @module
7
+ */
8
+ export namespace sprites {
9
+ /**
10
+ * Load a sprite from a URL path.
11
+ * @param spriteId - Id used with {@link getById}.
12
+ * @param path - URL or asset path to load.
13
+ * @param options - Optional tint and load options.
14
+ */
15
+ export function load(spriteId: string, path: string, options?: SpriteLoadOptions): Promise<void>;
16
+ /**
17
+ * Load a sprite from the calling mod folder.
18
+ * @param spriteId - Id used with {@link getById}.
19
+ * @param relativePath - Path relative to the mod folder.
20
+ * @param options - Optional tint and load options.
21
+ */
22
+ export function loadFromMod(spriteId: string, relativePath: string, options?: SpriteLoadOptions): Promise<void>;
23
+ /**
24
+ * Return a loaded sprite by id.
25
+ * @param spriteId - Sprite id from {@link load} or {@link loadFromMod}.
26
+ */
27
+ export function getById(spriteId: string): LoadedSprite | undefined;
28
+ /** Hide all player mod-attached sprites. */
29
+ export function hideAllPlayerModSprites(): void;
30
+ /**
31
+ * Rotate all player mod-attached sprites by angle.
32
+ * @param angle - Rotation in radians.
33
+ */
34
+ export function rotatePlayerModSprites(angle: number): void;
35
+
36
+ /** Loaded sprite handle (runtime texture or display object). */
37
+ export type LoadedSprite = unknown
38
+
39
+ /** Options for {@link load} and {@link loadFromMod}. */
40
+ export interface SpriteLoadOptions {
41
+ /** Packed RGB tint applied after load. */
42
+ tint?: number;
43
+ [key: string]: unknown;
44
+ }
45
+ }
@@ -0,0 +1,55 @@
1
+ import { JsonObjectV1, JsonValueV1 } from "../../shared/jsonvalue";
2
+
3
+ /**
4
+ * Per-mod persistent storage and local session storage.
5
+ *
6
+ * Available as `sandkit.api.storage`.
7
+ *
8
+ * @module
9
+ */
10
+ export namespace storage {
11
+ /**
12
+ * Ensure storage exists for a mod id.
13
+ * @param modId - Mod identifier (typically `modinfo.id`).
14
+ */
15
+ export function ensure(modId: string): JsonObjectV1;
16
+ /**
17
+ * Read a value from mod storage by key.
18
+ * @param modId - Mod identifier.
19
+ * @param key - Storage key.
20
+ */
21
+ export function get(modId: string, key: string): JsonValueV1 | undefined;
22
+ /**
23
+ * Write a value to mod storage by key.
24
+ * @param modId - Mod identifier.
25
+ * @param key - Storage key.
26
+ * @param value - JSON-serializable value.
27
+ */
28
+ export function set(modId: string, key: string, value: JsonValueV1): void;
29
+ /**
30
+ * Remove a key from mod storage.
31
+ * @param modId - Mod identifier.
32
+ * @param key - Storage key.
33
+ */
34
+ export function remove(modId: string, key: string): void;
35
+
36
+ /** Local session storage without mod id scope. */
37
+ export namespace local {
38
+ /**
39
+ * Read a local storage value by key.
40
+ * @param key - Storage key.
41
+ */
42
+ export function get(key: string): JsonValueV1 | undefined;
43
+ /**
44
+ * Write a local storage value by key.
45
+ * @param key - Storage key.
46
+ * @param value - JSON-serializable value.
47
+ */
48
+ export function set(key: string, value: JsonValueV1): void;
49
+ /**
50
+ * Remove a local storage key.
51
+ * @param key - Storage key.
52
+ */
53
+ export function remove(key: string): void;
54
+ }
55
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Structure behavior registration for conveyors and launchers.
3
+ *
4
+ * Available as `sandkit.api.structureBehaviors`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { Vector2 } from "../../shared/player";
9
+
10
+ export namespace structureBehaviors {
11
+ /**
12
+ * Register conveyor behavior for a structure type.
13
+ * @param structureId - Structure type id string.
14
+ * @param options - Transport offset, velocity, distance, and run direction.
15
+ */
16
+ export function registerConveyorType(structureId: string, options?: { transportOffset?: Vector2; velocity?: Vector2; maxTransportDistance?: number; transportHeight?: number; runWith?: 'left' | 'right'; skipQueued?: boolean; }): void;
17
+ /**
18
+ * Register launcher behavior for up, left, and right launcher types.
19
+ * @param definition - Launcher type ids, velocities, and optional shared buffer key.
20
+ */
21
+ export function registerLauncherType(definition: { upType: string; leftType: string; rightType: string; velocity: [number, number]; softDropVelocity: number; runTickSharedBufferKey?: string; }): void;
22
+ }