dredless 0.2.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/LICENSE +21 -0
- package/README.md +48 -0
- package/docs/API_REFERENCE.md +2481 -0
- package/docs/BROWSER_API.md +98 -0
- package/docs/NODE_API.md +359 -0
- package/package.json +173 -0
- package/src/browser.d.ts +212 -0
- package/src/browser.js +133 -0
- package/src/client/core.js +1202 -0
- package/src/client/domains/index.js +1818 -0
- package/src/client/index.d.ts +2 -0
- package/src/client/index.js +1 -0
- package/src/compression/lz4.d.ts +1 -0
- package/src/compression/lz4.js +112 -0
- package/src/constants.js +74 -0
- package/src/crypto/chacha-native.d.ts +9 -0
- package/src/crypto/chacha-native.js +48 -0
- package/src/crypto/chacha.d.ts +25 -0
- package/src/crypto/chacha.js +274 -0
- package/src/data/item-schema.js +2235 -0
- package/src/data/official-client-data.js +156 -0
- package/src/events.js +39 -0
- package/src/index.d.ts +2277 -0
- package/src/index.js +125 -0
- package/src/network/browser-session.js +291 -0
- package/src/network/connection.d.ts +1 -0
- package/src/network/connection.js +31 -0
- package/src/network/cookies.js +85 -0
- package/src/network/http.js +34 -0
- package/src/network/index.d.ts +4 -0
- package/src/network/index.js +4 -0
- package/src/network/servers.d.ts +7 -0
- package/src/network/servers.js +133 -0
- package/src/network/session.d.ts +7 -0
- package/src/network/session.js +320 -0
- package/src/network/ships.d.ts +12 -0
- package/src/network/ships.js +73 -0
- package/src/node.d.ts +2 -0
- package/src/node.js +8 -0
- package/src/protocol/codec/binary.d.ts +3 -0
- package/src/protocol/codec/binary.js +52 -0
- package/src/protocol/codec/msgpack.d.ts +3 -0
- package/src/protocol/codec/msgpack.js +555 -0
- package/src/protocol/inbound/frame.d.ts +1 -0
- package/src/protocol/inbound/frame.js +8 -0
- package/src/protocol/inbound/world-payload.d.ts +3 -0
- package/src/protocol/inbound/world-payload.js +21 -0
- package/src/protocol/index.d.ts +11 -0
- package/src/protocol/index.js +19 -0
- package/src/protocol/outbound/blueprint.d.ts +22 -0
- package/src/protocol/outbound/blueprint.js +36 -0
- package/src/protocol/outbound/commands.d.ts +3 -0
- package/src/protocol/outbound/commands.js +149 -0
- package/src/protocol/outbound/comms.d.ts +28 -0
- package/src/protocol/outbound/comms.js +40 -0
- package/src/protocol/outbound/inventory.d.ts +64 -0
- package/src/protocol/outbound/inventory.js +147 -0
- package/src/protocol/outbound/ship-management.d.ts +84 -0
- package/src/protocol/outbound/ship-management.js +221 -0
- package/src/protocol/outbound/sign.d.ts +18 -0
- package/src/protocol/outbound/sign.js +45 -0
- package/src/protocol/outbound/ui-config.d.ts +157 -0
- package/src/protocol/outbound/ui-config.js +578 -0
- package/src/runtime.js +36 -0
- package/src/state/generator-maze.d.ts +32 -0
- package/src/state/generator-maze.js +370 -0
- package/src/state/index.d.ts +3 -0
- package/src/state/index.js +3 -0
- package/src/state/items.js +20 -0
- package/src/state/model/decoder.js +1554 -0
- package/src/state/model/index.d.ts +33 -0
- package/src/state/model/index.js +2 -0
- package/src/state/model/loader-config.js +1020 -0
- package/src/state/model/reader.js +69 -0
- package/src/state/model/state.js +1257 -0
- package/src/state/overworld.js +72 -0
- package/src/state/tilesets.js +53 -0
- package/src/state/world/index.d.ts +29 -0
- package/src/state/world/index.js +180 -0
- package/src/state/world/state.js +297 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export const OFFICIAL_CLIENT_SNAPSHOT = {
|
|
2
|
+
capturedAt: "2026-05-17",
|
|
3
|
+
gameVersion: "Fri May 8 09:43:31 PM MDT 2026 / 92e9666650b250eae8968a40ff4f3a04c257f2e6",
|
|
4
|
+
moduleTable: "drednot-official-client/latest-captured-module-table.js",
|
|
5
|
+
wasmGlue: "/x/wasm.2cc626268724032ec685dd97023d77da.js",
|
|
6
|
+
wasm: "/x/4719d471af3e158f9fc6c69af872fe1c.wasm",
|
|
7
|
+
sourceModules: {
|
|
8
|
+
tilesets: 89,
|
|
9
|
+
physicsFilters: 42,
|
|
10
|
+
itemIds: 78
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const OFFICIAL_CLIENT_ITEM_ID = {
|
|
15
|
+
BLOCK: 232,
|
|
16
|
+
BLOCK_HYPER_RUBBER: 233,
|
|
17
|
+
BLOCK_ICE_GLASS: 234,
|
|
18
|
+
BLOCK_LADDER: 235,
|
|
19
|
+
BLOCK_WALKWAY: 236,
|
|
20
|
+
BLOCK_ITEM_NET: 237,
|
|
21
|
+
PAINT: 239,
|
|
22
|
+
BLOCK_ANNIHILATOR: 254,
|
|
23
|
+
BLOCK_LOGISTICS_RAIL: 262
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const OFFICIAL_CLIENT_FILTERS = {
|
|
27
|
+
DEFAULT_FILTER: {categoryBits: 1, maskBits: 65535, groupIndex: 0},
|
|
28
|
+
NOCOLLIDE_FILTER: {categoryBits: 0, maskBits: 65535, groupIndex: 0},
|
|
29
|
+
FILTER_BLOCK_WALKWAY: {categoryBits: 28, maskBits: 28, groupIndex: 0},
|
|
30
|
+
FILTER_BLOCK_ITEM_NET: {categoryBits: 1, maskBits: 1, groupIndex: 0},
|
|
31
|
+
FILTER_BLOCK_GLASS: {categoryBits: 1, maskBits: 65535, groupIndex: 0}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const OFFICIAL_CLIENT_SUBWORLD_MATERIAL_NAMES = new Map([
|
|
35
|
+
[0, "Nothing"],
|
|
36
|
+
[1, "Ship Border Corner"],
|
|
37
|
+
[2, "Ship Border Edge Horizontal"],
|
|
38
|
+
[3, "Ship Border Edge Vertical"],
|
|
39
|
+
[4, "Iron Block"],
|
|
40
|
+
[5, "Ladder"],
|
|
41
|
+
[6, "Walkway"],
|
|
42
|
+
[7, "Item Net"],
|
|
43
|
+
[8, "Iron Block"],
|
|
44
|
+
[9, "Iron Block"],
|
|
45
|
+
[10, "Iron Block"],
|
|
46
|
+
[11, "Iron Block"],
|
|
47
|
+
[12, "Paint"],
|
|
48
|
+
[13, "Hyper Rubber Block"],
|
|
49
|
+
[14, "Hyper Ice Block"],
|
|
50
|
+
[15, "Annihilator Tile"],
|
|
51
|
+
[16, "Logistics Rail"]
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
export const OFFICIAL_CLIENT_OVERWORLD_MATERIAL_NAMES = new Map([
|
|
55
|
+
[0, "Air"],
|
|
56
|
+
[1, "Wall"],
|
|
57
|
+
[2, "Unbreakable"],
|
|
58
|
+
[3, "Treasure"],
|
|
59
|
+
[4, "Blank"],
|
|
60
|
+
[5, "Flux"],
|
|
61
|
+
[6, "Sleeping Bot"],
|
|
62
|
+
[7, "Bot Red"],
|
|
63
|
+
[8, "Strong Wall"],
|
|
64
|
+
[9, "Rock"],
|
|
65
|
+
[10, "Rock Metal"],
|
|
66
|
+
[11, "Rock Flux"],
|
|
67
|
+
[12, "Vault"],
|
|
68
|
+
[13, "Vault Locked"]
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
const I = OFFICIAL_CLIENT_ITEM_ID;
|
|
72
|
+
const F = OFFICIAL_CLIENT_FILTERS;
|
|
73
|
+
|
|
74
|
+
// Copied from official client module 89. The official damage_f callbacks are
|
|
75
|
+
// behavior, not static tile metadata, so they are intentionally omitted here.
|
|
76
|
+
export const OFFICIAL_CLIENT_TILESETS = {
|
|
77
|
+
overworld: {
|
|
78
|
+
scale: 8,
|
|
79
|
+
atlas: "tiles_overworld",
|
|
80
|
+
tile_width: 64,
|
|
81
|
+
tiles: [
|
|
82
|
+
{solid: false},
|
|
83
|
+
{solid: true, hp: 999},
|
|
84
|
+
{solid: true},
|
|
85
|
+
{solid: true, hp: 1999},
|
|
86
|
+
{solid: true, hp: 999},
|
|
87
|
+
{solid: true, hp: 1999},
|
|
88
|
+
{solid: true, hp: 1},
|
|
89
|
+
{solid: false},
|
|
90
|
+
{solid: true, hp: 1999},
|
|
91
|
+
{solid: true, hp: 199},
|
|
92
|
+
{solid: true, hp: 199},
|
|
93
|
+
{solid: true, hp: 199},
|
|
94
|
+
{solid: true, hp: 999},
|
|
95
|
+
{solid: true}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
subworld: {
|
|
99
|
+
scale: 1,
|
|
100
|
+
atlas: "tiles_subworld",
|
|
101
|
+
tile_width: 40,
|
|
102
|
+
tiles: [
|
|
103
|
+
{solid: false},
|
|
104
|
+
{solid: true},
|
|
105
|
+
{solid: true},
|
|
106
|
+
{solid: true},
|
|
107
|
+
{solid: true, destruct_item: I.BLOCK, blocks_bullets: true, hp: 199},
|
|
108
|
+
{solid: false, destruct_item: I.BLOCK_LADDER, hp: 1},
|
|
109
|
+
{
|
|
110
|
+
solid: true,
|
|
111
|
+
destruct_item: I.BLOCK_WALKWAY,
|
|
112
|
+
hp: 1,
|
|
113
|
+
physics: {
|
|
114
|
+
filter: F.FILTER_BLOCK_WALKWAY,
|
|
115
|
+
transparent: true,
|
|
116
|
+
walkway: true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
solid: true,
|
|
121
|
+
destruct_item: I.BLOCK_ITEM_NET,
|
|
122
|
+
hp: 1,
|
|
123
|
+
physics: {
|
|
124
|
+
filter: F.FILTER_BLOCK_ITEM_NET,
|
|
125
|
+
transparent: true
|
|
126
|
+
},
|
|
127
|
+
no_build_surface: true
|
|
128
|
+
},
|
|
129
|
+
{solid: true, destruct_item: I.BLOCK, blocks_bullets: true, hp: 199},
|
|
130
|
+
{solid: true, destruct_item: I.BLOCK, blocks_bullets: true, hp: 199},
|
|
131
|
+
{solid: true, destruct_item: I.BLOCK, blocks_bullets: true, hp: 199},
|
|
132
|
+
{solid: true, destruct_item: I.BLOCK, blocks_bullets: true, hp: 199},
|
|
133
|
+
{solid: false, destruct_item: I.PAINT, hp: 1},
|
|
134
|
+
{
|
|
135
|
+
solid: true,
|
|
136
|
+
blocks_bullets: true,
|
|
137
|
+
destruct_item: I.BLOCK_HYPER_RUBBER,
|
|
138
|
+
hp: 599,
|
|
139
|
+
physics: {restitution: 0.9}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
solid: true,
|
|
143
|
+
blocks_bullets: true,
|
|
144
|
+
destruct_item: I.BLOCK_ICE_GLASS,
|
|
145
|
+
hp: 199,
|
|
146
|
+
physics: {
|
|
147
|
+
friction: 0,
|
|
148
|
+
filter: F.FILTER_BLOCK_GLASS,
|
|
149
|
+
transparent: true
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{solid: false, destruct_item: I.BLOCK_ANNIHILATOR, hp: 1},
|
|
153
|
+
{solid: false, destruct_item: I.BLOCK_LOGISTICS_RAIL, hp: 1}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
};
|
package/src/events.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export class EventBus {
|
|
2
|
+
#listeners = new Map();
|
|
3
|
+
|
|
4
|
+
on(type, callback) {
|
|
5
|
+
if (typeof callback !== "function") return this;
|
|
6
|
+
if (!this.#listeners.has(type)) this.#listeners.set(type, new Set());
|
|
7
|
+
this.#listeners.get(type).add(callback);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
off(type, callback) {
|
|
12
|
+
this.#listeners.get(type)?.delete(callback);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
once(type, callback) {
|
|
17
|
+
const wrapped = (...args) => {
|
|
18
|
+
this.off(type, wrapped);
|
|
19
|
+
callback(...args);
|
|
20
|
+
};
|
|
21
|
+
return this.on(type, wrapped);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
emit(type, ...args) {
|
|
25
|
+
const listeners = this.#listeners.get(type);
|
|
26
|
+
if (!listeners || listeners.size === 0) return;
|
|
27
|
+
// Copy only when there is more than one listener: the copy exists so a
|
|
28
|
+
// listener may unsubscribe mid-dispatch, and a lone listener removing
|
|
29
|
+
// itself cannot disturb an iteration that is already finishing.
|
|
30
|
+
for (const callback of listeners.size === 1 ? listeners : [...listeners]) {
|
|
31
|
+
try {
|
|
32
|
+
callback(...args);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (type === "error" || !this.#listeners.has("error")) throw error;
|
|
35
|
+
this.emit("error", error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|