@nodemod/core 1.0.4 → 1.0.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/dist/core/cmd.d.ts +31 -11
- package/dist/core/cmd.d.ts.map +1 -1
- package/dist/core/cmd.js +54 -14
- package/dist/core/cmd.js.map +1 -1
- package/dist/enhanced/events.d.ts +17 -148
- package/dist/enhanced/events.d.ts.map +1 -1
- package/dist/enhanced/events.js +53 -213
- package/dist/enhanced/events.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/core/cmd.d.ts
CHANGED
|
@@ -29,23 +29,28 @@ export interface ServerCommandContext {
|
|
|
29
29
|
/** Array of parsed command arguments, including the command name as the first element */
|
|
30
30
|
args: string[];
|
|
31
31
|
}
|
|
32
|
+
/** Return type for command handlers - can be sync or async */
|
|
33
|
+
type CommandResult = nodemod.META_RES | void | Promise<nodemod.META_RES | void>;
|
|
32
34
|
/**
|
|
33
35
|
* Handler function for console commands (client or server).
|
|
36
|
+
* Can optionally return a META_RES value to set the result.
|
|
34
37
|
*/
|
|
35
38
|
export interface CommandHandler {
|
|
36
|
-
(ctx: CommandContext):
|
|
39
|
+
(ctx: CommandContext): CommandResult;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
42
|
* Handler function for client commands.
|
|
43
|
+
* Can optionally return a META_RES value to set the result.
|
|
40
44
|
*/
|
|
41
45
|
export interface ClientCommandHandler {
|
|
42
|
-
(ctx: ClientCommandContext):
|
|
46
|
+
(ctx: ClientCommandContext): CommandResult;
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
45
49
|
* Handler function for server commands.
|
|
50
|
+
* Can optionally return a META_RES value to set the result.
|
|
46
51
|
*/
|
|
47
52
|
export interface ServerCommandHandler {
|
|
48
|
-
(ctx: ServerCommandContext):
|
|
53
|
+
(ctx: ServerCommandContext): CommandResult;
|
|
49
54
|
}
|
|
50
55
|
/**
|
|
51
56
|
* Configuration options for registering a command.
|
|
@@ -104,11 +109,20 @@ export default class NodemodCmd {
|
|
|
104
109
|
*/
|
|
105
110
|
constructor();
|
|
106
111
|
/**
|
|
107
|
-
* Retrieves
|
|
112
|
+
* Retrieves all registered commands by name and type.
|
|
113
|
+
*
|
|
114
|
+
* @param commandName - The name of the command to find
|
|
115
|
+
* @param type - The type of command ('client', 'server', or 'console')
|
|
116
|
+
* @returns Array of matching command options
|
|
117
|
+
*/
|
|
118
|
+
getCommands(commandName: string, type: string): CommandOptions[];
|
|
119
|
+
/**
|
|
120
|
+
* Retrieves a registered command by name and type (first match only).
|
|
108
121
|
*
|
|
109
122
|
* @param commandName - The name of the command to find
|
|
110
123
|
* @param type - The type of command ('client' or 'server')
|
|
111
124
|
* @returns The command options if found, undefined otherwise
|
|
125
|
+
* @deprecated Use getCommands() for multiple handlers
|
|
112
126
|
*/
|
|
113
127
|
getCommand(commandName: string, type: string): CommandOptions | undefined;
|
|
114
128
|
/**
|
|
@@ -143,6 +157,7 @@ export default class NodemodCmd {
|
|
|
143
157
|
* Convenience method to register a console command that works from both client and server.
|
|
144
158
|
* Similar to AMXX console commands - can be executed by clients or from server console.
|
|
145
159
|
* The handler receives the client (null if from console) and arguments.
|
|
160
|
+
* Can optionally return a META_RES value to set the result.
|
|
146
161
|
*
|
|
147
162
|
* @param name - The command name
|
|
148
163
|
* @param handler - Function that receives the client entity (or null) and arguments
|
|
@@ -155,30 +170,34 @@ export default class NodemodCmd {
|
|
|
155
170
|
* } else {
|
|
156
171
|
* console.log('Server console requested status');
|
|
157
172
|
* }
|
|
173
|
+
* return nodemod.META_RES.SUPERCEDE; // optional
|
|
158
174
|
* });
|
|
159
175
|
* ```
|
|
160
176
|
*/
|
|
161
|
-
register(name: string, handler: (client: nodemod.Entity | null, args: string[]) =>
|
|
177
|
+
register(name: string, handler: (client: nodemod.Entity | null, args: string[]) => CommandResult): void;
|
|
162
178
|
/**
|
|
163
179
|
* Convenience method to register a client-only command with a simplified handler signature.
|
|
164
180
|
* The handler receives the client entity and arguments (excluding the command name).
|
|
181
|
+
* Can optionally return a META_RES value to set the result.
|
|
165
182
|
*
|
|
166
183
|
* @param name - The command name
|
|
167
184
|
* @param handler - Function that receives the client and arguments
|
|
168
185
|
*
|
|
169
186
|
* @example
|
|
170
187
|
* ```typescript
|
|
171
|
-
* nodemodCore.cmd.registerClient('
|
|
172
|
-
* const
|
|
173
|
-
*
|
|
174
|
-
*
|
|
188
|
+
* nodemodCore.cmd.registerClient('say', (client, args) => {
|
|
189
|
+
* const message = args.join(' ');
|
|
190
|
+
* console.log(`${client.name} said: ${message}`);
|
|
191
|
+
* // No return = IGNORED, chat passes through to engine
|
|
192
|
+
* // return nodemod.META_RES.SUPERCEDE; // to block the chat
|
|
175
193
|
* });
|
|
176
194
|
* ```
|
|
177
195
|
*/
|
|
178
|
-
registerClient(name: string, handler: (client: nodemod.Entity, args: string[]) =>
|
|
196
|
+
registerClient(name: string, handler: (client: nodemod.Entity, args: string[]) => CommandResult): void;
|
|
179
197
|
/**
|
|
180
198
|
* Convenience method to register a server command with a simplified handler signature.
|
|
181
199
|
* The handler receives the arguments (excluding the command name) but no client entity.
|
|
200
|
+
* Can optionally return a META_RES value to set the result.
|
|
182
201
|
*
|
|
183
202
|
* @param name - The command name
|
|
184
203
|
* @param handler - Function that receives the command arguments
|
|
@@ -192,7 +211,7 @@ export default class NodemodCmd {
|
|
|
192
211
|
* });
|
|
193
212
|
* ```
|
|
194
213
|
*/
|
|
195
|
-
registerServer(name: string, handler: (args: string[]) =>
|
|
214
|
+
registerServer(name: string, handler: (args: string[]) => CommandResult): void;
|
|
196
215
|
/**
|
|
197
216
|
* Executes a server command through the native engine.
|
|
198
217
|
* Automatically appends a newline character to the command.
|
|
@@ -208,4 +227,5 @@ export default class NodemodCmd {
|
|
|
208
227
|
*/
|
|
209
228
|
run(command: string): void;
|
|
210
229
|
}
|
|
230
|
+
export {};
|
|
211
231
|
//# sourceMappingURL=cmd.d.ts.map
|
package/dist/core/cmd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/core/cmd.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,4EAA4E;IAC5E,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gDAAgD;IAChD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/core/cmd.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,4EAA4E;IAC5E,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gDAAgD;IAChD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACz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,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,aAAa,GAAG,IAAI;IAQvG;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,aAAa,GAAG,IAAI;IAQtG;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,aAAa,GAAG,IAAI;IAS9E;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG3B"}
|
package/dist/core/cmd.js
CHANGED
|
@@ -73,29 +73,64 @@ class NodemodCmd {
|
|
|
73
73
|
*/
|
|
74
74
|
constructor() {
|
|
75
75
|
nodemod.on('dllClientCommand', (client, rtext) => {
|
|
76
|
+
// Check if a previous listener already blocked this command
|
|
77
|
+
if (nodemod.getMetaResult() === 4 /* nodemod.META_RES.SUPERCEDE */) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
76
80
|
const args = this.parseCommand(rtext);
|
|
77
81
|
const commandName = args[0];
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
// Get matching commands by type
|
|
83
|
+
const clientCommands = this.getCommands(commandName, 'client');
|
|
84
|
+
const consoleCommands = this.getCommands(commandName, 'console');
|
|
85
|
+
const commands = [...clientCommands, ...consoleCommands];
|
|
86
|
+
if (commands.length === 0) {
|
|
80
87
|
return;
|
|
81
88
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
// Execute all registered handlers, stopping if one sets SUPERCEDE
|
|
90
|
+
for (const command of commands) {
|
|
91
|
+
let result;
|
|
92
|
+
if (command.type === 'client') {
|
|
93
|
+
const ctx = { text: rtext, args, client };
|
|
94
|
+
result = command.handler(ctx);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const ctx = { text: rtext, args, client };
|
|
98
|
+
result = command.handler(ctx);
|
|
99
|
+
}
|
|
100
|
+
// If handler returned a sync META_RES value, set it (ignore Promises)
|
|
101
|
+
if (typeof result === 'number') {
|
|
102
|
+
nodemod.setMetaResult(result);
|
|
103
|
+
}
|
|
104
|
+
// Check if handler blocked the command - stop processing further handlers
|
|
105
|
+
const mres = nodemod.getMetaResult();
|
|
106
|
+
if (mres === 4 /* nodemod.META_RES.SUPERCEDE */) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
86
109
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
// Auto-SUPERCEDE only for console commands (register/registerServer)
|
|
111
|
+
// Client-only commands (registerClient) let the plugin decide
|
|
112
|
+
if (clientCommands.length === 0 && nodemod.getMetaResult() === 1 /* nodemod.META_RES.IGNORED */) {
|
|
113
|
+
nodemod.setMetaResult(4 /* nodemod.META_RES.SUPERCEDE */);
|
|
90
114
|
}
|
|
91
115
|
});
|
|
92
116
|
}
|
|
93
117
|
/**
|
|
94
|
-
* Retrieves
|
|
118
|
+
* Retrieves all registered commands by name and type.
|
|
119
|
+
*
|
|
120
|
+
* @param commandName - The name of the command to find
|
|
121
|
+
* @param type - The type of command ('client', 'server', or 'console')
|
|
122
|
+
* @returns Array of matching command options
|
|
123
|
+
*/
|
|
124
|
+
getCommands(commandName, type) {
|
|
125
|
+
return this.commands.filter(v => v.name === commandName && v.type === type);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Retrieves a registered command by name and type (first match only).
|
|
95
129
|
*
|
|
96
130
|
* @param commandName - The name of the command to find
|
|
97
131
|
* @param type - The type of command ('client' or 'server')
|
|
98
132
|
* @returns The command options if found, undefined otherwise
|
|
133
|
+
* @deprecated Use getCommands() for multiple handlers
|
|
99
134
|
*/
|
|
100
135
|
getCommand(commandName, type) {
|
|
101
136
|
return this.commands.find(v => v.name === commandName && v.type === type);
|
|
@@ -175,6 +210,7 @@ class NodemodCmd {
|
|
|
175
210
|
* Convenience method to register a console command that works from both client and server.
|
|
176
211
|
* Similar to AMXX console commands - can be executed by clients or from server console.
|
|
177
212
|
* The handler receives the client (null if from console) and arguments.
|
|
213
|
+
* Can optionally return a META_RES value to set the result.
|
|
178
214
|
*
|
|
179
215
|
* @param name - The command name
|
|
180
216
|
* @param handler - Function that receives the client entity (or null) and arguments
|
|
@@ -187,6 +223,7 @@ class NodemodCmd {
|
|
|
187
223
|
* } else {
|
|
188
224
|
* console.log('Server console requested status');
|
|
189
225
|
* }
|
|
226
|
+
* return nodemod.META_RES.SUPERCEDE; // optional
|
|
190
227
|
* });
|
|
191
228
|
* ```
|
|
192
229
|
*/
|
|
@@ -200,16 +237,18 @@ class NodemodCmd {
|
|
|
200
237
|
/**
|
|
201
238
|
* Convenience method to register a client-only command with a simplified handler signature.
|
|
202
239
|
* The handler receives the client entity and arguments (excluding the command name).
|
|
240
|
+
* Can optionally return a META_RES value to set the result.
|
|
203
241
|
*
|
|
204
242
|
* @param name - The command name
|
|
205
243
|
* @param handler - Function that receives the client and arguments
|
|
206
244
|
*
|
|
207
245
|
* @example
|
|
208
246
|
* ```typescript
|
|
209
|
-
* nodemodCore.cmd.registerClient('
|
|
210
|
-
* const
|
|
211
|
-
*
|
|
212
|
-
*
|
|
247
|
+
* nodemodCore.cmd.registerClient('say', (client, args) => {
|
|
248
|
+
* const message = args.join(' ');
|
|
249
|
+
* console.log(`${client.name} said: ${message}`);
|
|
250
|
+
* // No return = IGNORED, chat passes through to engine
|
|
251
|
+
* // return nodemod.META_RES.SUPERCEDE; // to block the chat
|
|
213
252
|
* });
|
|
214
253
|
* ```
|
|
215
254
|
*/
|
|
@@ -223,6 +262,7 @@ class NodemodCmd {
|
|
|
223
262
|
/**
|
|
224
263
|
* Convenience method to register a server command with a simplified handler signature.
|
|
225
264
|
* The handler receives the arguments (excluding the command name) but no client entity.
|
|
265
|
+
* Can optionally return a META_RES value to set the result.
|
|
226
266
|
*
|
|
227
267
|
* @param name - The command name
|
|
228
268
|
* @param handler - Function that receives the command arguments
|
package/dist/core/cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/core/cmd.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/core/cmd.ts"],"names":[],"mappings":";;AAyEA,0DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAqB,UAAU;IAC7B,mCAAmC;IAC3B,QAAQ,GAAqB,EAAE,CAAC;IAExC;;;;;;;;;;;OAWG;IACK,YAAY,CAAC,OAAe;QAClC,MAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,CAAC;QAEV,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAExB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACjB,QAAQ,GAAG,CAAC,QAAQ,CAAC;YACvB,CAAC;iBAAM,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACrC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACnB,OAAO,GAAG,EAAE,CAAC;gBACf,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,IAAI,CAAC;YAClB,CAAC;YACD,CAAC,EAAE,CAAC;QACN,CAAC;QAED,wCAAwC;QACxC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,E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IACH,cAAc,CAAC,IAAY,EAAE,OAA0C;QACrE,IAAI,CAAC,GAAG,CAAC;YACP,IAAI;YACJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC,GAAyB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACnE,CAAC,CAAC;IACL,CAAC;IAGD;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,OAAe;QACjB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;CACF;AAnSD,6BAmSC"}
|
|
@@ -1,134 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
handler: nodemod.EventCallbacks[T];
|
|
7
|
-
/** The original handler function */
|
|
8
|
-
original: nodemod.EventCallbacks[T];
|
|
9
|
-
/** Priority level for execution order */
|
|
10
|
-
priority: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Options for configuring event listeners.
|
|
14
|
-
*/
|
|
15
|
-
export interface EventOptions {
|
|
16
|
-
/** Execute the handler only once, then automatically remove it */
|
|
17
|
-
once?: boolean;
|
|
18
|
-
/** Priority level (higher numbers execute first) */
|
|
19
|
-
priority?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Enhanced player information for connection events.
|
|
23
|
-
*/
|
|
24
|
-
export interface PlayerInfo {
|
|
25
|
-
/** Player entity */
|
|
26
|
-
entity: nodemod.Entity;
|
|
27
|
-
/** Player entity index */
|
|
28
|
-
id: number;
|
|
29
|
-
/** Player display name */
|
|
30
|
-
name: string;
|
|
31
|
-
/** Player IP address (if available) */
|
|
32
|
-
address?: string;
|
|
33
|
-
/** Player Steam ID */
|
|
34
|
-
steamId: string;
|
|
35
|
-
/** Player user ID (if available) */
|
|
36
|
-
userId?: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Enhanced spawn information for entity/player spawn events.
|
|
40
|
-
*/
|
|
41
|
-
export interface SpawnInfo {
|
|
42
|
-
/** Spawned entity */
|
|
43
|
-
entity: nodemod.Entity;
|
|
44
|
-
/** Entity index */
|
|
45
|
-
id: number;
|
|
46
|
-
/** Entity name (for players) */
|
|
47
|
-
name?: string;
|
|
48
|
-
/** Entity class name */
|
|
49
|
-
className: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Frame timing and server state information.
|
|
2
|
+
* Enhanced event utilities providing convenience methods on top of nodemod's native events.
|
|
3
|
+
*
|
|
4
|
+
* Note: For low-level event handling that needs SUPERCEDE support, use nodemod.on() directly.
|
|
5
|
+
* This wrapper provides utilities like once(), waitFor(), throttle(), and debounce().
|
|
53
6
|
*/
|
|
54
|
-
export interface FrameInfo {
|
|
55
|
-
/** Current server time */
|
|
56
|
-
time: number;
|
|
57
|
-
/** Current map name */
|
|
58
|
-
mapname: string;
|
|
59
|
-
/** Number of connected players */
|
|
60
|
-
playerCount: number;
|
|
61
|
-
}
|
|
62
7
|
/** Type alias for event handler functions */
|
|
63
8
|
export type EventHandler<T extends keyof nodemod.EventCallbacks = keyof nodemod.EventCallbacks> = nodemod.EventCallbacks[T];
|
|
64
9
|
/** Type alias for event filtering predicates */
|
|
65
10
|
export type EventPredicate<T extends keyof nodemod.EventCallbacks = keyof nodemod.EventCallbacks> = (...args: Parameters<nodemod.EventCallbacks[T]>) => boolean;
|
|
66
|
-
/** Type alias for event transformation functions */
|
|
67
|
-
export type EventTransformer<T extends keyof nodemod.EventCallbacks = keyof nodemod.EventCallbacks> = (...args: Parameters<nodemod.EventCallbacks[T]>) => any;
|
|
68
11
|
/**
|
|
69
|
-
* Enhanced event
|
|
70
|
-
* Features include priority-based execution, one-time listeners, event filtering, throttling, and debouncing.
|
|
12
|
+
* Enhanced event utilities for nodemod events.
|
|
71
13
|
*
|
|
72
14
|
* @example
|
|
73
15
|
* ```typescript
|
|
74
|
-
* // Basic event listening
|
|
75
|
-
* nodemodCore.events.on('dllClientConnect', (entity, name) => {
|
|
76
|
-
* console.log(`${name} connected`);
|
|
77
|
-
* });
|
|
78
|
-
*
|
|
79
16
|
* // One-time event listener
|
|
80
17
|
* nodemodCore.events.once('dllSpawn', (entity) => {
|
|
81
18
|
* console.log('First spawn event received');
|
|
82
19
|
* });
|
|
83
20
|
*
|
|
84
|
-
* // Priority-based event handling
|
|
85
|
-
* nodemodCore.events.on('dllClientCommand', handleCommand, { priority: 10 });
|
|
86
|
-
* nodemodCore.events.on('dllClientCommand', logCommand, { priority: 1 });
|
|
87
|
-
*
|
|
88
|
-
* // Event filtering
|
|
89
|
-
* nodemodCore.events.filter('dllClientConnect',
|
|
90
|
-
* (entity, name) => name.startsWith('Admin'),
|
|
91
|
-
* (entity, name) => console.log(`Admin ${name} connected`)
|
|
92
|
-
* );
|
|
93
|
-
*
|
|
94
21
|
* // Throttled events (max once per second)
|
|
95
22
|
* nodemodCore.events.throttle('dllStartFrame', frameHandler, 1000);
|
|
23
|
+
*
|
|
24
|
+
* // Wait for event with timeout
|
|
25
|
+
* const [entity, name] = await nodemodCore.events.waitFor('dllClientConnect', 30000);
|
|
96
26
|
* ```
|
|
97
27
|
*/
|
|
98
28
|
export default class NodemodEvents {
|
|
99
|
-
/** Map
|
|
100
|
-
private
|
|
29
|
+
/** Map tracking wrapped handlers for removal */
|
|
30
|
+
private wrappedHandlers;
|
|
101
31
|
/**
|
|
102
|
-
*
|
|
32
|
+
* Adds an event listener. This is a simple wrapper around nodemod.on().
|
|
33
|
+
* For most cases, use nodemod.on() directly.
|
|
103
34
|
*/
|
|
104
|
-
|
|
35
|
+
on<T extends keyof nodemod.EventCallbacks>(eventName: T, handler: nodemod.EventCallbacks[T]): this;
|
|
105
36
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @param eventName - Name of the event to listen for
|
|
109
|
-
* @param handler - Function to execute when event occurs
|
|
110
|
-
* @param options - Additional options for the listener
|
|
111
|
-
* @returns This instance for method chaining
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* // Basic event listener
|
|
116
|
-
* nodemodCore.events.on('dllClientConnect', (entity, name) => {
|
|
117
|
-
* console.log(`${name} joined the server`);
|
|
118
|
-
* });
|
|
119
|
-
*
|
|
120
|
-
* // High-priority listener (executes first)
|
|
121
|
-
* nodemodCore.events.on('dllClientCommand', (entity, command) => {
|
|
122
|
-
* console.log('Processing command:', command);
|
|
123
|
-
* }, { priority: 100 });
|
|
124
|
-
*
|
|
125
|
-
* // One-time listener
|
|
126
|
-
* nodemodCore.events.on('dllSpawn', (entity) => {
|
|
127
|
-
* console.log('First entity spawned');
|
|
128
|
-
* }, { once: true });
|
|
129
|
-
* ```
|
|
37
|
+
* Removes an event listener.
|
|
130
38
|
*/
|
|
131
|
-
on<T extends keyof nodemod.EventCallbacks>(eventName: T, handler: nodemod.EventCallbacks[T], options?: EventOptions): this;
|
|
132
39
|
off<T extends keyof nodemod.EventCallbacks>(eventName: T, handler: nodemod.EventCallbacks[T]): this;
|
|
133
40
|
/**
|
|
134
41
|
* Adds a one-time event listener that automatically removes itself after first execution.
|
|
@@ -139,24 +46,14 @@ export default class NodemodEvents {
|
|
|
139
46
|
*
|
|
140
47
|
* @example
|
|
141
48
|
* ```typescript
|
|
142
|
-
* // Listen for first player connection only
|
|
143
49
|
* nodemodCore.events.once('dllClientConnect', (entity, name) => {
|
|
144
|
-
* console.log(`First player ${name} connected
|
|
145
|
-
* });
|
|
146
|
-
*
|
|
147
|
-
* // Wait for map change
|
|
148
|
-
* nodemodCore.events.once('dllSpawn', () => {
|
|
149
|
-
* console.log('Map fully loaded');
|
|
50
|
+
* console.log(`First player ${name} connected`);
|
|
150
51
|
* });
|
|
151
52
|
* ```
|
|
152
53
|
*/
|
|
153
54
|
once<T extends keyof nodemod.EventCallbacks>(eventName: T, handler: nodemod.EventCallbacks[T]): this;
|
|
154
|
-
clearListeners(eventName?: keyof nodemod.EventCallbacks): this;
|
|
155
|
-
getListeners<T extends keyof nodemod.EventCallbacks>(eventName: T): EventListener<T>[];
|
|
156
|
-
private initializeEvents;
|
|
157
55
|
/**
|
|
158
56
|
* Waits for a specific event to occur and returns its parameters as a promise.
|
|
159
|
-
* Useful for async/await patterns with events.
|
|
160
57
|
*
|
|
161
58
|
* @param eventName - Name of the event to wait for
|
|
162
59
|
* @param timeout - Timeout in milliseconds (default: 10000)
|
|
@@ -164,16 +61,12 @@ export default class NodemodEvents {
|
|
|
164
61
|
*
|
|
165
62
|
* @example
|
|
166
63
|
* ```typescript
|
|
167
|
-
* // Wait for player connection
|
|
168
64
|
* try {
|
|
169
65
|
* const [entity, name] = await nodemodCore.events.waitFor('dllClientConnect', 30000);
|
|
170
66
|
* console.log(`Player ${name} connected within 30 seconds`);
|
|
171
67
|
* } catch (error) {
|
|
172
68
|
* console.log('No player connected within timeout');
|
|
173
69
|
* }
|
|
174
|
-
*
|
|
175
|
-
* // Wait for entity spawn with shorter timeout
|
|
176
|
-
* const [spawnedEntity] = await nodemodCore.events.waitFor('dllSpawn', 5000);
|
|
177
70
|
* ```
|
|
178
71
|
*/
|
|
179
72
|
waitFor<T extends keyof nodemod.EventCallbacks>(eventName: T, timeout?: number): Promise<Parameters<nodemod.EventCallbacks[T]>>;
|
|
@@ -187,24 +80,16 @@ export default class NodemodEvents {
|
|
|
187
80
|
*
|
|
188
81
|
* @example
|
|
189
82
|
* ```typescript
|
|
190
|
-
* // Only handle commands from admins
|
|
191
83
|
* nodemodCore.events.filter('dllClientCommand',
|
|
192
84
|
* (entity, command) => isAdmin(entity),
|
|
193
85
|
* (entity, command) => handleAdminCommand(entity, command)
|
|
194
86
|
* );
|
|
195
|
-
*
|
|
196
|
-
* // Only handle player connections with specific names
|
|
197
|
-
* nodemodCore.events.filter('dllClientConnect',
|
|
198
|
-
* (entity, name) => name.startsWith('VIP_'),
|
|
199
|
-
* (entity, name) => grantVipAccess(entity)
|
|
200
|
-
* );
|
|
201
87
|
* ```
|
|
202
88
|
*/
|
|
203
89
|
filter<T extends keyof nodemod.EventCallbacks>(eventName: T, predicate: EventPredicate<T>, handler: nodemod.EventCallbacks[T]): this;
|
|
204
|
-
map<T extends keyof nodemod.EventCallbacks>(eventName: T, transformer: EventTransformer<T>, newEventName?: keyof nodemod.EventCallbacks): this;
|
|
205
90
|
/**
|
|
206
91
|
* Adds a throttled event listener that limits execution to once per specified interval.
|
|
207
|
-
* Useful for performance optimization with high-frequency events.
|
|
92
|
+
* Useful for performance optimization with high-frequency events like dllStartFrame.
|
|
208
93
|
*
|
|
209
94
|
* @param eventName - Name of the event to listen for
|
|
210
95
|
* @param handler - Function to execute when event occurs
|
|
@@ -213,23 +98,15 @@ export default class NodemodEvents {
|
|
|
213
98
|
*
|
|
214
99
|
* @example
|
|
215
100
|
* ```typescript
|
|
216
|
-
* // Throttle frame events to once per second
|
|
217
101
|
* nodemodCore.events.throttle('dllStartFrame', () => {
|
|
218
102
|
* console.log('Frame update (max once per second)');
|
|
219
103
|
* }, 1000);
|
|
220
|
-
*
|
|
221
|
-
* // Throttle player movement tracking
|
|
222
|
-
* nodemodCore.events.throttle('dllClientCommand', (entity, command) => {
|
|
223
|
-
* if (command.startsWith('+move')) {
|
|
224
|
-
* updatePlayerPosition(entity);
|
|
225
|
-
* }
|
|
226
|
-
* }, 500); // Max twice per second
|
|
227
104
|
* ```
|
|
228
105
|
*/
|
|
229
106
|
throttle<T extends keyof nodemod.EventCallbacks>(eventName: T, handler: nodemod.EventCallbacks[T], delay?: number): this;
|
|
230
107
|
/**
|
|
231
108
|
* Adds a debounced event listener that delays execution until after the specified interval
|
|
232
|
-
* has passed since the last event occurrence.
|
|
109
|
+
* has passed since the last event occurrence.
|
|
233
110
|
*
|
|
234
111
|
* @param eventName - Name of the event to listen for
|
|
235
112
|
* @param handler - Function to execute when event occurs
|
|
@@ -238,14 +115,6 @@ export default class NodemodEvents {
|
|
|
238
115
|
*
|
|
239
116
|
* @example
|
|
240
117
|
* ```typescript
|
|
241
|
-
* // Debounce player input to handle final command only
|
|
242
|
-
* nodemodCore.events.debounce('dllClientCommand', (entity, command) => {
|
|
243
|
-
* if (command.startsWith('buy_')) {
|
|
244
|
-
* processPurchase(entity, command);
|
|
245
|
-
* }
|
|
246
|
-
* }, 300); // Wait 300ms after last buy command
|
|
247
|
-
*
|
|
248
|
-
* // Debounce entity spawning for batch processing
|
|
249
118
|
* nodemodCore.events.debounce('dllSpawn', () => {
|
|
250
119
|
* console.log('Finished spawning entities');
|
|
251
120
|
* optimizeMapEntities();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/enhanced/events.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/enhanced/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6CAA6C;AAC7C,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,OAAO,CAAC,cAAc,GAAG,MAAM,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAE5H,gDAAgD;AAChD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,OAAO,CAAC,cAAc,GAAG,MAAM,OAAO,CAAC,cAAc,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;AAEhK;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,gDAAgD;IAChD,OAAO,CAAC,eAAe,CAAiC;IAExD;;;OAGG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI;IAKlG;;OAE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
+
/**
|
|
3
|
+
* Enhanced event utilities providing convenience methods on top of nodemod's native events.
|
|
4
|
+
*
|
|
5
|
+
* Note: For low-level event handling that needs SUPERCEDE support, use nodemod.on() directly.
|
|
6
|
+
* This wrapper provides utilities like once(), waitFor(), throttle(), and debounce().
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Extend the nodemod namespace to include missing methods
|
|
4
9
|
/**
|
|
5
|
-
* Enhanced event
|
|
6
|
-
* Features include priority-based execution, one-time listeners, event filtering, throttling, and debouncing.
|
|
10
|
+
* Enhanced event utilities for nodemod events.
|
|
7
11
|
*
|
|
8
12
|
* @example
|
|
9
13
|
* ```typescript
|
|
10
|
-
* // Basic event listening
|
|
11
|
-
* nodemodCore.events.on('dllClientConnect', (entity, name) => {
|
|
12
|
-
* console.log(`${name} connected`);
|
|
13
|
-
* });
|
|
14
|
-
*
|
|
15
14
|
* // One-time event listener
|
|
16
15
|
* nodemodCore.events.once('dllSpawn', (entity) => {
|
|
17
16
|
* console.log('First spawn event received');
|
|
18
17
|
* });
|
|
19
18
|
*
|
|
20
|
-
* // Priority-based event handling
|
|
21
|
-
* nodemodCore.events.on('dllClientCommand', handleCommand, { priority: 10 });
|
|
22
|
-
* nodemodCore.events.on('dllClientCommand', logCommand, { priority: 1 });
|
|
23
|
-
*
|
|
24
|
-
* // Event filtering
|
|
25
|
-
* nodemodCore.events.filter('dllClientConnect',
|
|
26
|
-
* (entity, name) => name.startsWith('Admin'),
|
|
27
|
-
* (entity, name) => console.log(`Admin ${name} connected`)
|
|
28
|
-
* );
|
|
29
|
-
*
|
|
30
19
|
* // Throttled events (max once per second)
|
|
31
20
|
* nodemodCore.events.throttle('dllStartFrame', frameHandler, 1000);
|
|
21
|
+
*
|
|
22
|
+
* // Wait for event with timeout
|
|
23
|
+
* const [entity, name] = await nodemodCore.events.waitFor('dllClientConnect', 30000);
|
|
32
24
|
* ```
|
|
33
25
|
*/
|
|
34
26
|
class NodemodEvents {
|
|
35
|
-
/** Map
|
|
36
|
-
|
|
27
|
+
/** Map tracking wrapped handlers for removal */
|
|
28
|
+
wrappedHandlers = new Map();
|
|
37
29
|
/**
|
|
38
|
-
*
|
|
30
|
+
* Adds an event listener. This is a simple wrapper around nodemod.on().
|
|
31
|
+
* For most cases, use nodemod.on() directly.
|
|
39
32
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
on(eventName, handler) {
|
|
34
|
+
nodemod.on(eventName, handler);
|
|
35
|
+
return this;
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @param eventName - Name of the event to listen for
|
|
47
|
-
* @param handler - Function to execute when event occurs
|
|
48
|
-
* @param options - Additional options for the listener
|
|
49
|
-
* @returns This instance for method chaining
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* // Basic event listener
|
|
54
|
-
* nodemodCore.events.on('dllClientConnect', (entity, name) => {
|
|
55
|
-
* console.log(`${name} joined the server`);
|
|
56
|
-
* });
|
|
57
|
-
*
|
|
58
|
-
* // High-priority listener (executes first)
|
|
59
|
-
* nodemodCore.events.on('dllClientCommand', (entity, command) => {
|
|
60
|
-
* console.log('Processing command:', command);
|
|
61
|
-
* }, { priority: 100 });
|
|
62
|
-
*
|
|
63
|
-
* // One-time listener
|
|
64
|
-
* nodemodCore.events.on('dllSpawn', (entity) => {
|
|
65
|
-
* console.log('First entity spawned');
|
|
66
|
-
* }, { once: true });
|
|
67
|
-
* ```
|
|
38
|
+
* Removes an event listener.
|
|
68
39
|
*/
|
|
69
|
-
on(eventName, handler, options = {}) {
|
|
70
|
-
const wrappedHandler = (options.once) ?
|
|
71
|
-
((...args) => {
|
|
72
|
-
handler(...args);
|
|
73
|
-
this.off(eventName, wrappedHandler);
|
|
74
|
-
}) : handler;
|
|
75
|
-
if (!this.eventListeners.has(eventName)) {
|
|
76
|
-
this.eventListeners.set(eventName, []);
|
|
77
|
-
}
|
|
78
|
-
this.eventListeners.get(eventName).push({
|
|
79
|
-
handler: wrappedHandler,
|
|
80
|
-
original: handler,
|
|
81
|
-
priority: options.priority || 0
|
|
82
|
-
});
|
|
83
|
-
// Sort by priority (higher priority first)
|
|
84
|
-
this.eventListeners.get(eventName).sort((a, b) => b.priority - a.priority);
|
|
85
|
-
nodemod.on(eventName, wrappedHandler);
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
// Remove event listener
|
|
89
40
|
off(eventName, handler) {
|
|
90
|
-
if
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
this.eventListeners.delete(eventName);
|
|
99
|
-
}
|
|
41
|
+
// Check if this was a wrapped handler
|
|
42
|
+
const wrapped = this.wrappedHandlers.get(handler);
|
|
43
|
+
if (wrapped) {
|
|
44
|
+
nodemod.removeListener(eventName, wrapped);
|
|
45
|
+
this.wrappedHandlers.delete(handler);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
nodemod.removeListener(eventName, handler);
|
|
100
49
|
}
|
|
101
50
|
return this;
|
|
102
51
|
}
|
|
@@ -109,101 +58,23 @@ class NodemodEvents {
|
|
|
109
58
|
*
|
|
110
59
|
* @example
|
|
111
60
|
* ```typescript
|
|
112
|
-
* // Listen for first player connection only
|
|
113
61
|
* nodemodCore.events.once('dllClientConnect', (entity, name) => {
|
|
114
|
-
* console.log(`First player ${name} connected
|
|
115
|
-
* });
|
|
116
|
-
*
|
|
117
|
-
* // Wait for map change
|
|
118
|
-
* nodemodCore.events.once('dllSpawn', () => {
|
|
119
|
-
* console.log('Map fully loaded');
|
|
62
|
+
* console.log(`First player ${name} connected`);
|
|
120
63
|
* });
|
|
121
64
|
* ```
|
|
122
65
|
*/
|
|
123
66
|
once(eventName, handler) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (eventName) {
|
|
129
|
-
nodemod.clearListeners(eventName);
|
|
130
|
-
this.eventListeners.delete(eventName);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// Clear all listeners
|
|
134
|
-
for (const [event] of this.eventListeners) {
|
|
135
|
-
nodemod.clearListeners(event);
|
|
136
|
-
}
|
|
137
|
-
this.eventListeners.clear();
|
|
138
|
-
}
|
|
139
|
-
return this;
|
|
140
|
-
}
|
|
141
|
-
// Get list of active event listeners
|
|
142
|
-
getListeners(eventName) {
|
|
143
|
-
return this.eventListeners.get(eventName) || [];
|
|
144
|
-
}
|
|
145
|
-
// Initialize commonly used event handlers with utilities
|
|
146
|
-
initializeEvents() {
|
|
147
|
-
// Player connection events with enhanced data
|
|
148
|
-
this.on('dllClientConnect', (entity, name, address, rejectReason) => {
|
|
149
|
-
const playerId = nodemod.eng.indexOfEdict(entity);
|
|
150
|
-
const playerInfo = {
|
|
151
|
-
entity,
|
|
152
|
-
id: playerId,
|
|
153
|
-
name: name,
|
|
154
|
-
address: address,
|
|
155
|
-
steamId: nodemod.eng.getPlayerAuthId(entity),
|
|
156
|
-
userId: nodemod.eng.getPlayerUserId(entity)
|
|
157
|
-
};
|
|
158
|
-
// Custom event - not calling nodemod functions
|
|
159
|
-
});
|
|
160
|
-
this.on('dllClientDisconnect', (entity) => {
|
|
161
|
-
const playerId = nodemod.eng.indexOfEdict(entity);
|
|
162
|
-
const playerInfo = {
|
|
163
|
-
entity,
|
|
164
|
-
id: playerId,
|
|
165
|
-
name: entity.netname,
|
|
166
|
-
steamId: nodemod.eng.getPlayerAuthId(entity)
|
|
167
|
-
};
|
|
168
|
-
// Custom event - not calling nodemod functions
|
|
169
|
-
});
|
|
170
|
-
// Enhanced spawn event
|
|
171
|
-
this.on('dllSpawn', (entity) => {
|
|
172
|
-
if (entity.netname) {
|
|
173
|
-
// Player spawn
|
|
174
|
-
const playerSpawnInfo = {
|
|
175
|
-
entity,
|
|
176
|
-
id: nodemod.eng.indexOfEdict(entity),
|
|
177
|
-
name: entity.netname,
|
|
178
|
-
className: entity.classname
|
|
179
|
-
};
|
|
180
|
-
// Custom event - not calling nodemod functions
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
// Entity spawn
|
|
184
|
-
const entitySpawnInfo = {
|
|
185
|
-
entity,
|
|
186
|
-
id: nodemod.eng.indexOfEdict(entity),
|
|
187
|
-
className: entity.classname
|
|
188
|
-
};
|
|
189
|
-
// Custom event - not calling nodemod functions
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
// Frame timing events
|
|
193
|
-
this.on('dllStartFrame', () => {
|
|
194
|
-
const frameInfo = {
|
|
195
|
-
time: nodemod.time,
|
|
196
|
-
mapname: nodemod.mapname,
|
|
197
|
-
playerCount: nodemod.players.length
|
|
198
|
-
};
|
|
199
|
-
// Custom event - not calling nodemod functions
|
|
67
|
+
const wrappedHandler = ((...args) => {
|
|
68
|
+
nodemod.removeListener(eventName, wrappedHandler);
|
|
69
|
+
this.wrappedHandlers.delete(handler);
|
|
70
|
+
handler(...args);
|
|
200
71
|
});
|
|
72
|
+
this.wrappedHandlers.set(handler, wrappedHandler);
|
|
73
|
+
nodemod.on(eventName, wrappedHandler);
|
|
74
|
+
return this;
|
|
201
75
|
}
|
|
202
|
-
// Custom emit removed - only using nodemod events
|
|
203
|
-
// Event helper methods
|
|
204
76
|
/**
|
|
205
77
|
* Waits for a specific event to occur and returns its parameters as a promise.
|
|
206
|
-
* Useful for async/await patterns with events.
|
|
207
78
|
*
|
|
208
79
|
* @param eventName - Name of the event to wait for
|
|
209
80
|
* @param timeout - Timeout in milliseconds (default: 10000)
|
|
@@ -211,16 +82,12 @@ class NodemodEvents {
|
|
|
211
82
|
*
|
|
212
83
|
* @example
|
|
213
84
|
* ```typescript
|
|
214
|
-
* // Wait for player connection
|
|
215
85
|
* try {
|
|
216
86
|
* const [entity, name] = await nodemodCore.events.waitFor('dllClientConnect', 30000);
|
|
217
87
|
* console.log(`Player ${name} connected within 30 seconds`);
|
|
218
88
|
* } catch (error) {
|
|
219
89
|
* console.log('No player connected within timeout');
|
|
220
90
|
* }
|
|
221
|
-
*
|
|
222
|
-
* // Wait for entity spawn with shorter timeout
|
|
223
|
-
* const [spawnedEntity] = await nodemodCore.events.waitFor('dllSpawn', 5000);
|
|
224
91
|
* ```
|
|
225
92
|
*/
|
|
226
93
|
waitFor(eventName, timeout = 10000) {
|
|
@@ -246,38 +113,25 @@ class NodemodEvents {
|
|
|
246
113
|
*
|
|
247
114
|
* @example
|
|
248
115
|
* ```typescript
|
|
249
|
-
* // Only handle commands from admins
|
|
250
116
|
* nodemodCore.events.filter('dllClientCommand',
|
|
251
117
|
* (entity, command) => isAdmin(entity),
|
|
252
118
|
* (entity, command) => handleAdminCommand(entity, command)
|
|
253
119
|
* );
|
|
254
|
-
*
|
|
255
|
-
* // Only handle player connections with specific names
|
|
256
|
-
* nodemodCore.events.filter('dllClientConnect',
|
|
257
|
-
* (entity, name) => name.startsWith('VIP_'),
|
|
258
|
-
* (entity, name) => grantVipAccess(entity)
|
|
259
|
-
* );
|
|
260
120
|
* ```
|
|
261
121
|
*/
|
|
262
122
|
filter(eventName, predicate, handler) {
|
|
263
|
-
const wrappedHandler =
|
|
123
|
+
const wrappedHandler = ((...args) => {
|
|
264
124
|
if (predicate(...args)) {
|
|
265
|
-
|
|
266
|
-
return handler(...args);
|
|
125
|
+
handler(...args);
|
|
267
126
|
}
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
map(eventName, transformer, newEventName) {
|
|
273
|
-
return this.on(eventName, ((...args) => {
|
|
274
|
-
const transformed = transformer(...args);
|
|
275
|
-
// Note: mapping to custom events not supported in strict mode
|
|
276
|
-
}));
|
|
127
|
+
});
|
|
128
|
+
this.wrappedHandlers.set(handler, wrappedHandler);
|
|
129
|
+
nodemod.on(eventName, wrappedHandler);
|
|
130
|
+
return this;
|
|
277
131
|
}
|
|
278
132
|
/**
|
|
279
133
|
* Adds a throttled event listener that limits execution to once per specified interval.
|
|
280
|
-
* Useful for performance optimization with high-frequency events.
|
|
134
|
+
* Useful for performance optimization with high-frequency events like dllStartFrame.
|
|
281
135
|
*
|
|
282
136
|
* @param eventName - Name of the event to listen for
|
|
283
137
|
* @param handler - Function to execute when event occurs
|
|
@@ -286,34 +140,27 @@ class NodemodEvents {
|
|
|
286
140
|
*
|
|
287
141
|
* @example
|
|
288
142
|
* ```typescript
|
|
289
|
-
* // Throttle frame events to once per second
|
|
290
143
|
* nodemodCore.events.throttle('dllStartFrame', () => {
|
|
291
144
|
* console.log('Frame update (max once per second)');
|
|
292
145
|
* }, 1000);
|
|
293
|
-
*
|
|
294
|
-
* // Throttle player movement tracking
|
|
295
|
-
* nodemodCore.events.throttle('dllClientCommand', (entity, command) => {
|
|
296
|
-
* if (command.startsWith('+move')) {
|
|
297
|
-
* updatePlayerPosition(entity);
|
|
298
|
-
* }
|
|
299
|
-
* }, 500); // Max twice per second
|
|
300
146
|
* ```
|
|
301
147
|
*/
|
|
302
148
|
throttle(eventName, handler, delay = 1000) {
|
|
303
149
|
let lastCall = 0;
|
|
304
|
-
const wrappedHandler =
|
|
150
|
+
const wrappedHandler = ((...args) => {
|
|
305
151
|
const now = Date.now();
|
|
306
152
|
if (now - lastCall >= delay) {
|
|
307
153
|
lastCall = now;
|
|
308
|
-
|
|
309
|
-
return handler(...args);
|
|
154
|
+
handler(...args);
|
|
310
155
|
}
|
|
311
|
-
};
|
|
312
|
-
|
|
156
|
+
});
|
|
157
|
+
this.wrappedHandlers.set(handler, wrappedHandler);
|
|
158
|
+
nodemod.on(eventName, wrappedHandler);
|
|
159
|
+
return this;
|
|
313
160
|
}
|
|
314
161
|
/**
|
|
315
162
|
* Adds a debounced event listener that delays execution until after the specified interval
|
|
316
|
-
* has passed since the last event occurrence.
|
|
163
|
+
* has passed since the last event occurrence.
|
|
317
164
|
*
|
|
318
165
|
* @param eventName - Name of the event to listen for
|
|
319
166
|
* @param handler - Function to execute when event occurs
|
|
@@ -322,14 +169,6 @@ class NodemodEvents {
|
|
|
322
169
|
*
|
|
323
170
|
* @example
|
|
324
171
|
* ```typescript
|
|
325
|
-
* // Debounce player input to handle final command only
|
|
326
|
-
* nodemodCore.events.debounce('dllClientCommand', (entity, command) => {
|
|
327
|
-
* if (command.startsWith('buy_')) {
|
|
328
|
-
* processPurchase(entity, command);
|
|
329
|
-
* }
|
|
330
|
-
* }, 300); // Wait 300ms after last buy command
|
|
331
|
-
*
|
|
332
|
-
* // Debounce entity spawning for batch processing
|
|
333
172
|
* nodemodCore.events.debounce('dllSpawn', () => {
|
|
334
173
|
* console.log('Finished spawning entities');
|
|
335
174
|
* optimizeMapEntities();
|
|
@@ -338,12 +177,13 @@ class NodemodEvents {
|
|
|
338
177
|
*/
|
|
339
178
|
debounce(eventName, handler, delay = 1000) {
|
|
340
179
|
let timeoutId;
|
|
341
|
-
const wrappedHandler =
|
|
180
|
+
const wrappedHandler = ((...args) => {
|
|
342
181
|
clearTimeout(timeoutId);
|
|
343
|
-
// @ts-ignore - TypeScript can't guarantee spread matches exact signature but it's safe here
|
|
344
182
|
timeoutId = setTimeout(() => handler(...args), delay);
|
|
345
|
-
};
|
|
346
|
-
|
|
183
|
+
});
|
|
184
|
+
this.wrappedHandlers.set(handler, wrappedHandler);
|
|
185
|
+
nodemod.on(eventName, wrappedHandler);
|
|
186
|
+
return this;
|
|
347
187
|
}
|
|
348
188
|
}
|
|
349
189
|
exports.default = NodemodEvents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/enhanced/events.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/enhanced/events.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAQH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAqB,aAAa;IAChC,gDAAgD;IACxC,eAAe,GAAG,IAAI,GAAG,EAAsB,CAAC;IAExD;;;OAGG;I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