@sandustry-modding/types 0.1.0 → 0.3.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/README.md +36 -12
- package/docs/Changelog.md +46 -0
- package/docs/README.md +62 -0
- package/package.json +11 -10
- package/src/sandkit/api/blueprints.d.ts +33 -0
- package/src/sandkit/api/effects.d.ts +127 -0
- package/src/sandkit/api/elements.d.ts +385 -0
- package/src/sandkit/api/entities.d.ts +79 -0
- package/src/sandkit/api/events.d.ts +137 -0
- package/src/sandkit/api/excavation.d.ts +58 -0
- package/src/sandkit/api/factory.d.ts +38 -0
- package/src/sandkit/api/fire.d.ts +33 -0
- package/src/sandkit/api/game.d.ts +22 -0
- package/src/sandkit/api/grid.d.ts +180 -0
- package/src/sandkit/api/hooks.d.ts +357 -0
- package/{sandkit → src/sandkit}/api/i18n.d.ts +80 -4
- package/{sandkit → src/sandkit}/api/index.d.ts +6 -0
- package/src/sandkit/api/lights.d.ts +101 -0
- package/{sandkit → src/sandkit}/api/maps.d.ts +15 -0
- package/src/sandkit/api/pickups.d.ts +89 -0
- package/src/sandkit/api/pipes.d.ts +54 -0
- package/src/sandkit/api/player.d.ts +141 -0
- package/{sandkit → src/sandkit}/api/rendering.d.ts +8 -0
- package/{sandkit → src/sandkit}/api/sandkit-api.d.ts +19 -2
- package/src/sandkit/api/shared.d.ts +41 -0
- package/{sandkit → src/sandkit}/api/sound.d.ts +32 -2
- package/{sandkit → src/sandkit}/api/structures.d.ts +171 -18
- package/{sandkit → src/sandkit}/api/tech.d.ts +54 -1
- package/src/sandkit/api/terrains.d.ts +147 -0
- package/{sandkit → src/sandkit}/api/upgrades.d.ts +9 -0
- package/{sandkit → src/sandkit}/api/utils.d.ts +19 -2
- package/src/sandkit/api/world.d.ts +105 -0
- package/{sandkit → src/sandkit}/enums/index.d.ts +14 -0
- package/{shared → src/shared}/api/elements.d.ts +84 -12
- package/{shared/api/world.d.ts → src/shared/api/grid.d.ts} +29 -3
- package/{shared → src/shared}/api/player.d.ts +12 -0
- package/{shared → src/shared}/api/shared.d.ts +5 -3
- package/{shared → src/shared}/api/structures.d.ts +46 -0
- package/src/shared/api/terrains.d.ts +231 -0
- package/src/shared/api/world.d.ts +43 -0
- package/{shared → src/shared}/index.d.ts +2 -0
- package/src/worker/api/effects.d.ts +52 -0
- package/src/worker/api/elements.d.ts +266 -0
- package/src/worker/api/events.d.ts +75 -0
- package/src/worker/api/fire.d.ts +29 -0
- package/src/worker/api/grid.d.ts +45 -0
- package/src/worker/api/hooks.d.ts +111 -0
- package/src/worker/api/lights.d.ts +43 -0
- package/{worker → src/worker}/api/shared.d.ts +8 -3
- package/{worker → src/worker}/index.d.ts +8 -5
- package/{worker → src/worker}/sandkit-api.d.ts +12 -3
- package/CHANGELOG.md +0 -19
- package/sandkit/api/effects.d.ts +0 -76
- package/sandkit/api/elements.d.ts +0 -237
- package/sandkit/api/events.d.ts +0 -53
- package/sandkit/api/excavation.d.ts +0 -34
- package/sandkit/api/fire.d.ts +0 -26
- package/sandkit/api/grid.d.ts +0 -26
- package/sandkit/api/hooks.d.ts +0 -52
- package/sandkit/api/lights.d.ts +0 -66
- package/sandkit/api/player.d.ts +0 -84
- package/sandkit/api/shared.d.ts +0 -27
- package/sandkit/api/terrains.d.ts +0 -125
- package/sandkit/api/world.d.ts +0 -107
- package/shared/api/terrains.d.ts +0 -100
- package/worker/api/elements.d.ts +0 -60
- /package/{global.d.ts → src/global.d.ts} +0 -0
- /package/{sandkit → src/sandkit}/api/action.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/assets.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/authorization.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/building.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/camera.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/collector.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/constants.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/cooldown.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/discoveries.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/energy.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/gameconfig.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/input.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/items.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/mods.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/patterns.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/processing.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/progression.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/projectiles.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/random.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/raycast.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/reactions.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/resources.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/scene.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/schedule.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/settings.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/signals.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/sprites.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/storage.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/structureBehaviors.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/time.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/tools.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/triggers.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/ui.d.ts +0 -0
- /package/{sandkit → src/sandkit}/api/workers.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/augments.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/auralite.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/blueprints.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/clipboard.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/colorPicker.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/coloringTool.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/conveyors.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/debug.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/drones.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/entities.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/extensions.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/factory.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/foliage.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/foundationColorPicker.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/game.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/heatTransfer.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/index.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/launchers.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/lightColorPicker.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/matters.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/misc.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/portals.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/prefabData.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/prefabDecor.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/prefabulator.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/prismaline.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/prismite.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/queue.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/shadows.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/strataform.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/swarmConsole.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/sweeperDrone.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/teleportZones.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/tutorialBuild.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/usageTracker.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/wall.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/api/workerLocal.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/index.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/retro-console.d.ts +0 -0
- /package/{sandkit → src/sandkit}/engine/state.d.ts +0 -0
- /package/{sandkit → src/sandkit}/index.d.ts +0 -0
- /package/{sandkit → src/sandkit}/react.d.ts +0 -0
- /package/{shared → src/shared}/api/effects.d.ts +0 -0
- /package/{shared → src/shared}/api/maps.d.ts +0 -0
- /package/{shared → src/shared}/api/ui.d.ts +0 -0
- /package/{shared → src/shared}/asset.d.ts +0 -0
- /package/{shared → src/shared}/engine.d.ts +0 -0
- /package/{shared → src/shared}/jsonvalue.d.ts +0 -0
- /package/{shared → src/shared}/nominal.d.ts +0 -0
- /package/{shared → src/shared}/player.d.ts +0 -0
- /package/{worker → src/worker}/api/main.d.ts +0 -0
- /package/{worker → src/worker}/api/worker.d.ts +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
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 ensure and lookup. */
|
|
13
|
+
export namespace buffers {
|
|
14
|
+
/**
|
|
15
|
+
* Create or return a named shared buffer with type and length.
|
|
16
|
+
*
|
|
17
|
+
* @param key - Buffer name shared across threads.
|
|
18
|
+
* @param config - Typed array kind and element count.
|
|
19
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.shared.buffers.ensure`
|
|
20
|
+
*/
|
|
21
|
+
export function ensure(key: string, config: { type: SharedArrayType; length: number; }): SharedArray;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use {@link ensure} instead.
|
|
25
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.shared.buffers.ensure`
|
|
26
|
+
*/
|
|
27
|
+
export function create(key: string, config: { type: SharedArrayType; length: number; }): SharedArray;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Look up a named shared buffer without creating it.
|
|
31
|
+
*
|
|
32
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.shared.buffers.get`
|
|
33
|
+
*/
|
|
34
|
+
export import get = sharedApi.api.shared.buffers.get;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Opaque shared array backing store. */
|
|
38
|
+
export import SharedArray = sharedApi.api.shared.SharedArray;
|
|
39
|
+
/** Discriminator for the underlying typed array kind. */
|
|
40
|
+
export import SharedArrayType = sharedApi.api.shared.SharedArrayType;
|
|
41
|
+
}
|
|
@@ -8,37 +8,67 @@
|
|
|
8
8
|
export namespace sound {
|
|
9
9
|
/**
|
|
10
10
|
* Play a sound by id with optional options.
|
|
11
|
+
*
|
|
11
12
|
* @param soundId - Registered sound identifier.
|
|
12
13
|
* @param options - Volume, position, playback rate, and rate-limit options.
|
|
14
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.sound.play`
|
|
13
15
|
*/
|
|
14
16
|
export function play(soundId: string, options?: SoundOptions): SoundHandle;
|
|
17
|
+
|
|
15
18
|
/**
|
|
16
19
|
* Play a sound on the active sound channel.
|
|
20
|
+
*
|
|
17
21
|
* @param soundId - Registered sound identifier.
|
|
18
22
|
* @param options - Volume, position, playback rate, and rate-limit options.
|
|
23
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.sound.playActive`
|
|
19
24
|
*/
|
|
20
25
|
export function playActive(soundId: string, options?: SoundOptions): SoundHandle;
|
|
26
|
+
|
|
21
27
|
/**
|
|
22
28
|
* Play multiple sound layers with shared options.
|
|
29
|
+
*
|
|
23
30
|
* @param layers - Layer definitions (sound id, volume, delay, and per-layer options).
|
|
24
31
|
* @param options - Shared position, volume, and rate-limit options for all layers.
|
|
32
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.sound.playLayers`
|
|
25
33
|
*/
|
|
26
34
|
export function playLayers(layers: SoundLayer[], options?: SoundLayersOptions): SoundHandle[];
|
|
35
|
+
|
|
27
36
|
/**
|
|
28
37
|
* Build distance-based volume options for a world position.
|
|
38
|
+
*
|
|
29
39
|
* @param worldX - World X coordinate in pixels.
|
|
30
40
|
* @param worldY - World Y coordinate in pixels.
|
|
31
41
|
* @param baseVolume - Base volume before distance attenuation.
|
|
42
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.sound.calculateDistanceOptionsAtWorld`
|
|
32
43
|
*/
|
|
33
44
|
export function calculateDistanceOptionsAtWorld(worldX: number, worldY: number, baseVolume?: number): SoundOptions;
|
|
45
|
+
|
|
34
46
|
/**
|
|
35
47
|
* Stop a sound by id.
|
|
48
|
+
*
|
|
36
49
|
* @param soundId - Registered sound identifier to stop.
|
|
50
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.sound.stopBySoundId`
|
|
51
|
+
*/
|
|
52
|
+
export function stopBySoundId(soundId: string): void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Use {@link stopBySoundId} instead.
|
|
56
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.sound.stopBySoundId`
|
|
37
57
|
*/
|
|
38
58
|
export function stopById(soundId: string): void;
|
|
39
|
-
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Stop the active sound channel.
|
|
62
|
+
*
|
|
63
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.sound.stopActive`
|
|
64
|
+
*/
|
|
40
65
|
export function stopActive(): void;
|
|
41
|
-
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Stop all playing sounds.
|
|
69
|
+
*
|
|
70
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.sound.stopAll`
|
|
71
|
+
*/
|
|
42
72
|
export function stopAll(): void;
|
|
43
73
|
|
|
44
74
|
/** Handle returned from a play call. */
|
|
@@ -10,6 +10,7 @@ import { shared } from "../../shared";
|
|
|
10
10
|
// Aliased: `structures` declares a nested `processing` namespace that would
|
|
11
11
|
// otherwise shadow this import.
|
|
12
12
|
import { processing as processingApi } from "./processing";
|
|
13
|
+
import type { elements } from "./elements";
|
|
13
14
|
|
|
14
15
|
export namespace structures {
|
|
15
16
|
|
|
@@ -20,7 +21,7 @@ export namespace structures {
|
|
|
20
21
|
/** Return the definition for a structure type. */
|
|
21
22
|
export import getDefinitionByType = shared.api.structures.getDefinitionByType;
|
|
22
23
|
/** Resolve a string structure id to its type. */
|
|
23
|
-
export import
|
|
24
|
+
export import getTypeById = shared.api.structures.getTypeById;
|
|
24
25
|
/** Return true when a built structure exists at the cell. */
|
|
25
26
|
export import hasBuiltAtCell = shared.api.structures.hasBuiltAtCell;
|
|
26
27
|
/** Return true when a structure matches a string id. */
|
|
@@ -37,8 +38,8 @@ export namespace structures {
|
|
|
37
38
|
export import setSpritesheetIndexByValueAtCell = shared.api.structures.setSpritesheetIndexByValueAtCell;
|
|
38
39
|
/** Push structure state updates to the game and workers. */
|
|
39
40
|
export import update = shared.api.structures.update;
|
|
40
|
-
/**
|
|
41
|
-
export import
|
|
41
|
+
/** Merge partial data onto a structure instance. */
|
|
42
|
+
export import updateData = shared.api.structures.updateData;
|
|
42
43
|
/** Structure instance in the world. */
|
|
43
44
|
export import Structure = shared.api.structures.Structure;
|
|
44
45
|
/** Structure type id or enum value. */
|
|
@@ -49,133 +50,225 @@ export namespace structures {
|
|
|
49
50
|
export import StructureRef = shared.api.structures.StructureRef;
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
54
|
-
* @param definition - Periodic processing interval and callback.
|
|
53
|
+
* @deprecated Use {@link getTypeById} instead.
|
|
54
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.getTypeById`
|
|
55
55
|
*/
|
|
56
|
-
export
|
|
56
|
+
export import getTypeFromId = shared.api.structures.getTypeFromId;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use {@link updateData} instead.
|
|
60
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.updateData`
|
|
61
|
+
*/
|
|
62
|
+
export import setData = shared.api.structures.setData;
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
65
|
* Register a new structure definition.
|
|
66
|
+
*
|
|
60
67
|
* @param definition - Full structure definition.
|
|
61
68
|
* @param options - When `useRawShape` is true, keep the shape matrix as-is.
|
|
69
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.register`
|
|
62
70
|
*/
|
|
63
71
|
export function register(definition: SandkitStructureDefinition, options?: { useRawShape?: boolean; }): void;
|
|
64
72
|
|
|
65
73
|
/**
|
|
66
74
|
* Patch fields on an existing structure definition.
|
|
75
|
+
*
|
|
67
76
|
* @param structureTypeOrId - Structure type value or string id.
|
|
68
77
|
* @param partial - Fields to merge onto the definition.
|
|
69
78
|
* @param options - When `useRawShape` is true, keep the shape matrix as-is.
|
|
79
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.updateDefinition`
|
|
70
80
|
*/
|
|
71
81
|
export function updateDefinition(structureTypeOrId: StructureRef, partial: Partial<SandkitStructureDefinition>, options?: { useRawShape?: boolean; }): void;
|
|
72
82
|
|
|
73
83
|
/**
|
|
74
84
|
* Add a rotated variant to a base structure type.
|
|
85
|
+
*
|
|
75
86
|
* @param baseStructureTypeOrId - Base structure type or id.
|
|
76
87
|
* @param variant - Variant id and supported rotation angles.
|
|
77
88
|
* @param options - Optional build-mode wiring for the variant.
|
|
89
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.registerVariant`
|
|
90
|
+
*/
|
|
91
|
+
export function registerVariant(baseStructureTypeOrId: StructureRef, variant: { id: StructureRef; angles: number[]; }, options?: { addBuildMode?: unknown; }): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Use {@link registerVariant} instead.
|
|
95
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.registerVariant`
|
|
78
96
|
*/
|
|
79
97
|
export function addVariant(baseStructureTypeOrId: StructureRef, variant: { id: StructureRef; angles: number[]; }, options?: { addBuildMode?: unknown; }): void;
|
|
80
98
|
|
|
81
99
|
/**
|
|
82
100
|
* Register placement rules for a structure.
|
|
101
|
+
*
|
|
83
102
|
* @param definition - Hotbar placement field configuration.
|
|
103
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.registerPlacementConfig`
|
|
84
104
|
*/
|
|
85
105
|
export function registerPlacementConfig(definition: PlacementConfigDefinition): void;
|
|
86
106
|
|
|
87
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Return structure types available for building.
|
|
109
|
+
*
|
|
110
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.getAvailableTypes`
|
|
111
|
+
*/
|
|
112
|
+
export function getAvailableTypes(): Set<StructureRef>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated Use {@link getAvailableTypes} instead.
|
|
116
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.getAvailableTypes`
|
|
117
|
+
*/
|
|
88
118
|
export function getUnlockedTypes(): Set<StructureRef>;
|
|
89
119
|
|
|
90
120
|
/**
|
|
91
121
|
* Return true when the player blocks building at the cell.
|
|
122
|
+
*
|
|
92
123
|
* @param cellX - Grid column of the target cell.
|
|
93
124
|
* @param cellY - Grid row of the target cell.
|
|
125
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.isBlockedByPlayerAtCell`
|
|
94
126
|
*/
|
|
95
127
|
export function isBlockedByPlayerAtCell(...args: CellCoordinates): boolean;
|
|
96
128
|
|
|
97
129
|
/**
|
|
98
130
|
* Return true when a launcher structure is at the cell.
|
|
131
|
+
*
|
|
99
132
|
* @param cellX - Grid column of the target cell.
|
|
100
133
|
* @param cellY - Grid row of the target cell.
|
|
134
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.isLauncherAtCell`
|
|
101
135
|
*/
|
|
102
136
|
export function isLauncherAtCell(...args: CellCoordinates): boolean;
|
|
103
137
|
|
|
104
138
|
/**
|
|
105
|
-
* Return
|
|
139
|
+
* Return structure lock state for a type.
|
|
140
|
+
*
|
|
141
|
+
* Official docs list {@link isUnlockedByType} as a deprecated alias of this
|
|
142
|
+
* function (same implementation and return value; names differ only).
|
|
143
|
+
*
|
|
106
144
|
* @param structureType - Structure type value or string id.
|
|
145
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.isLockedByType`
|
|
146
|
+
*/
|
|
147
|
+
export function isLockedByType(structureType: StructureRef): boolean;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated Use {@link isLockedByType} instead. Same function as {@link isLockedByType}; return value is not inverted.
|
|
151
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.isLockedByType`
|
|
107
152
|
*/
|
|
108
153
|
export function isUnlockedByType(structureType: StructureRef): boolean;
|
|
109
154
|
|
|
110
155
|
/**
|
|
111
156
|
* Map a numeric value through thresholds to a spritesheet index.
|
|
157
|
+
*
|
|
112
158
|
* @param value - Numeric value to map.
|
|
113
159
|
* @param thresholds - Ascending threshold values.
|
|
114
160
|
* @returns Spritesheet frame index.
|
|
161
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.mapValueToSpritesheetIndex`
|
|
115
162
|
*/
|
|
116
163
|
export function mapValueToSpritesheetIndex(value: number, thresholds: number[]): number;
|
|
117
164
|
|
|
118
165
|
/**
|
|
119
|
-
* Build a structure at a cell
|
|
166
|
+
* Build a structure at a cell. Main-thread writes are deferred.
|
|
167
|
+
*
|
|
120
168
|
* @param cellX - Grid column of the target cell.
|
|
121
169
|
* @param cellY - Grid row of the target cell.
|
|
122
170
|
* @param structureTypeOrId - Structure type or string id to build.
|
|
123
171
|
* @param options - Optional build overrides.
|
|
172
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.buildAtCell`
|
|
173
|
+
*/
|
|
174
|
+
export function buildAtCell(...args: [...CellCoordinates, structureTypeOrId: StructureRef, options?: StructureBuildOptions]): void;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @deprecated Use {@link buildAtCell} instead.
|
|
178
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.buildAtCell`
|
|
124
179
|
*/
|
|
125
180
|
export function buildAtCellWhenIdle(...args: [...CellCoordinates, structureTypeOrId: StructureRef, options?: StructureBuildOptions]): void;
|
|
126
181
|
|
|
127
182
|
/**
|
|
128
|
-
* Remove a structure at a cell
|
|
183
|
+
* Remove a structure at a cell. Main-thread writes are deferred.
|
|
184
|
+
*
|
|
129
185
|
* @param cellX - Grid column of the target cell.
|
|
130
186
|
* @param cellY - Grid row of the target cell.
|
|
131
187
|
* @param options - Optional removal flags.
|
|
188
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.removeAtCell`
|
|
189
|
+
*/
|
|
190
|
+
export function removeAtCell(...args: [...CellCoordinates, options?: StructureRemovalOptions]): void;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated Use {@link removeAtCell} instead.
|
|
194
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.removeAtCell`
|
|
132
195
|
*/
|
|
133
196
|
export function removeAtCellWhenIdle(...args: [...CellCoordinates, options?: StructureRemovalOptions]): void;
|
|
134
197
|
|
|
135
198
|
/**
|
|
136
|
-
* Remove structures between two cells
|
|
199
|
+
* Remove structures between two cells. Main-thread writes are deferred.
|
|
200
|
+
*
|
|
137
201
|
* @param startCellX - Start cell column.
|
|
138
202
|
* @param startCellY - Start cell row.
|
|
139
203
|
* @param endCellX - End cell column.
|
|
140
204
|
* @param endCellY - End cell row.
|
|
141
205
|
* @param options - Optional bulk-removal flags.
|
|
206
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.removeBetweenCells`
|
|
207
|
+
*/
|
|
208
|
+
export function removeBetweenCells(startCellX: number, startCellY: number, endCellX: number, endCellY: number, options?: StructureBulkRemovalOptions): void;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @deprecated Use {@link removeBetweenCells} instead.
|
|
212
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.removeBetweenCells`
|
|
142
213
|
*/
|
|
143
214
|
export function removeBetweenCellsWhenIdle(startCellX: number, startCellY: number, endCellX: number, endCellY: number, options?: StructureBulkRemovalOptions): void;
|
|
144
215
|
|
|
145
216
|
/**
|
|
146
|
-
* Remove structures at many cells
|
|
217
|
+
* Remove structures at many cells. Main-thread writes are deferred.
|
|
218
|
+
*
|
|
147
219
|
* @param positions - Cell positions to clear.
|
|
148
220
|
* @param options - Optional bulk-removal flags.
|
|
221
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.removeAtCells`
|
|
222
|
+
*/
|
|
223
|
+
export function removeAtCells(positions: Vector2[], options?: StructureBulkRemovalOptions): void;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @deprecated Use {@link removeAtCells} instead.
|
|
227
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.removeAtCells`
|
|
149
228
|
*/
|
|
150
229
|
export function removeAtCellsWhenIdle(positions: Vector2[], options?: StructureBulkRemovalOptions): void;
|
|
151
230
|
|
|
231
|
+
/**
|
|
232
|
+
* @deprecated Use {@link processing.register} instead.
|
|
233
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.processing.register`
|
|
234
|
+
*/
|
|
235
|
+
export function addProcessor(structureId: StructureRef, definition: StructureProcessorDefinitionV1): void;
|
|
236
|
+
|
|
152
237
|
/** Structure recipe registration by machine kind. */
|
|
153
238
|
export namespace recipes {
|
|
154
239
|
/**
|
|
155
240
|
* Register a planter box recipe.
|
|
241
|
+
*
|
|
156
242
|
* @param id - Machine recipe slot id.
|
|
157
243
|
* @param definition - Grower recipe definition.
|
|
244
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.recipes.register`
|
|
158
245
|
*/
|
|
159
246
|
export function register(id: 'planterBox', definition: PlanterBoxRecipeDefinitionV1): void;
|
|
160
247
|
|
|
161
248
|
/**
|
|
162
249
|
* Register a shaker recipe.
|
|
250
|
+
*
|
|
163
251
|
* @param id - Machine recipe slot id.
|
|
164
252
|
* @param definition - Shaker recipe definition.
|
|
253
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.recipes.register`
|
|
165
254
|
*/
|
|
166
255
|
export function register(id: 'shaker', definition: ShakerRecipeDefinitionV1): void;
|
|
167
256
|
|
|
168
257
|
/**
|
|
169
258
|
* Register a kinetic press recipe.
|
|
259
|
+
*
|
|
170
260
|
* @param id - Machine recipe slot id.
|
|
171
261
|
* @param definition - Kinetic press recipe definition.
|
|
262
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.recipes.register`
|
|
172
263
|
*/
|
|
173
264
|
export function register(id: 'kineticPress', definition: KineticPressRecipeDefinitionV1): void;
|
|
174
265
|
|
|
175
266
|
/**
|
|
176
267
|
* Register a weighted refinery machine recipe.
|
|
268
|
+
*
|
|
177
269
|
* @param id - Refinery machine id.
|
|
178
270
|
* @param definition - Weighted input/output recipe.
|
|
271
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.recipes.register`
|
|
179
272
|
*/
|
|
180
273
|
export function register(id: 'condenser' | 'steamDryer' | 'synthesizer' | 'snowmaker' | 'smelter', definition: WeightedRefineryRecipeDefinitionV1): void;
|
|
181
274
|
}
|
|
@@ -183,21 +276,37 @@ export namespace structures {
|
|
|
183
276
|
/** Per-structure processing enablement and registration. */
|
|
184
277
|
export namespace processing {
|
|
185
278
|
/** Return true when processing is enabled at a cell. */
|
|
279
|
+
export import isEnabledAtCell = shared.api.structures.processing.isEnabledAtCell;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @deprecated Use {@link isEnabledAtCell} instead.
|
|
283
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.processing.isEnabledAtCell`
|
|
284
|
+
*/
|
|
186
285
|
export import isEnabledAt = shared.api.structures.processing.isEnabledAt;
|
|
187
286
|
|
|
188
287
|
/**
|
|
189
288
|
* Register a custom processing definition by id.
|
|
289
|
+
*
|
|
190
290
|
* @param id - Unique processing registration id.
|
|
191
291
|
* @param definition - Structure type, interval, and callback.
|
|
292
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.processing.register`
|
|
192
293
|
*/
|
|
193
294
|
export function register(id: StructureId, definition: StructureProcessingDefinitionV1): void;
|
|
194
295
|
|
|
195
296
|
/**
|
|
196
297
|
* Enable or disable processing at a cell.
|
|
298
|
+
*
|
|
197
299
|
* @param cellX - Grid column of the target cell.
|
|
198
300
|
* @param cellY - Grid row of the target cell.
|
|
199
301
|
* @param enabled - Desired processing enabled state.
|
|
200
302
|
* @returns True when the enabled state changed.
|
|
303
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.processing.setEnabledAtCell`
|
|
304
|
+
*/
|
|
305
|
+
export function setEnabledAtCell(...args: [...CellCoordinates, enabled: boolean]): boolean;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @deprecated Use {@link setEnabledAtCell} instead.
|
|
309
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.processing.setEnabledAtCell`
|
|
201
310
|
*/
|
|
202
311
|
export function setEnabledAt(...args: [...CellCoordinates, enabled: boolean]): boolean;
|
|
203
312
|
}
|
|
@@ -236,12 +345,12 @@ export namespace structures {
|
|
|
236
345
|
[key: string]: unknown;
|
|
237
346
|
}
|
|
238
347
|
|
|
239
|
-
/** Options passed to {@link
|
|
348
|
+
/** Options passed to {@link buildAtCell}. */
|
|
240
349
|
export interface StructureBuildOptions {
|
|
241
350
|
[key: string]: unknown;
|
|
242
351
|
}
|
|
243
352
|
|
|
244
|
-
/** Options passed to {@link
|
|
353
|
+
/** Options passed to {@link removeAtCell}. */
|
|
245
354
|
export interface StructureRemovalOptions {
|
|
246
355
|
/** Also remove underlying terrain cells in the footprint. */
|
|
247
356
|
removeCells?: boolean;
|
|
@@ -258,12 +367,56 @@ export namespace structures {
|
|
|
258
367
|
onlyPositions?: Vector2[];
|
|
259
368
|
}
|
|
260
369
|
|
|
261
|
-
/**
|
|
370
|
+
/**
|
|
371
|
+
* Context passed to structure processing callbacks.
|
|
372
|
+
*
|
|
373
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.processing.register`
|
|
374
|
+
*/
|
|
375
|
+
export interface StructureProcessingContext {
|
|
376
|
+
/**
|
|
377
|
+
* Return the resolved element type at a cell, or null.
|
|
378
|
+
*
|
|
379
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.processing.register`
|
|
380
|
+
*/
|
|
381
|
+
getResolvedTypeAtCell(...args: CellCoordinates): elements.ElementType | null;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* @deprecated Use {@link getResolvedTypeAtCell} instead.
|
|
385
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias in `api.structures.processing.register` context
|
|
386
|
+
*/
|
|
387
|
+
getElementTypeAtCell(...args: CellCoordinates): elements.ElementType | null;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Return true when the cell has no element or terrain.
|
|
391
|
+
*
|
|
392
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.processing.register`
|
|
393
|
+
*/
|
|
394
|
+
isCellEmptyAtCell(...args: CellCoordinates): boolean;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* @deprecated Use {@link isCellEmptyAtCell} instead.
|
|
398
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias in `api.structures.processing.register` context
|
|
399
|
+
*/
|
|
400
|
+
isCellEmpty(...args: CellCoordinates): boolean;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Commit batched grid mutations from the processing callback.
|
|
404
|
+
*
|
|
405
|
+
* @param mutations - Mutation writer payload accepted by the runtime.
|
|
406
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.structures.processing.register`
|
|
407
|
+
*/
|
|
408
|
+
commit(mutations: unknown): void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* @deprecated Use {@link StructureProcessingDefinitionV1} with {@link processing.register} instead.
|
|
413
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.structures.processing.register`
|
|
414
|
+
*/
|
|
262
415
|
export interface StructureProcessorDefinitionV1 {
|
|
263
416
|
/** Tick interval in milliseconds. Must be > 0. */
|
|
264
417
|
intervalMs: number;
|
|
265
418
|
/** Synchronous callback invoked for each structure instance. */
|
|
266
|
-
process: (
|
|
419
|
+
process: (structure: Structure, context: StructureProcessingContext) => void;
|
|
267
420
|
}
|
|
268
421
|
|
|
269
422
|
/** Placement hotbar field definition. */
|
|
@@ -315,6 +468,6 @@ export namespace structures {
|
|
|
315
468
|
export interface StructureProcessingDefinitionV1 {
|
|
316
469
|
structureType: StructureRef;
|
|
317
470
|
intervalMs: number;
|
|
318
|
-
process: (
|
|
471
|
+
process: (structure: Structure, context: StructureProcessingContext) => void;
|
|
319
472
|
}
|
|
320
473
|
}
|
|
@@ -11,45 +11,89 @@ import type { LooseString, TaggedNumber } from "../../shared/nominal";
|
|
|
11
11
|
export namespace tech {
|
|
12
12
|
/**
|
|
13
13
|
* Return a tech definition by string id.
|
|
14
|
+
*
|
|
14
15
|
* @param techId - Tech entry identifier.
|
|
16
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.getDefinitionById`
|
|
15
17
|
*/
|
|
16
18
|
export function getDefinitionById(techId: TechGridId): TechDefinition | undefined;
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* Patch fields on an existing tech definition.
|
|
22
|
+
*
|
|
19
23
|
* @param techId - Tech entry identifier.
|
|
20
24
|
* @param updates - Fields to merge into the definition.
|
|
25
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.updateDefinition`
|
|
21
26
|
*/
|
|
22
27
|
export function updateDefinition(techId: TechGridId, updates: Partial<TechDefinition>): void;
|
|
28
|
+
|
|
23
29
|
/**
|
|
24
|
-
*
|
|
30
|
+
* Register a new tech definition by id.
|
|
31
|
+
*
|
|
25
32
|
* @param techId - Tech entry identifier.
|
|
26
33
|
* @param definition - Full tech definition to register.
|
|
34
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.registerDefinition`
|
|
35
|
+
*/
|
|
36
|
+
export function registerDefinition(techId: TechGridId, definition: TechDefinition): void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use {@link registerDefinition} instead.
|
|
40
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — deprecated alias of `api.tech.registerDefinition`
|
|
27
41
|
*/
|
|
28
42
|
export function addDefinition(techId: TechGridId, definition: TechDefinition): void;
|
|
43
|
+
|
|
29
44
|
/**
|
|
30
45
|
* Register a tech node on the grid with parent and position options.
|
|
46
|
+
*
|
|
31
47
|
* @param techId - Tech grid node id.
|
|
32
48
|
* @param definition - Tech definition for the node.
|
|
33
49
|
* @param options - Parent node id and optional preferred grid position.
|
|
50
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.registerNode`
|
|
34
51
|
*/
|
|
35
52
|
export function registerNode(techId: TechGridId, definition: TechDefinition, options: { parentId: TechGridId; preferredPosition?: TechGridPosition; }): TechGridPosition;
|
|
53
|
+
|
|
36
54
|
/**
|
|
37
55
|
* Return true when a tech entry is locked.
|
|
56
|
+
*
|
|
38
57
|
* @param techId - Tech entry id (string or numeric enum).
|
|
58
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.isLockedById`
|
|
39
59
|
*/
|
|
40
60
|
export function isLockedById(techId: TechGridId): boolean;
|
|
61
|
+
|
|
41
62
|
/**
|
|
42
63
|
* Set locked state for a tech entry by id.
|
|
64
|
+
*
|
|
43
65
|
* @param techId - Tech entry id (string or numeric enum).
|
|
44
66
|
* @param locked - When true, the tech cannot be purchased.
|
|
67
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.setLockedById`
|
|
45
68
|
*/
|
|
46
69
|
export function setLockedById(techId: TechGridId, locked: boolean): void;
|
|
47
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Return true when a tech entry has been researched.
|
|
73
|
+
*
|
|
74
|
+
* @param techId - Tech entry id (string or numeric enum).
|
|
75
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.isResearchedById`
|
|
76
|
+
*/
|
|
77
|
+
export function isResearchedById(techId: TechGridId): boolean;
|
|
78
|
+
|
|
79
|
+
/** Conservatory unlock wiring for built-in tech nodes. */
|
|
80
|
+
export namespace conservatory {
|
|
81
|
+
/**
|
|
82
|
+
* Append structure or item unlocks to a conservatory tech node.
|
|
83
|
+
*
|
|
84
|
+
* @param techId - Built-in or custom tech id.
|
|
85
|
+
* @param unlocks - Optional structure and item ids to unlock.
|
|
86
|
+
* @see https://sandustry.com/sandkit.html Official Sandkit API — Main entry `api.tech.conservatory.appendUnlock`
|
|
87
|
+
*/
|
|
88
|
+
export function appendUnlock(techId: TechGridId, unlocks: ConservatoryUnlocks): void;
|
|
89
|
+
}
|
|
90
|
+
|
|
48
91
|
/**
|
|
49
92
|
* Tech grid node id.
|
|
50
93
|
* Built-in {@link TechEnum} values autocomplete; custom string ids and tagged handles are allowed.
|
|
51
94
|
*/
|
|
52
95
|
export type TechGridId = TechEnum | LooseString<never> | TaggedNumber<"tech">;
|
|
96
|
+
|
|
53
97
|
/** Tech definition shape. */
|
|
54
98
|
export interface TechDefinition {
|
|
55
99
|
/** Display name translation key. */
|
|
@@ -58,9 +102,18 @@ export namespace tech {
|
|
|
58
102
|
descriptionKey?: string;
|
|
59
103
|
[key: string]: unknown;
|
|
60
104
|
}
|
|
105
|
+
|
|
61
106
|
/** Position on the tech grid. */
|
|
62
107
|
export interface TechGridPosition {
|
|
63
108
|
x: number;
|
|
64
109
|
y: number;
|
|
65
110
|
}
|
|
111
|
+
|
|
112
|
+
/** Unlock payload for {@link conservatory.appendUnlock}. */
|
|
113
|
+
export interface ConservatoryUnlocks {
|
|
114
|
+
/** Structure ids to unlock. */
|
|
115
|
+
structures?: readonly string[];
|
|
116
|
+
/** Item ids to unlock. */
|
|
117
|
+
items?: readonly string[];
|
|
118
|
+
}
|
|
66
119
|
}
|