@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.
Files changed (68) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/LICENSE +21 -0
  3. package/README.md +8 -19
  4. package/package.json +65 -5
  5. package/src/configs/index.d.ts +38 -0
  6. package/src/configs/modinfo.d.ts +751 -0
  7. package/src/configs/patches.d.ts +195 -0
  8. package/src/sandkit/api/action.d.ts +5 -0
  9. package/src/sandkit/api/blueprints.d.ts +5 -3
  10. package/src/sandkit/api/camera.d.ts +5 -0
  11. package/src/sandkit/api/effects.d.ts +28 -7
  12. package/src/sandkit/api/elements.d.ts +124 -39
  13. package/src/sandkit/api/energy.d.ts +8 -0
  14. package/src/sandkit/api/entities.d.ts +15 -8
  15. package/src/sandkit/api/events.d.ts +139 -2
  16. package/src/sandkit/api/excavation.d.ts +33 -3
  17. package/src/sandkit/api/factory.d.ts +6 -4
  18. package/src/sandkit/api/fire.d.ts +7 -4
  19. package/src/sandkit/api/game.d.ts +8 -2
  20. package/src/sandkit/api/grid.d.ts +72 -23
  21. package/src/sandkit/api/hooks.d.ts +362 -2
  22. package/src/sandkit/api/i18n.d.ts +65 -20
  23. package/src/sandkit/api/input.d.ts +15 -0
  24. package/src/sandkit/api/items.d.ts +7 -0
  25. package/src/sandkit/api/lights.d.ts +55 -8
  26. package/src/sandkit/api/maps.d.ts +10 -1
  27. package/src/sandkit/api/patterns.d.ts +22 -0
  28. package/src/sandkit/api/pickups.d.ts +14 -8
  29. package/src/sandkit/api/pipes.d.ts +9 -5
  30. package/src/sandkit/api/player.d.ts +29 -15
  31. package/src/sandkit/api/progression.d.ts +8 -0
  32. package/src/sandkit/api/reactions.d.ts +11 -0
  33. package/src/sandkit/api/rendering.d.ts +25 -2
  34. package/src/sandkit/api/resources.d.ts +5 -0
  35. package/src/sandkit/api/schedule.d.ts +7 -0
  36. package/src/sandkit/api/settings.d.ts +7 -0
  37. package/src/sandkit/api/shared.d.ts +13 -3
  38. package/src/sandkit/api/signals.d.ts +29 -0
  39. package/src/sandkit/api/sound.d.ts +14 -8
  40. package/src/sandkit/api/structureBehaviors.d.ts +8 -0
  41. package/src/sandkit/api/structures.d.ts +353 -43
  42. package/src/sandkit/api/tech.d.ts +73 -9
  43. package/src/sandkit/api/terrains.d.ts +25 -13
  44. package/src/sandkit/api/triggers.d.ts +10 -0
  45. package/src/sandkit/api/ui.d.ts +146 -1
  46. package/src/sandkit/api/upgrades.d.ts +2 -1
  47. package/src/sandkit/api/utils.d.ts +10 -5
  48. package/src/sandkit/api/world.d.ts +30 -25
  49. package/src/sandkit/index.d.ts +12 -1
  50. package/src/shared/api/elements.d.ts +36 -22
  51. package/src/shared/api/grid.d.ts +11 -6
  52. package/src/shared/api/player.d.ts +8 -4
  53. package/src/shared/api/shared.d.ts +2 -1
  54. package/src/shared/api/structures.d.ts +55 -17
  55. package/src/shared/api/terrains.d.ts +39 -23
  56. package/src/shared/api/ui.d.ts +5 -0
  57. package/src/shared/api/world.d.ts +9 -9
  58. package/src/worker/api/effects.d.ts +11 -3
  59. package/src/worker/api/elements.d.ts +54 -19
  60. package/src/worker/api/events.d.ts +31 -2
  61. package/src/worker/api/fire.d.ts +4 -2
  62. package/src/worker/api/grid.d.ts +10 -2
  63. package/src/worker/api/hooks.d.ts +68 -2
  64. package/src/worker/api/lights.d.ts +13 -3
  65. package/src/worker/api/shared.d.ts +12 -2
  66. package/src/worker/sandkit-api.d.ts +2 -1
  67. package/docs/Changelog.md +0 -46
  68. package/docs/README.md +0 -62
