@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.
- package/CHANGELOG.md +19 -0
- package/README.md +66 -0
- package/global.d.ts +38 -0
- package/package.json +44 -0
- package/sandkit/api/action.d.ts +28 -0
- package/sandkit/api/assets.d.ts +30 -0
- package/sandkit/api/authorization.d.ts +54 -0
- package/sandkit/api/building.d.ts +92 -0
- package/sandkit/api/camera.d.ts +23 -0
- package/sandkit/api/collector.d.ts +36 -0
- package/sandkit/api/constants.d.ts +21 -0
- package/sandkit/api/cooldown.d.ts +26 -0
- package/sandkit/api/discoveries.d.ts +18 -0
- package/sandkit/api/effects.d.ts +76 -0
- package/sandkit/api/elements.d.ts +237 -0
- package/sandkit/api/energy.d.ts +70 -0
- package/sandkit/api/events.d.ts +53 -0
- package/sandkit/api/excavation.d.ts +34 -0
- package/sandkit/api/fire.d.ts +26 -0
- package/sandkit/api/gameconfig.d.ts +15 -0
- package/sandkit/api/grid.d.ts +26 -0
- package/sandkit/api/hooks.d.ts +52 -0
- package/sandkit/api/i18n.d.ts +101 -0
- package/sandkit/api/index.d.ts +66 -0
- package/sandkit/api/input.d.ts +119 -0
- package/sandkit/api/items.d.ts +60 -0
- package/sandkit/api/lights.d.ts +66 -0
- package/sandkit/api/maps.d.ts +33 -0
- package/sandkit/api/mods.d.ts +18 -0
- package/sandkit/api/patterns.d.ts +32 -0
- package/sandkit/api/player.d.ts +84 -0
- package/sandkit/api/processing.d.ts +66 -0
- package/sandkit/api/progression.d.ts +22 -0
- package/sandkit/api/projectiles.d.ts +80 -0
- package/sandkit/api/random.d.ts +21 -0
- package/sandkit/api/raycast.d.ts +19 -0
- package/sandkit/api/reactions.d.ts +30 -0
- package/sandkit/api/rendering.d.ts +26 -0
- package/sandkit/api/resources.d.ts +23 -0
- package/sandkit/api/sandkit-api.d.ts +117 -0
- package/sandkit/api/scene.d.ts +15 -0
- package/sandkit/api/schedule.d.ts +14 -0
- package/sandkit/api/settings.d.ts +29 -0
- package/sandkit/api/shared.d.ts +27 -0
- package/sandkit/api/signals.d.ts +25 -0
- package/sandkit/api/sound.d.ts +91 -0
- package/sandkit/api/sprites.d.ts +45 -0
- package/sandkit/api/storage.d.ts +55 -0
- package/sandkit/api/structureBehaviors.d.ts +22 -0
- package/sandkit/api/structures.d.ts +320 -0
- package/sandkit/api/tech.d.ts +66 -0
- package/sandkit/api/terrains.d.ts +125 -0
- package/sandkit/api/time.d.ts +13 -0
- package/sandkit/api/tools.d.ts +35 -0
- package/sandkit/api/triggers.d.ts +24 -0
- package/sandkit/api/ui.d.ts +175 -0
- package/sandkit/api/upgrades.d.ts +63 -0
- package/sandkit/api/utils.d.ts +35 -0
- package/sandkit/api/workers.d.ts +14 -0
- package/sandkit/api/world.d.ts +107 -0
- package/sandkit/engine/api/augments.d.ts +96 -0
- package/sandkit/engine/api/auralite.d.ts +21 -0
- package/sandkit/engine/api/blueprints.d.ts +47 -0
- package/sandkit/engine/api/clipboard.d.ts +46 -0
- package/sandkit/engine/api/colorPicker.d.ts +74 -0
- package/sandkit/engine/api/coloringTool.d.ts +56 -0
- package/sandkit/engine/api/conveyors.d.ts +16 -0
- package/sandkit/engine/api/debug.d.ts +16 -0
- package/sandkit/engine/api/drones.d.ts +21 -0
- package/sandkit/engine/api/entities.d.ts +66 -0
- package/sandkit/engine/api/extensions.d.ts +16 -0
- package/sandkit/engine/api/factory.d.ts +56 -0
- package/sandkit/engine/api/foliage.d.ts +31 -0
- package/sandkit/engine/api/foundationColorPicker.d.ts +16 -0
- package/sandkit/engine/api/game.d.ts +26 -0
- package/sandkit/engine/api/heatTransfer.d.ts +46 -0
- package/sandkit/engine/api/index.d.ts +47 -0
- package/sandkit/engine/api/launchers.d.ts +16 -0
- package/sandkit/engine/api/lightColorPicker.d.ts +16 -0
- package/sandkit/engine/api/matters.d.ts +26 -0
- package/sandkit/engine/api/misc.d.ts +16 -0
- package/sandkit/engine/api/portals.d.ts +16 -0
- package/sandkit/engine/api/prefabData.d.ts +36 -0
- package/sandkit/engine/api/prefabDecor.d.ts +21 -0
- package/sandkit/engine/api/prefabulator.d.ts +21 -0
- package/sandkit/engine/api/prismaline.d.ts +26 -0
- package/sandkit/engine/api/prismite.d.ts +26 -0
- package/sandkit/engine/api/queue.d.ts +41 -0
- package/sandkit/engine/api/shadows.d.ts +26 -0
- package/sandkit/engine/api/strataform.d.ts +36 -0
- package/sandkit/engine/api/swarmConsole.d.ts +71 -0
- package/sandkit/engine/api/sweeperDrone.d.ts +16 -0
- package/sandkit/engine/api/teleportZones.d.ts +46 -0
- package/sandkit/engine/api/tutorialBuild.d.ts +66 -0
- package/sandkit/engine/api/usageTracker.d.ts +26 -0
- package/sandkit/engine/api/wall.d.ts +31 -0
- package/sandkit/engine/api/workerLocal.d.ts +30 -0
- package/sandkit/engine/index.d.ts +135 -0
- package/sandkit/engine/retro-console.d.ts +52 -0
- package/sandkit/engine/state.d.ts +31 -0
- package/sandkit/enums/index.d.ts +444 -0
- package/sandkit/index.d.ts +47 -0
- package/sandkit/react.d.ts +49 -0
- package/shared/api/effects.d.ts +76 -0
- package/shared/api/elements.d.ts +162 -0
- package/shared/api/maps.d.ts +30 -0
- package/shared/api/player.d.ts +31 -0
- package/shared/api/shared.d.ts +46 -0
- package/shared/api/structures.d.ts +138 -0
- package/shared/api/terrains.d.ts +100 -0
- package/shared/api/ui.d.ts +54 -0
- package/shared/api/world.d.ts +71 -0
- package/shared/asset.d.ts +14 -0
- package/shared/engine.d.ts +17 -0
- package/shared/index.d.ts +25 -0
- package/shared/jsonvalue.d.ts +30 -0
- package/shared/nominal.d.ts +31 -0
- package/shared/player.d.ts +173 -0
- package/worker/api/elements.d.ts +60 -0
- package/worker/api/main.d.ts +16 -0
- package/worker/api/shared.d.ts +38 -0
- package/worker/api/worker.d.ts +20 -0
- package/worker/index.d.ts +29 -0
- package/worker/sandkit-api.d.ts +31 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-08-27
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial public release of `@sandustry-modding/types`
|
|
13
|
+
- TypeScript declarations for main-thread `sandkit` (`sandkit/api`, `sandkit/engine`, `sandkit/enums`, `sandkit/react`)
|
|
14
|
+
- Worker-thread declarations under `worker/` (`WorkerSandkitApi`)
|
|
15
|
+
- Shared base shapes under `shared/` for main and worker reuse
|
|
16
|
+
- Ambient `sandkit` free variable and type aliases via `global.d.ts`
|
|
17
|
+
- Docsify API reference generated from the declarations
|
|
18
|
+
|
|
19
|
+
[0.1.0]: https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.1.0
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# SandustryTypes
|
|
2
|
+
|
|
3
|
+
TypeScript declarations and Docsify API docs for the live Sandustry `sandkit` object. Package name: `@sandustry-modding/types`.
|
|
4
|
+
|
|
5
|
+
Folder layout mirrors runtime shape so you can jump from code to the matching `.d.ts` path.
|
|
6
|
+
|
|
7
|
+
## Runtime map
|
|
8
|
+
|
|
9
|
+
| Path | Runtime object |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `sandkit/api/` | `sandkit.api` (main thread) |
|
|
12
|
+
| `sandkit/engine/api/` | `sandkit.engine.api` |
|
|
13
|
+
| `sandkit/engine/state.d.ts` | `sandkit.engine.state` / `sandkit.state` |
|
|
14
|
+
| `sandkit/enums/` | `sandkit.enums` |
|
|
15
|
+
| `sandkit/react.d.ts` | `sandkit.react` |
|
|
16
|
+
| `sandkit/index.d.ts` | Composed `Sandkit` root type |
|
|
17
|
+
| `global.d.ts` | Ambient `sandkit` free variable and type aliases |
|
|
18
|
+
| `worker/` | Worker-thread `sandkit.api` (see `WorkerSandkitApi`) |
|
|
19
|
+
| `shared/` | Internal base shapes reused by main and worker declarations |
|
|
20
|
+
|
|
21
|
+
## Runtime shape vs `export namespace`
|
|
22
|
+
|
|
23
|
+
At runtime, every API bag is a **plain object** with function properties — not a TypeScript `namespace`. MCP checks on a live game session show:
|
|
24
|
+
|
|
25
|
+
- `sandkit.api`, `sandkit.api.ui`, `sandkit.api.ui.overlays`, and `sandkit.engine.api.game` are all `typeof "object"` with `Object.prototype`
|
|
26
|
+
- Nested keys hold functions or further plain objects
|
|
27
|
+
|
|
28
|
+
Declaration files use `export namespace` because it is the usual `.d.ts` pattern for nested object APIs. It matches how you call the API (`sandkit.api.ui.update`) and supports `export import` when main and worker share base shapes under `shared/`.
|
|
29
|
+
|
|
30
|
+
`interface` or `type` object literals would also work for runtime shape, but they do not support the `export import` re-export style used across main, worker, and shared modules.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @sandustry-modding/types
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
In `tsconfig.json`, include the package types (or reference them from an ambient file):
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"compilerOptions": {
|
|
43
|
+
"types": ["@sandustry-modding/types"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
- **Main mod (`main.js`):** use the ambient free name `sandkit`. Type aliases such as `SandkitApi` are global; do not import a value binding.
|
|
51
|
+
- **Worker mod (`worker.js`):** type `sandkit.api` as `WorkerSandkitApi`. Worker and main APIs overlap but are not interchangeable.
|
|
52
|
+
- **Shared folder:** not a runtime namespace. It holds domain shapes and API bases that main and worker modules extend.
|
|
53
|
+
|
|
54
|
+
## Maintaining types
|
|
55
|
+
|
|
56
|
+
Edit `.d.ts` files here. Regenerate the Docsify API reference after JSDoc changes.
|
|
57
|
+
|
|
58
|
+
## Docs site
|
|
59
|
+
|
|
60
|
+
Regenerate the Docsify API reference from these declarations:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm run docs:api
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Output lands in `docs/api/`. `npm run docs` runs that step, then serves the docs site.
|
package/global.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient host bindings for mod `main.js`.
|
|
3
|
+
*
|
|
4
|
+
* The game evaluates the bundle with `new Function("__sandkit", body)` and
|
|
5
|
+
* binds `const sandkit = __sandkit` before the IIFE. Use the free name
|
|
6
|
+
* `sandkit` in mod and modkit code — do not import a value binding.
|
|
7
|
+
*
|
|
8
|
+
* Type names below are also ambient so mods can annotate without imports.
|
|
9
|
+
* Prefer `typeof sandkit` / `typeof sandkit.api` when that reads clearer.
|
|
10
|
+
*/
|
|
11
|
+
declare global {
|
|
12
|
+
/**
|
|
13
|
+
* Host-injected free variable in the sandkit loader scope (not `globalThis`).
|
|
14
|
+
* Use this name in mod `main.js` and modkit code. Do not import a value binding.
|
|
15
|
+
*/
|
|
16
|
+
const sandkit: import("./sandkit").Sandkit;
|
|
17
|
+
|
|
18
|
+
/** Full shape of the ambient `sandkit` object. */
|
|
19
|
+
type Sandkit = import("./sandkit").Sandkit;
|
|
20
|
+
/** Main-thread `sandkit.api` composed type. Not the worker API. */
|
|
21
|
+
type SandkitApi = import("./sandkit").SandkitApi;
|
|
22
|
+
/** `sandkit.engine` internals bag (state-first APIs). */
|
|
23
|
+
type SandkitEngine = import("./sandkit").SandkitEngine;
|
|
24
|
+
/** Composed `sandkit.engine.api` namespaces. */
|
|
25
|
+
type SandkitEngineApi = import("./sandkit").SandkitEngineApi;
|
|
26
|
+
/** Game state at `sandkit.state` / `sandkit.engine.state`. */
|
|
27
|
+
type SandkitState = import("./sandkit").SandkitState;
|
|
28
|
+
/** Runtime enum bags at `sandkit.enums`. */
|
|
29
|
+
type SandkitEnums = import("./sandkit").SandkitEnums;
|
|
30
|
+
/** Host React package at `sandkit.react`. */
|
|
31
|
+
type SandkitReact = import("./sandkit").SandkitReact;
|
|
32
|
+
/** Retro Console API surface on supported engine namespaces. */
|
|
33
|
+
type RetroConsoleApi = import("./sandkit").RetroConsoleApi;
|
|
34
|
+
/** Worker-thread `sandkit.api` shape — use in `worker.ts`. */
|
|
35
|
+
type WorkerSandkitApi = import("./worker/sandkit-api").WorkerSandkitApi;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sandustry-modding/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript declarations and API docs for the Sandustry Sandkit host API",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/sandustry-modding/SandustryTypes.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/sandustry-modding/SandustryTypes#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/sandustry-modding/SandustryTypes/issues"
|
|
13
|
+
},
|
|
14
|
+
"types": "./global.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./global.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"global.d.ts",
|
|
22
|
+
"sandkit/**/*.d.ts",
|
|
23
|
+
"shared/**/*.d.ts",
|
|
24
|
+
"worker/**/*.d.ts",
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md",
|
|
28
|
+
"ATTRIBUTION.md"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"docs": "npm run docs:api && npm run docs:serve",
|
|
32
|
+
"docs:api": "node scripts/generate-api-docs.mjs",
|
|
33
|
+
"docs:serve": "npx --yes docsify-cli serve docs",
|
|
34
|
+
"test": "node --test scripts/api-search.test.js",
|
|
35
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/react": "^18.3.1",
|
|
39
|
+
"typescript": "^5.9.3"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AssetRef } from "../../shared/asset";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `sandkit.api.action` — active hotbar action and custom handler data.
|
|
5
|
+
* Main thread only.
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace action {
|
|
8
|
+
/** Hotbar action asset reference. */
|
|
9
|
+
export type Action = AssetRef;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Return the action slot the player is using.
|
|
13
|
+
* @returns Active hotbar action reference.
|
|
14
|
+
*/
|
|
15
|
+
export function getActive(): Action;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Return the action slot selected in the hotbar.
|
|
19
|
+
* @returns Selected hotbar action reference.
|
|
20
|
+
*/
|
|
21
|
+
export function getSelected(): Action;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Store custom data on the active action handler.
|
|
25
|
+
* @param data - Serializable payload attached to the active action.
|
|
26
|
+
*/
|
|
27
|
+
export function setCustomData<Input>(data: Input): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sandkit.api.assets` — mod asset URLs and asset provider selection.
|
|
3
|
+
* Main thread only.
|
|
4
|
+
*/
|
|
5
|
+
export namespace assets {
|
|
6
|
+
/** Describes a mod or pack that supplies assets for a kind. */
|
|
7
|
+
export type AssetProviderV1 = {
|
|
8
|
+
id: `${string}:${string}:${string}`,
|
|
9
|
+
kind: string,
|
|
10
|
+
localId?: string,
|
|
11
|
+
modId?: number,
|
|
12
|
+
modName: string,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a path under the mod folder to a loadable URL.
|
|
16
|
+
* @param relativePath - Path relative to the calling mod folder.
|
|
17
|
+
*/
|
|
18
|
+
export function getUrl(relativePath: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the selected provider for an asset kind, or null.
|
|
21
|
+
* @param kind - Asset kind identifier.
|
|
22
|
+
*/
|
|
23
|
+
export function getSelectedProvider(kind: string): AssetProviderV1 | null;
|
|
24
|
+
/**
|
|
25
|
+
* Selects a provider for an asset kind. Returns true on success.
|
|
26
|
+
* @param kind - Asset kind identifier.
|
|
27
|
+
* @param providerId - Provider id from {@link getSelectedProvider}, or null to clear.
|
|
28
|
+
*/
|
|
29
|
+
export function selectProvider(kind: string, providerId: string | null): boolean;
|
|
30
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CellCoordinates, Player } from "../../shared/player";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `sandkit.api.authorization` — player permission checks for build, grab, and tools.
|
|
5
|
+
* Main thread only.
|
|
6
|
+
*/
|
|
7
|
+
export namespace authorization {
|
|
8
|
+
/**
|
|
9
|
+
* Return true when the player may place a structure at the cell.
|
|
10
|
+
* @param cellX - Grid column of the target cell.
|
|
11
|
+
* @param cellY - Grid row of the target cell.
|
|
12
|
+
* @returns True when building is allowed in the authorization zone.
|
|
13
|
+
*/
|
|
14
|
+
export function canBuildAtCell(...args: CellCoordinates): boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Return true when the player may grab at the cell.
|
|
18
|
+
* @param cellX - Grid column of the target cell.
|
|
19
|
+
* @param cellY - Grid row of the target cell.
|
|
20
|
+
* @returns True when grabbing is allowed in the authorization zone.
|
|
21
|
+
*/
|
|
22
|
+
export function canGrabAtCell(...args: CellCoordinates): boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Return true when the player may use a tool.
|
|
26
|
+
* @param player - Player state snapshot.
|
|
27
|
+
* @param isFlamethrower - When true, apply flamethrower-specific rules.
|
|
28
|
+
* @returns True when tool use is allowed for the player.
|
|
29
|
+
*/
|
|
30
|
+
export function canUseTool(player: Player, isFlamethrower?: boolean): boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Return true when the player may use a tool at the cell.
|
|
34
|
+
* @param cellX - Grid column of the target cell.
|
|
35
|
+
* @param cellY - Grid row of the target cell.
|
|
36
|
+
* @param isFlamethrower - When true, apply flamethrower-specific rules.
|
|
37
|
+
* @returns True when tool use is allowed at the cell.
|
|
38
|
+
*/
|
|
39
|
+
export function canUseToolAtCell(...args: [...CellCoordinates, isFlamethrower?: boolean]): boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Return the authorization zone id at the cell.
|
|
43
|
+
* @param cellX - Grid column of the target cell.
|
|
44
|
+
* @param cellY - Grid row of the target cell.
|
|
45
|
+
* @returns Numeric zone id for the cell.
|
|
46
|
+
*/
|
|
47
|
+
export function getZoneIdAtCell(...args: CellCoordinates): number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Return the authorization zone id for the player.
|
|
51
|
+
* @returns Numeric zone id for the player's current position.
|
|
52
|
+
*/
|
|
53
|
+
export function getPlayerZoneId(): number;
|
|
54
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CellCoordinates, Vector2 } from "../../shared/player";
|
|
2
|
+
import { shared } from "../../shared";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `sandkit.api.building` — structure placement and built-in structure types.
|
|
6
|
+
* Main thread only.
|
|
7
|
+
*/
|
|
8
|
+
export namespace building {
|
|
9
|
+
/** Built-in structure type ids used during placement. */
|
|
10
|
+
export enum StructureType {
|
|
11
|
+
/** Left-facing conveyor belt. */
|
|
12
|
+
ConveyorLeft = 1,
|
|
13
|
+
/** Right-facing conveyor belt. */
|
|
14
|
+
ConveyorRight = 2,
|
|
15
|
+
/** Left-facing shaker. */
|
|
16
|
+
ShakerLeft = 3,
|
|
17
|
+
/** Right-facing shaker. */
|
|
18
|
+
ShakerRight = 4,
|
|
19
|
+
/** Up-facing launcher. */
|
|
20
|
+
LauncherUp = 5,
|
|
21
|
+
/** Left-facing launcher. */
|
|
22
|
+
LauncherLeft = 6,
|
|
23
|
+
/** Right-facing launcher. */
|
|
24
|
+
LauncherRight = 7,
|
|
25
|
+
/** Left-facing splitter. */
|
|
26
|
+
SplitterLeft = 8,
|
|
27
|
+
/** Right-facing splitter. */
|
|
28
|
+
SplitterRight = 9,
|
|
29
|
+
/** Dropper structure. */
|
|
30
|
+
Dropper = 10,
|
|
31
|
+
/** Foundation block. */
|
|
32
|
+
Foundation = 11,
|
|
33
|
+
/** Angled foundation facing left. */
|
|
34
|
+
FoundationAngledLeft = 12,
|
|
35
|
+
/** Left triangle foundation (deprecated id). */
|
|
36
|
+
FoundationTriangleLeftDel = 13,
|
|
37
|
+
/** Angled foundation facing right. */
|
|
38
|
+
FoundationAngledRight = 14,
|
|
39
|
+
/** Right triangle foundation (deprecated id). */
|
|
40
|
+
FoundationTriangleRightDel = 15,
|
|
41
|
+
/** Collector structure. */
|
|
42
|
+
Collector = 16,
|
|
43
|
+
/** Left-facing filter. */
|
|
44
|
+
FilterLeft = 17,
|
|
45
|
+
/** Right-facing filter. */
|
|
46
|
+
FilterRight = 18,
|
|
47
|
+
/** Sliding foundation block. */
|
|
48
|
+
SlidingFoundation = 19,
|
|
49
|
+
/** Velocity soaker structure. */
|
|
50
|
+
VelocitySoaker = 20,
|
|
51
|
+
/** Grower structure. */
|
|
52
|
+
Grower = 21,
|
|
53
|
+
/** Sound box structure. */
|
|
54
|
+
SoundBox = 22,
|
|
55
|
+
/** Pipe segment. */
|
|
56
|
+
Pipe = 23,
|
|
57
|
+
/** Pump structure. */
|
|
58
|
+
Pump = 24,
|
|
59
|
+
/** Liquid vent structure. */
|
|
60
|
+
LiquidVent = 25,
|
|
61
|
+
/** Light structure. */
|
|
62
|
+
Light = 26,
|
|
63
|
+
/** Gloom emitter structure. */
|
|
64
|
+
GloomEmitter = 27,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Return the snapped world position for placement at the cell.
|
|
69
|
+
* @param cellX - Grid column of the target cell.
|
|
70
|
+
* @param cellY - Grid row of the target cell.
|
|
71
|
+
* @returns Snapped world position in pixels.
|
|
72
|
+
*/
|
|
73
|
+
export function getSnappedPositionAtCell(...args: CellCoordinates): Vector2;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Return true when placement is blocked at the cell.
|
|
77
|
+
* @param cellX - Grid column of the target cell.
|
|
78
|
+
* @param cellY - Grid row of the target cell.
|
|
79
|
+
* @returns True when a structure cannot be placed at the cell.
|
|
80
|
+
*/
|
|
81
|
+
export function isBlockedAtCell(...args: CellCoordinates): boolean;
|
|
82
|
+
|
|
83
|
+
/** Cancel the current structure placement preview. */
|
|
84
|
+
export function cancelPlacement(): void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Select a structure for placement by type or id.
|
|
88
|
+
* @param structureTypeOrId - Built-in {@link StructureType} value or registered structure id.
|
|
89
|
+
* @returns Resolved selection, or null when the type or id is invalid.
|
|
90
|
+
*/
|
|
91
|
+
export function selectStructure(structureTypeOrId: StructureType | shared.api.structures.StructureRef): shared.api.structures.StructureRef | null;
|
|
92
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sandkit.api.camera` — camera focus and follow control.
|
|
3
|
+
* Main thread only.
|
|
4
|
+
*/
|
|
5
|
+
export namespace camera {
|
|
6
|
+
/** Snap the camera to the player position. */
|
|
7
|
+
export function snapToPlayer(): void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Move camera focus to world coordinates.
|
|
11
|
+
* @param worldX - World x position in pixels.
|
|
12
|
+
* @param worldY - World y position in pixels.
|
|
13
|
+
* @returns True when focus was applied.
|
|
14
|
+
*/
|
|
15
|
+
export function setFocusAtWorld(worldX: number, worldY: number): boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Release scripted focus and return control to the player.
|
|
19
|
+
* @param options - Optional transition duration in milliseconds.
|
|
20
|
+
* @returns True when focus was released.
|
|
21
|
+
*/
|
|
22
|
+
export function releaseFocus(options?: { durationMs?: number; }): boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CellCoordinates } from "../../shared/player";
|
|
2
|
+
import type { CellId } from "../../shared/nominal";
|
|
3
|
+
import { shared } from "../../shared";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `sandkit.api.collector` — collector structure value and pickup handling.
|
|
7
|
+
* Main thread only.
|
|
8
|
+
*/
|
|
9
|
+
export namespace collector {
|
|
10
|
+
/**
|
|
11
|
+
* Returns the collector value for a cell id.
|
|
12
|
+
* @param cellId - Packed cell identifier.
|
|
13
|
+
*/
|
|
14
|
+
export function getValueFromCellId(cellId: CellId): number;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the collector value for an element type.
|
|
17
|
+
* @param elementType - Numeric element type id.
|
|
18
|
+
*/
|
|
19
|
+
export function getValueByType(elementType: shared.api.elements.ElementType): number;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true when the cell id can be collected.
|
|
22
|
+
* @param cellId - Packed cell identifier.
|
|
23
|
+
*/
|
|
24
|
+
export function isCellIdCollectable(cellId: CellId): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns true when the cell id can be collected for sprite display.
|
|
27
|
+
* @param cellId - Packed cell identifier.
|
|
28
|
+
*/
|
|
29
|
+
export function isCellIdCollectableForSprite(cellId: CellId): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Notifies collector logic that a pickup happened at the cell.
|
|
32
|
+
* @param cellX - Grid cell X coordinate.
|
|
33
|
+
* @param cellY - Grid cell Y coordinate.
|
|
34
|
+
*/
|
|
35
|
+
export function notifyPickupAtCell(...args: CellCoordinates): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Physics skip modes used with element skip-physics fields.
|
|
3
|
+
*
|
|
4
|
+
* `sandkit.api.constants` — shared numeric constants for mod API use.
|
|
5
|
+
* Main thread only.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
export namespace constants {
|
|
10
|
+
/**
|
|
11
|
+
* Skip-physics modes for element physics fields.
|
|
12
|
+
*/
|
|
13
|
+
export const physics: Readonly<{
|
|
14
|
+
/** Run physics every tick. */
|
|
15
|
+
normal: 0;
|
|
16
|
+
/** Skip some physics updates. */
|
|
17
|
+
skip: 1;
|
|
18
|
+
/** Skip more aggressively than `skip`. */
|
|
19
|
+
aggressiveSkip: 2;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sandkit.api.cooldown` — reusable cooldown timers for abilities and items.
|
|
3
|
+
* Main thread only.
|
|
4
|
+
*/
|
|
5
|
+
export namespace cooldown {
|
|
6
|
+
/**
|
|
7
|
+
* Starts the cooldown when ready and returns true; otherwise returns false.
|
|
8
|
+
* @param cooldown - Cooldown state object to check and update.
|
|
9
|
+
* @param overrideTime - Optional timestamp (ms) instead of current game time.
|
|
10
|
+
*/
|
|
11
|
+
export function check(cooldown: Cooldown, overrideTime?: number): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Returns true when the cooldown has elapsed.
|
|
14
|
+
* @param cooldown - Cooldown state object to check.
|
|
15
|
+
* @param overrideTime - Optional timestamp (ms) instead of current game time.
|
|
16
|
+
*/
|
|
17
|
+
export function isReady(cooldown: Cooldown, overrideTime?: number): boolean;
|
|
18
|
+
|
|
19
|
+
/** Cooldown state object passed to {@link check} and {@link isReady}. */
|
|
20
|
+
export interface Cooldown {
|
|
21
|
+
/** Timestamp when the cooldown was last triggered (game time). */
|
|
22
|
+
last: number;
|
|
23
|
+
/** Cooldown duration in milliseconds. */
|
|
24
|
+
time: number;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { shared } from "../../shared";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `sandkit.api.discoveries` — unlock element and terrain entries in the discovery log.
|
|
5
|
+
* Main thread only.
|
|
6
|
+
*/
|
|
7
|
+
export namespace discoveries {
|
|
8
|
+
/**
|
|
9
|
+
* Marks an element type as discovered for the player.
|
|
10
|
+
* @param elementType - Numeric element type id.
|
|
11
|
+
*/
|
|
12
|
+
export function addElementByType(elementType: shared.api.elements.ElementType): void;
|
|
13
|
+
/**
|
|
14
|
+
* Marks a terrain type as discovered for the player.
|
|
15
|
+
* @param terrainType - Numeric terrain type id.
|
|
16
|
+
*/
|
|
17
|
+
export function addTerrainByType(terrainType: shared.api.terrains.TerrainType): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
}
|