teeworlds 2.5.4 → 2.5.5
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 +4 -3
- package/docs/documentation.md +3 -0
- package/index.js +24 -24
- package/lib/MsgPacker.js +46 -55
- package/lib/MsgUnpacker.js +52 -53
- package/lib/UUIDManager.js +44 -50
- package/lib/client.js +761 -830
- package/lib/client.ts +24 -3
- package/lib/components/game.js +103 -106
- package/lib/components/movement.js +74 -82
- package/lib/components/rcon.js +91 -122
- package/lib/components/snapshot.js +143 -234
- package/lib/enums_types/protocol.js +13 -13
- package/lib/enums_types/protocol.ts +8 -0
- package/lib/huffman.js +186 -192
- package/lib/snapshot.js +598 -610
- package/package.json +4 -3
- package/tsconfig.json +1 -1
|
@@ -1,234 +1,143 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return this.getParsed(
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return this.getParsed(
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return this.
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return this.
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
get: function () {
|
|
145
|
-
return this.getAll(10 /* SnapshotItemIDs.OBJ_PLAYER_INFO */);
|
|
146
|
-
},
|
|
147
|
-
enumerable: false,
|
|
148
|
-
configurable: true
|
|
149
|
-
});
|
|
150
|
-
SnapshotWrapper.prototype.getObjClientInfo = function (player_id) {
|
|
151
|
-
return this.getParsed(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */, player_id);
|
|
152
|
-
};
|
|
153
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjClientInfo", {
|
|
154
|
-
get: function () {
|
|
155
|
-
return this.getAll(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */);
|
|
156
|
-
},
|
|
157
|
-
enumerable: false,
|
|
158
|
-
configurable: true
|
|
159
|
-
});
|
|
160
|
-
SnapshotWrapper.prototype.getObjSpectatorInfo = function (player_id) {
|
|
161
|
-
return this.getParsed(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */, player_id);
|
|
162
|
-
};
|
|
163
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjSpectatorInfo", {
|
|
164
|
-
get: function () {
|
|
165
|
-
return this.getAll(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */);
|
|
166
|
-
},
|
|
167
|
-
enumerable: false,
|
|
168
|
-
configurable: true
|
|
169
|
-
});
|
|
170
|
-
SnapshotWrapper.prototype.getTypeId = function (name) {
|
|
171
|
-
var _a;
|
|
172
|
-
return ((_a = this._client.rawSnapUnpacker.uuid_manager.LookupName(name)) === null || _a === void 0 ? void 0 : _a.type_id) || -1;
|
|
173
|
-
};
|
|
174
|
-
SnapshotWrapper.prototype.getObjExMyOwnObject = function (id) {
|
|
175
|
-
return this.getParsed(this.getTypeId("my-own-object@heinrich5991.de"), id);
|
|
176
|
-
};
|
|
177
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExMyOwnObject", {
|
|
178
|
-
get: function () {
|
|
179
|
-
return this.getAll(this.getTypeId("my-own-object@heinrich5991.de"));
|
|
180
|
-
},
|
|
181
|
-
enumerable: false,
|
|
182
|
-
configurable: true
|
|
183
|
-
});
|
|
184
|
-
SnapshotWrapper.prototype.getObjExDDNetCharacter = function (id) {
|
|
185
|
-
return this.getParsed(this.getTypeId("character@netobj.ddnet.tw"), id);
|
|
186
|
-
};
|
|
187
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExDDNetCharacter", {
|
|
188
|
-
get: function () {
|
|
189
|
-
return this.getAll(this.getTypeId("character@netobj.ddnet.tw"));
|
|
190
|
-
},
|
|
191
|
-
enumerable: false,
|
|
192
|
-
configurable: true
|
|
193
|
-
});
|
|
194
|
-
SnapshotWrapper.prototype.getObjExGameInfo = function (id) {
|
|
195
|
-
return this.getParsed(this.getTypeId("gameinfo@netobj.ddnet.tw"), id);
|
|
196
|
-
};
|
|
197
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExGameInfo", {
|
|
198
|
-
get: function () {
|
|
199
|
-
return this.getAll(this.getTypeId("gameinfo@netobj.ddnet.tw"));
|
|
200
|
-
},
|
|
201
|
-
enumerable: false,
|
|
202
|
-
configurable: true
|
|
203
|
-
});
|
|
204
|
-
SnapshotWrapper.prototype.getObjExDDNetProjectile = function (id) {
|
|
205
|
-
return this.getParsed(this.getTypeId("projectile@netobj.ddnet.tw"), id);
|
|
206
|
-
};
|
|
207
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExDDNetProjectile", {
|
|
208
|
-
get: function () {
|
|
209
|
-
return this.getAll(this.getTypeId("projectile@netobj.ddnet.tw"));
|
|
210
|
-
},
|
|
211
|
-
enumerable: false,
|
|
212
|
-
configurable: true
|
|
213
|
-
});
|
|
214
|
-
SnapshotWrapper.prototype.getObjExLaser = function (id) {
|
|
215
|
-
return this.getParsed(this.getTypeId("laser@netobj.ddnet.tw"), id);
|
|
216
|
-
};
|
|
217
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExLaser", {
|
|
218
|
-
get: function () {
|
|
219
|
-
return this.getAll(this.getTypeId("laser@netobj.ddnet.tw"));
|
|
220
|
-
},
|
|
221
|
-
enumerable: false,
|
|
222
|
-
configurable: true
|
|
223
|
-
});
|
|
224
|
-
Object.defineProperty(SnapshotWrapper.prototype, "OwnID", {
|
|
225
|
-
get: function () {
|
|
226
|
-
var _a;
|
|
227
|
-
return (_a = this.AllObjPlayerInfo.find(function (parsed) { return parsed.local; })) === null || _a === void 0 ? void 0 : _a.client_id;
|
|
228
|
-
},
|
|
229
|
-
enumerable: false,
|
|
230
|
-
configurable: true
|
|
231
|
-
});
|
|
232
|
-
return SnapshotWrapper;
|
|
233
|
-
}(stream_1.EventEmitter));
|
|
234
|
-
exports.SnapshotWrapper = SnapshotWrapper;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnapshotWrapper = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
class SnapshotWrapper extends stream_1.EventEmitter {
|
|
6
|
+
constructor(_client) {
|
|
7
|
+
// this.SendMsgEx = callback;
|
|
8
|
+
super();
|
|
9
|
+
this._client = _client;
|
|
10
|
+
}
|
|
11
|
+
getParsed(type_id, id) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (type_id == -1)
|
|
14
|
+
return undefined;
|
|
15
|
+
return (_a = this._client.rawSnapUnpacker.deltas.find(delta => delta.type_id == type_id && delta.id == id)) === null || _a === void 0 ? void 0 : _a.parsed;
|
|
16
|
+
}
|
|
17
|
+
getAll(type_id) {
|
|
18
|
+
let _all = [];
|
|
19
|
+
if (type_id == -1)
|
|
20
|
+
return _all;
|
|
21
|
+
this._client.rawSnapUnpacker.deltas.forEach(delta => {
|
|
22
|
+
if (delta.type_id == type_id)
|
|
23
|
+
_all.push(delta.parsed);
|
|
24
|
+
});
|
|
25
|
+
return _all;
|
|
26
|
+
// return this._client.rawSnapUnpacker.deltas.filter(delta => delta.type_id == type_id && delta.id == id).map(a => a.parsed);
|
|
27
|
+
}
|
|
28
|
+
getObjPlayerInput(player_id) {
|
|
29
|
+
return this.getParsed(1 /* SnapshotItemIDs.OBJ_PLAYER_INPUT */, player_id);
|
|
30
|
+
}
|
|
31
|
+
get AllObjPlayerInput() {
|
|
32
|
+
return this.getAll(1 /* SnapshotItemIDs.OBJ_PLAYER_INPUT */);
|
|
33
|
+
}
|
|
34
|
+
getObjProjectile(id) {
|
|
35
|
+
return this.getParsed(2 /* SnapshotItemIDs.OBJ_PROJECTILE */, id);
|
|
36
|
+
}
|
|
37
|
+
get AllProjectiles() {
|
|
38
|
+
return this.getAll(2 /* SnapshotItemIDs.OBJ_PROJECTILE */);
|
|
39
|
+
}
|
|
40
|
+
getObjLaser(id) {
|
|
41
|
+
return this.getParsed(3 /* SnapshotItemIDs.OBJ_LASER */, id);
|
|
42
|
+
}
|
|
43
|
+
get AllObjLaser() {
|
|
44
|
+
return this.getAll(3 /* SnapshotItemIDs.OBJ_LASER */);
|
|
45
|
+
}
|
|
46
|
+
getObjPickup(id) {
|
|
47
|
+
return this.getParsed(4 /* SnapshotItemIDs.OBJ_PICKUP */, id);
|
|
48
|
+
}
|
|
49
|
+
get AllObjPickup() {
|
|
50
|
+
return this.getAll(4 /* SnapshotItemIDs.OBJ_PICKUP */);
|
|
51
|
+
}
|
|
52
|
+
getObjFlag(id) {
|
|
53
|
+
return this.getParsed(5 /* SnapshotItemIDs.OBJ_FLAG */, id);
|
|
54
|
+
}
|
|
55
|
+
get AllObjFlag() {
|
|
56
|
+
return this.getAll(5 /* SnapshotItemIDs.OBJ_FLAG */);
|
|
57
|
+
}
|
|
58
|
+
getObjGameInfo(id) {
|
|
59
|
+
return this.getParsed(6 /* SnapshotItemIDs.OBJ_GAME_INFO */, id);
|
|
60
|
+
}
|
|
61
|
+
get AllObjGameInfo() {
|
|
62
|
+
return this.getAll(6 /* SnapshotItemIDs.OBJ_GAME_INFO */);
|
|
63
|
+
}
|
|
64
|
+
getObjGameData(id) {
|
|
65
|
+
return this.getParsed(7 /* SnapshotItemIDs.OBJ_GAME_DATA */, id);
|
|
66
|
+
}
|
|
67
|
+
get AllObjGameData() {
|
|
68
|
+
return this.getAll(7 /* SnapshotItemIDs.OBJ_GAME_DATA */);
|
|
69
|
+
}
|
|
70
|
+
/** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
|
|
71
|
+
getObjCharacterCore(player_id) {
|
|
72
|
+
return this.getParsed(8 /* SnapshotItemIDs.OBJ_CHARACTER_CORE */, player_id);
|
|
73
|
+
}
|
|
74
|
+
/** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
|
|
75
|
+
get AllObjCharacterCore() {
|
|
76
|
+
return this.getAll(8 /* SnapshotItemIDs.OBJ_CHARACTER_CORE */);
|
|
77
|
+
}
|
|
78
|
+
/** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
|
|
79
|
+
getObjCharacter(player_id) {
|
|
80
|
+
return this.getParsed(9 /* SnapshotItemIDs.OBJ_CHARACTER */, player_id);
|
|
81
|
+
}
|
|
82
|
+
/** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
|
|
83
|
+
get AllObjCharacter() {
|
|
84
|
+
return this.getAll(9 /* SnapshotItemIDs.OBJ_CHARACTER */);
|
|
85
|
+
}
|
|
86
|
+
getObjPlayerInfo(player_id) {
|
|
87
|
+
return this.getParsed(10 /* SnapshotItemIDs.OBJ_PLAYER_INFO */, player_id);
|
|
88
|
+
}
|
|
89
|
+
get AllObjPlayerInfo() {
|
|
90
|
+
return this.getAll(10 /* SnapshotItemIDs.OBJ_PLAYER_INFO */);
|
|
91
|
+
}
|
|
92
|
+
getObjClientInfo(player_id) {
|
|
93
|
+
return this.getParsed(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */, player_id);
|
|
94
|
+
}
|
|
95
|
+
get AllObjClientInfo() {
|
|
96
|
+
return this.getAll(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */);
|
|
97
|
+
}
|
|
98
|
+
getObjSpectatorInfo(player_id) {
|
|
99
|
+
return this.getParsed(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */, player_id);
|
|
100
|
+
}
|
|
101
|
+
get AllObjSpectatorInfo() {
|
|
102
|
+
return this.getAll(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */);
|
|
103
|
+
}
|
|
104
|
+
getTypeId(name) {
|
|
105
|
+
var _a;
|
|
106
|
+
return ((_a = this._client.rawSnapUnpacker.uuid_manager.LookupName(name)) === null || _a === void 0 ? void 0 : _a.type_id) || -1;
|
|
107
|
+
}
|
|
108
|
+
getObjExMyOwnObject(id) {
|
|
109
|
+
return this.getParsed(this.getTypeId("my-own-object@heinrich5991.de"), id);
|
|
110
|
+
}
|
|
111
|
+
get AllObjExMyOwnObject() {
|
|
112
|
+
return this.getAll(this.getTypeId("my-own-object@heinrich5991.de"));
|
|
113
|
+
}
|
|
114
|
+
getObjExDDNetCharacter(id) {
|
|
115
|
+
return this.getParsed(this.getTypeId("character@netobj.ddnet.tw"), id);
|
|
116
|
+
}
|
|
117
|
+
get AllObjExDDNetCharacter() {
|
|
118
|
+
return this.getAll(this.getTypeId("character@netobj.ddnet.tw"));
|
|
119
|
+
}
|
|
120
|
+
getObjExGameInfo(id) {
|
|
121
|
+
return this.getParsed(this.getTypeId("gameinfo@netobj.ddnet.tw"), id);
|
|
122
|
+
}
|
|
123
|
+
get AllObjExGameInfo() {
|
|
124
|
+
return this.getAll(this.getTypeId("gameinfo@netobj.ddnet.tw"));
|
|
125
|
+
}
|
|
126
|
+
getObjExDDNetProjectile(id) {
|
|
127
|
+
return this.getParsed(this.getTypeId("projectile@netobj.ddnet.tw"), id);
|
|
128
|
+
}
|
|
129
|
+
get AllObjExDDNetProjectile() {
|
|
130
|
+
return this.getAll(this.getTypeId("projectile@netobj.ddnet.tw"));
|
|
131
|
+
}
|
|
132
|
+
getObjExLaser(id) {
|
|
133
|
+
return this.getParsed(this.getTypeId("laser@netobj.ddnet.tw"), id);
|
|
134
|
+
}
|
|
135
|
+
get AllObjExLaser() {
|
|
136
|
+
return this.getAll(this.getTypeId("laser@netobj.ddnet.tw"));
|
|
137
|
+
}
|
|
138
|
+
get OwnID() {
|
|
139
|
+
var _a;
|
|
140
|
+
return (_a = this.AllObjPlayerInfo.find(parsed => parsed.local)) === null || _a === void 0 ? void 0 : _a.client_id;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.SnapshotWrapper = SnapshotWrapper;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.States = void 0;
|
|
4
|
-
var States;
|
|
5
|
-
(function (States) {
|
|
6
|
-
States[States["STATE_OFFLINE"] = 0] = "STATE_OFFLINE";
|
|
7
|
-
States[States["STATE_CONNECTING"] = 1] = "STATE_CONNECTING";
|
|
8
|
-
States[States["STATE_LOADING"] = 2] = "STATE_LOADING";
|
|
9
|
-
States[States["STATE_ONLINE"] = 3] = "STATE_ONLINE";
|
|
10
|
-
States[States["STATE_DEMOPLAYBACK"] = 4] = "STATE_DEMOPLAYBACK";
|
|
11
|
-
States[States["STATE_QUITTING"] = 5] = "STATE_QUITTING";
|
|
12
|
-
States[States["STATE_RESTARTING"] = 6] = "STATE_RESTARTING";
|
|
13
|
-
})(States
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.States = void 0;
|
|
4
|
+
var States;
|
|
5
|
+
(function (States) {
|
|
6
|
+
States[States["STATE_OFFLINE"] = 0] = "STATE_OFFLINE";
|
|
7
|
+
States[States["STATE_CONNECTING"] = 1] = "STATE_CONNECTING";
|
|
8
|
+
States[States["STATE_LOADING"] = 2] = "STATE_LOADING";
|
|
9
|
+
States[States["STATE_ONLINE"] = 3] = "STATE_ONLINE";
|
|
10
|
+
States[States["STATE_DEMOPLAYBACK"] = 4] = "STATE_DEMOPLAYBACK";
|
|
11
|
+
States[States["STATE_QUITTING"] = 5] = "STATE_QUITTING";
|
|
12
|
+
States[States["STATE_RESTARTING"] = 6] = "STATE_RESTARTING";
|
|
13
|
+
})(States || (exports.States = States = {}));
|
|
@@ -105,6 +105,14 @@ export namespace NETMSG {
|
|
|
105
105
|
NETMSG_CHECKSUM_ERROR,
|
|
106
106
|
|
|
107
107
|
NETMSG_REDIRECT,
|
|
108
|
+
|
|
109
|
+
NETMSG_RCON_CMD_GROUP_START,
|
|
110
|
+
NETMSG_RCON_CMD_GROUP_END,
|
|
111
|
+
NETMSG_MAP_RELOAD,
|
|
112
|
+
NETMSG_RECONNECT,
|
|
113
|
+
NETMSG_MAPLIST_ADD,
|
|
114
|
+
NETMSG_MAPLIST_GROUP_START,
|
|
115
|
+
NETMSG_MAPLIST_GROUP_END,
|
|
108
116
|
|
|
109
117
|
NETMSG_I_AM_NPM_PACKAGE
|
|
110
118
|
|