@nodemod/core 1.0.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.
Files changed (60) hide show
  1. package/README.md +60 -0
  2. package/dist/core/cmd.d.ts +148 -0
  3. package/dist/core/cmd.d.ts.map +1 -0
  4. package/dist/core/cmd.js +177 -0
  5. package/dist/core/cmd.js.map +1 -0
  6. package/dist/core/menu.d.ts +300 -0
  7. package/dist/core/menu.d.ts.map +1 -0
  8. package/dist/core/menu.js +449 -0
  9. package/dist/core/menu.js.map +1 -0
  10. package/dist/core/msg.d.ts +300 -0
  11. package/dist/core/msg.d.ts.map +1 -0
  12. package/dist/core/msg.js +374 -0
  13. package/dist/core/msg.js.map +1 -0
  14. package/dist/core/resource.d.ts +137 -0
  15. package/dist/core/resource.d.ts.map +1 -0
  16. package/dist/core/resource.js +171 -0
  17. package/dist/core/resource.js.map +1 -0
  18. package/dist/core/sound.d.ts +262 -0
  19. package/dist/core/sound.d.ts.map +1 -0
  20. package/dist/core/sound.js +300 -0
  21. package/dist/core/sound.js.map +1 -0
  22. package/dist/enhanced/entity.d.ts +263 -0
  23. package/dist/enhanced/entity.d.ts.map +1 -0
  24. package/dist/enhanced/entity.js +447 -0
  25. package/dist/enhanced/entity.js.map +1 -0
  26. package/dist/enhanced/events.d.ts +257 -0
  27. package/dist/enhanced/events.d.ts.map +1 -0
  28. package/dist/enhanced/events.js +350 -0
  29. package/dist/enhanced/events.js.map +1 -0
  30. package/dist/enhanced/player.d.ts +272 -0
  31. package/dist/enhanced/player.d.ts.map +1 -0
  32. package/dist/enhanced/player.js +389 -0
  33. package/dist/enhanced/player.js.map +1 -0
  34. package/dist/enhanced/trace.d.ts +198 -0
  35. package/dist/enhanced/trace.d.ts.map +1 -0
  36. package/dist/enhanced/trace.js +311 -0
  37. package/dist/enhanced/trace.js.map +1 -0
  38. package/dist/index.d.ts +88 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +120 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/native/cvar.d.ts +49 -0
  43. package/dist/native/cvar.d.ts.map +1 -0
  44. package/dist/native/cvar.js +169 -0
  45. package/dist/native/cvar.js.map +1 -0
  46. package/dist/native/file.d.ts +221 -0
  47. package/dist/native/file.d.ts.map +1 -0
  48. package/dist/native/file.js +353 -0
  49. package/dist/native/file.js.map +1 -0
  50. package/dist/types/dll.d.ts +109 -0
  51. package/dist/types/engine.d.ts +319 -0
  52. package/dist/types/enums.d.ts +434 -0
  53. package/dist/types/events.d.ts +2432 -0
  54. package/dist/types/index.d.ts +38 -0
  55. package/dist/types/structures.d.ts +1144 -0
  56. package/dist/utils/util.d.ts +202 -0
  57. package/dist/utils/util.d.ts.map +1 -0
  58. package/dist/utils/util.js +318 -0
  59. package/dist/utils/util.js.map +1 -0
  60. package/package.json +167 -0
