@benev/tact 0.4.0-7 → 0.4.0-9
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 +22 -18
- package/package.json +6 -5
- package/s/lib/index.ts +1 -1
- package/s/lib/input/controller.ts +4 -1
- package/s/lib/input/data/intent/decode.ts +2 -2
- package/s/lib/input/data/intent/encode.ts +2 -2
- package/s/lib/input/data/intent/minihash.ts +5 -0
- package/s/lib/input/decoder.ts +2 -2
- package/s/lib/input/investigate/hash-bindings.ts +5 -3
- package/s/lib/input/investigate/investigate.ts +24 -9
- package/s/lib/input/test.ts +11 -0
- package/s/lib/input/testing/quickbind.ts +3 -3
- package/s/lib/ui/deck/hub.ts +4 -3
- package/s/lib/ui/deck/players.ts +73 -0
- package/s/lib/utils/hash.ts +47 -0
- package/x/demo/main.bundle.min.js +104 -104
- package/x/demo/main.bundle.min.js.map +4 -4
- package/x/gamepad/index.html +1 -1
- package/x/index.html +2 -2
- package/x/lib/index.d.ts +1 -1
- package/x/lib/index.js +1 -1
- package/x/lib/index.js.map +1 -1
- package/x/lib/input/controller.js +1 -1
- package/x/lib/input/controller.js.map +1 -1
- package/x/lib/input/data/intent/decode.d.ts +1 -1
- package/x/lib/input/data/intent/decode.js +2 -2
- package/x/lib/input/data/intent/decode.js.map +1 -1
- package/x/lib/input/data/intent/encode.d.ts +1 -1
- package/x/lib/input/data/intent/encode.js +2 -2
- package/x/lib/input/data/intent/encode.js.map +1 -1
- package/x/lib/input/data/intent/minihash.d.ts +1 -0
- package/x/lib/input/data/intent/minihash.js +4 -0
- package/x/lib/input/data/intent/minihash.js.map +1 -0
- package/x/lib/input/decoder.d.ts +1 -1
- package/x/lib/input/decoder.js +2 -2
- package/x/lib/input/decoder.js.map +1 -1
- package/x/lib/input/investigate/hash-bindings.d.ts +1 -1
- package/x/lib/input/investigate/hash-bindings.js +5 -3
- package/x/lib/input/investigate/hash-bindings.js.map +1 -1
- package/x/lib/input/investigate/investigate.d.ts +2 -1
- package/x/lib/input/investigate/investigate.js +14 -9
- package/x/lib/input/investigate/investigate.js.map +1 -1
- package/x/lib/input/test.d.ts +1 -0
- package/x/lib/input/test.js +10 -0
- package/x/lib/input/test.js.map +1 -1
- package/x/lib/input/testing/quickbind.d.ts +3 -2
- package/x/lib/input/testing/quickbind.js +3 -3
- package/x/lib/input/testing/quickbind.js.map +1 -1
- package/x/lib/ui/deck/hub.js +4 -3
- package/x/lib/ui/deck/hub.js.map +1 -1
- package/x/lib/ui/deck/players.d.ts +16 -0
- package/x/lib/ui/deck/players.js +56 -0
- package/x/lib/ui/deck/players.js.map +1 -0
- package/x/lib/utils/hash.d.ts +1 -0
- package/x/lib/utils/hash.js +47 -0
- package/x/lib/utils/hash.js.map +1 -0
- package/s/lib/ui/deck/collector.ts +0 -52
- package/x/lib/ui/deck/collector.d.ts +0 -13
- package/x/lib/ui/deck/collector.js +0 -35
- package/x/lib/ui/deck/collector.js.map +0 -1
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {RMap} from "@e280/strata"
|
|
3
|
-
import {guarantee} from "@e280/stz"
|
|
4
|
-
|
|
5
|
-
import {PlayerId} from "./types.js"
|
|
6
|
-
import {Bindings} from "../../input/types.js"
|
|
7
|
-
import {InputDecoder} from "../../input/decoder.js"
|
|
8
|
-
import {decodeParcels} from "../../input/data/parcel/decode.js"
|
|
9
|
-
|
|
10
|
-
export class Collector<B extends Bindings> {
|
|
11
|
-
#bindings: B
|
|
12
|
-
#decoders = new RMap<PlayerId, InputDecoder<B>>()
|
|
13
|
-
|
|
14
|
-
constructor(bindings: B) {
|
|
15
|
-
this.#bindings = bindings
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get players() {
|
|
19
|
-
return [...this.#decoders].map(([playerId, decoder]) => ({
|
|
20
|
-
playerId,
|
|
21
|
-
inputs: decoder.inputs,
|
|
22
|
-
}))
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
#getDecoder(playerId: PlayerId) {
|
|
26
|
-
return guarantee(
|
|
27
|
-
this.#decoders,
|
|
28
|
-
playerId,
|
|
29
|
-
() => new InputDecoder(this.#bindings),
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
decodeAll(...buffers: ArrayBuffer[]) {
|
|
34
|
-
const grouped = new Map<PlayerId, ArrayBuffer[]>()
|
|
35
|
-
|
|
36
|
-
for (const buffer of buffers) {
|
|
37
|
-
for (const {playerId, intents} of decodeParcels(buffer))
|
|
38
|
-
guarantee(grouped, playerId, () => []).push(intents)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
for (const [playerId, intents] of grouped)
|
|
42
|
-
this.#getDecoder(playerId).decode(...intents)
|
|
43
|
-
|
|
44
|
-
for (const playerId of this.#decoders.keys()) {
|
|
45
|
-
if (!grouped.has(playerId))
|
|
46
|
-
this.#decoders.delete(playerId)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return this.players
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Bindings } from "../../input/types.js";
|
|
2
|
-
export declare class Collector<B extends Bindings> {
|
|
3
|
-
#private;
|
|
4
|
-
constructor(bindings: B);
|
|
5
|
-
get players(): {
|
|
6
|
-
playerId: number;
|
|
7
|
-
inputs: import("../../input/types.js").Inputs<B>;
|
|
8
|
-
}[];
|
|
9
|
-
decodeAll(...buffers: ArrayBuffer[]): {
|
|
10
|
-
playerId: number;
|
|
11
|
-
inputs: import("../../input/types.js").Inputs<B>;
|
|
12
|
-
}[];
|
|
13
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { RMap } from "@e280/strata";
|
|
2
|
-
import { guarantee } from "@e280/stz";
|
|
3
|
-
import { InputDecoder } from "../../input/decoder.js";
|
|
4
|
-
import { decodeParcels } from "../../input/data/parcel/decode.js";
|
|
5
|
-
export class Collector {
|
|
6
|
-
#bindings;
|
|
7
|
-
#decoders = new RMap();
|
|
8
|
-
constructor(bindings) {
|
|
9
|
-
this.#bindings = bindings;
|
|
10
|
-
}
|
|
11
|
-
get players() {
|
|
12
|
-
return [...this.#decoders].map(([playerId, decoder]) => ({
|
|
13
|
-
playerId,
|
|
14
|
-
inputs: decoder.inputs,
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
#getDecoder(playerId) {
|
|
18
|
-
return guarantee(this.#decoders, playerId, () => new InputDecoder(this.#bindings));
|
|
19
|
-
}
|
|
20
|
-
decodeAll(...buffers) {
|
|
21
|
-
const grouped = new Map();
|
|
22
|
-
for (const buffer of buffers) {
|
|
23
|
-
for (const { playerId, intents } of decodeParcels(buffer))
|
|
24
|
-
guarantee(grouped, playerId, () => []).push(intents);
|
|
25
|
-
}
|
|
26
|
-
for (const [playerId, intents] of grouped)
|
|
27
|
-
this.#getDecoder(playerId).decode(...intents);
|
|
28
|
-
for (const playerId of this.#decoders.keys()) {
|
|
29
|
-
if (!grouped.has(playerId))
|
|
30
|
-
this.#decoders.delete(playerId);
|
|
31
|
-
}
|
|
32
|
-
return this.players;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=collector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../../../s/lib/ui/deck/collector.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAA;AAInC,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAA;AAE/D,MAAM,OAAO,SAAS;IACrB,SAAS,CAAG;IACZ,SAAS,GAAG,IAAI,IAAI,EAA6B,CAAA;IAEjD,YAAY,QAAW;QACtB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,IAAI,OAA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