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
@@ -775,6 +775,333 @@ var BinaryStream = class {
775
775
  out.z = norm[2];
776
776
  }
777
777
  };
778
+ var BinaryWriter = class {
779
+ constructor(sizeOrBuffer = 1400) {
780
+ if (typeof sizeOrBuffer === "number") {
781
+ this.buffer = new Uint8Array(sizeOrBuffer);
782
+ this.fixed = false;
783
+ } else {
784
+ this.buffer = sizeOrBuffer;
785
+ this.fixed = true;
786
+ }
787
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
788
+ this.offset = 0;
789
+ }
790
+ ensureSpace(bytes) {
791
+ if (this.offset + bytes > this.buffer.byteLength) {
792
+ if (this.fixed) {
793
+ throw new Error(`Buffer overflow: capacity ${this.buffer.byteLength}, needed ${this.offset + bytes}`);
794
+ }
795
+ const newSize = Math.max(this.buffer.byteLength * 2, this.offset + bytes);
796
+ const newBuffer = new Uint8Array(newSize);
797
+ newBuffer.set(this.buffer);
798
+ this.buffer = newBuffer;
799
+ this.view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
800
+ }
801
+ }
802
+ writeByte(value) {
803
+ this.ensureSpace(1);
804
+ this.view.setUint8(this.offset, value);
805
+ this.offset += 1;
806
+ }
807
+ writeChar(value) {
808
+ this.ensureSpace(1);
809
+ this.view.setInt8(this.offset, value);
810
+ this.offset += 1;
811
+ }
812
+ writeShort(value) {
813
+ this.ensureSpace(2);
814
+ this.view.setInt16(this.offset, value, true);
815
+ this.offset += 2;
816
+ }
817
+ writeLong(value) {
818
+ this.ensureSpace(4);
819
+ this.view.setInt32(this.offset, value, true);
820
+ this.offset += 4;
821
+ }
822
+ writeFloat(value) {
823
+ this.ensureSpace(4);
824
+ this.view.setFloat32(this.offset, value, true);
825
+ this.offset += 4;
826
+ }
827
+ writeString(value) {
828
+ const len = value.length;
829
+ this.ensureSpace(len + 1);
830
+ for (let i = 0; i < len; i++) {
831
+ this.view.setUint8(this.offset + i, value.charCodeAt(i));
832
+ }
833
+ this.view.setUint8(this.offset + len, 0);
834
+ this.offset += len + 1;
835
+ }
836
+ writeCoord(value) {
837
+ this.writeShort(Math.trunc(value * 8));
838
+ }
839
+ writeAngle(value) {
840
+ this.writeByte(Math.trunc(value * 256 / 360) & 255);
841
+ }
842
+ writeAngle16(value) {
843
+ this.writeShort(Math.trunc(value * 65536 / 360) & 65535);
844
+ }
845
+ writePos(pos) {
846
+ this.writeCoord(pos.x);
847
+ this.writeCoord(pos.y);
848
+ this.writeCoord(pos.z);
849
+ }
850
+ writeDir(dir) {
851
+ let maxDot = -1;
852
+ let bestIndex = 0;
853
+ if (dir.x === 0 && dir.y === 0 && dir.z === 0) {
854
+ this.writeByte(0);
855
+ return;
856
+ }
857
+ for (let i = 0; i < ANORMS.length; i++) {
858
+ const norm = ANORMS[i];
859
+ const dot = dir.x * norm[0] + dir.y * norm[1] + dir.z * norm[2];
860
+ if (dot > maxDot) {
861
+ maxDot = dot;
862
+ bestIndex = i;
863
+ }
864
+ }
865
+ this.writeByte(bestIndex);
866
+ }
867
+ getData() {
868
+ return this.buffer.slice(0, this.offset);
869
+ }
870
+ getBuffer() {
871
+ return this.buffer;
872
+ }
873
+ getOffset() {
874
+ return this.offset;
875
+ }
876
+ reset() {
877
+ this.offset = 0;
878
+ }
879
+ };
880
+ var _NetChan = class _NetChan2 {
881
+ constructor() {
882
+ this.qport = 0;
883
+ this.incomingSequence = 0;
884
+ this.outgoingSequence = 0;
885
+ this.incomingAcknowledged = 0;
886
+ this.incomingReliableAcknowledged = false;
887
+ this.incomingReliableSequence = 0;
888
+ this.outgoingReliableSequence = 0;
889
+ this.reliableLength = 0;
890
+ this.lastReceived = 0;
891
+ this.lastSent = 0;
892
+ this.remoteAddress = null;
893
+ this.reliableMessage = new BinaryWriter(_NetChan2.MAX_MSGLEN);
894
+ const now = Date.now();
895
+ this.lastReceived = now;
896
+ this.lastSent = now;
897
+ this.qport = Math.floor(Math.random() * 65536);
898
+ }
899
+ /**
900
+ * Setup the netchan with specific settings
901
+ */
902
+ setup(qport, address = null) {
903
+ this.qport = qport;
904
+ this.remoteAddress = address;
905
+ this.reset();
906
+ }
907
+ /**
908
+ * Reset the netchan state
909
+ */
910
+ reset() {
911
+ this.incomingSequence = 0;
912
+ this.outgoingSequence = 0;
913
+ this.incomingAcknowledged = 0;
914
+ this.incomingReliableAcknowledged = false;
915
+ this.incomingReliableSequence = 0;
916
+ this.outgoingReliableSequence = 0;
917
+ this.reliableLength = 0;
918
+ this.reliableMessage.reset();
919
+ this.lastReceived = Date.now();
920
+ this.lastSent = Date.now();
921
+ }
922
+ /**
923
+ * Transmits a packet containing reliable and unreliable data
924
+ */
925
+ transmit(unreliableData) {
926
+ this.outgoingSequence++;
927
+ this.lastSent = Date.now();
928
+ const headerSize = _NetChan2.PACKET_HEADER;
929
+ const reliableSize = this.reliableLength > 0 ? this.reliableLength + 2 : 0;
930
+ let unreliableSize = unreliableData ? unreliableData.length : 0;
931
+ if (headerSize + reliableSize + unreliableSize > _NetChan2.MAX_MSGLEN) {
932
+ unreliableSize = _NetChan2.MAX_MSGLEN - headerSize - reliableSize;
933
+ if (unreliableSize < 0) unreliableSize = 0;
934
+ }
935
+ const buffer = new ArrayBuffer(headerSize + reliableSize + unreliableSize);
936
+ const view = new DataView(buffer);
937
+ const result = new Uint8Array(buffer);
938
+ let sequence = this.outgoingSequence;
939
+ if (this.reliableLength > 0) {
940
+ sequence |= 2147483648;
941
+ if ((this.outgoingReliableSequence & 1) !== 0) {
942
+ sequence |= 1073741824;
943
+ }
944
+ }
945
+ view.setUint32(0, sequence, true);
946
+ let ack = this.incomingSequence;
947
+ if ((this.incomingReliableSequence & 1) !== 0) {
948
+ ack |= 2147483648;
949
+ }
950
+ view.setUint32(4, ack, true);
951
+ view.setUint16(8, this.qport, true);
952
+ let offset = headerSize;
953
+ if (this.reliableLength > 0) {
954
+ view.setUint16(offset, this.reliableLength, true);
955
+ offset += 2;
956
+ const reliableBuffer = this.reliableMessage.getBuffer();
957
+ const reliableBytes = reliableBuffer.subarray(0, this.reliableLength);
958
+ result.set(reliableBytes, offset);
959
+ offset += this.reliableLength;
960
+ }
961
+ if (unreliableData && unreliableSize > 0) {
962
+ const chunk = unreliableData.slice(0, unreliableSize);
963
+ result.set(chunk, offset);
964
+ }
965
+ return result;
966
+ }
967
+ /**
968
+ * Processes a received packet
969
+ * Returns the payload data (reliable + unreliable) to be processed, or null if discarded
970
+ */
971
+ process(packet) {
972
+ if (packet.length < _NetChan2.PACKET_HEADER) {
973
+ return null;
974
+ }
975
+ this.lastReceived = Date.now();
976
+ const view = new DataView(packet.buffer, packet.byteOffset, packet.byteLength);
977
+ const sequence = view.getUint32(0, true);
978
+ const ack = view.getUint32(4, true);
979
+ const qport = view.getUint16(8, true);
980
+ if (this.qport !== qport) {
981
+ return null;
982
+ }
983
+ const seqNumberClean = sequence & ~(2147483648 | 1073741824);
984
+ if ((seqNumberClean - this.incomingSequence | 0) <= 0) {
985
+ return null;
986
+ }
987
+ this.incomingSequence = seqNumberClean;
988
+ const ackNumber = ack & ~2147483648;
989
+ const ackReliable = (ack & 2147483648) !== 0;
990
+ if (ackNumber > this.incomingAcknowledged) {
991
+ this.incomingAcknowledged = ackNumber;
992
+ }
993
+ if (this.reliableLength > 0) {
994
+ const receivedAckBit = ackReliable ? 1 : 0;
995
+ const currentReliableBit = this.outgoingReliableSequence & 1;
996
+ if (receivedAckBit !== currentReliableBit) {
997
+ this.reliableLength = 0;
998
+ this.reliableMessage.reset();
999
+ this.outgoingReliableSequence ^= 1;
1000
+ }
1001
+ }
1002
+ const hasReliableData = (sequence & 2147483648) !== 0;
1003
+ const reliableSeqBit = (sequence & 1073741824) !== 0 ? 1 : 0;
1004
+ let payloadOffset = _NetChan2.PACKET_HEADER;
1005
+ let reliableData = null;
1006
+ if (hasReliableData) {
1007
+ if (payloadOffset + 2 > packet.byteLength) return null;
1008
+ const reliableLen = view.getUint16(payloadOffset, true);
1009
+ payloadOffset += 2;
1010
+ const expectedBit = this.incomingReliableSequence & 1;
1011
+ if (reliableSeqBit === expectedBit) {
1012
+ this.incomingReliableSequence++;
1013
+ if (payloadOffset + reliableLen > packet.byteLength) return null;
1014
+ reliableData = packet.slice(payloadOffset, payloadOffset + reliableLen);
1015
+ }
1016
+ payloadOffset += reliableLen;
1017
+ }
1018
+ const unreliableData = packet.slice(payloadOffset);
1019
+ if (reliableData && reliableData.length > 0) {
1020
+ const totalLen = reliableData.length + unreliableData.length;
1021
+ const result = new Uint8Array(totalLen);
1022
+ result.set(reliableData, 0);
1023
+ result.set(unreliableData, reliableData.length);
1024
+ return result;
1025
+ }
1026
+ if (unreliableData) {
1027
+ return unreliableData;
1028
+ }
1029
+ return new Uint8Array(0);
1030
+ }
1031
+ /**
1032
+ * Checks if reliable message buffer is empty and ready for new data
1033
+ */
1034
+ canSendReliable() {
1035
+ return this.reliableLength === 0;
1036
+ }
1037
+ /**
1038
+ * Writes a byte to the reliable message buffer
1039
+ */
1040
+ writeReliableByte(value) {
1041
+ if (this.reliableLength + 1 > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1042
+ throw new Error("NetChan reliable buffer overflow");
1043
+ }
1044
+ this.reliableMessage.writeByte(value);
1045
+ this.reliableLength++;
1046
+ }
1047
+ /**
1048
+ * Writes a short to the reliable message buffer
1049
+ */
1050
+ writeReliableShort(value) {
1051
+ if (this.reliableLength + 2 > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1052
+ throw new Error("NetChan reliable buffer overflow");
1053
+ }
1054
+ this.reliableMessage.writeShort(value);
1055
+ this.reliableLength += 2;
1056
+ }
1057
+ /**
1058
+ * Writes a long to the reliable message buffer
1059
+ */
1060
+ writeReliableLong(value) {
1061
+ if (this.reliableLength + 4 > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1062
+ throw new Error("NetChan reliable buffer overflow");
1063
+ }
1064
+ this.reliableMessage.writeLong(value);
1065
+ this.reliableLength += 4;
1066
+ }
1067
+ /**
1068
+ * Writes a string to the reliable message buffer
1069
+ */
1070
+ writeReliableString(value) {
1071
+ const len = value.length + 1;
1072
+ if (this.reliableLength + len > _NetChan2.MAX_MSGLEN - _NetChan2.HEADER_OVERHEAD) {
1073
+ throw new Error("NetChan reliable buffer overflow");
1074
+ }
1075
+ this.reliableMessage.writeString(value);
1076
+ this.reliableLength += len;
1077
+ }
1078
+ /**
1079
+ * Returns the current reliable data buffer
1080
+ */
1081
+ getReliableData() {
1082
+ if (this.reliableLength === 0) {
1083
+ return new Uint8Array(0);
1084
+ }
1085
+ const buffer = this.reliableMessage.getBuffer();
1086
+ return buffer.subarray(0, this.reliableLength);
1087
+ }
1088
+ /**
1089
+ * Checks if we need to send a keepalive packet
1090
+ */
1091
+ needsKeepalive(currentTime) {
1092
+ return currentTime - this.lastSent > 1e3;
1093
+ }
1094
+ /**
1095
+ * Checks if the connection has timed out
1096
+ */
1097
+ isTimedOut(currentTime, timeoutMs = 3e4) {
1098
+ return currentTime - this.lastReceived > timeoutMs;
1099
+ }
1100
+ };
1101
+ _NetChan.MAX_MSGLEN = 1400;
1102
+ _NetChan.FRAGMENT_SIZE = 1024;
1103
+ _NetChan.PACKET_HEADER = 10;
1104
+ _NetChan.HEADER_OVERHEAD = _NetChan.PACKET_HEADER + 2;
778
1105
  var AmmoType = /* @__PURE__ */ ((AmmoType2) => {
779
1106
  AmmoType2[AmmoType2["Bullets"] = 0] = "Bullets";
780
1107
  AmmoType2[AmmoType2["Shells"] = 1] = "Shells";
@@ -793,6 +1120,35 @@ var AmmoType = /* @__PURE__ */ ((AmmoType2) => {
793
1120
  return AmmoType2;
794
1121
  })(AmmoType || {});
795
1122
  var AMMO_TYPE_COUNT = Object.keys(AmmoType).length / 2;
1123
+ var MAX_SOUND_CHANNELS = 32;
1124
+ var SoundChannel = /* @__PURE__ */ ((SoundChannel2) => {
1125
+ SoundChannel2[SoundChannel2["Auto"] = 0] = "Auto";
1126
+ SoundChannel2[SoundChannel2["Weapon"] = 1] = "Weapon";
1127
+ SoundChannel2[SoundChannel2["Voice"] = 2] = "Voice";
1128
+ SoundChannel2[SoundChannel2["Item"] = 3] = "Item";
1129
+ SoundChannel2[SoundChannel2["Body"] = 4] = "Body";
1130
+ SoundChannel2[SoundChannel2["Aux"] = 5] = "Aux";
1131
+ SoundChannel2[SoundChannel2["Footstep"] = 6] = "Footstep";
1132
+ SoundChannel2[SoundChannel2["Aux3"] = 7] = "Aux3";
1133
+ SoundChannel2[SoundChannel2["NoPhsAdd"] = 8] = "NoPhsAdd";
1134
+ SoundChannel2[SoundChannel2["Reliable"] = 16] = "Reliable";
1135
+ SoundChannel2[SoundChannel2["ForcePos"] = 32] = "ForcePos";
1136
+ return SoundChannel2;
1137
+ })(SoundChannel || {});
1138
+ var ATTN_LOOP_NONE = -1;
1139
+ var ATTN_NONE = 0;
1140
+ var ATTN_NORM = 1;
1141
+ var ATTN_IDLE = 2;
1142
+ var ATTN_STATIC = 3;
1143
+ var SOUND_FULLVOLUME = 80;
1144
+ var SOUND_LOOP_ATTENUATE = 3e-3;
1145
+ function attenuationToDistanceMultiplier(attenuation) {
1146
+ return attenuation === ATTN_STATIC ? attenuation * 1e-3 : attenuation * 5e-4;
1147
+ }
1148
+ function calculateMaxAudibleDistance(attenuation) {
1149
+ const distMult = attenuationToDistanceMultiplier(attenuation);
1150
+ return distMult <= 0 ? Number.POSITIVE_INFINITY : SOUND_FULLVOLUME + 1 / distMult;
1151
+ }
796
1152
 
797
1153
  // src/cvars.ts
798
1154
  var Cvar = class {
@@ -3643,37 +3999,6 @@ var AssetManager = class {
3643
3999
  }
3644
4000
  };
3645
4001
 
3646
- // src/audio/constants.ts
3647
- var MAX_SOUND_CHANNELS = 32;
3648
- var SoundChannel = /* @__PURE__ */ ((SoundChannel2) => {
3649
- SoundChannel2[SoundChannel2["Auto"] = 0] = "Auto";
3650
- SoundChannel2[SoundChannel2["Weapon"] = 1] = "Weapon";
3651
- SoundChannel2[SoundChannel2["Voice"] = 2] = "Voice";
3652
- SoundChannel2[SoundChannel2["Item"] = 3] = "Item";
3653
- SoundChannel2[SoundChannel2["Body"] = 4] = "Body";
3654
- SoundChannel2[SoundChannel2["Aux"] = 5] = "Aux";
3655
- SoundChannel2[SoundChannel2["Footstep"] = 6] = "Footstep";
3656
- SoundChannel2[SoundChannel2["Aux3"] = 7] = "Aux3";
3657
- SoundChannel2[SoundChannel2["NoPhsAdd"] = 8] = "NoPhsAdd";
3658
- SoundChannel2[SoundChannel2["Reliable"] = 16] = "Reliable";
3659
- SoundChannel2[SoundChannel2["ForcePos"] = 32] = "ForcePos";
3660
- return SoundChannel2;
3661
- })(SoundChannel || {});
3662
- var ATTN_LOOP_NONE = -1;
3663
- var ATTN_NONE = 0;
3664
- var ATTN_NORM = 1;
3665
- var ATTN_IDLE = 2;
3666
- var ATTN_STATIC = 3;
3667
- var SOUND_FULLVOLUME = 80;
3668
- var SOUND_LOOP_ATTENUATE = 3e-3;
3669
- function attenuationToDistanceMultiplier(attenuation) {
3670
- return attenuation === ATTN_STATIC ? attenuation * 1e-3 : attenuation * 5e-4;
3671
- }
3672
- function calculateMaxAudibleDistance(attenuation) {
3673
- const distMult = attenuationToDistanceMultiplier(attenuation);
3674
- return distMult <= 0 ? Number.POSITIVE_INFINITY : SOUND_FULLVOLUME + 1 / distMult;
3675
- }
3676
-
3677
4002
  // src/audio/context.ts
3678
4003
  var AudioContextController = class {
3679
4004
  constructor(factory) {
@@ -3799,7 +4124,7 @@ var baseChannel = (entchannel) => entchannel & CHANNEL_MASK;
3799
4124
  function createInitialChannels(playerEntity) {
3800
4125
  return Array.from({ length: MAX_SOUND_CHANNELS }, () => ({
3801
4126
  entnum: 0,
3802
- entchannel: 0 /* Auto */,
4127
+ entchannel: SoundChannel.Auto,
3803
4128
  endTimeMs: 0,
3804
4129
  isPlayer: false,
3805
4130
  active: false
@@ -3815,7 +4140,7 @@ function pickChannel(channels, entnum, entchannel, context) {
3815
4140
  for (let i = 0; i < channels.length; i += 1) {
3816
4141
  const channel = channels[i];
3817
4142
  const channelBase = baseChannel(channel.entchannel);
3818
- if (normalizedEntchannel !== 0 /* Auto */ && channel.entnum === entnum && channelBase === normalizedEntchannel) {
4143
+ if (normalizedEntchannel !== SoundChannel.Auto && channel.entnum === entnum && channelBase === normalizedEntchannel) {
3819
4144
  firstToDie = i;
3820
4145
  break;
3821
4146
  }
@@ -3977,7 +4302,7 @@ var AudioSystem = class {
3977
4302
  positionedSound(origin, soundIndex, volume, attenuation) {
3978
4303
  return this.play({
3979
4304
  entity: 0,
3980
- channel: 0 /* Auto */,
4305
+ channel: SoundChannel.Auto,
3981
4306
  soundIndex,
3982
4307
  volume,
3983
4308
  attenuation,
@@ -3987,7 +4312,7 @@ var AudioSystem = class {
3987
4312
  ambientSound(origin, soundIndex, volume) {
3988
4313
  return this.play({
3989
4314
  entity: 0,
3990
- channel: 0 /* Auto */,
4315
+ channel: SoundChannel.Auto,
3991
4316
  soundIndex,
3992
4317
  volume,
3993
4318
  attenuation: ATTN_NONE,