@@ -0,0 +1,300 @@
1
+ import { EventEmitter } from 'events';
2
+ import type NodemodUtil from '../utils/util';
3
+ /**
4
+ * Represents a single piece of message data with its type and value.
5
+ */
6
+ export interface MessageData {
7
+ /** The data type for network serialization */
8
+ type: 'byte' | 'char' | 'short' | 'long' | 'angle' | 'coord' | 'string' | 'entity';
9
+ /** The actual value to be sent */
10
+ value: any;
11
+ }
12
+ /**
13
+ * Internal state tracking for message processing.
14
+ */
15
+ export interface MessageState {
16
+ /** Message destination flags */
17
+ dest: number;
18
+ /** Message type ID */
19
+ type: number;
20
+ /** Message name/identifier */
21
+ name: string;
22
+ /** 3D origin coordinates */
23
+ origin: number[];
24
+ /** Target entity (if applicable) */
25
+ entity?: nodemod.Entity | null;
26
+ /** Processed data array */
27
+ data: any[];
28
+ /** Raw message data with type information */
29
+ rawData: MessageData[];
30
+ /** Flag indicating message processing is complete */
31
+ isMessageEnd?: boolean;
32
+ }
33
+ /**
34
+ * Options for sending a message to clients.
35
+ */
36
+ export interface SendOptions {
37
+ /** Message type name or numeric ID */
38
+ type: string | number;
39
+ /** Message destination (defaults based on entity presence) */
40
+ dest?: number;
41
+ /** Target entity, entity index, or null for broadcasts */
42
+ entity?: nodemod.Entity | number | null;
43
+ /** 3D origin coordinates for positional messages */
44
+ origin?: number[];
45
+ /** Array of message data to send */
46
+ data: MessageData[];
47
+ }
48
+ /**
49
+ * Message destination constants for targeting different groups of clients.
50
+ */
51
+ export declare const MsgDest: {
52
+ /** Message to all players without delivery guarantee */
53
+ broadcast: number;
54
+ /** Message to one player with delivery guarantee */
55
+ one: number;
56
+ /** Message with delivery guarantee to all players */
57
+ all: number;
58
+ /** Write to the init string */
59
+ init: number;
60
+ /** All players in potentially visible set of point */
61
+ pvs: number;
62
+ /** All players in potentially audible set */
63
+ pas: number;
64
+ /** All players in PVS with reliable delivery */
65
+ pvs_r: number;
66
+ /** All players in PAS with reliable delivery */
67
+ pas_r: number;
68
+ /** Message to one player without delivery guarantee */
69
+ one_unreliable: number;
70
+ /** Message to all HLTV proxy */
71
+ spec: number;
72
+ };
73
+ /**
74
+ * Engine message type constants for different types of network messages.
75
+ */
76
+ export declare const MsgTypes: {
77
+ /** Invalid message type */
78
+ bad: number;
79
+ /** No operation */
80
+ nop: number;
81
+ /** Client disconnect message */
82
+ disconnect: number;
83
+ /** Event message */
84
+ event: number;
85
+ /** Version information */
86
+ version: number;
87
+ /** Set client view */
88
+ setview: number;
89
+ /** Sound message */
90
+ sound: number;
91
+ /** Time synchronization */
92
+ time: number;
93
+ /** Print message to console */
94
+ print: number;
95
+ /** Send command to client */
96
+ stufftext: number;
97
+ /** Set client view angle */
98
+ setangle: number;
99
+ /** Server information */
100
+ serverinfo: number;
101
+ /** Light style update */
102
+ lightstyle: number;
103
+ /** Update user information */
104
+ updateuserinfo: number;
105
+ /** Delta description */
106
+ deltadescription: number;
107
+ /** Client data update */
108
+ clientdata: number;
109
+ /** Stop sound */
110
+ stopsound: number;
111
+ /** Ping information */
112
+ pings: number;
113
+ /** Particle effect */
114
+ particle: number;
115
+ /** Damage indicator */
116
+ damage: number;
117
+ /** Spawn static entity */
118
+ spawnstatic: number;
119
+ /** Reliable event */
120
+ event_reliable: number;
121
+ /** Spawn baseline */
122
+ spawnbaseline: number;
123
+ /** Temporary entity */
124
+ tempentity: number;
125
+ /** Set game pause state */
126
+ setpause: number;
127
+ /** Sign-on number */
128
+ signonnum: number;
129
+ /** Center print message */
130
+ centerprint: number;
131
+ /** Monster killed notification */
132
+ killedmonster: number;
133
+ /** Secret found notification */
134
+ foundsecret: number;
135
+ /** Spawn static sound */
136
+ spawnstaticsound: number;
137
+ /** Intermission state */
138
+ intermission: number;
139
+ /** Finale message */
140
+ finale: number;
141
+ /** CD track change */
142
+ cdtrack: number;
143
+ /** Game state restore */
144
+ restore: number;
145
+ /** Cutscene message */
146
+ cutscene: number;
147
+ /** Weapon animation */
148
+ weaponanim: number;
149
+ /** Decal name */
150
+ decalname: number;
151
+ /** Room type for audio */
152
+ roomtype: number;
153
+ /** Add to view angle */
154
+ addangle: number;
155
+ /** New user message registration */
156
+ newusermsg: number;
157
+ /** Packet entities */
158
+ packetentities: number;
159
+ /** Delta packet entities */
160
+ deltapacketentities: number;
161
+ /** Network choke */
162
+ choke: number;
163
+ /** Resource list */
164
+ resourcelist: number;
165
+ /** New movement variables */
166
+ newmovevars: number;
167
+ /** Resource request */
168
+ resourcerequest: number;
169
+ /** Client customization */
170
+ customization: number;
171
+ /** Crosshair angle */
172
+ crosshairangle: number;
173
+ /** Sound fade */
174
+ soundfade: number;
175
+ /** File transfer failed */
176
+ filetxferfailed: number;
177
+ /** HLTV message */
178
+ hltv: number;
179
+ /** Director message */
180
+ director: number;
181
+ /** Voice initialization */
182
+ voiceinit: number;
183
+ /** Voice data */
184
+ voicedata: number;
185
+ /** Send extra info */
186
+ sendextrainfo: number;
187
+ /** Time scale */
188
+ timescale: number;
189
+ /** Resource location */
190
+ resourcelocation: number;
191
+ /** Send CVAR value */
192
+ sendcvarvalue: number;
193
+ /** Send CVAR value (v2) */
194
+ sendcvarvalue2: number;
195
+ };
196
+ /**
197
+ * Message system for handling network communication between server and clients.
198
+ * Provides an event-driven interface for intercepting and sending game messages.
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * // Listen for a specific message
203
+ * nodemodCore.msg.on('ShowMenu', (state) => {
204
+ * console.log('Menu message intercepted:', state);
205
+ * });
206
+ *
207
+ * // Send a message to all clients
208
+ * nodemodCore.msg.send({
209
+ * type: 'TextMsg',
210
+ * data: [
211
+ * { type: 'byte', value: 4 }, // HUD_PRINTCENTER
212
+ * { type: 'string', value: 'Welcome to the server!' }
213
+ * ]
214
+ * });
215
+ *
216
+ * // Send a message to specific player
217
+ * nodemodCore.msg.send({
218
+ * type: 'ShowMenu',
219
+ * entity: player,
220
+ * data: [
221
+ * { type: 'short', value: 1023 },
222
+ * { type: 'char', value: 30 },
223
+ * { type: 'byte', value: false },
224
+ * { type: 'string', value: 'Menu text here' }
225
+ * ]
226
+ * });
227
+ * ```
228
+ */
229
+ export default class NodemodMsg extends EventEmitter {
230
+ /** Utility service for entity operations */
231
+ private util;
232
+ /** Current message processing state */
233
+ private state;
234
+ /** Map of registered user message types */
235
+ private registeredEventTypes;
236
+ /**
237
+ * Creates a new NodemodMsg instance.
238
+ *
239
+ * @param utilService - Optional utility service (can be injected later)
240
+ */
241
+ constructor(utilService?: NodemodUtil | null);
242
+ /**
243
+ * Sets the utility service after construction.
244
+ * Used for dependency injection when service isn't available during construction.
245
+ *
246
+ * @param utilService - The utility service instance
247
+ */
248
+ setUtilService(utilService: NodemodUtil): void;
249
+ private initializeEventHandlers;
250
+ private writers;
251
+ private writeValue;
252
+ /**
253
+ * Registers a new user message type with the engine.
254
+ *
255
+ * @param eventName - Name of the message type
256
+ * @param size - Maximum size of the message (-1 for variable size)
257
+ * @returns Message type ID, or MsgTypes.bad if registration failed
258
+ */
259
+ register(eventName: string, size?: number): number;
260
+ /**
261
+ * Gets the message ID for a user message, registering it if necessary.
262
+ *
263
+ * @param name - Message name
264
+ * @param size - Message size (-1 for variable)
265
+ * @returns Message ID
266
+ */
267
+ getUserMsgId(name: string, size?: number): number;
268
+ /**
269
+ * Sends a message to clients.
270
+ *
271
+ * @param options - Message sending options
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * // Send text message to all clients
276
+ * nodemodCore.msg.send({
277
+ * type: 'TextMsg',
278
+ * dest: MsgDest.all,
279
+ * data: [
280
+ * { type: 'byte', value: 4 }, // HUD_PRINTCENTER
281
+ * { type: 'string', value: 'Server announcement!' }
282
+ * ]
283
+ * });
284
+ *
285
+ * // Send menu to specific player
286
+ * nodemodCore.msg.send({
287
+ * type: 'ShowMenu',
288
+ * entity: player,
289
+ * data: [
290
+ * { type: 'short', value: 511 }, // key mask
291
+ * { type: 'char', value: 30 }, // display time
292
+ * { type: 'byte', value: false }, // multi-part
293
+ * { type: 'string', value: '1. Option 1\n2. Option 2' }
294
+ * ]
295
+ * });
296
+ * ```
297
+ */
298
+ send(options: SendOptions): void;
299
+ }
300
+ //# sourceMappingURL=msg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"msg.d.ts","sourceRoot":"","sources":["../../src/core/msg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnF,kCAAkC;IAClC,KAAK,EAAE,GAAG,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oCAAoC;IACpC,MAAM,CAAC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IACH,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CA8CjC"}
@@ -0,0 +1,374 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MsgTypes = exports.MsgDest = void 0;
4
+ const events_1 = require("events");
5
+ // Extend the nodemod namespace to include missing methods
6
+ // Beautiful dependency injection for util service
7
+ /**
8
+ * Message destination constants for targeting different groups of clients.
9
+ */
10
+ exports.MsgDest = {
11
+ /** Message to all players without delivery guarantee */
12
+ broadcast: 0,
13
+ /** Message to one player with delivery guarantee */
14
+ one: 1,
15
+ /** Message with delivery guarantee to all players */
16
+ all: 2,
17
+ /** Write to the init string */
18
+ init: 3,
19
+ /** All players in potentially visible set of point */
20
+ pvs: 4,
21
+ /** All players in potentially audible set */
22
+ pas: 5,
23
+ /** All players in PVS with reliable delivery */
24
+ pvs_r: 6,
25
+ /** All players in PAS with reliable delivery */
26
+ pas_r: 7,
27
+ /** Message to one player without delivery guarantee */
28
+ one_unreliable: 8,
29
+ /** Message to all HLTV proxy */
30
+ spec: 9
31
+ };
32
+ /**
33
+ * Engine message type constants for different types of network messages.
34
+ */
35
+ exports.MsgTypes = {
36
+ /** Invalid message type */
37
+ bad: 0,
38
+ /** No operation */
39
+ nop: 1,
40
+ /** Client disconnect message */
41
+ disconnect: 2,
42
+ /** Event message */
43
+ event: 3,
44
+ /** Version information */
45
+ version: 4,
46
+ /** Set client view */
47
+ setview: 5,
48
+ /** Sound message */
49
+ sound: 6,
50
+ /** Time synchronization */
51
+ time: 7,
52
+ /** Print message to console */
53
+ print: 8,
54
+ /** Send command to client */
55
+ stufftext: 9,
56
+ /** Set client view angle */
57
+ setangle: 10,
58
+ /** Server information */
59
+ serverinfo: 11,
60
+ /** Light style update */
61
+ lightstyle: 12,
62
+ /** Update user information */
63
+ updateuserinfo: 13,
64
+ /** Delta description */
65
+ deltadescription: 14,
66
+ /** Client data update */
67
+ clientdata: 15,
68
+ /** Stop sound */
69
+ stopsound: 16,
70
+ /** Ping information */
71
+ pings: 17,
72
+ /** Particle effect */
73
+ particle: 18,
74
+ /** Damage indicator */
75
+ damage: 19,
76
+ /** Spawn static entity */
77
+ spawnstatic: 20,
78
+ /** Reliable event */
79
+ event_reliable: 21,
80
+ /** Spawn baseline */
81
+ spawnbaseline: 22,
82
+ /** Temporary entity */
83
+ tempentity: 23,
84
+ /** Set game pause state */
85
+ setpause: 24,
86
+ /** Sign-on number */
87
+ signonnum: 25,
88
+ /** Center print message */
89
+ centerprint: 26,
90
+ /** Monster killed notification */
91
+ killedmonster: 27,
92
+ /** Secret found notification */
93
+ foundsecret: 28,
94
+ /** Spawn static sound */
95
+ spawnstaticsound: 29,
96
+ /** Intermission state */
97
+ intermission: 30,
98
+ /** Finale message */
99
+ finale: 31,
100
+ /** CD track change */
101
+ cdtrack: 32,
102
+ /** Game state restore */
103
+ restore: 33,
104
+ /** Cutscene message */
105
+ cutscene: 34,
106
+ /** Weapon animation */
107
+ weaponanim: 35,
108
+ /** Decal name */
109
+ decalname: 36,
110
+ /** Room type for audio */
111
+ roomtype: 37,
112
+ /** Add to view angle */
113
+ addangle: 38,
114
+ /** New user message registration */
115
+ newusermsg: 39,
116
+ /** Packet entities */
117
+ packetentities: 40,
118
+ /** Delta packet entities */
119
+ deltapacketentities: 41,
120
+ /** Network choke */
121
+ choke: 42,
122
+ /** Resource list */
123
+ resourcelist: 43,
124
+ /** New movement variables */
125
+ newmovevars: 44,
126
+ /** Resource request */
127
+ resourcerequest: 45,
128
+ /** Client customization */
129
+ customization: 46,
130
+ /** Crosshair angle */
131
+ crosshairangle: 47,
132
+ /** Sound fade */
133
+ soundfade: 48,
134
+ /** File transfer failed */
135
+ filetxferfailed: 49,
136
+ /** HLTV message */
137
+ hltv: 50,
138
+ /** Director message */
139
+ director: 51,
140
+ /** Voice initialization */
141
+ voiceinit: 52,
142
+ /** Voice data */
143
+ voicedata: 53,
144
+ /** Send extra info */
145
+ sendextrainfo: 54,
146
+ /** Time scale */
147
+ timescale: 55,
148
+ /** Resource location */
149
+ resourcelocation: 56,
150
+ /** Send CVAR value */
151
+ sendcvarvalue: 57,
152
+ /** Send CVAR value (v2) */
153
+ sendcvarvalue2: 58
154
+ };
155
+ /**
156
+ * Message system for handling network communication between server and clients.
157
+ * Provides an event-driven interface for intercepting and sending game messages.
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * // Listen for a specific message
162
+ * nodemodCore.msg.on('ShowMenu', (state) => {
163
+ * console.log('Menu message intercepted:', state);
164
+ * });
165
+ *
166
+ * // Send a message to all clients
167
+ * nodemodCore.msg.send({
168
+ * type: 'TextMsg',
169
+ * data: [
170
+ * { type: 'byte', value: 4 }, // HUD_PRINTCENTER
171
+ * { type: 'string', value: 'Welcome to the server!' }
172
+ * ]
173
+ * });
174
+ *
175
+ * // Send a message to specific player
176
+ * nodemodCore.msg.send({
177
+ * type: 'ShowMenu',
178
+ * entity: player,
179
+ * data: [
180
+ * { type: 'short', value: 1023 },
181
+ * { type: 'char', value: 30 },
182
+ * { type: 'byte', value: false },
183
+ * { type: 'string', value: 'Menu text here' }
184
+ * ]
185
+ * });
186
+ * ```
187
+ */
188
+ class NodemodMsg extends events_1.EventEmitter {
189
+ /** Utility service for entity operations */
190
+ util;
191
+ /** Current message processing state */
192
+ state;
193
+ /** Map of registered user message types */
194
+ registeredEventTypes;
195
+ /**
196
+ * Creates a new NodemodMsg instance.
197
+ *
198
+ * @param utilService - Optional utility service (can be injected later)
199
+ */
200
+ constructor(utilService = null) {
201
+ super();
202
+ this.util = utilService; // Will be null initially, injected later
203
+ this.state = null;
204
+ this.registeredEventTypes = {};
205
+ try {
206
+ this.initializeEventHandlers();
207
+ }
208
+ catch (error) {
209
+ // Ignore errors if nodemod is not available (outside HLDS environment)
210
+ }
211
+ }
212
+ /**
213
+ * Sets the utility service after construction.
214
+ * Used for dependency injection when service isn't available during construction.
215
+ *
216
+ * @param utilService - The utility service instance
217
+ */
218
+ setUtilService(utilService) {
219
+ this.util = utilService;
220
+ }
221
+ initializeEventHandlers() {
222
+ this.on('newListener', (eventName) => this.getUserMsgId(eventName.replace(/^post:/, '')));
223
+ nodemod.on('engMessageBegin', (msg_dest, msg_type, origin, entity) => {
224
+ const name = nodemod.getUserMsgName(msg_type);
225
+ if (!this.listeners(name).length && !this.listeners(`post:${name}`).length) {
226
+ return;
227
+ }
228
+ this.state = { dest: msg_dest, type: msg_type, name, origin, entity, data: [], rawData: [] };
229
+ });
230
+ // POST because programmer might want to send a new message immediately from notification
231
+ nodemod.on('engMessageEnd', () => {
232
+ if (!this.state) {
233
+ return;
234
+ }
235
+ const state = this.state;
236
+ this.emit(state.name, state);
237
+ this.state.isMessageEnd = true; // so that write methods are not called repeatedly
238
+ this.state.rawData.map(v => this.writers[v.type](v.value));
239
+ this.state.data = this.state.rawData.map(v => v.value);
240
+ });
241
+ nodemod.on('postEngMessageEnd', () => {
242
+ if (!this.state) {
243
+ return;
244
+ }
245
+ const state = this.state;
246
+ this.state = null;
247
+ this.emit(`post:${state.name}`, state);
248
+ });
249
+ nodemod.on('engWriteByte', (v) => this.writeValue(v || 0, 'byte'));
250
+ nodemod.on('engWriteChar', (v) => this.writeValue(v || 0, 'char'));
251
+ nodemod.on('engWriteShort', (v) => this.writeValue(v || 0, 'short'));
252
+ nodemod.on('engWriteLong', (v) => this.writeValue(v || 0, 'long'));
253
+ nodemod.on('engWriteAngle', (v) => this.writeValue(v || 0, 'angle'));
254
+ nodemod.on('engWriteCoord', (v) => this.writeValue(v || 0, 'coord'));
255
+ nodemod.on('engWriteString', (v) => this.writeValue(v || '', 'string'));
256
+ nodemod.on('engWriteEntity', (v) => this.writeValue(v, 'entity'));
257
+ }
258
+ writers = {
259
+ byte: (v) => nodemod.eng.writeByte(v),
260
+ char: (v) => nodemod.eng.writeChar(v),
261
+ short: (v) => nodemod.eng.writeShort(v),
262
+ long: (v) => nodemod.eng.writeLong(v),
263
+ angle: (v) => nodemod.eng.writeAngle(v),
264
+ coord: (v) => nodemod.eng.writeCoord(v),
265
+ string: (v) => nodemod.eng.writeString(v || ''),
266
+ entity: (v) => nodemod.eng.writeEntity(typeof v === 'number' ? v : nodemod.eng.indexOfEdict(v)),
267
+ };
268
+ writeValue(value, type) {
269
+ if (!this.state || this.state.isMessageEnd) {
270
+ nodemod.setMetaResult(0 /* nodemod.META_RES.UNSET */);
271
+ return;
272
+ }
273
+ this.state.data.push(value);
274
+ this.state.rawData.push({ type, value });
275
+ nodemod.setMetaResult(4 /* nodemod.META_RES.SUPERCEDE */);
276
+ }
277
+ /**
278
+ * Registers a new user message type with the engine.
279
+ *
280
+ * @param eventName - Name of the message type
281
+ * @param size - Maximum size of the message (-1 for variable size)
282
+ * @returns Message type ID, or MsgTypes.bad if registration failed
283
+ */
284
+ register(eventName, size = -1) {
285
+ const eventId = nodemod.getUserMsgId(eventName) ?? nodemod.eng.regUserMsg(eventName, size);
286
+ if (eventId === exports.MsgTypes.bad) {
287
+ // Doesn't seem to be registered still.
288
+ return eventId;
289
+ }
290
+ this.registeredEventTypes[eventId.toString()] = eventName;
291
+ return eventId;
292
+ }
293
+ /**
294
+ * Gets the message ID for a user message, registering it if necessary.
295
+ *
296
+ * @param name - Message name
297
+ * @param size - Message size (-1 for variable)
298
+ * @returns Message ID
299
+ */
300
+ getUserMsgId(name, size = -1) {
301
+ const entry = Object.entries(this.registeredEventTypes).find(v => v[1] === name);
302
+ return entry ? parseInt(entry[0]) : this.register(name, size);
303
+ }
304
+ /**
305
+ * Sends a message to clients.
306
+ *
307
+ * @param options - Message sending options
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * // Send text message to all clients
312
+ * nodemodCore.msg.send({
313
+ * type: 'TextMsg',
314
+ * dest: MsgDest.all,
315
+ * data: [
316
+ * { type: 'byte', value: 4 }, // HUD_PRINTCENTER
317
+ * { type: 'string', value: 'Server announcement!' }
318
+ * ]
319
+ * });
320
+ *
321
+ * // Send menu to specific player
322
+ * nodemodCore.msg.send({
323
+ * type: 'ShowMenu',
324
+ * entity: player,
325
+ * data: [
326
+ * { type: 'short', value: 511 }, // key mask
327
+ * { type: 'char', value: 30 }, // display time
328
+ * { type: 'byte', value: false }, // multi-part
329
+ * { type: 'string', value: '1. Option 1\n2. Option 2' }
330
+ * ]
331
+ * });
332
+ * ```
333
+ */
334
+ send(options) {
335
+ if (options.type === exports.MsgTypes.bad) {
336
+ console.error(`[NodemodMsg] Invalid message type 'bad' specified`);
337
+ return;
338
+ }
339
+ const dest = options.dest ?? (options.entity ? exports.MsgDest.one : exports.MsgDest.all);
340
+ let finalEntity = null;
341
+ // For broadcast destinations, always use null
342
+ const broadcastDestinations = [exports.MsgDest.broadcast, exports.MsgDest.all, exports.MsgDest.init, exports.MsgDest.pvs, exports.MsgDest.pas, exports.MsgDest.pvs_r, exports.MsgDest.pas_r, exports.MsgDest.spec];
343
+ if (broadcastDestinations.includes(dest)) {
344
+ finalEntity = null;
345
+ }
346
+ else {
347
+ // For targeted messages, convert entity properly
348
+ if (options.entity) {
349
+ if (this.util) {
350
+ finalEntity = this.util.forceEntityObject(options.entity) || nodemod.eng.pEntityOfEntIndex(0);
351
+ }
352
+ else if (typeof options.entity === 'number') {
353
+ finalEntity = nodemod.eng.pEntityOfEntIndex(options.entity);
354
+ }
355
+ else {
356
+ finalEntity = options.entity;
357
+ }
358
+ }
359
+ else {
360
+ finalEntity = nodemod.eng.pEntityOfEntIndex(0);
361
+ }
362
+ }
363
+ let type = typeof options.type === 'string' ? this.getUserMsgId(options.type) : options.type;
364
+ if (type === exports.MsgTypes.bad) {
365
+ console.error(`[NodemodMsg] Failed to send message, unknown type '${options.type}'`);
366
+ return;
367
+ }
368
+ nodemod.eng.messageBegin(dest, type, options.origin || [0, 0, 0], finalEntity);
369
+ options.data.map(v => this.writers[v.type](v.value));
370
+ nodemod.eng.messageEnd();
371
+ }
372
+ }
373
+ exports.default = NodemodMsg;
374
+ //# sourceMappingURL=msg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"msg.js","sourceRoot":"","sources":["../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