@sandustry-modding/types 0.3.1 → 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 +40 -11
- package/README.md +3 -0
- package/package.json +12 -2
- 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
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandkit bundle patch schema (`patches.json`).
|
|
3
|
+
*
|
|
4
|
+
* Not a runtime `sandkit` object. Use these types when authoring or validating
|
|
5
|
+
* compiled-bundle patches. Patches break across game updates; prefer
|
|
6
|
+
* `sandkit.api` when possible.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*
|
|
10
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Known compiled bundle paths the loader can patch.
|
|
15
|
+
*
|
|
16
|
+
* | Value | Role |
|
|
17
|
+
* | --- | --- |
|
|
18
|
+
* | `js/bundle.js` | Main renderer |
|
|
19
|
+
* | `js/manager-worker.js` | Manager worker |
|
|
20
|
+
* | `js/simulation-worker.js` | Simulation workers |
|
|
21
|
+
* | `js/utility-worker.js` | Utility worker |
|
|
22
|
+
*
|
|
23
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
24
|
+
*/
|
|
25
|
+
export type PatchTargetFile =
|
|
26
|
+
| "js/bundle.js"
|
|
27
|
+
| "js/simulation-worker.js"
|
|
28
|
+
| "js/manager-worker.js"
|
|
29
|
+
| "js/utility-worker.js"
|
|
30
|
+
| (string & {});
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Supported patch operations.
|
|
34
|
+
*
|
|
35
|
+
* | Value | Behaviour |
|
|
36
|
+
* | --- | --- |
|
|
37
|
+
* | `replace` | Replace the matched text with {@link BundlePatch.code} / {@link BundlePatch.replace} |
|
|
38
|
+
* | `remove` | Delete the matched text |
|
|
39
|
+
* | `insertBefore` | Insert {@link BundlePatch.code} before the match |
|
|
40
|
+
* | `insertAfter` | Insert {@link BundlePatch.code} after the match |
|
|
41
|
+
* | `wrap` | Surround the match with {@link BundlePatch.before} and {@link BundlePatch.after} |
|
|
42
|
+
*
|
|
43
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
44
|
+
*/
|
|
45
|
+
export type PatchOperation =
|
|
46
|
+
| "replace"
|
|
47
|
+
| "remove"
|
|
48
|
+
| "insertBefore"
|
|
49
|
+
| "insertAfter"
|
|
50
|
+
| "wrap";
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Regex finder when the target is not a plain {@link BundlePatch.find} string.
|
|
54
|
+
*
|
|
55
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
56
|
+
*/
|
|
57
|
+
export interface BundlePatchRegex {
|
|
58
|
+
/**
|
|
59
|
+
* JavaScript regex pattern source (without surrounding `/` delimiters).
|
|
60
|
+
* Capture groups may be referenced from {@link BundlePatch.code} as `$1`, `$2`, …
|
|
61
|
+
*
|
|
62
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
63
|
+
*/
|
|
64
|
+
pattern: string;
|
|
65
|
+
/**
|
|
66
|
+
* Optional regex flags (for example `"g"` or `"m"`).
|
|
67
|
+
*
|
|
68
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
69
|
+
*/
|
|
70
|
+
flags?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* One entry in `patches.json`.
|
|
75
|
+
*
|
|
76
|
+
* The file is an array of these objects. Prefer `expectedMatches` so a missed
|
|
77
|
+
* or duplicated match fails loudly. When several patches must succeed together
|
|
78
|
+
* (for example main + worker), set the same {@link atomicGroup} on each.
|
|
79
|
+
*
|
|
80
|
+
* @example patches.json example
|
|
81
|
+
* ```ts
|
|
82
|
+
* [
|
|
83
|
+
* {
|
|
84
|
+
* "file": "js/bundle.js",
|
|
85
|
+
* "find": "const message = 'Hello';",
|
|
86
|
+
* "operation": "replace",
|
|
87
|
+
* "code": "const message = 'Hello from my mod';",
|
|
88
|
+
* "expectedMatches": 1
|
|
89
|
+
* },
|
|
90
|
+
* {
|
|
91
|
+
* "file": "js/simulation-worker.js",
|
|
92
|
+
* "regex": {
|
|
93
|
+
* "pattern": "const ([a-z]+) = false;"
|
|
94
|
+
* },
|
|
95
|
+
* "operation": "replace",
|
|
96
|
+
* "code": "const $1 = true;",
|
|
97
|
+
* "expectedMatches": 1
|
|
98
|
+
* },
|
|
99
|
+
* {
|
|
100
|
+
* "file": "js/bundle.js",
|
|
101
|
+
* "find": "doThing();",
|
|
102
|
+
* "operation": "wrap",
|
|
103
|
+
* "before": "if (enabled) { ",
|
|
104
|
+
* "after": " }",
|
|
105
|
+
* "expectedMatches": 1
|
|
106
|
+
* }
|
|
107
|
+
* ]
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
111
|
+
*/
|
|
112
|
+
export interface BundlePatch {
|
|
113
|
+
/**
|
|
114
|
+
* Compiled bundle to modify.
|
|
115
|
+
*
|
|
116
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
117
|
+
*/
|
|
118
|
+
file: PatchTargetFile;
|
|
119
|
+
/**
|
|
120
|
+
* Exact source substring to locate in the bundle.
|
|
121
|
+
* Mutually exclusive with {@link regex} in typical patches.
|
|
122
|
+
*
|
|
123
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
124
|
+
*/
|
|
125
|
+
find?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Replacement or inserted source text.
|
|
128
|
+
* Official examples use `code`; some loaders also accept {@link replace}.
|
|
129
|
+
*
|
|
130
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
131
|
+
*/
|
|
132
|
+
code?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Alias of {@link code} used by some patch loaders and workshop mods.
|
|
135
|
+
*
|
|
136
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
137
|
+
*/
|
|
138
|
+
replace?: string;
|
|
139
|
+
/**
|
|
140
|
+
* How to apply the match. Defaults to replace-style behaviour when omitted
|
|
141
|
+
* in common workshop patches.
|
|
142
|
+
*
|
|
143
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
144
|
+
*/
|
|
145
|
+
operation?: PatchOperation;
|
|
146
|
+
/**
|
|
147
|
+
* How many times `find` / `regex` must match.
|
|
148
|
+
* Use a number (often `1`) so the load fails on miss or over-match.
|
|
149
|
+
* Some loaders accept `"any"`.
|
|
150
|
+
*
|
|
151
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
152
|
+
*/
|
|
153
|
+
expectedMatches?: number | "any";
|
|
154
|
+
/**
|
|
155
|
+
* Regex-based locator instead of a literal {@link find} string.
|
|
156
|
+
*
|
|
157
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
158
|
+
*/
|
|
159
|
+
regex?: BundlePatchRegex;
|
|
160
|
+
/**
|
|
161
|
+
* Text inserted before the match when {@link operation} is `"wrap"`.
|
|
162
|
+
*
|
|
163
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
164
|
+
*/
|
|
165
|
+
before?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Text inserted after the match when {@link operation} is `"wrap"`.
|
|
168
|
+
*
|
|
169
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
170
|
+
*/
|
|
171
|
+
after?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Optional stable id for logging and tooling.
|
|
174
|
+
*
|
|
175
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
176
|
+
*/
|
|
177
|
+
id?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Group id shared by patches that must all succeed or all fail together.
|
|
180
|
+
* Use the same string on paired main (`js/bundle.js`) and worker
|
|
181
|
+
* (`js/simulation-worker.js`) patches.
|
|
182
|
+
*/
|
|
183
|
+
atomicGroup?: string;
|
|
184
|
+
/**
|
|
185
|
+
* Human-readable note for maintainers. Not required by the official schema.
|
|
186
|
+
*/
|
|
187
|
+
description?: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Root shape of `patches.json`: an ordered list of {@link BundlePatch} entries.
|
|
192
|
+
*
|
|
193
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#patches-heading)
|
|
194
|
+
*/
|
|
195
|
+
export type BundlePatchesFile = BundlePatch[];
|
|
@@ -23,6 +23,11 @@ export declare namespace action {
|
|
|
23
23
|
/**
|
|
24
24
|
* Store custom data on the active action handler.
|
|
25
25
|
* @param data - Serializable payload attached to the active action.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* api.action.setCustomData({ mode: "example" });
|
|
30
|
+
* ```
|
|
26
31
|
*/
|
|
27
32
|
export function setCustomData<Input>(data: Input): void;
|
|
28
33
|
}
|
|
@@ -5,14 +5,15 @@ import type { structures } from "../../shared/api/structures";
|
|
|
5
5
|
*
|
|
6
6
|
* Available as `sandkit.api.blueprints`.
|
|
7
7
|
*
|
|
8
|
-
* @see https://sandustry.com/sandkit.html
|
|
8
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
9
9
|
*/
|
|
10
10
|
export namespace blueprints {
|
|
11
11
|
/**
|
|
12
12
|
* Serialize live structure instances into blueprint records.
|
|
13
13
|
*
|
|
14
14
|
* @param structures - Structure instances to encode.
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
16
17
|
*/
|
|
17
18
|
export function serializeStructures(structures: readonly structures.Structure[]): BlueprintStructure[];
|
|
18
19
|
|
|
@@ -20,7 +21,8 @@ export namespace blueprints {
|
|
|
20
21
|
* Localize blueprint structure records for placement.
|
|
21
22
|
*
|
|
22
23
|
* @param structures - Blueprint structure records to localize.
|
|
23
|
-
*
|
|
24
|
+
*
|
|
25
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
24
26
|
*/
|
|
25
27
|
export function localizeStructures(structures: readonly BlueprintStructure[]): BlueprintStructure[];
|
|
26
28
|
|
|
@@ -18,6 +18,11 @@ export namespace camera {
|
|
|
18
18
|
* Release scripted focus and return control to the player.
|
|
19
19
|
* @param options - Optional transition duration in milliseconds.
|
|
20
20
|
* @returns True when focus was released.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const released = api.camera.releaseFocus({ durationMs: 250 });
|
|
25
|
+
* ```
|
|
21
26
|
*/
|
|
22
27
|
export function releaseFocus(options?: { durationMs?: number; }): boolean;
|
|
23
28
|
}
|
|
@@ -19,7 +19,8 @@ export namespace effects {
|
|
|
19
19
|
* @param worldX - World X coordinate in pixels.
|
|
20
20
|
* @param worldY - World Y coordinate in pixels.
|
|
21
21
|
* @param options - Duration, radius, and intensity settings.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
23
24
|
*/
|
|
24
25
|
export function createAtWorld(
|
|
25
26
|
effectId: string,
|
|
@@ -30,7 +31,8 @@ export namespace effects {
|
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* @deprecated Use {@link createAtWorld} instead.
|
|
33
|
-
*
|
|
34
|
+
*
|
|
35
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
34
36
|
*/
|
|
35
37
|
export function createEffectAtWorld(
|
|
36
38
|
effectId: string,
|
|
@@ -45,13 +47,22 @@ export namespace effects {
|
|
|
45
47
|
* @param worldX - World X coordinate in pixels.
|
|
46
48
|
* @param worldY - World Y coordinate in pixels.
|
|
47
49
|
* @param options - Count, velocity, colour, and lifetime settings.
|
|
48
|
-
*
|
|
50
|
+
*
|
|
51
|
+
* @example Main entry
|
|
52
|
+
* ```ts
|
|
53
|
+
* api.effects.createParticlesAtWorld(worldX, worldY, {
|
|
54
|
+
* count: 12,
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
49
59
|
*/
|
|
50
60
|
export import createParticlesAtWorld = shared.api.effects.createParticlesAtWorld;
|
|
51
61
|
|
|
52
62
|
/**
|
|
53
63
|
* @deprecated Use {@link lights.temporary.createAtWorld} instead.
|
|
54
|
-
*
|
|
64
|
+
*
|
|
65
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
55
66
|
*/
|
|
56
67
|
export function createLightAtWorld(
|
|
57
68
|
worldX: number,
|
|
@@ -65,7 +76,15 @@ export namespace effects {
|
|
|
65
76
|
* @param worldX - World X coordinate in pixels.
|
|
66
77
|
* @param worldY - World Y coordinate in pixels.
|
|
67
78
|
* @param options - Style, duration, radius, intensity, and color.
|
|
68
|
-
*
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* api.effects.createDistortionWaveAtWorld(worldX, worldY, {
|
|
83
|
+
* style: "implode",
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
69
88
|
*/
|
|
70
89
|
export function createDistortionWaveAtWorld(worldX: number, worldY: number, options?: DistortionEffectOptions): void;
|
|
71
90
|
|
|
@@ -77,7 +96,8 @@ export namespace effects {
|
|
|
77
96
|
* @param endWorldX - Beam end world X in pixels.
|
|
78
97
|
* @param endWorldY - Beam end world Y in pixels.
|
|
79
98
|
* @param options - Width, brightness, color, and glow options.
|
|
80
|
-
*
|
|
99
|
+
*
|
|
100
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
81
101
|
*/
|
|
82
102
|
export function createLaserAtWorld(
|
|
83
103
|
startWorldX: number,
|
|
@@ -89,7 +109,8 @@ export namespace effects {
|
|
|
89
109
|
|
|
90
110
|
/**
|
|
91
111
|
* @deprecated Use {@link lights.temporary.removeById} instead.
|
|
92
|
-
*
|
|
112
|
+
*
|
|
113
|
+
* @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
|
|
93
114
|
*/
|
|
94
115
|
export function removeLightById(lightId: number): void;
|
|
95
116
|
|