@sandustry-modding/types 0.3.0 → 0.4.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 +88 -0
- package/LICENSE +21 -0
- package/README.md +8 -19
- package/package.json +65 -5
- package/src/configs/index.d.ts +38 -0
- package/src/configs/modinfo.d.ts +751 -0
- package/src/configs/patches.d.ts +195 -0
- package/src/sandkit/api/action.d.ts +5 -0
- package/src/sandkit/api/blueprints.d.ts +5 -3
- package/src/sandkit/api/camera.d.ts +5 -0
- package/src/sandkit/api/effects.d.ts +28 -7
- package/src/sandkit/api/elements.d.ts +124 -39
- package/src/sandkit/api/energy.d.ts +8 -0
- package/src/sandkit/api/entities.d.ts +15 -8
- package/src/sandkit/api/events.d.ts +139 -2
- package/src/sandkit/api/excavation.d.ts +33 -3
- package/src/sandkit/api/factory.d.ts +6 -4
- package/src/sandkit/api/fire.d.ts +7 -4
- package/src/sandkit/api/game.d.ts +8 -2
- package/src/sandkit/api/grid.d.ts +72 -23
- package/src/sandkit/api/hooks.d.ts +362 -2
- package/src/sandkit/api/i18n.d.ts +65 -20
- package/src/sandkit/api/input.d.ts +15 -0
- package/src/sandkit/api/items.d.ts +7 -0
- package/src/sandkit/api/lights.d.ts +55 -8
- package/src/sandkit/api/maps.d.ts +10 -1
- package/src/sandkit/api/patterns.d.ts +22 -0
- package/src/sandkit/api/pickups.d.ts +14 -8
- package/src/sandkit/api/pipes.d.ts +9 -5
- package/src/sandkit/api/player.d.ts +29 -15
- package/src/sandkit/api/progression.d.ts +8 -0
- package/src/sandkit/api/reactions.d.ts +11 -0
- package/src/sandkit/api/rendering.d.ts +25 -2
- package/src/sandkit/api/resources.d.ts +5 -0
- package/src/sandkit/api/schedule.d.ts +7 -0
- package/src/sandkit/api/settings.d.ts +7 -0
- package/src/sandkit/api/shared.d.ts +13 -3
- package/src/sandkit/api/signals.d.ts +29 -0
- package/src/sandkit/api/sound.d.ts +14 -8
- package/src/sandkit/api/structureBehaviors.d.ts +8 -0
- package/src/sandkit/api/structures.d.ts +353 -43
- package/src/sandkit/api/tech.d.ts +73 -9
- package/src/sandkit/api/terrains.d.ts +25 -13
- package/src/sandkit/api/triggers.d.ts +10 -0
- package/src/sandkit/api/ui.d.ts +146 -1
- package/src/sandkit/api/upgrades.d.ts +2 -1
- package/src/sandkit/api/utils.d.ts +10 -5
- package/src/sandkit/api/world.d.ts +30 -25
- package/src/sandkit/index.d.ts +12 -1
- package/src/shared/api/elements.d.ts +36 -22
- package/src/shared/api/grid.d.ts +11 -6
- package/src/shared/api/player.d.ts +8 -4
- package/src/shared/api/shared.d.ts +2 -1
- package/src/shared/api/structures.d.ts +55 -17
- package/src/shared/api/terrains.d.ts +39 -23
- package/src/shared/api/ui.d.ts +5 -0
- package/src/shared/api/world.d.ts +9 -9
- package/src/worker/api/effects.d.ts +11 -3
- package/src/worker/api/elements.d.ts +54 -19
- package/src/worker/api/events.d.ts +31 -2
- package/src/worker/api/fire.d.ts +4 -2
- package/src/worker/api/grid.d.ts +10 -2
- package/src/worker/api/hooks.d.ts +68 -2
- package/src/worker/api/lights.d.ts +13 -3
- package/src/worker/api/shared.d.ts +12 -2
- package/src/worker/sandkit-api.d.ts +2 -1
- package/docs/Changelog.md +0 -46
- package/docs/README.md +0 -62
|
@@ -13,7 +13,65 @@ export namespace hooks {
|
|
|
13
13
|
* @param hookId - Registered hook identifier.
|
|
14
14
|
* @param callback - Called with hook arguments and context; may cancel the hook.
|
|
15
15
|
* @param options - Optional guard and priority.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @example cell:process
|
|
18
|
+
* ```ts
|
|
19
|
+
* api.hooks.intercept("cell:process", handleCell, {
|
|
20
|
+
* guard: { elementType },
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example element:update
|
|
25
|
+
* ```ts
|
|
26
|
+
* api.hooks.intercept("element:update", handleUpdate, {
|
|
27
|
+
* guard: { elementType },
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example element:move
|
|
32
|
+
* ```ts
|
|
33
|
+
* api.hooks.intercept("element:move", (args, context) => {
|
|
34
|
+
* handleElementMove(args, context);
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example element:move:blocked
|
|
39
|
+
* ```ts
|
|
40
|
+
* api.hooks.intercept(
|
|
41
|
+
* "element:move:blocked",
|
|
42
|
+
* (args, context) => {
|
|
43
|
+
* handleBlockedMovement(args, context);
|
|
44
|
+
* },
|
|
45
|
+
* { guard: { elementType } },
|
|
46
|
+
* );
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example element:duration:expire
|
|
50
|
+
* ```ts
|
|
51
|
+
* api.hooks.intercept(
|
|
52
|
+
* "element:duration:expire",
|
|
53
|
+
* (args, context) => {
|
|
54
|
+
* handleDurationExpiry(args, context);
|
|
55
|
+
* },
|
|
56
|
+
* { guard: { elementType } },
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example fire:element:burn
|
|
61
|
+
* ```ts
|
|
62
|
+
* api.hooks.intercept("fire:element:burn", (args, context) => {
|
|
63
|
+
* handleElementBurn(args, context);
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example shaker:elementOn
|
|
68
|
+
* ```ts
|
|
69
|
+
* api.hooks.intercept("shaker:elementOn", (args, context) => {
|
|
70
|
+
* handleShakerElement(args, context);
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
17
75
|
*/
|
|
18
76
|
export function intercept<K extends InterceptHookId>(
|
|
19
77
|
hookId: K,
|
|
@@ -27,7 +85,15 @@ export namespace hooks {
|
|
|
27
85
|
* @param hookId - Registered hook identifier.
|
|
28
86
|
* @param callback - Called with hook arguments; may mutate hook payload.
|
|
29
87
|
* @param options - Optional guard and priority.
|
|
30
|
-
*
|
|
88
|
+
*
|
|
89
|
+
* @example Worker entry
|
|
90
|
+
* ```ts
|
|
91
|
+
* api.hooks.modify("example:prepare", (args) => {
|
|
92
|
+
* args.value *= 2;
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
31
97
|
*/
|
|
32
98
|
export function modify<K extends ModifyHookId>(
|
|
33
99
|
hookId: K,
|
|
@@ -9,7 +9,7 @@ export namespace lights {
|
|
|
9
9
|
/**
|
|
10
10
|
* Short-lived visual effect lights.
|
|
11
11
|
*
|
|
12
|
-
* @see https://sandustry.com/sandkit.html
|
|
12
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
13
13
|
*/
|
|
14
14
|
export namespace temporary {
|
|
15
15
|
/** Options for {@link createAtWorld}. */
|
|
@@ -21,7 +21,8 @@ export namespace lights {
|
|
|
21
21
|
lightId: number | null;
|
|
22
22
|
/**
|
|
23
23
|
* @deprecated Use {@link lightId} instead.
|
|
24
|
-
*
|
|
24
|
+
*
|
|
25
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
25
26
|
*/
|
|
26
27
|
index?: number | null;
|
|
27
28
|
}
|
|
@@ -32,7 +33,16 @@ export namespace lights {
|
|
|
32
33
|
* @param worldX - World x position in pixels.
|
|
33
34
|
* @param worldY - World y position in pixels.
|
|
34
35
|
* @param options - Brightness, duration, colour, and dedup settings.
|
|
35
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* @example Worker entry
|
|
38
|
+
* ```ts
|
|
39
|
+
* const light = api.lights.temporary.createAtWorld(worldX, worldY, {
|
|
40
|
+
* durationTicks: 15,
|
|
41
|
+
* });
|
|
42
|
+
* const lightId = light.lightId;
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
36
46
|
*/
|
|
37
47
|
export function createAtWorld(
|
|
38
48
|
worldX: number,
|
|
@@ -23,7 +23,16 @@ export namespace shared {
|
|
|
23
23
|
*
|
|
24
24
|
* @param key - Buffer name shared across threads.
|
|
25
25
|
* @param config - Expected array type and length for validation.
|
|
26
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const counts = api.shared.buffers.require("counts", {
|
|
30
|
+
* type: "uint32",
|
|
31
|
+
* length: 4,
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
27
36
|
*/
|
|
28
37
|
export function require(key: string, config: { type: SharedArrayType; length: number; }): SharedArray;
|
|
29
38
|
|
|
@@ -31,7 +40,8 @@ export namespace shared {
|
|
|
31
40
|
* Read an existing buffer without validating type or length.
|
|
32
41
|
*
|
|
33
42
|
* @param key - Buffer name shared across threads.
|
|
34
|
-
*
|
|
43
|
+
*
|
|
44
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
35
45
|
*/
|
|
36
46
|
export import get = sharedApi.api.shared.buffers.get;
|
|
37
47
|
}
|
|
@@ -34,7 +34,8 @@ export type WorkerSandkitApi = {
|
|
|
34
34
|
worker: typeof import("./api/worker").worker;
|
|
35
35
|
/**
|
|
36
36
|
* @deprecated Use {@link grid} instead.
|
|
37
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
38
39
|
*/
|
|
39
40
|
world: typeof import("./api/grid").world;
|
|
40
41
|
};
|
package/docs/Changelog.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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.3.0] - 2026-08-27
|
|
9
|
-
|
|
10
|
-
### Changed
|
|
11
|
-
|
|
12
|
-
- Move declaration sources into `src/` (`src/sandkit`, `src/worker`, `src/shared`, `src/global.d.ts`). Package subpaths such as `@sandustry-modding/types/sandkit/engine` stay the same
|
|
13
|
-
- Show local names for API member headings in the Docsify reference (full runtime path stays under each heading)
|
|
14
|
-
|
|
15
|
-
## [0.2.0] - 2026-08-27
|
|
16
|
-
|
|
17
|
-
### Added
|
|
18
|
-
|
|
19
|
-
- Official Sandkit API coverage from [sandustry.com/sandkit.html](https://sandustry.com/sandkit.html): `api.entities`, `api.pipes`, `api.factory`, `api.game`, `api.blueprints`, `api.pickups`, `api.grid.mutate`, and related worker surfaces
|
|
20
|
-
- JSDoc `@see` links back to the official Sandkit page on documented members
|
|
21
|
-
|
|
22
|
-
### Changed
|
|
23
|
-
|
|
24
|
-
- Canonical mutation names match official docs (`createAtCell`, `grid.mutate`, `getTypeById`, and similar). Old names stay as `@deprecated` aliases (`*WhenIdle`, `api.world`, `getTypeFromId`, and similar)
|
|
25
|
-
|
|
26
|
-
## [0.1.1] - 2026-08-27
|
|
27
|
-
|
|
28
|
-
### Changed
|
|
29
|
-
|
|
30
|
-
- Export subpaths (`./*`) so mods can import declaration modules such as `@sandustry-modding/types/sandkit/engine`
|
|
31
|
-
|
|
32
|
-
## [0.1.0] - 2026-08-27
|
|
33
|
-
|
|
34
|
-
### Added
|
|
35
|
-
|
|
36
|
-
- Initial public release of `@sandustry-modding/types`
|
|
37
|
-
- TypeScript declarations for main-thread `sandkit` (`sandkit/api`, `sandkit/engine`, `sandkit/enums`, `sandkit/react`)
|
|
38
|
-
- Worker-thread declarations under `worker/` (`WorkerSandkitApi`)
|
|
39
|
-
- Shared base shapes under `shared/` for main and worker reuse
|
|
40
|
-
- Ambient `sandkit` free variable and type aliases via `global.d.ts`
|
|
41
|
-
- Docsify API reference generated from the declarations
|
|
42
|
-
|
|
43
|
-
[0.3.0]: https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.3.0
|
|
44
|
-
[0.2.0]: https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.2.0
|
|
45
|
-
[0.1.1]: https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.1.1
|
|
46
|
-
[0.1.0]: https://github.com/sandustry-modding/SandustryTypes/releases/tag/v0.1.0
|
package/docs/README.md
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Sandkit API
|
|
2
|
-
|
|
3
|
-
> [!WARNING]
|
|
4
|
-
> **Unofficial** community docs. Not affiliated with Lantto Games, Hooded Horse, or the [official Sandustry wiki](https://wiki.hoodedhorse.com/Sandustry/Sandustry_Official_Wiki). See the [official Sandkit docs](https://sandustry.com/sandkit.html).
|
|
5
|
-
|
|
6
|
-
Community TypeScript reference for the live Sandustry `sandkit` host API. Package: [`@sandustry-modding/types`](https://www.npmjs.com/package/@sandustry-modding/types).
|
|
7
|
-
|
|
8
|
-
## Start here
|
|
9
|
-
|
|
10
|
-
| Go to | When you need |
|
|
11
|
-
| --- | --- |
|
|
12
|
-
| [Namespaces](modules.md) | Browse namespaces by group |
|
|
13
|
-
| [Full API reference](full.md) | All namespaces on one page |
|
|
14
|
-
| [Main thread](api/sandkit.api.md) | `main.js` APIs (`sandkit.api`) |
|
|
15
|
-
| [Worker thread](api/sandkit.api.worker.md) | `worker.js` APIs (subset + direct mutations) |
|
|
16
|
-
| [Engine](api/sandkit.engine.md) | Escape hatch (`sandkit.engine`) |
|
|
17
|
-
| [Enums](api/sandkit.enums.md) | Runtime enum values |
|
|
18
|
-
| [React](api/sandkit.react.md) | HUD JSX helpers |
|
|
19
|
-
|
|
20
|
-
## Install types
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @sandustry-modding/types
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Project config (preferred)
|
|
27
|
-
|
|
28
|
-
In `tsconfig.json` or `jsconfig.json`:
|
|
29
|
-
|
|
30
|
-
```json
|
|
31
|
-
{
|
|
32
|
-
"compilerOptions": {
|
|
33
|
-
"types": ["@sandustry-modding/types"]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If `types` already lists other packages (for example `"react"` or `"node"`), add `"@sandustry-modding/types"` to that array. A non-empty `types` list replaces auto-inclusion of all `@types/*` packages.
|
|
39
|
-
|
|
40
|
-
### Per-file reference
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
/// <reference types="@sandustry-modding/types" />
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Works in `.ts` and `.js` (including checked JS). Put it at the top of a source file, or in an ambient `.d.ts` included by the project.
|
|
47
|
-
|
|
48
|
-
Use the ambient `sandkit` free name in `main.js`. In `worker.js`, type the API as `WorkerSandkitApi` — worker and main surfaces overlap but are not interchangeable.
|
|
49
|
-
|
|
50
|
-
## Also useful
|
|
51
|
-
|
|
52
|
-
- [Official Sandkit docs](https://sandustry.com/sandkit.html)
|
|
53
|
-
- [Sandustry Mod Template](https://sandustry-modding.github.io/SandustryModTemplate/#/)
|
|
54
|
-
- [Official Sandustry wiki](https://wiki.hoodedhorse.com/Sandustry/Sandustry_Official_Wiki)
|
|
55
|
-
|
|
56
|
-
## Regenerate
|
|
57
|
-
|
|
58
|
-
From the package repo root:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
npm run docs:api
|
|
62
|
-
```
|