teeworlds 2.5.3 → 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 -845
- package/lib/client.ts +124 -214
- package/lib/components/game.js +103 -143
- package/lib/components/game.ts +12 -13
- package/lib/components/movement.js +74 -82
- package/lib/components/rcon.js +91 -0
- package/lib/components/rcon.ts +114 -0
- package/lib/components/snapshot.js +143 -258
- package/lib/components/snapshot.ts +68 -100
- package/lib/enums_types/protocol.js +13 -0
- package/lib/enums_types/protocol.ts +145 -0
- package/lib/enums_types/types.d.ts +236 -0
- package/lib/huffman.js +186 -192
- package/lib/snapshot.js +598 -610
- package/lib/snapshot.ts +36 -38
- package/package.json +4 -3
- package/tsconfig.json +1 -1
- package/lib/snapshots.d.ts +0 -233
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
|
|
2
|
+
import { EventEmitter } from "stream";
|
|
3
|
+
import { MsgPacker } from "../MsgPacker";
|
|
4
|
+
import { MsgUnpacker } from "../MsgUnpacker";
|
|
5
|
+
import { Client } from "../client";
|
|
6
|
+
import { NETMSG } from "../enums_types/protocol";
|
|
7
|
+
import { Chunk, RconCommand } from "../enums_types/types";
|
|
8
|
+
|
|
9
|
+
interface RconEvents {
|
|
10
|
+
rcon_line: (line: string) => void;
|
|
11
|
+
rcon_auth_status: (info: {AuthLevel: number, ReceiveCommands: number}) => void;
|
|
12
|
+
rcon_cmd_add: (info: {command: string, description: string, params: string}) => void;
|
|
13
|
+
rcon_cmd_rem: (info: {command: string}) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export class Rcon extends EventEmitter {
|
|
18
|
+
on<K extends keyof RconEvents>(event: K, listener: RconEvents[K]): this {
|
|
19
|
+
return super.on(event, listener);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
emit<K extends keyof RconEvents>(event: K, ...args: Parameters<RconEvents[K]>): boolean {
|
|
23
|
+
return super.emit(event, ...args);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
CommandList: RconCommand[] = [];
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
private _client: Client;
|
|
30
|
+
constructor(_client: Client) {
|
|
31
|
+
super();
|
|
32
|
+
this._client = _client;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// SendMsgEx: (Msgs: MsgPacker[] | MsgPacker) => void;
|
|
36
|
+
private send(packer: MsgPacker | MsgPacker[]) {
|
|
37
|
+
if (!this._client.options?.lightweight)
|
|
38
|
+
this._client.QueueChunkEx(packer);
|
|
39
|
+
else
|
|
40
|
+
this._client.SendMsgEx(packer);
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
public auth(username: string, password: string): void;
|
|
44
|
+
public auth(password: string): void;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/** Rcon auth, set the `username` to empty string for authentication w/o username **/
|
|
48
|
+
auth(usernameOrPassword: string, password?: string) {
|
|
49
|
+
const rconAuthMsg = new MsgPacker(NETMSG.System.NETMSG_RCON_AUTH, true, 1);
|
|
50
|
+
if (password == undefined) {
|
|
51
|
+
rconAuthMsg.AddString("");
|
|
52
|
+
rconAuthMsg.AddString(usernameOrPassword);
|
|
53
|
+
|
|
54
|
+
} else {
|
|
55
|
+
rconAuthMsg.AddString(usernameOrPassword);
|
|
56
|
+
rconAuthMsg.AddString(password);
|
|
57
|
+
}
|
|
58
|
+
rconAuthMsg.AddInt(1);
|
|
59
|
+
this.send(rconAuthMsg);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Send rcon command **/
|
|
63
|
+
rcon(cmds: string[] | string) {
|
|
64
|
+
let _cmds: string[];
|
|
65
|
+
if (cmds instanceof Array) _cmds = cmds
|
|
66
|
+
else _cmds = [cmds];
|
|
67
|
+
const msgs: MsgPacker[] = [];
|
|
68
|
+
_cmds.forEach((cmd) => {
|
|
69
|
+
const rconCmdMsg = new MsgPacker(NETMSG.System.NETMSG_RCON_CMD, true, 1);
|
|
70
|
+
rconCmdMsg.AddString(cmd);
|
|
71
|
+
msgs.push(rconCmdMsg);
|
|
72
|
+
})
|
|
73
|
+
this.send(msgs);
|
|
74
|
+
}
|
|
75
|
+
/** This method is called by the Client to handle the chunks. It should not be called directly. */
|
|
76
|
+
_checkChunks(chunk: Chunk): boolean {
|
|
77
|
+
if (chunk.msgid == NETMSG.System.NETMSG_RCON_LINE) {
|
|
78
|
+
const unpacker = new MsgUnpacker(chunk.raw);
|
|
79
|
+
const msg = unpacker.unpackString();
|
|
80
|
+
this.emit('rcon_line', msg);
|
|
81
|
+
|
|
82
|
+
} else if (chunk.msgid == NETMSG.System.NETMSG_RCON_AUTH_STATUS) {
|
|
83
|
+
const unpacker = new MsgUnpacker(chunk.raw);
|
|
84
|
+
const AuthLevel = unpacker.unpackInt();
|
|
85
|
+
const ReceiveCommands = unpacker.unpackInt();
|
|
86
|
+
this.emit('rcon_auth_status', {AuthLevel, ReceiveCommands});
|
|
87
|
+
} else if (chunk.msgid == NETMSG.System.NETMSG_RCON_CMD_ADD) {
|
|
88
|
+
const unpacker = new MsgUnpacker(chunk.raw);
|
|
89
|
+
const command = unpacker.unpackString();
|
|
90
|
+
const description = unpacker.unpackString();
|
|
91
|
+
const params = unpacker.unpackString();
|
|
92
|
+
|
|
93
|
+
this.CommandList.push({command, description, params});
|
|
94
|
+
|
|
95
|
+
this.emit('rcon_cmd_add', {command, description, params});
|
|
96
|
+
} else if (chunk.msgid == NETMSG.System.NETMSG_RCON_CMD_REM) {
|
|
97
|
+
const unpacker = new MsgUnpacker(chunk.raw);
|
|
98
|
+
const command = unpacker.unpackString();
|
|
99
|
+
this.emit('rcon_cmd_rem', {command});
|
|
100
|
+
|
|
101
|
+
let index = this.CommandList.findIndex(a => a.command == command);
|
|
102
|
+
if (index -1 >= 0)
|
|
103
|
+
this.CommandList.splice(index, 1);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
}
|
|
@@ -1,258 +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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return this.getParsed(
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjCharacterCore", {
|
|
145
|
-
/** 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 */
|
|
146
|
-
get: function () {
|
|
147
|
-
return this.getAll(items.OBJ_CHARACTER_CORE);
|
|
148
|
-
},
|
|
149
|
-
enumerable: false,
|
|
150
|
-
configurable: true
|
|
151
|
-
});
|
|
152
|
-
/** 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 */
|
|
153
|
-
SnapshotWrapper.prototype.getObjCharacter = function (player_id) {
|
|
154
|
-
return this.getParsed(items.OBJ_CHARACTER, player_id);
|
|
155
|
-
};
|
|
156
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjCharacter", {
|
|
157
|
-
/** 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 */
|
|
158
|
-
get: function () {
|
|
159
|
-
return this.getAll(items.OBJ_CHARACTER);
|
|
160
|
-
},
|
|
161
|
-
enumerable: false,
|
|
162
|
-
configurable: true
|
|
163
|
-
});
|
|
164
|
-
SnapshotWrapper.prototype.getObjPlayerInfo = function (player_id) {
|
|
165
|
-
return this.getParsed(items.OBJ_PLAYER_INFO, player_id);
|
|
166
|
-
};
|
|
167
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjPlayerInfo", {
|
|
168
|
-
get: function () {
|
|
169
|
-
return this.getAll(items.OBJ_PLAYER_INFO);
|
|
170
|
-
},
|
|
171
|
-
enumerable: false,
|
|
172
|
-
configurable: true
|
|
173
|
-
});
|
|
174
|
-
SnapshotWrapper.prototype.getObjClientInfo = function (player_id) {
|
|
175
|
-
return this.getParsed(items.OBJ_CLIENT_INFO, player_id);
|
|
176
|
-
};
|
|
177
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjClientInfo", {
|
|
178
|
-
get: function () {
|
|
179
|
-
return this.getAll(items.OBJ_CLIENT_INFO);
|
|
180
|
-
},
|
|
181
|
-
enumerable: false,
|
|
182
|
-
configurable: true
|
|
183
|
-
});
|
|
184
|
-
SnapshotWrapper.prototype.getObjSpectatorInfo = function (player_id) {
|
|
185
|
-
return this.getParsed(items.OBJ_SPECTATOR_INFO, player_id);
|
|
186
|
-
};
|
|
187
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjSpectatorInfo", {
|
|
188
|
-
get: function () {
|
|
189
|
-
return this.getAll(items.OBJ_SPECTATOR_INFO);
|
|
190
|
-
},
|
|
191
|
-
enumerable: false,
|
|
192
|
-
configurable: true
|
|
193
|
-
});
|
|
194
|
-
SnapshotWrapper.prototype.getTypeId = function (name) {
|
|
195
|
-
var _a;
|
|
196
|
-
return ((_a = this._client.rawSnapUnpacker.uuid_manager.LookupName(name)) === null || _a === void 0 ? void 0 : _a.type_id) || -1;
|
|
197
|
-
};
|
|
198
|
-
SnapshotWrapper.prototype.getObjExMyOwnObject = function (id) {
|
|
199
|
-
return this.getParsed(this.getTypeId("my-own-object@heinrich5991.de"), id);
|
|
200
|
-
};
|
|
201
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExMyOwnObject", {
|
|
202
|
-
get: function () {
|
|
203
|
-
return this.getAll(this.getTypeId("my-own-object@heinrich5991.de"));
|
|
204
|
-
},
|
|
205
|
-
enumerable: false,
|
|
206
|
-
configurable: true
|
|
207
|
-
});
|
|
208
|
-
SnapshotWrapper.prototype.getObjExDDNetCharacter = function (id) {
|
|
209
|
-
return this.getParsed(this.getTypeId("character@netobj.ddnet.tw"), id);
|
|
210
|
-
};
|
|
211
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExDDNetCharacter", {
|
|
212
|
-
get: function () {
|
|
213
|
-
return this.getAll(this.getTypeId("character@netobj.ddnet.tw"));
|
|
214
|
-
},
|
|
215
|
-
enumerable: false,
|
|
216
|
-
configurable: true
|
|
217
|
-
});
|
|
218
|
-
SnapshotWrapper.prototype.getObjExGameInfo = function (id) {
|
|
219
|
-
return this.getParsed(this.getTypeId("gameinfo@netobj.ddnet.tw"), id);
|
|
220
|
-
};
|
|
221
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExGameInfo", {
|
|
222
|
-
get: function () {
|
|
223
|
-
return this.getAll(this.getTypeId("gameinfo@netobj.ddnet.tw"));
|
|
224
|
-
},
|
|
225
|
-
enumerable: false,
|
|
226
|
-
configurable: true
|
|
227
|
-
});
|
|
228
|
-
SnapshotWrapper.prototype.getObjExDDNetProjectile = function (id) {
|
|
229
|
-
return this.getParsed(this.getTypeId("projectile@netobj.ddnet.tw"), id);
|
|
230
|
-
};
|
|
231
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExDDNetProjectile", {
|
|
232
|
-
get: function () {
|
|
233
|
-
return this.getAll(this.getTypeId("projectile@netobj.ddnet.tw"));
|
|
234
|
-
},
|
|
235
|
-
enumerable: false,
|
|
236
|
-
configurable: true
|
|
237
|
-
});
|
|
238
|
-
SnapshotWrapper.prototype.getObjExLaser = function (id) {
|
|
239
|
-
return this.getParsed(this.getTypeId("laser@netobj.ddnet.tw"), id);
|
|
240
|
-
};
|
|
241
|
-
Object.defineProperty(SnapshotWrapper.prototype, "AllObjExLaser", {
|
|
242
|
-
get: function () {
|
|
243
|
-
return this.getAll(this.getTypeId("laser@netobj.ddnet.tw"));
|
|
244
|
-
},
|
|
245
|
-
enumerable: false,
|
|
246
|
-
configurable: true
|
|
247
|
-
});
|
|
248
|
-
Object.defineProperty(SnapshotWrapper.prototype, "OwnID", {
|
|
249
|
-
get: function () {
|
|
250
|
-
var _a;
|
|
251
|
-
return (_a = this.AllObjPlayerInfo.find(function (parsed) { return parsed.local; })) === null || _a === void 0 ? void 0 : _a.client_id;
|
|
252
|
-
},
|
|
253
|
-
enumerable: false,
|
|
254
|
-
configurable: true
|
|
255
|
-
});
|
|
256
|
-
return SnapshotWrapper;
|
|
257
|
-
}(stream_1.EventEmitter));
|
|
258
|
-
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;
|