quake2ts 0.0.288 → 0.0.290

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 (52) hide show
  1. package/package.json +1 -1
  2. package/packages/client/dist/browser/index.global.js +13 -13
  3. package/packages/client/dist/browser/index.global.js.map +1 -1
  4. package/packages/client/dist/cjs/index.cjs +554 -2
  5. package/packages/client/dist/cjs/index.cjs.map +1 -1
  6. package/packages/client/dist/esm/index.js +554 -2
  7. package/packages/client/dist/esm/index.js.map +1 -1
  8. package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
  9. package/packages/engine/dist/browser/index.global.js +16 -16
  10. package/packages/engine/dist/browser/index.global.js.map +1 -1
  11. package/packages/engine/dist/cjs/index.cjs +360 -35
  12. package/packages/engine/dist/cjs/index.cjs.map +1 -1
  13. package/packages/engine/dist/esm/index.js +360 -35
  14. package/packages/engine/dist/esm/index.js.map +1 -1
  15. package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
  16. package/packages/engine/dist/types/audio/constants.d.ts +1 -23
  17. package/packages/engine/dist/types/audio/constants.d.ts.map +1 -1
  18. package/packages/game/dist/browser/index.global.js +3 -3
  19. package/packages/game/dist/browser/index.global.js.map +1 -1
  20. package/packages/game/dist/cjs/index.cjs +556 -19
  21. package/packages/game/dist/cjs/index.cjs.map +1 -1
  22. package/packages/game/dist/esm/index.js +556 -19
  23. package/packages/game/dist/esm/index.js.map +1 -1
  24. package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
  25. package/packages/game/dist/types/entities/monsters/actor.d.ts.map +1 -1
  26. package/packages/game/dist/types/entities/monsters/arachnid.d.ts.map +1 -1
  27. package/packages/game/dist/types/entities/system.d.ts +1 -0
  28. package/packages/game/dist/types/entities/system.d.ts.map +1 -1
  29. package/packages/game/dist/types/index.d.ts +2 -0
  30. package/packages/game/dist/types/index.d.ts.map +1 -1
  31. package/packages/server/dist/index.cjs +54 -11
  32. package/packages/server/dist/index.d.cts +6 -1
  33. package/packages/server/dist/index.d.ts +6 -1
  34. package/packages/server/dist/index.js +56 -13
  35. package/packages/shared/dist/browser/index.global.js +1 -1
  36. package/packages/shared/dist/browser/index.global.js.map +1 -1
  37. package/packages/shared/dist/cjs/index.cjs +562 -0
  38. package/packages/shared/dist/cjs/index.cjs.map +1 -1
  39. package/packages/shared/dist/esm/index.js +549 -0
  40. package/packages/shared/dist/esm/index.js.map +1 -1
  41. package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
  42. package/packages/shared/dist/types/audio/constants.d.ts +24 -0
  43. package/packages/shared/dist/types/audio/constants.d.ts.map +1 -0
  44. package/packages/shared/dist/types/index.d.ts +1 -0
  45. package/packages/shared/dist/types/index.d.ts.map +1 -1
  46. package/packages/shared/dist/types/net/index.d.ts +1 -0
  47. package/packages/shared/dist/types/net/index.d.ts.map +1 -1
  48. package/packages/shared/dist/types/protocol/crc.d.ts +5 -0
  49. package/packages/shared/dist/types/protocol/crc.d.ts.map +1 -0
  50. package/packages/shared/dist/types/protocol/index.d.ts +1 -0
  51. package/packages/shared/dist/types/protocol/index.d.ts.map +1 -1
  52. package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
@@ -969,6 +969,333 @@ var BinaryStream = class {
969
969
  out.z = norm[2];
970
970
  }
971
971
  };
