screeps-clockwork 0.7.2 → 0.8.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 +949 -988
- package/dist/index.js.map +1 -1
- package/dist/screeps_clockwork.wasm +0 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/wasm/screeps_clockwork.d.ts +637 -407
- package/dist/src/wasm/snippets/screeps-clockwork-869b2861045aa01b/inline0.d.ts +1 -0
- package/dist/src/wrappers/distanceMap.d.ts +24 -0
- package/dist/src/wrappers/multiroomDistanceMap.d.ts +10 -4
- package/dist/src/wrappers/path.d.ts +3 -3
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function clockworkcostmatrix_get_pointer(value: any): any;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
/**
|
|
21
|
+
* Frees the memory allocated for this distance map.
|
|
22
|
+
*/
|
|
23
|
+
free(): void;
|
|
24
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { DistanceMap, MultiroomDistanceMap } from '../wasm/screeps_clockwork';
|
|
1
|
+
import { DistanceMap, DirectionOrder, MultiroomDistanceMap } from '../wasm/screeps_clockwork';
|
|
2
2
|
import { ClockworkMultiroomFlowField } from './multiroomFlowField';
|
|
3
3
|
import { ClockworkMultiroomMonoFlowField } from './multiroomMonoFlowField';
|
|
4
4
|
import { ClockworkPath } from './path';
|
|
5
|
+
export interface DirectionOrderOptions {
|
|
6
|
+
directionOrder?: DirectionOrder;
|
|
7
|
+
}
|
|
5
8
|
/**
|
|
6
9
|
* A distance map that covers multiple rooms. Typically returned by a function
|
|
7
10
|
* like `bfsMultiroomDistanceMap` rather than created directly.
|
|
@@ -31,14 +34,17 @@ export declare class ClockworkMultiroomDistanceMap {
|
|
|
31
34
|
free(): void;
|
|
32
35
|
/**
|
|
33
36
|
* Path to the origin from a given position.
|
|
37
|
+
* Pass `DirectionOrder.DiagonalFirst` to prefer diagonal steps when multiple neighbors are equally close.
|
|
34
38
|
*/
|
|
35
|
-
pathToOrigin(start: RoomPosition): ClockworkPath;
|
|
39
|
+
pathToOrigin(start: RoomPosition, options?: DirectionOrderOptions): ClockworkPath;
|
|
36
40
|
/**
|
|
37
41
|
* Flow field for this distance map.
|
|
42
|
+
* Pass `DirectionOrder.DiagonalFirst` to prefer diagonal directions when multiple neighbors are equally close.
|
|
38
43
|
*/
|
|
39
|
-
toFlowField(): ClockworkMultiroomFlowField;
|
|
44
|
+
toFlowField(options?: DirectionOrderOptions): ClockworkMultiroomFlowField;
|
|
40
45
|
/**
|
|
41
46
|
* Mono-directional flow field for this distance map.
|
|
47
|
+
* Pass `DirectionOrder.DiagonalFirst` to prefer diagonal directions when multiple neighbors are equally close.
|
|
42
48
|
*/
|
|
43
|
-
toMonoFlowField(): ClockworkMultiroomMonoFlowField;
|
|
49
|
+
toMonoFlowField(options?: DirectionOrderOptions): ClockworkMultiroomMonoFlowField;
|
|
44
50
|
}
|
|
@@ -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
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screeps-clockwork",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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"
|