screeps-clockwork 0.7.2 → 0.9.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 +7 -4
- package/dist/index.js +1104 -1157
- package/dist/index.js.map +1 -1
- package/dist/screeps_clockwork.wasm +0 -0
- package/dist/src/index.d.ts +2 -3
- package/dist/src/wasm/screeps_clockwork.d.ts +637 -407
- package/dist/src/wasm/snippets/screeps-clockwork-c6f0a8e884eae31c/inline0.d.ts +1 -0
- package/dist/src/wrappers/distanceMap.d.ts +20 -0
- package/dist/src/wrappers/flowField.d.ts +0 -4
- package/dist/src/wrappers/monoFlowField.d.ts +0 -4
- package/dist/src/wrappers/multiroomDistanceMap.d.ts +12 -9
- package/dist/src/wrappers/multiroomFlowField.d.ts +0 -4
- package/dist/src/wrappers/multiroomMonoFlowField.d.ts +0 -4
- package/dist/src/wrappers/path.d.ts +3 -7
- package/package.json +6 -6
- package/dist/src/utils/cleanup.d.ts +0 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function clockworkcostmatrix_get_pointer(value: any): any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DistanceMap } from '../wasm/screeps_clockwork';
|
|
2
|
+
/**
|
|
3
|
+
* A distance map for a single room.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ClockworkDistanceMap {
|
|
6
|
+
private _map;
|
|
7
|
+
constructor(_map: DistanceMap);
|
|
8
|
+
/**
|
|
9
|
+
* Gets the distance value at a given position.
|
|
10
|
+
*/
|
|
11
|
+
get(x: number, y: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* Sets the distance value at a given position.
|
|
14
|
+
*/
|
|
15
|
+
set(x: number, y: number, value: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Converts the distance map into a flat array of distances.
|
|
18
|
+
*/
|
|
19
|
+
toArray(): Uint32Array;
|
|
20
|
+
}
|
|
@@ -25,8 +25,4 @@ export declare class ClockworkFlowField {
|
|
|
25
25
|
* Add a direction to the list of valid directions for a given coordinate.
|
|
26
26
|
*/
|
|
27
27
|
addDirection(x: number, y: number, direction: DirectionConstant): void;
|
|
28
|
-
/**
|
|
29
|
-
* Free the memory allocated for this flow field.
|
|
30
|
-
*/
|
|
31
|
-
free(): void;
|
|
32
28
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DirectionOrder, MultiroomDistanceMap } from '../wasm/screeps_clockwork';
|
|
2
|
+
import { ClockworkDistanceMap } from './distanceMap';
|
|
2
3
|
import { ClockworkMultiroomFlowField } from './multiroomFlowField';
|
|
3
4
|
import { ClockworkMultiroomMonoFlowField } from './multiroomMonoFlowField';
|
|
4
5
|
import { ClockworkPath } from './path';
|
|
6
|
+
export interface DirectionOrderOptions {
|
|
7
|
+
directionOrder?: DirectionOrder;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* A distance map that covers multiple rooms. Typically returned by a function
|
|
7
11
|
* like `bfsMultiroomDistanceMap` rather than created directly.
|
|
@@ -20,25 +24,24 @@ export declare class ClockworkMultiroomDistanceMap {
|
|
|
20
24
|
/**
|
|
21
25
|
* Get the DistanceMap for a given room.
|
|
22
26
|
*/
|
|
23
|
-
getRoom(room: string):
|
|
27
|
+
getRoom(room: string): ClockworkDistanceMap | undefined;
|
|
24
28
|
/**
|
|
25
29
|
* List all the rooms covered by this distance map.
|
|
26
30
|
*/
|
|
27
31
|
getRooms(): string[];
|
|
28
|
-
/**
|
|
29
|
-
* Free the memory allocated for this distance map.
|
|
30
|
-
*/
|
|
31
|
-
free(): void;
|
|
32
32
|
/**
|
|
33
33
|
* Path to the origin from a given position.
|
|
34
|
+
* Pass `DirectionOrder.DiagonalFirst` to prefer diagonal steps when multiple neighbors are equally close.
|
|
34
35
|
*/
|
|
35
|
-
pathToOrigin(start: RoomPosition): ClockworkPath;
|
|
36
|
+
pathToOrigin(start: RoomPosition, options?: DirectionOrderOptions): ClockworkPath;
|
|
36
37
|
/**
|
|
37
38
|
* Flow field for this distance map.
|
|
39
|
+
* Pass `DirectionOrder.DiagonalFirst` to prefer diagonal directions when multiple neighbors are equally close.
|
|
38
40
|
*/
|
|
39
|
-
toFlowField(): ClockworkMultiroomFlowField;
|
|
41
|
+
toFlowField(options?: DirectionOrderOptions): ClockworkMultiroomFlowField;
|
|
40
42
|
/**
|
|
41
43
|
* Mono-directional flow field for this distance map.
|
|
44
|
+
* Pass `DirectionOrder.DiagonalFirst` to prefer diagonal directions when multiple neighbors are equally close.
|
|
42
45
|
*/
|
|
43
|
-
toMonoFlowField(): ClockworkMultiroomMonoFlowField;
|
|
46
|
+
toMonoFlowField(options?: DirectionOrderOptions): ClockworkMultiroomMonoFlowField;
|
|
44
47
|
}
|
|
@@ -39,8 +39,4 @@ export declare class ClockworkMultiroomFlowField {
|
|
|
39
39
|
* Find a path from a given position to the origin of the flow field.
|
|
40
40
|
*/
|
|
41
41
|
pathToOrigin(start: RoomPosition): ClockworkPath;
|
|
42
|
-
/**
|
|
43
|
-
* Free the memory allocated for this flow field.
|
|
44
|
-
*/
|
|
45
|
-
free(): void;
|
|
46
42
|
}
|
|
@@ -27,8 +27,4 @@ export declare class ClockworkMultiroomMonoFlowField {
|
|
|
27
27
|
* Find a path from a given position to the origin of the flow field.
|
|
28
28
|
*/
|
|
29
29
|
pathToOrigin(start: RoomPosition): ClockworkPath;
|
|
30
|
-
/**
|
|
31
|
-
* Free the memory allocated for this flow field.
|
|
32
|
-
*/
|
|
33
|
-
free(): void;
|
|
34
30
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Path } from '../wasm/screeps_clockwork';
|
|
2
2
|
/**
|
|
3
3
|
* A path from a start position to an end position. Typically returned by a
|
|
4
|
-
* function like `
|
|
4
|
+
* function like `ClockworkMultiroomFlowField.pathToOrigin` rather than created directly.
|
|
5
5
|
*/
|
|
6
6
|
export declare class ClockworkPath {
|
|
7
7
|
private readonly path;
|
|
@@ -12,7 +12,7 @@ export declare class ClockworkPath {
|
|
|
12
12
|
* @example
|
|
13
13
|
* ```typescript
|
|
14
14
|
* for (const pos of path) {
|
|
15
|
-
* console.
|
|
15
|
+
* console.logUnsafe(pos);
|
|
16
16
|
* }
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
@@ -28,7 +28,7 @@ export declare class ClockworkPath {
|
|
|
28
28
|
* @example
|
|
29
29
|
* ```typescript
|
|
30
30
|
* for (const pos of path.reversed()) {
|
|
31
|
-
* console.
|
|
31
|
+
* console.logUnsafe(pos);
|
|
32
32
|
* }
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
@@ -58,8 +58,4 @@ export declare class ClockworkPath {
|
|
|
58
58
|
* Convert the path to an array of positions in reverse order.
|
|
59
59
|
*/
|
|
60
60
|
toArrayReversed(): RoomPosition[];
|
|
61
|
-
/**
|
|
62
|
-
* Free the memory allocated for this path.
|
|
63
|
-
*/
|
|
64
|
-
free(): void;
|
|
65
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screeps-clockwork",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A WASM movement library for Screeps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"build:docs": "typedoc",
|
|
12
12
|
"build:pserver": "run-s build:lib build:src && rollup -c --environment DEST:pserver",
|
|
13
13
|
"watch": "run-s build watch:both",
|
|
14
|
-
"watch:lib": "
|
|
14
|
+
"watch:lib": "bacon --headless -j build-lib",
|
|
15
15
|
"watch:src": "wait-on src/wasm/screeps_clockwork_bg.wasm && rollup -cw",
|
|
16
16
|
"watch:pserver": "rollup -cw --environment DEST:pserver",
|
|
17
17
|
"watch:both": "run-p watch:lib watch:pserver"
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/glitchassassin/screeps-clockwork#readme",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@rollup/plugin-commonjs": "^
|
|
36
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
38
38
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
39
39
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
40
|
-
"@types/node": "^24.
|
|
40
|
+
"@types/node": "^24.12.4",
|
|
41
41
|
"@types/screeps": "^3.3.0",
|
|
42
42
|
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
43
43
|
"@typescript-eslint/parser": "^8.17.0",
|
|
44
|
-
"eslint": "^
|
|
44
|
+
"eslint": "^10.3.0",
|
|
45
45
|
"npm-run-all": "^4.1.5",
|
|
46
46
|
"prettier": "^3.4.2",
|
|
47
47
|
"rollup": "2.79.2",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"source-map": "0.6.1",
|
|
52
52
|
"tslib": "^2.8.1",
|
|
53
53
|
"typedoc": "^0.28.5",
|
|
54
|
-
"typescript": "^
|
|
54
|
+
"typescript": "^6.0.3"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"fastestsmallesttextencoderdecoder-encodeinto": "^1.0.22"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mark an item as ephemeral. This means that the item will be freed after the
|
|
3
|
-
* current tick.
|
|
4
|
-
*
|
|
5
|
-
* If you don't use this to clean up your data, you'll need to call `free()`
|
|
6
|
-
* yourself.
|
|
7
|
-
*
|
|
8
|
-
* @param item - The item to be cleaned up.
|
|
9
|
-
* @returns The item.
|
|
10
|
-
*/
|
|
11
|
-
export declare function ephemeral<T extends {
|
|
12
|
-
free: () => void;
|
|
13
|
-
}>(item: T): T;
|
|
14
|
-
/**
|
|
15
|
-
* Persist an ephemeral item. This means that the item will not be freed after
|
|
16
|
-
* the current tick.
|
|
17
|
-
*
|
|
18
|
-
* @param item - The item to be persisted.
|
|
19
|
-
* @returns The item.
|
|
20
|
-
*/
|
|
21
|
-
export declare function persist<T extends {
|
|
22
|
-
free: () => void;
|
|
23
|
-
}>(item: T): T;
|