screeps-clockwork 0.2.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.
- package/README.md +49 -1
- package/dist/index.js +401 -96
- package/dist/index.js.map +1 -1
- package/dist/screeps_clockwork.wasm +0 -0
- package/dist/src/index.d.ts +5 -1
- package/dist/src/utils/fromPacked.d.ts +1 -0
- package/dist/src/wasm/screeps_clockwork.d.ts +484 -0
- package/dist/src/wrappers/bfsDistanceMap.d.ts +5 -2
- package/dist/src/wrappers/bfsFlowField.d.ts +6 -3
- package/dist/src/wrappers/dijkstraDistanceMap.d.ts +5 -2
- package/dist/src/wrappers/dijkstraFlowField.d.ts +6 -3
- package/dist/src/wrappers/path.d.ts +26 -0
- package/dist/src/wrappers/pathtoDistanceMapOrigin.d.ts +3 -0
- package/dist/src/wrappers/pathtoFlowFieldOrigin.d.ts +3 -0
- package/dist/src/wrappers/pathtoMonoFlowFieldOrigin.d.ts +3 -0
- package/package.json +3 -3
package/README.md
CHANGED
@@ -4,7 +4,55 @@
|
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
-
(
|
7
|
+
This guide will assume you're using Rollup along the lines of the [Screeps Typescript starter kit](https://github.com/screepers/screeps-typescript-starter).
|
8
|
+
|
9
|
+
Set up dependencies:
|
10
|
+
|
11
|
+
```
|
12
|
+
npm install screeps-clockwork
|
13
|
+
npm install -D @rollup/plugin-wasm rollup-plugin-copy
|
14
|
+
```
|
15
|
+
|
16
|
+
Update your Rollup build script to copy the WASM binary to your dist folder:
|
17
|
+
|
18
|
+
```js
|
19
|
+
// add to existing dependencies
|
20
|
+
import wasm from '@rollup/plugin-wasm';
|
21
|
+
import copy from 'rollup-plugin-copy';
|
22
|
+
|
23
|
+
// ...
|
24
|
+
|
25
|
+
export default {
|
26
|
+
// ...
|
27
|
+
external: ['screeps_clockwork.wasm'],
|
28
|
+
plugins: [
|
29
|
+
clear({ targets: ['dist'] }),
|
30
|
+
wasm(),
|
31
|
+
copy({
|
32
|
+
targets: [
|
33
|
+
{
|
34
|
+
src: 'node_modules/screeps-clockwork/dist/screeps_clockwork.wasm',
|
35
|
+
dest: 'dist'
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}),
|
39
|
+
// ...
|
40
|
+
screeps({ config: cfg, dryRun: cfg == null })
|
41
|
+
]
|
42
|
+
};
|
43
|
+
```
|
44
|
+
|
45
|
+
`rollup-plugin-screeps` will automatically push the wasm file out when it deploys.
|
46
|
+
|
47
|
+
Then, in your main loop, call the `initialize` function before running anything else:
|
48
|
+
|
49
|
+
```js
|
50
|
+
import { initialize } from 'screeps-clockwork';
|
51
|
+
export const loop = () => {
|
52
|
+
initialize();
|
53
|
+
// ...
|
54
|
+
};
|
55
|
+
```
|
8
56
|
|
9
57
|
## Dev Setup
|
10
58
|
|