quake2ts 0.0.289 → 0.0.291
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/package.json +1 -1
- package/packages/client/dist/browser/index.global.js +11 -11
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +22 -12
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +22 -12
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/client/dist/types/net/connection.d.ts +1 -0
- package/packages/client/dist/types/net/connection.d.ts.map +1 -1
- package/packages/engine/dist/browser/index.global.js +16 -16
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +33 -35
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +33 -35
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/audio/constants.d.ts +1 -23
- package/packages/engine/dist/types/audio/constants.d.ts.map +1 -1
- package/packages/game/dist/browser/index.global.js +3 -3
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +65 -19
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +65 -19
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/monsters/actor.d.ts.map +1 -1
- package/packages/game/dist/types/entities/monsters/arachnid.d.ts.map +1 -1
- package/packages/game/dist/types/entities/system.d.ts +1 -0
- package/packages/game/dist/types/entities/system.d.ts.map +1 -1
- package/packages/game/dist/types/index.d.ts +2 -0
- package/packages/game/dist/types/index.d.ts.map +1 -1
- package/packages/shared/dist/browser/index.global.js +1 -1
- package/packages/shared/dist/browser/index.global.js.map +1 -1
- package/packages/shared/dist/cjs/index.cjs +53 -0
- package/packages/shared/dist/cjs/index.cjs.map +1 -1
- package/packages/shared/dist/esm/index.js +42 -0
- package/packages/shared/dist/esm/index.js.map +1 -1
- package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/shared/dist/types/audio/constants.d.ts +24 -0
- package/packages/shared/dist/types/audio/constants.d.ts.map +1 -0
- package/packages/shared/dist/types/index.d.ts +1 -0
- package/packages/shared/dist/types/index.d.ts.map +1 -1
- package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -1314,6 +1314,35 @@ var AmmoType = /* @__PURE__ */ ((AmmoType2) => {
|
|
|
1314
1314
|
return AmmoType2;
|
|
1315
1315
|
})(AmmoType || {});
|
|
1316
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
|
+
}
|
|
1317
1346
|
|
|
1318
1347
|
// src/cvars.ts
|
|
1319
1348
|
var Cvar = class {
|
|
@@ -4164,37 +4193,6 @@ var AssetManager = class {
|
|
|
4164
4193
|
}
|
|
4165
4194
|
};
|
|
4166
4195
|
|
|
4167
|
-
// src/audio/constants.ts
|
|
4168
|
-
var MAX_SOUND_CHANNELS = 32;
|
|
4169
|
-
var SoundChannel = /* @__PURE__ */ ((SoundChannel2) => {
|
|
4170
|
-
SoundChannel2[SoundChannel2["Auto"] = 0] = "Auto";
|
|
4171
|
-
SoundChannel2[SoundChannel2["Weapon"] = 1] = "Weapon";
|
|
4172
|
-
SoundChannel2[SoundChannel2["Voice"] = 2] = "Voice";
|
|
4173
|
-
SoundChannel2[SoundChannel2["Item"] = 3] = "Item";
|
|
4174
|
-
SoundChannel2[SoundChannel2["Body"] = 4] = "Body";
|
|
4175
|
-
SoundChannel2[SoundChannel2["Aux"] = 5] = "Aux";
|
|
4176
|
-
SoundChannel2[SoundChannel2["Footstep"] = 6] = "Footstep";
|
|
4177
|
-
SoundChannel2[SoundChannel2["Aux3"] = 7] = "Aux3";
|
|
4178
|
-
SoundChannel2[SoundChannel2["NoPhsAdd"] = 8] = "NoPhsAdd";
|
|
4179
|
-
SoundChannel2[SoundChannel2["Reliable"] = 16] = "Reliable";
|
|
4180
|
-
SoundChannel2[SoundChannel2["ForcePos"] = 32] = "ForcePos";
|
|
4181
|
-
return SoundChannel2;
|
|
4182
|
-
})(SoundChannel || {});
|
|
4183
|
-
var ATTN_LOOP_NONE = -1;
|
|
4184
|
-
var ATTN_NONE = 0;
|
|
4185
|
-
var ATTN_NORM = 1;
|
|
4186
|
-
var ATTN_IDLE = 2;
|
|
4187
|
-
var ATTN_STATIC = 3;
|
|
4188
|
-
var SOUND_FULLVOLUME = 80;
|
|
4189
|
-
var SOUND_LOOP_ATTENUATE = 3e-3;
|
|
4190
|
-
function attenuationToDistanceMultiplier(attenuation) {
|
|
4191
|
-
return attenuation === ATTN_STATIC ? attenuation * 1e-3 : attenuation * 5e-4;
|
|
4192
|
-
}
|
|
4193
|
-
function calculateMaxAudibleDistance(attenuation) {
|
|
4194
|
-
const distMult = attenuationToDistanceMultiplier(attenuation);
|
|
4195
|
-
return distMult <= 0 ? Number.POSITIVE_INFINITY : SOUND_FULLVOLUME + 1 / distMult;
|
|
4196
|
-
}
|
|
4197
|
-
|
|
4198
4196
|
// src/audio/context.ts
|
|
4199
4197
|
var AudioContextController = class {
|
|
4200
4198
|
constructor(factory) {
|
|
@@ -4320,7 +4318,7 @@ var baseChannel = (entchannel) => entchannel & CHANNEL_MASK;
|
|
|
4320
4318
|
function createInitialChannels(playerEntity) {
|
|
4321
4319
|
return Array.from({ length: MAX_SOUND_CHANNELS }, () => ({
|
|
4322
4320
|
entnum: 0,
|
|
4323
|
-
entchannel:
|
|
4321
|
+
entchannel: SoundChannel.Auto,
|
|
4324
4322
|
endTimeMs: 0,
|
|
4325
4323
|
isPlayer: false,
|
|
4326
4324
|
active: false
|
|
@@ -4336,7 +4334,7 @@ function pickChannel(channels, entnum, entchannel, context) {
|
|
|
4336
4334
|
for (let i = 0; i < channels.length; i += 1) {
|
|
4337
4335
|
const channel = channels[i];
|
|
4338
4336
|
const channelBase = baseChannel(channel.entchannel);
|
|
4339
|
-
if (normalizedEntchannel !==
|
|
4337
|
+
if (normalizedEntchannel !== SoundChannel.Auto && channel.entnum === entnum && channelBase === normalizedEntchannel) {
|
|
4340
4338
|
firstToDie = i;
|
|
4341
4339
|
break;
|
|
4342
4340
|
}
|
|
@@ -4498,7 +4496,7 @@ var AudioSystem = class {
|
|
|
4498
4496
|
positionedSound(origin, soundIndex, volume, attenuation) {
|
|
4499
4497
|
return this.play({
|
|
4500
4498
|
entity: 0,
|
|
4501
|
-
channel:
|
|
4499
|
+
channel: SoundChannel.Auto,
|
|
4502
4500
|
soundIndex,
|
|
4503
4501
|
volume,
|
|
4504
4502
|
attenuation,
|
|
@@ -4508,7 +4506,7 @@ var AudioSystem = class {
|
|
|
4508
4506
|
ambientSound(origin, soundIndex, volume) {
|
|
4509
4507
|
return this.play({
|
|
4510
4508
|
entity: 0,
|
|
4511
|
-
channel:
|
|
4509
|
+
channel: SoundChannel.Auto,
|
|
4512
4510
|
soundIndex,
|
|
4513
4511
|
volume,
|
|
4514
4512
|
attenuation: ATTN_NONE,
|