ddbot.js-0374 4.4.0 → 4.4.1
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/lib/core/core.d.ts +1 -0
- package/lib/core/core.js +4 -13
- package/lib/core/module.js +1 -0
- package/package.json +1 -1
package/lib/core/core.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import * as Types from '../types.js';
|
|
4
4
|
interface BotEvents {
|
|
5
5
|
error: (...args: any[]) => void;
|
|
6
|
+
destroy: () => void;
|
|
6
7
|
connect: (info: Types.ConnectionInfo) => void;
|
|
7
8
|
disconnect: (reason: string | null, info: Types.ConnectionInfo) => void;
|
|
8
9
|
rawconnect: (info: Types.ConnectionInfo) => void;
|
package/lib/core/core.js
CHANGED
|
@@ -36,17 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.Bot = void 0;
|
|
37
37
|
const Teeworlds = __importStar(require("teeworlds"));
|
|
38
38
|
const events_1 = require("events");
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
name: name,
|
|
42
|
-
clan: "",
|
|
43
|
-
skin: "default",
|
|
44
|
-
use_custom_color: 0,
|
|
45
|
-
color_body: 0,
|
|
46
|
-
color_feet: 0,
|
|
47
|
-
country: 0
|
|
48
|
-
};
|
|
49
|
-
}
|
|
39
|
+
const ddutils_js_1 = require("../ddutils.js");
|
|
50
40
|
class Bot extends events_1.EventEmitter {
|
|
51
41
|
teeworlds;
|
|
52
42
|
client = null;
|
|
@@ -71,7 +61,7 @@ class Bot extends events_1.EventEmitter {
|
|
|
71
61
|
super();
|
|
72
62
|
this.teeworlds = CustomTeeworlds;
|
|
73
63
|
this.options = options;
|
|
74
|
-
this.identity = identity ? identity : DefaultIdentity('nameless tee');
|
|
64
|
+
this.identity = identity ? identity : (0, ddutils_js_1.DefaultIdentity)('nameless tee');
|
|
75
65
|
}
|
|
76
66
|
error(...err) {
|
|
77
67
|
//console.error(err);
|
|
@@ -206,7 +196,7 @@ class Bot extends events_1.EventEmitter {
|
|
|
206
196
|
this.identity =
|
|
207
197
|
typeof identity === 'object' && identity !== null
|
|
208
198
|
? { ...this.identity, ...identity }
|
|
209
|
-
: DefaultIdentity(this.identity.name);
|
|
199
|
+
: (0, ddutils_js_1.DefaultIdentity)(this.identity.name);
|
|
210
200
|
if (this.client && this.status.connect.connected) {
|
|
211
201
|
this.client.game.ChangePlayerInfo(this.identity);
|
|
212
202
|
}
|
|
@@ -320,6 +310,7 @@ class Bot extends events_1.EventEmitter {
|
|
|
320
310
|
await this.disconnect();
|
|
321
311
|
this.removeAllListeners();
|
|
322
312
|
this._clientProxy = null;
|
|
313
|
+
this.emit('destroy');
|
|
323
314
|
}
|
|
324
315
|
on(event, listener) {
|
|
325
316
|
return super.on(event, listener);
|
package/lib/core/module.js
CHANGED