972
+ var BinaryWriter = class {
973
+ constructor(sizeOrBuffer = 1400) {
974
+ if (typeof sizeOrBuffer === "number") {
975
+ this.buffer = new Uint8Array(sizeOrBuffer);
976
+ this.fixed = false;
977
+ } else {
978
+ this.buffer = sizeOrBuffer;
979
+ this.fixed = true;
980
+ }
981
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
982
+ this.offset = 0;
983
+ }
984
+ ensureSpace(bytes) {
985
+ if (this.offset + bytes > this.buffer.byteLength) {
986
+ if (this.fixed) {
987
+ throw new Error(`Buffer overflow: capacity ${this.buffer.byteLength}, needed ${this.offset + bytes}`);
988
+ }
989
+ const newSize = Math.max(this.buffer.byteLength * 2, this.offset + bytes);
990
+ const newBuffer = new Uint8Array(newSize);
991
+ newBuffer.set(this.buffer);
992
+ this.buffer = newBuffer;
993
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
994
+ }
995
+ }
996
+ writeByte(value) {
997
+ this.ensureSpace(1);
998
+ this.view.setUint8(this.offset, value);
999
+ this.offset += 1;
1000
+ }
1001
+ writeChar(value) {
1002
+ this.ensureSpace(1);
1003
+ this.view.setInt8(this.offset, value);
1004
+ this.offset += 1;
1005
+ }
1006
+ writeShort(value) {
1007
+ this.ensureSpace(2);
1008
+ this.view.setInt16(this.offset, value, true);
1009
+ this.offset += 2;
1010
+ }
1011
+ writeLong(value) {
1012
+ this.ensureSpace(4);
1013
+ this.view.setInt32(this.offset, value, true);
1014
+ this.offset += 4;
1015
+ }
1016
+ writeFloat(value) {
1017
+ this.ensureSpace(4);
1018
+ this.view.setFloat32(this.offset, value, true);
1019
+ this.offset += 4;
1020
+ }
1021
+ writeString(value) {
1022
+ const len = value.length;
1023
+ this.ensureSpace(len + 1);
1024
+ for (let i = 0; i < len; i++) {
1025
+ this.view.setUint8(this.offset + i, value.charCodeAt(i));
1026
+ }
1027
+ this.view.setUint8(this.offset + len, 0);
1028
+ this.offset += len + 1;
1029
+ }
1030
+ writeCoord(value) {
1031
+ this.writeShort(Math.trunc(value * 8));
1032
+ }
1033
+ writeAngle(value) {
1034
+ this.writeByte(Math.trunc(value * 256 / 360) & 255);
1035
+ }
1036
+ writeAngle16(value) {
1037
+ this.writeShort(Math.trunc(value * 65536 / 360) & 65535);
1038
+ }
1039
+ writePos(pos) {
1040
+ this.writeCoord(pos.x);
1041
+ this.writeCoord(pos.y);
1042
+ this.writeCoord(pos.z);
1043
+ }
1044
+ writeDir(dir) {
1045
+ let maxDot = -1;
1046
+ let bestIndex = 0;
1047
+ if (dir.x === 0 && dir.y === 0 && dir.z === 0) {
1048
+ this.writeByte(0);
1049
+ return;
1050
+ }
1051
+ for (let i = 0; i < ANORMS.length; i++) {
1052
+ const norm = ANORMS[i];
1053
+ const dot = dir.x * norm[0] + dir.y * norm[1] + dir.z * norm[2];
1054
+ if (dot > maxDot) {
1055
+ maxDot = dot;
1056
+ bestIndex = i;
1057
+ }
1058
+ }
1059
+ this.writeByte(bestIndex);
1060
+ }
1061
+ getData() {
1062
+ return this.buffer.slice(0, this.offset);
1063
+ }
1064
+ getBuffer() {
1065
+ return this.buffer;
1066
+ }
1067
+ getOffset() {
1068
+ return this.offset;
1069
+ }
1070
+ reset() {
1071
+ this.offset = 0;
1072
+ }
1073
+ };
1074
+ var _NetChan = class _NetChan2 {
1075
+ constructor() {
1076
+ this.qport = 0;
1077
+ this.incomingSequence = 0;
1078
+ this.outgoingSequence = 0;
1079
+ this.incomingAcknowledged = 0;
1080
+ this.incomingReliableAcknowledged = false;
1081
+ this.incomingReliableSequence = 0;
1082
+ this.outgoingReliableSequence = 0;
1083
+ this.reliableLength = 0;
1084
+ this.lastReceived = 0;
1085
+ this.lastSent = 0;
1086
+ this.remoteAddress = null;
1087
+ this.reliableMessage = new BinaryWriter(_NetChan2.MAX_MSGLEN);
1088
+ const now = Date.now();
1089
+ this.lastReceived = now;
1090
+ this.lastSent = now;
1091
+ this.qport = Math.floor(Math.random() * 65536);
1092
+ }
1093
+ /**
1094
+ * Setup the netchan with specific settings
1095
+ */
1096
+ setup(qport, address = null) {
1097
+ this.qport = qport;
1098
+ this.remoteAddress = address;
1099
+ this.reset();
1100
+ }
1101
+ /**
1102
+ * Reset the netchan state
1103
+ */
1104
+ reset() {
1105
+ this.incomingSequence = 0;
1106
+ this.outgoingSequence = 0;
1107
+ this.incomingAcknowledged = 0;
1108
+ this.incomingReliableAcknowledged = false;
1109
+ this.incomingReliableSequence = 0;
1110
+ this.outgoingReliableSequence = 0;
1111
+ this.reliableLength = 0;
1112
+ this.reliableMessage.reset();
1113
+ this.lastReceived = Date.now();
1114
+ this.lastSent = Date.now();
1115
+ }
1116
+ /**
1117
+ * Transmits a packet containing reliable and unreliable data
1118
+ */
1119
+ transmit(unreliableData) {
1120
+ this.outgoingSequence++;
1121
+ this.lastSent = Date.now();
1122
+ const headerSize = _NetChan2.PACKET_HEADER;
1123
+ const reliableSize = this.reliableLength > 0 ? this.reliableLength + 2 : 0;
1124
+ let unreliableSize = unreliableData ? unreliableData.length : 0;
1125
+ if (headerSize + reliableSize + unreliableSize > _NetChan2.MAX_MSGLEN) {
1126
+ unreliableSize = _NetChan2.MAX_MSGLEN - headerSize - reliableSize;
1127
+ if (unreliableSize < 0) unreliableSize = 0;
1128
+ }
1129
+ const buffer = new ArrayBuffer(headerSize + reliableSize + unreliableSize);
1130
+ const view = new DataView(buffer);
1131
+ const result = new Uint8Array(buffer);
1132
+ let sequence = this.outgoingSequence;
1133
+ if (this.reliableLength > 0) {
1134
+ sequence |= 2147483648;
1135
+ if ((this.outgoingReliableSequence & 1) !== 0) {
1136
+ sequence |= 1073741824;
1137
+ }
1138
+ }
1139
+ view.setUint32(0, sequence, true);
1140
+ let ack = this.incomingSequence;
1141
+ if ((this.incomingReliableSequence & 1) !== 0) {
1142
+ ack |= 2147483648;
1143
+ }
1144
+ view.setUint32(4, ack, true);
1145
+ view.setUint16(8, this.qport, true);
1146
+ let offset = headerSize;
1147
+ if (this.reliableLength > 0) {
1148
+ view.setUint16(offset, this.reliableLength, true);
1149
+ offset += 2;
1150
+ const reliableBuffer = this.reliableMessage.getBuffer();
1151
+ const reliableBytes = reliableBuffer.subarray(0, this.reliableLength);
1152
+ result.set(reliableBytes, offset);
1153
+ offset += this.reliableLength;
1154
+ }
1155
+ if (unreliableData && unreliableSize > 0) {
1156
+ const chunk = unreliableData.slice(0, unreliableSize);
1157
+ result.set(chunk, offset);
1158
+ }
1159
+ return result;
1160
+ }
1161
+ /**
1162
+ * Processes a received packet
1163
+ * Returns the payload data (reliable + unreliable) to be processed, or null if discarded
1164
+ */
1165
+ process(packet) {
1166
+ if (packet.length < _NetChan2.PACKET_HEADER) {
1167
+ return null;
1168
+ }
1169
+ this.lastReceived = Date.now();
1170
+ const view = new DataView(packet.buffer, packet.byteOffset, packet.byteLength);
1171
+ const sequence = view.getUint32(0, true);
1172
+ const ack = view.getUint32(4, true);
1173
+ const qport = view.getUint16(8, true);
1174
+ if (this.qport !== qport) {
1175
+ return null;
1176
+ }
1177
+ const seqNumberClean = sequence & ~(2147483648 | 1073741824);
1178
+ if ((seqNumberClean - this.incomingSequence | 0) <= 0) {
1179
+ return null;
1180
+ }
1181
+ this.incomingSequence = seqNumberClean;
1182
+ const ackNumber = ack & ~2147483648;
1183
+ const ackReliable = (ack & 2147483648) !== 0;
1184
+ if (ackNumber > this.incomingAcknowledged) {
1185
+ this.incomingAcknowledged = ackNumber;
1186
+ }
1187
+ if (this.reliableLength > 0) {
1188
+ const receivedAckBit = ackReliable ? 1 : 0;
1189
+ const currentReliableBit = this.outgoingReliableSequence & 1;
1190
+ if (receivedAckBit !== currentReliableBit) {
1191
+ this.reliableLength = 0;
1192
+ this.reliableMessage.reset();
1193
+ this.outgoingReliableSequence ^= 1;
1194
+ }
1195
+ }
1196
+ const hasReliableData = (sequence & 2147483648) !== 0;
1197
+ const reliableSeqBit = (sequence & 1073741824) !== 0 ? 1 : 0;
1198
+ let payloadOffset = _NetChan2.PACKET_HEADER;
1199
+ let reliableData = null;
1200
+ if (hasReliableData) {
1201
+ if (payloadOffset + 2 > packet.byteLength) return null;
1202
+ const reliableLen = view.getUint16(payloadOffset, true);
1203
+ payloadOffset += 2;
1204
+ const expectedBit = this.incomingReliableSequence & 1;
1205
+ if (reliableSeqBit === expectedBit) {
1206
+ this.incomingReliableSequence++;
1207
+ if (payloadOffset + reliableLen > packet.byteLength) return null;
1208
+ reliableData = packet.slice(payloadOffset, payloadOffset + reliableLen);
1209
+ }
1210
+ payloadOffset += reliableLen;
1211
+ }
1212
+ const unreliableData = packet.slice(payloadOffset);
1213
+ if (reliableData && reliableData.length > 0) {
1214
+ const totalLen = reliableData.length + unreliableData.length;
1215
+ const result = new Uint8Array(totalLen);
1216
+ result.set(reliableData, 0);
1217
+ result.set(unreliableData, reliableData.length);
1218
+ return result;
1219
+ }
1220
+ if (unreliableData) {
1221
+ return unreliableData;
1222
+ }
1223
+ return new Uint8Array(0);
1224
+ }
1225
+ /**
1226
+ * Checks if reliable message buffer is empty and ready for new data
1227
+ */
1228
+ canSendReliable() {
1229
+ return this.reliableLength === 0;
1230
+ }
1231
+ /**
1232
+ * Writes a byte to the reliable message buffer
1233
+ */
1234
+ writeReliableByte(value) {
1235
+ if (this.reliableLength + 1 > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1236
+ throw new Error("NetChan reliable buffer overflow");
1237
+ }
1238
+ this.reliableMessage.writeByte(value);
1239
+ this.reliableLength++;
1240
+ }
1241
+ /**
1242
+ * Writes a short to the reliable message buffer
1243
+ */
1244
+ writeReliableShort(value) {
1245
+ if (this.reliableLength + 2 > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1246
+ throw new Error("NetChan reliable buffer overflow");
1247
+ }
1248
+ this.reliableMessage.writeShort(value);
1249
+ this.reliableLength += 2;
1250
+ }
1251
+ /**
1252
+ * Writes a long to the reliable message buffer
1253
+ */
1254
+ writeReliableLong(value) {
1255
+ if (this.reliableLength + 4 > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1256
+ throw new Error("NetChan reliable buffer overflow");
1257
+ }
1258
+ this.reliableMessage.writeLong(value);
1259
+ this.reliableLength += 4;
1260
+ }
1261
+ /**
1262
+ * Writes a string to the reliable message buffer
1263
+ */
1264
+ writeReliableString(value) {
1265
+ const len = value.length + 1;
1266
+ if (this.reliableLength + len > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1267
+ throw new Error("NetChan reliable buffer overflow");
1268
+ }
1269
+ this.reliableMessage.writeString(value);
1270
+ this.reliableLength += len;
1271
+ }
1272
+ /**
1273
+ * Returns the current reliable data buffer
1274
+ */
1275
+ getReliableData() {
1276
+ if (this.reliableLength === 0) {
1277
+ return new Uint8Array(0);
1278
+ }
1279
+ const buffer = this.reliableMessage.getBuffer();
1280
+ return buffer.subarray(0, this.reliableLength);
1281
+ }
1282
+ /**
1283
+ * Checks if we need to send a keepalive packet
1284
+ */
1285
+ needsKeepalive(currentTime) {
1286
+ return currentTime - this.lastSent > 1e3;
1287
+ }
1288
+ /**
1289
+ * Checks if the connection has timed out
1290
+ */
1291
+ isTimedOut(currentTime, timeoutMs = 3e4) {
1292
+ return currentTime - this.lastReceived > timeoutMs;
1293
+ }
1294
+ };
1295
+ _NetChan.MAX_MSGLEN = 1400;
1296
+ _NetChan.FRAGMENT_SIZE = 1024;
1297
+ _NetChan.PACKET_HEADER = 10;
1298
+ _NetChan.HEADER_OVERHEAD = _NetChan.PACKET_HEADER + 2;
972
1299
  var AmmoType = /* @__PURE__ */ ((AmmoType2) => {
973
1300
  AmmoType2[AmmoType2["Bullets"] = 0] = "Bullets";
974
1301
  AmmoType2[AmmoType2["Shells"] = 1] = "Shells";
@@ -987,6 +1314,35 @@ var AmmoType = /* @__PURE__ */ ((AmmoType2) => {
987
1314
  return AmmoType2;
988
1315
  })(AmmoType || {});
989
1316
  var AMMO_TYPE_COUNT = Object.keys(AmmoType).length / 2;
1317
+ var MAX_SOUND_CHANNELS = 32;
1318
+ var SoundChannel = /* @__PURE__ */ ((SoundChannel2) => {
1319
+ SoundChannel2[SoundChannel2["Auto"] = 0] = "Auto";
1320
+ SoundChannel2[SoundChannel2["Weapon"] = 1] = "Weapon";
1321
+ SoundChannel2[SoundChannel2["Voice"] = 2] = "Voice";
1322
+ SoundChannel2[SoundChannel2["Item"] = 3] = "Item";
1323
+ SoundChannel2[SoundChannel2["Body"] = 4] = "Body";
1324
+ SoundChannel2[SoundChannel2["Aux"] = 5] = "Aux";
1325
+ SoundChannel2[SoundChannel2["Footstep"] = 6] = "Footstep";
1326
+ SoundChannel2[SoundChannel2["Aux3"] = 7] = "Aux3";
1327
+ SoundChannel2[SoundChannel2["NoPhsAdd"] = 8] = "NoPhsAdd";
1328
+ SoundChannel2[SoundChannel2["Reliable"] = 16] = "Reliable";
1329
+ SoundChannel2[SoundChannel2["ForcePos"] = 32] = "ForcePos";
1330
+ return SoundChannel2;
1331
+ })(SoundChannel || {});
1332
+ var ATTN_LOOP_NONE = -1;
1333
+ var ATTN_NONE = 0;
1334
+ var ATTN_NORM = 1;
1335
+ var ATTN_IDLE = 2;
1336
+ var ATTN_STATIC = 3;
1337
+ var SOUND_FULLVOLUME = 80;
1338
+ var SOUND_LOOP_ATTENUATE = 3e-3;
1339
+ function attenuationToDistanceMultiplier(attenuation) {
1340
+ return attenuation === ATTN_STATIC ? attenuation * 1e-3 : attenuation * 5e-4;
1341
+ }
1342
+ function calculateMaxAudibleDistance(attenuation) {
1343
+ const distMult = attenuationToDistanceMultiplier(attenuation);
1344
+ return distMult <= 0 ? Number.POSITIVE_INFINITY : SOUND_FULLVOLUME + 1 / distMult;
1345
+ }
990
1346
 
991
1347
  // src/cvars.ts
992
1348
  var Cvar = class {
@@ -3837,37 +4193,6 @@ var AssetManager = class {
3837
4193
  }
3838
4194
  };
3839
4195
 
3840
- // src/audio/constants.ts
3841
- var MAX_SOUND_CHANNELS = 32;
3842
- var SoundChannel = /* @__PURE__ */ ((SoundChannel2) => {
3843
- SoundChannel2[SoundChannel2["Auto"] = 0] = "Auto";
3844
- SoundChannel2[SoundChannel2["Weapon"] = 1] = "Weapon";
3845
- SoundChannel2[SoundChannel2["Voice"] = 2] = "Voice";
3846
- SoundChannel2[SoundChannel2["Item"] = 3] = "Item";
3847
- SoundChannel2[SoundChannel2["Body"] = 4] = "Body";
3848
- SoundChannel2[SoundChannel2["Aux"] = 5] = "Aux";
3849
- SoundChannel2[SoundChannel2["Footstep"] = 6] = "Footstep";
3850
- SoundChannel2[SoundChannel2["Aux3"] = 7] = "Aux3";
3851
- SoundChannel2[SoundChannel2["NoPhsAdd"] = 8] = "NoPhsAdd";
3852
- SoundChannel2[SoundChannel2["Reliable"] = 16] = "Reliable";
3853
- SoundChannel2[SoundChannel2["ForcePos"] = 32] = "ForcePos";
3854
- return SoundChannel2;
3855
- })(SoundChannel || {});
3856
- var ATTN_LOOP_NONE = -1;
3857
- var ATTN_NONE = 0;
3858
- var ATTN_NORM = 1;
3859
- var ATTN_IDLE = 2;
3860
- var ATTN_STATIC = 3;
3861
- var SOUND_FULLVOLUME = 80;
3862
- var SOUND_LOOP_ATTENUATE = 3e-3;
3863
- function attenuationToDistanceMultiplier(attenuation) {
3864
- return attenuation === ATTN_STATIC ? attenuation * 1e-3 : attenuation * 5e-4;
3865
- }
3866
- function calculateMaxAudibleDistance(attenuation) {
3867
- const distMult = attenuationToDistanceMultiplier(attenuation);
3868
- return distMult <= 0 ? Number.POSITIVE_INFINITY : SOUND_FULLVOLUME + 1 / distMult;
3869
- }
3870
-
3871
4196
  // src/audio/context.ts
3872
4197
  var AudioContextController = class {
3873
4198
  constructor(factory) {
@@ -3993,7 +4318,7 @@ var baseChannel = (entchannel) => entchannel & CHANNEL_MASK;
3993
4318
  function createInitialChannels(playerEntity) {
3994
4319
  return Array.from({ length: MAX_SOUND_CHANNELS }, () => ({
3995
4320
  entnum: 0,
3996
- entchannel: 0 /* Auto */,
4321
+ entchannel: SoundChannel.Auto,
3997
4322
  endTimeMs: 0,
3998
4323
  isPlayer: false,
3999
4324
  active: false
@@ -4009,7 +4334,7 @@ function pickChannel(channels, entnum, entchannel, context) {
4009
4334
  for (let i = 0; i < channels.length; i += 1) {
4010
4335
  const channel = channels[i];
4011
4336
  const channelBase = baseChannel(channel.entchannel);
4012
- if (normalizedEntchannel !== 0 /* Auto */ && channel.entnum === entnum && channelBase === normalizedEntchannel) {
4337
+ if (normalizedEntchannel !== SoundChannel.Auto && channel.entnum === entnum && channelBase === normalizedEntchannel) {
4013
4338
  firstToDie = i;
4014
4339
  break;
4015
4340
  }
@@ -4171,7 +4496,7 @@ var AudioSystem = class {
4171
4496
  positionedSound(origin, soundIndex, volume, attenuation) {
4172
4497
  return this.play({
4173
4498
  entity: 0,
4174
- channel: 0 /* Auto */,
4499
+ channel: SoundChannel.Auto,
4175
4500
  soundIndex,
4176
4501
  volume,
4177
4502
  attenuation,
@@ -4181,7 +4506,7 @@ var AudioSystem = class {
4181
4506
  ambientSound(origin, soundIndex, volume) {
4182
4507
  return this.play({
4183
4508
  entity: 0,
4184
- channel: 0 /* Auto */,
4509
+ channel: SoundChannel.Auto,
4185
4510
  soundIndex,
4186
4511
  volume,
4187
4512
  attenuation: ATTN_NONE,