@@ -11,7 +11,169 @@ export namespace hooks {
11
11
  * @param hookId - Registered hook identifier.
12
12
  * @param callback - Called with hook arguments and context; may cancel the hook.
13
13
  * @param options - Optional priority and filter options.
14
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.hooks.intercept`
14
+ *
15
+ * @example item:use
16
+ * ```ts
17
+ * const unsubscribe = api.hooks.intercept(
18
+ * "item:use",
19
+ * (args, context) => {
20
+ * args.prepared.energyCost = Number(args.baseline.energyCost) * 2;
21
+ *
22
+ * if (args.prepared.energyCost > 1000) {
23
+ * context.cancel();
24
+ * }
25
+ * },
26
+ * { itemIds: ["laser"], priority: 0 },
27
+ * );
28
+ * ```
29
+ *
30
+ * @example teleport:effect:create
31
+ * ```ts
32
+ * api.hooks.intercept("teleport:effect:create", (args, context) => {
33
+ * context.cancel();
34
+ * });
35
+ * ```
36
+ *
37
+ * @example action:start
38
+ * ```ts
39
+ * api.hooks.intercept("action:start", (args, context) => {
40
+ * if (args.action?.id === "example") context.cancel();
41
+ * });
42
+ * ```
43
+ *
44
+ * @example input:keyDown
45
+ * ```ts
46
+ * api.hooks.intercept("input:keyDown", (args, context) => {
47
+ * if (args.code === "KeyK") context.cancel();
48
+ * });
49
+ * ```
50
+ *
51
+ * @example input:keyUp
52
+ * ```ts
53
+ * api.hooks.intercept("input:keyUp", (args, context) => {
54
+ * if (args.code === "KeyK") context.cancel();
55
+ * });
56
+ * ```
57
+ *
58
+ * @example placePoints:suppress
59
+ * ```ts
60
+ * api.hooks.intercept("placePoints:suppress", (args, context) => {
61
+ * if (args.type === "exampleStructure") context.cancel();
62
+ * });
63
+ * ```
64
+ *
65
+ * @example placePoints:directionalArrows:suppress
66
+ * ```ts
67
+ * api.hooks.intercept(
68
+ * "placePoints:directionalArrows:suppress",
69
+ * (args, context) => {
70
+ * if (args.type === "exampleStructure") context.cancel();
71
+ * },
72
+ * );
73
+ * ```
74
+ *
75
+ * @example entity:update
76
+ * ```ts
77
+ * const unsubscribe = api.hooks.intercept(
78
+ * "entity:update",
79
+ * (args) => {
80
+ * if (args.phase !== "normal") return;
81
+ * args.entity.targetX = args.playerWorldX;
82
+ * args.entity.targetY = args.playerWorldY;
83
+ * },
84
+ * { entityTypes: ["lumling"], priority: 0 },
85
+ * );
86
+ * ```
87
+ *
88
+ * @example building:place
89
+ * ```ts
90
+ * api.hooks.intercept("building:place", (args, context) => {
91
+ * if (args.structureId === "exampleStructure") context.cancel();
92
+ * });
93
+ * ```
94
+ *
95
+ * @example building:clearShape
96
+ * ```ts
97
+ * api.hooks.intercept("building:clearShape", (args, context) => {
98
+ * if (args.structure.data?.protected) context.cancel();
99
+ * });
100
+ * ```
101
+ *
102
+ * @example input:scroll
103
+ * ```ts
104
+ * api.hooks.intercept("input:scroll", (args, context) => {
105
+ * if (args.deltaY !== 0) context.cancel();
106
+ * });
107
+ * ```
108
+ *
109
+ * @example input:boostDown
110
+ * ```ts
111
+ * api.hooks.intercept("input:boostDown", (args, context) => {
112
+ * context.cancel();
113
+ * });
114
+ * ```
115
+ *
116
+ * @example input:descendDown
117
+ * ```ts
118
+ * api.hooks.intercept("input:descendDown", (args, context) => {
119
+ * context.cancel();
120
+ * });
121
+ * ```
122
+ *
123
+ * @example input:escape
124
+ * ```ts
125
+ * api.hooks.intercept("input:escape", (args, context) => {
126
+ * context.cancel();
127
+ * });
128
+ * ```
129
+ *
130
+ * @example interactable:suppressHover
131
+ * ```ts
132
+ * api.hooks.intercept("interactable:suppressHover", (args, context) => {
133
+ * if (args.type === "exampleStructure") context.cancel();
134
+ * });
135
+ * ```
136
+ *
137
+ * @example fire:element:ignite
138
+ * ```ts
139
+ * api.hooks.intercept("fire:element:ignite", (args, context) => {
140
+ * if (args.elementType === exampleElementType) context.cancel();
141
+ * });
142
+ * ```
143
+ *
144
+ * @example projectile:fire:overStructure
145
+ * ```ts
146
+ * api.hooks.intercept(
147
+ * "projectile:fire:overStructure",
148
+ * (args, context) => {
149
+ * if (args.projectile.type === "exampleProjectile") context.cancel();
150
+ * },
151
+ * );
152
+ * ```
153
+ *
154
+ * @example projectile:hit
155
+ * ```ts
156
+ * api.hooks.intercept("projectile:hit", (args, context) => {
157
+ * if (args.projectile.type === "exampleProjectile") context.cancel();
158
+ * });
159
+ * ```
160
+ *
161
+ * @example player:position:commit
162
+ * ```ts
163
+ * api.hooks.intercept("player:position:commit", (args) => {
164
+ * args.velocityX *= 0.5;
165
+ * args.velocityY *= 0.5;
166
+ * });
167
+ * ```
168
+ *
169
+ * @example progression:purchase
170
+ * ```ts
171
+ * api.hooks.intercept("progression:purchase", (args, context) => {
172
+ * if (args.id === "exampleTech") context.cancel();
173
+ * });
174
+ * ```
175
+ *
176
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
15
177
  */
16
178
  export function intercept<K extends InterceptHookId>(
17
179
  hookId: K,
@@ -25,7 +187,205 @@ export namespace hooks {
25
187
  * @param hookId - Registered hook identifier.
26
188
  * @param callback - Called with hook arguments; may mutate hook payload.
27
189
  * @param options - Optional priority and filter options.
28
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.hooks.modify`
190
+ *
191
+ * @example excavation:prepare
192
+ * ```ts
193
+ * const unsubscribe = api.hooks.modify(
194
+ * "excavation:prepare",
195
+ * (args) => {
196
+ * if (args.sourceId !== "implosionGun") return;
197
+ *
198
+ * args.profileId = "example:voidGun";
199
+ * args.patternDiameterCells = 21;
200
+ * args.drillTierDamage = 8;
201
+ * },
202
+ * { priority: 0 },
203
+ * );
204
+ * ```
205
+ *
206
+ * @example locator:scan:prepare
207
+ * ```ts
208
+ * const unsubscribe = api.hooks.modify(
209
+ * "locator:scan:prepare",
210
+ * (args) => {
211
+ * const target = findNearestTarget(args.originWorldX, args.originWorldY);
212
+ * args.hasTarget = target !== null;
213
+ *
214
+ * if (!target) {
215
+ * args.noTargetToast = "No example target was found.";
216
+ * args.noTargetToastKey = "mods|example|noTarget";
217
+ * return;
218
+ * }
219
+ *
220
+ * args.targetCellX = target.cellX;
221
+ * args.targetCellY = target.cellY;
222
+ * args.outerTint[0] = 103;
223
+ * args.outerTint[1] = 232;
224
+ * args.outerTint[2] = 249;
225
+ * args.triangulationLensOverride = true;
226
+ * },
227
+ * { priority: 0 },
228
+ * );
229
+ * ```
230
+ *
231
+ * @example vacuum:prepare
232
+ * ```ts
233
+ * const vacuumPattern = [
234
+ * [0, 1, 0],
235
+ * [1, 1, 1],
236
+ * [0, 1, 0],
237
+ * ];
238
+ *
239
+ * const unsubscribe = api.hooks.modify(
240
+ * "vacuum:prepare",
241
+ * (args) => {
242
+ * const target = api.input.getMousePositionAtCell();
243
+ * args.targetCellX = target.x;
244
+ * args.targetCellY = target.y;
245
+ * args.pattern = vacuumPattern;
246
+ * },
247
+ * { priority: 0 },
248
+ * );
249
+ * ```
250
+ *
251
+ * @example vacuum:element:prepare
252
+ * ```ts
253
+ * const unsubscribe = api.hooks.modify(
254
+ * "vacuum:element:prepare",
255
+ * (args) => {
256
+ * if (args.matterType !== sandkit.enums.MatterType.Liquid) return;
257
+ *
258
+ * args.collectable = true;
259
+ * args.visibleInPicker = true;
260
+ * },
261
+ * { priority: 0 },
262
+ * );
263
+ * ```
264
+ *
265
+ * @example player:movement:prepare
266
+ * ```ts
267
+ * api.hooks.modify("player:movement:prepare", (args) => {
268
+ * args.horizontalMaxSpeed *= 1.25;
269
+ * });
270
+ * ```
271
+ *
272
+ * @example building:placementLimit:prepare
273
+ * ```ts
274
+ * api.hooks.modify("building:placementLimit:prepare", (args) => {
275
+ * args.maxCount = args.maxCount === null ? 10 : args.maxCount + 10;
276
+ * });
277
+ * ```
278
+ *
279
+ * @example fluxEmanator:processing:prepare
280
+ * ```ts
281
+ * api.hooks.modify("fluxEmanator:processing:prepare", (args) => {
282
+ * args.speedMultiplier *= 2;
283
+ * });
284
+ * ```
285
+ *
286
+ * @example render:pipes:prepare
287
+ * ```ts
288
+ * api.hooks.modify("render:pipes:prepare", (args) => {
289
+ * args.layer = "foreground";
290
+ * });
291
+ * ```
292
+ *
293
+ * @example structures:moved:prepare
294
+ * ```ts
295
+ * api.hooks.modify("structures:moved:prepare", (args) => {
296
+ * prepareMovedStructures(args.moved, args.failedToPlace);
297
+ * });
298
+ * ```
299
+ *
300
+ * @example structures:removed:prepare
301
+ * ```ts
302
+ * api.hooks.modify("structures:removed:prepare", (args) => {
303
+ * prepareRemovedStructures(args.removed, args.byMove);
304
+ * });
305
+ * ```
306
+ *
307
+ * @example weapon:reload:prepare
308
+ * ```ts
309
+ * api.hooks.modify("weapon:reload:prepare", (args) => {
310
+ * args.reloadMs *= 0.8;
311
+ * }, { weaponIds: ["exampleWeapon"] });
312
+ * ```
313
+ *
314
+ * @example projectile:travel:prepare
315
+ * ```ts
316
+ * api.hooks.modify("projectile:travel:prepare", (args) => {
317
+ * args.collidesWithStructures = false;
318
+ * }, { projectileTypes: ["exampleProjectile"] });
319
+ * ```
320
+ *
321
+ * @example projectile:impact:prepare
322
+ * ```ts
323
+ * api.hooks.modify("projectile:impact:prepare", (args) => {
324
+ * args.radiusCells = 8;
325
+ * }, { projectileTypes: ["exampleProjectile"] });
326
+ * ```
327
+ *
328
+ * @example player:collision:prepare
329
+ * ```ts
330
+ * api.hooks.modify("player:collision:prepare", (args) => {
331
+ * args.maxStepCells = 4;
332
+ * });
333
+ * ```
334
+ *
335
+ * @example trigger:schedule:prepare
336
+ * ```ts
337
+ * api.hooks.modify("trigger:schedule:prepare", (args) => {
338
+ * args.intervalMs *= 0.5;
339
+ * }, { triggerIds: ["pump"] });
340
+ * ```
341
+ *
342
+ * @example progression:cost:prepare
343
+ * ```ts
344
+ * api.hooks.modify("progression:cost:prepare", (args) => {
345
+ * if (args.currencyId === "gold") args.amount *= 0.9;
346
+ * });
347
+ * ```
348
+ *
349
+ * @example resource:collection:prepare
350
+ * ```ts
351
+ * api.hooks.modify("resource:collection:prepare", (args) => {
352
+ * args.amount *= 2;
353
+ * }, { resourceIds: ["fluxite"] });
354
+ * ```
355
+ *
356
+ * @example resource:delivery:prepare
357
+ * ```ts
358
+ * api.hooks.modify("resource:delivery:prepare", (args) => {
359
+ * args.mode = "collection";
360
+ * }, { resourceIds: ["fluxite"] });
361
+ * ```
362
+ *
363
+ * @example resource:balance:prepare
364
+ * ```ts
365
+ * api.hooks.modify("resource:balance:prepare", (args) => {
366
+ * args.balance += api.storage.get("example", "gold") ?? 0;
367
+ * }, { resourceIds: ["gold"] });
368
+ * ```
369
+ *
370
+ * @example gold:removal:prepare
371
+ * ```ts
372
+ * api.hooks.modify("gold:removal:prepare", (args) => {
373
+ * const banked = api.storage.get("example", "gold") ?? 0;
374
+ * args.shortfall = Math.max(0, args.shortfall - banked);
375
+ * });
376
+ * ```
377
+ *
378
+ * @example gold:removal:settle
379
+ * ```ts
380
+ * api.hooks.modify("gold:removal:settle", (args) => {
381
+ * const banked = api.storage.get("example", "gold") ?? 0;
382
+ * const covered = Math.min(banked, args.shortfall);
383
+ * api.storage.set("example", "gold", banked - covered);
384
+ * args.shortfall -= covered;
385
+ * });
386
+ * ```
387
+ *
388
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
29
389
  */
30
390
  export function modify<K extends ModifyHookId>(
31
391
  hookId: K,
@@ -10,7 +10,15 @@ export namespace i18n {
10
10
  *
11
11
  * @param key - Translation key.
12
12
  * @param params - Placeholder values for the key template.
13
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.t`
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const message = api.i18n.t("mods|example|count", {
17
+ * count: 3,
18
+ * });
19
+ * ```
20
+ *
21
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
14
22
  */
15
23
  export function t(key: string, params?: Record<string, string | number>): string;
16
24
 
@@ -19,14 +27,22 @@ export namespace i18n {
19
27
  *
20
28
  * @param locale - Locale code (e.g. `en`).
21
29
  * @param translations - Map of keys to translated strings.
22
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.register`
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * api.i18n.register("en", {
34
+ * "mods|example|title": "Example",
35
+ * });
36
+ * ```
37
+ *
38
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
23
39
  */
24
40
  export function register(locale: Locale, translations: Record<string, string>): void;
25
41
 
26
42
  /**
27
43
  * Returns the active locale code.
28
44
  *
29
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.getLocale`
45
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
30
46
  */
31
47
  export function getLocale(): Locale;
32
48
 
@@ -35,7 +51,8 @@ export namespace i18n {
35
51
  *
36
52
  * @param key - Translation key.
37
53
  * @param locale - Optional locale; defaults to the active locale.
38
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.hasTranslation`
54
+ *
55
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
39
56
  */
40
57
  export function hasTranslation(key: string, locale?: Locale): boolean;
41
58
 
@@ -43,21 +60,22 @@ export namespace i18n {
43
60
  * Sets the active locale.
44
61
  *
45
62
  * @param locale - Locale code to activate.
46
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.setLocale`
63
+ *
64
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
47
65
  */
48
66
  export function setLocale(locale: Locale): Promise<void>;
49
67
 
50
68
  /**
51
69
  * Returns metadata for all known languages.
52
70
  *
53
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.getLanguages`
71
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
54
72
  */
55
73
  export function getLanguages(): { code: Locale; nativeName: string; englishName: string; enabled: boolean; }[];
56
74
 
57
75
  /**
58
76
  * Returns locale codes that have registered translations.
59
77
  *
60
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.getAvailableLocales`
78
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
61
79
  */
62
80
  export function getAvailableLocales(): Locale[];
63
81
 
@@ -66,7 +84,15 @@ export namespace i18n {
66
84
  *
67
85
  * @param value - Number to format.
68
86
  * @param options - Intl-style number format options.
69
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.formatNumber`
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const formatted = api.i18n.formatNumber(1234.5, {
91
+ * maximumFractionDigits: 1,
92
+ * });
93
+ * ```
94
+ *
95
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
70
96
  */
71
97
  export function formatNumber(value: number, options?: I18nNumberFormatOptions): string;
72
98
 
@@ -74,13 +100,15 @@ export namespace i18n {
74
100
  * Joins key parts into a single translation key.
75
101
  *
76
102
  * @param parts - Key segments joined with `.`.
77
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.joinKey`
103
+ *
104
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
78
105
  */
79
106
  export function joinKey(...parts: string[]): string;
80
107
 
81
108
  /**
82
109
  * @deprecated Use {@link joinKey} instead.
83
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.i18n.joinKey`
110
+ *
111
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
84
112
  */
85
113
  export function key(...parts: string[]): string;
86
114
 
@@ -88,7 +116,16 @@ export namespace i18n {
88
116
  * Returns the display name from a definition with nameKey or name.
89
117
  *
90
118
  * @param definition - Object with `nameKey` or `name`.
91
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.getName`
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const name = api.i18n.getName({
123
+ * name: "Example Machine",
124
+ * nameKey: "structures|exampleMachine|name",
125
+ * });
126
+ * ```
127
+ *
128
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
92
129
  */
93
130
  export function getName(definition: { nameKey?: string; name?: string; }): string;
94
131
 
@@ -96,7 +133,8 @@ export namespace i18n {
96
133
  * Returns the description from a definition with descriptionKey or description.
97
134
  *
98
135
  * @param definition - Object with `descriptionKey` or `description`.
99
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.getDescription`
136
+ *
137
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
100
138
  */
101
139
  export function getDescription(definition: { descriptionKey?: string; description?: string; }): string;
102
140
 
@@ -105,13 +143,15 @@ export namespace i18n {
105
143
  *
106
144
  * @param key - Translation key.
107
145
  * @param fallback - Text used when no translation is registered.
108
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.createTranslatable`
146
+ *
147
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
109
148
  */
110
149
  export function createTranslatable(key: string, fallback: string): { __translatable: true; key: string; fallback: string; };
111
150
 
112
151
  /**
113
152
  * @deprecated Use {@link createTranslatable} instead.
114
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.i18n.createTranslatable`
153
+ *
154
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
115
155
  */
116
156
  export function translatable(key: string, fallback: string): { __translatable: true; key: string; fallback: string; };
117
157
 
@@ -120,7 +160,8 @@ export namespace i18n {
120
160
  *
121
161
  * @param key - Global helper key.
122
162
  * @param value - Static string or function that returns the current value.
123
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.setGlobal`
163
+ *
164
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
124
165
  */
125
166
  export function setGlobal(key: string, value: string | (() => string)): void;
126
167
 
@@ -128,7 +169,8 @@ export namespace i18n {
128
169
  * Returns a global translation helper value.
129
170
  *
130
171
  * @param key - Global helper key.
131
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.getGlobal`
172
+ *
173
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
132
174
  */
133
175
  export function getGlobal(key: string): string | undefined;
134
176
 
@@ -136,20 +178,22 @@ export namespace i18n {
136
178
  * Removes a global translation helper value.
137
179
  *
138
180
  * @param key - Global helper key.
139
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.removeGlobal`
181
+ *
182
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
140
183
  */
141
184
  export function removeGlobal(key: string): void;
142
185
 
143
186
  /**
144
187
  * @deprecated Use {@link removeGlobal} instead.
145
- * @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.i18n.removeGlobal`
188
+ *
189
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
146
190
  */
147
191
  export function clearGlobal(key: string): void;
148
192
 
149
193
  /**
150
194
  * Returns all global translation helper values.
151
195
  *
152
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.getGlobals`
196
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
153
197
  */
154
198
  export function getGlobals(): Record<string, string>;
155
199
 
@@ -157,7 +201,8 @@ export namespace i18n {
157
201
  * Formats a key code for display in UI.
158
202
  *
159
203
  * @param keyCode - Keyboard key code or binding name.
160
- * @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.i18n.formatKeyForDisplay`
204
+ *
205
+ * @see [Official docs](https://sandustry.com/sandkit.html#api-access-heading)
161
206
  */
162
207
  export function formatKeyForDisplay(keyCode: string): string;
163
208
 
@@ -12,6 +12,21 @@ export namespace input {
12
12
  * @param defaultKeys - Default key codes (for example `"Control+KeyC"`).
13
13
  * @param definition - Display metadata and press/release handlers.
14
14
  * @returns The registered binding id.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * api.input.registerBinding("ExampleToggle", ["KeyO"], {
19
+ * displayName: "Toggle example",
20
+ * displayNameKey: "mods|example|toggle",
21
+ * subsection: {
22
+ * title: "Example controls",
23
+ * titleKey: "mods|example|controlsTitle",
24
+ * description: "Bindings installed by the example mod.",
25
+ * descriptionKey: "mods|example|controlsDescription",
26
+ * },
27
+ * handlers: { down: toggleExample },
28
+ * });
29
+ * ```
15
30
  */
16
31
  export function registerBinding(bindingId: BindingId, defaultKeys: KeyCode[], definition: InputBindingDefinition): BindingId;
17
32
 
@@ -24,6 +24,13 @@ export namespace items {
24
24
  * Updates fields on an existing item definition.
25
25
  * @param itemId - Registered item id.
26
26
  * @param partial - Fields to merge into the definition.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * api.items.updateDefinition("exampleTool", {
31
+ * name: "Updated Example Tool",
32
+ * });
33
+ * ```
27
34
  */
28
35
  export function updateDefinition(itemId: ItemId, partial: Partial<ItemDefinition>): void;
29
36
  /**