quake2ts 0.0.254 → 0.0.257

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 (58) 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 +770 -38
  5. package/packages/client/dist/cjs/index.cjs.map +1 -1
  6. package/packages/client/dist/esm/index.js +789 -57
  7. package/packages/client/dist/esm/index.js.map +1 -1
  8. package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
  9. package/packages/client/dist/types/hud/icons.d.ts.map +1 -1
  10. package/packages/client/dist/types/hud/statusbar.d.ts.map +1 -1
  11. package/packages/client/dist/types/index.d.ts +3 -1
  12. package/packages/client/dist/types/index.d.ts.map +1 -1
  13. package/packages/client/dist/types/net/connection.d.ts +60 -0
  14. package/packages/client/dist/types/net/connection.d.ts.map +1 -0
  15. package/packages/client/dist/types/ui/menu/main.d.ts +2 -0
  16. package/packages/client/dist/types/ui/menu/main.d.ts.map +1 -1
  17. package/packages/client/dist/types/ui/menu/multiplayer.d.ts +11 -0
  18. package/packages/client/dist/types/ui/menu/multiplayer.d.ts.map +1 -0
  19. package/packages/engine/dist/browser/index.global.js +14 -14
  20. package/packages/engine/dist/browser/index.global.js.map +1 -1
  21. package/packages/engine/dist/cjs/index.cjs +2 -0
  22. package/packages/engine/dist/cjs/index.cjs.map +1 -1
  23. package/packages/engine/dist/esm/index.js +1 -0
  24. package/packages/engine/dist/esm/index.js.map +1 -1
  25. package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
  26. package/packages/engine/dist/types/index.d.ts +1 -1
  27. package/packages/engine/dist/types/index.d.ts.map +1 -1
  28. package/packages/game/dist/browser/index.global.js +2 -2
  29. package/packages/game/dist/browser/index.global.js.map +1 -1
  30. package/packages/game/dist/cjs/index.cjs +231 -208
  31. package/packages/game/dist/cjs/index.cjs.map +1 -1
  32. package/packages/game/dist/esm/index.js +230 -206
  33. package/packages/game/dist/esm/index.js.map +1 -1
  34. package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
  35. package/packages/game/dist/types/combat/weapons/firing.d.ts.map +1 -1
  36. package/packages/game/dist/types/combat/weapons/projectSource.d.ts +28 -0
  37. package/packages/game/dist/types/combat/weapons/projectSource.d.ts.map +1 -0
  38. package/packages/game/dist/types/combat/weapons/rogue.d.ts +4 -4
  39. package/packages/game/dist/types/combat/weapons/rogue.d.ts.map +1 -1
  40. package/packages/game/dist/types/combat/weapons/state.d.ts +6 -0
  41. package/packages/game/dist/types/combat/weapons/state.d.ts.map +1 -1
  42. package/packages/game/dist/types/entities/playerStats.d.ts.map +1 -1
  43. package/packages/game/dist/types/inventory/ammo.d.ts.map +1 -1
  44. package/packages/game/dist/types/inventory/playerInventory.d.ts +91 -38
  45. package/packages/game/dist/types/inventory/playerInventory.d.ts.map +1 -1
  46. package/packages/shared/dist/browser/index.global.js +1 -1
  47. package/packages/shared/dist/browser/index.global.js.map +1 -1
  48. package/packages/shared/dist/cjs/index.cjs +101 -2
  49. package/packages/shared/dist/cjs/index.cjs.map +1 -1
  50. package/packages/shared/dist/esm/index.js +100 -2
  51. package/packages/shared/dist/esm/index.js.map +1 -1
  52. package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
  53. package/packages/shared/dist/types/io/index.d.ts +1 -0
  54. package/packages/shared/dist/types/io/index.d.ts.map +1 -1
  55. package/packages/shared/dist/types/io/messageBuilder.d.ts +21 -0
  56. package/packages/shared/dist/types/io/messageBuilder.d.ts.map +1 -0
  57. package/packages/shared/dist/types/protocol/stats.d.ts.map +1 -1
  58. package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
@@ -74,6 +74,7 @@ __export(index_exports, {
74
74
  WEAPONS: () => WEAPONS,
75
75
  WEAPON_ITEMS: () => WEAPON_ITEMS,
76
76
  WeaponId: () => WeaponId,
77
+ WeaponStateEnum: () => WeaponStateEnum,
77
78
  WeaponType: () => WeaponType,
78
79
  addAmmo: () => addAmmo,
79
80
  addKey: () => addKey,
@@ -124,7 +125,6 @@ __export(index_exports, {
124
125
  foundTarget: () => foundTarget,
125
126
  getAmmoItemDefinition: () => getAmmoItemDefinition,
126
127
  getWeaponState: () => getWeaponState,
127
- giveAmmo: () => giveAmmo,
128
128
  giveAmmoItem: () => giveAmmoItem,
129
129
  giveWeapon: () => giveWeapon,
130
130
  hasAnyDamageFlag: () => hasAnyDamageFlag,
@@ -156,7 +156,6 @@ __export(index_exports, {
156
156
  serializePlayerInventory: () => serializePlayerInventory,
157
157
  serializeRereleaseSave: () => serializeRereleaseSave,
158
158
  setMovedir: () => setMovedir,
159
- setPickup: () => setPickup,
160
159
  spawnEntitiesFromText: () => spawnEntitiesFromText,
161
160
  spawnEntityFromDictionary: () => spawnEntityFromDictionary,
162
161
  summarizeRereleaseSave: () => summarizeRereleaseSave,
@@ -932,33 +931,6 @@ function setCompressedInteger(stats, startIndex, id, count, bitsPerValue) {
932
931
  const valueToWrite = base & ~mask | count << bitShift & mask;
933
932
  writeUint16LE(stats, startIndex, byteOffset, valueToWrite & 65535);
934
933
  }
935
- var PowerupId = /* @__PURE__ */ ((PowerupId22) => {
936
- PowerupId22["QuadDamage"] = "quad";
937
- PowerupId22["Invulnerability"] = "invulnerability";
938
- PowerupId22["EnviroSuit"] = "enviro_suit";
939
- PowerupId22["Rebreather"] = "rebreather";
940
- PowerupId22["Silencer"] = "silencer";
941
- PowerupId22["PowerScreen"] = "power_screen";
942
- PowerupId22["PowerShield"] = "power_shield";
943
- PowerupId22["QuadFire"] = "quad_fire";
944
- PowerupId22["Invisibility"] = "invisibility";
945
- PowerupId22["Bandolier"] = "bandolier";
946
- PowerupId22["AmmoPack"] = "ammo_pack";
947
- PowerupId22["IRGoggles"] = "ir_goggles";
948
- PowerupId22["DoubleDamage"] = "double_damage";
949
- PowerupId22["SphereVengeance"] = "sphere_vengeance";
950
- PowerupId22["SphereHunter"] = "sphere_hunter";
951
- PowerupId22["SphereDefender"] = "sphere_defender";
952
- PowerupId22["Doppelganger"] = "doppelganger";
953
- PowerupId22["TagToken"] = "tag_token";
954
- PowerupId22["TechResistance"] = "tech_resistance";
955
- PowerupId22["TechStrength"] = "tech_strength";
956
- PowerupId22["TechHaste"] = "tech_haste";
957
- PowerupId22["TechRegeneration"] = "tech_regeneration";
958
- PowerupId22["Flashlight"] = "flashlight";
959
- PowerupId22["Compass"] = "compass";
960
- return PowerupId22;
961
- })(PowerupId || {});
962
934
  var PlayerStat = /* @__PURE__ */ ((PlayerStat2) => {
963
935
  PlayerStat2[PlayerStat2["STAT_HEALTH_ICON"] = 0] = "STAT_HEALTH_ICON";
964
936
  PlayerStat2[PlayerStat2["STAT_HEALTH"] = 1] = "STAT_HEALTH";
@@ -1053,7 +1025,16 @@ var POWERUP_STAT_MAP = {
1053
1025
  "enviro_suit"
1054
1026
  /* EnviroSuit */
1055
1027
  ]: 9,
1056
- // 10 is POWERUP_ADRENALINE (not in PowerupId?)
1028
+ [
1029
+ "bandolier"
1030
+ /* Bandolier */
1031
+ ]: 10,
1032
+ // Placeholder/Map mismatch handling?
1033
+ [
1034
+ "ammo_pack"
1035
+ /* AmmoPack */
1036
+ ]: 10,
1037
+ // Original reused indices or had gaps?
1057
1038
  [
1058
1039
  "ir_goggles"
1059
1040
  /* IRGoggles */
@@ -1101,7 +1082,12 @@ var POWERUP_STAT_MAP = {
1101
1082
  [
1102
1083
  "tech_regeneration"
1103
1084
  /* TechRegeneration */
1104
- ]: 22
1085
+ ]: 22,
1086
+ // Add missing mappings to avoid runtime lookups failing for new types
1087
+ [
1088
+ "tag_token"
1089
+ /* TagToken */
1090
+ ]: -1
1105
1091
  };
1106
1092
  function G_SetAmmoStat(stats, ammoId, count) {
1107
1093
  if (ammoId < 0 || ammoId >= AMMO_MAX) return;
@@ -1230,28 +1216,6 @@ var applyPmove = (state, cmd, trace, pointContents2) => {
1230
1216
  velocity: finalVelocity
1231
1217
  };
1232
1218
  };
1233
- var WeaponId = /* @__PURE__ */ ((WeaponId22) => {
1234
- WeaponId22["Blaster"] = "blaster";
1235
- WeaponId22["Shotgun"] = "shotgun";
1236
- WeaponId22["SuperShotgun"] = "super_shotgun";
1237
- WeaponId22["Machinegun"] = "machinegun";
1238
- WeaponId22["Chaingun"] = "chaingun";
1239
- WeaponId22["HandGrenade"] = "hand_grenade";
1240
- WeaponId22["GrenadeLauncher"] = "grenade_launcher";
1241
- WeaponId22["RocketLauncher"] = "rocket_launcher";
1242
- WeaponId22["HyperBlaster"] = "hyperblaster";
1243
- WeaponId22["Railgun"] = "railgun";
1244
- WeaponId22["BFG10K"] = "bfg10k";
1245
- WeaponId22["Grapple"] = "grapple";
1246
- WeaponId22["ChainFist"] = "chainfist";
1247
- WeaponId22["EtfRifle"] = "etf_rifle";
1248
- WeaponId22["ProxLauncher"] = "prox_launcher";
1249
- WeaponId22["IonRipper"] = "ionripper";
1250
- WeaponId22["PlasmaBeam"] = "plasmabeam";
1251
- WeaponId22["Phalanx"] = "phalanx";
1252
- WeaponId22["Disruptor"] = "disruptor";
1253
- return WeaponId22;
1254
- })(WeaponId || {});
1255
1219
  var AmmoType = /* @__PURE__ */ ((AmmoType22) => {
1256
1220
  AmmoType22[AmmoType22["Bullets"] = 0] = "Bullets";
1257
1221
  AmmoType22[AmmoType22["Shells"] = 1] = "Shells";
@@ -1286,6 +1250,75 @@ var AmmoItemId = /* @__PURE__ */ ((AmmoItemId22) => {
1286
1250
  return AmmoItemId22;
1287
1251
  })(AmmoItemId || {});
1288
1252
 
1253
+ // src/inventory/ammo.ts
1254
+ var AMMO_ITEM_DEFINITIONS = {
1255
+ [AmmoItemId.Shells]: { id: AmmoItemId.Shells, ammoType: AmmoType.Shells, quantity: 10, weaponAmmo: false },
1256
+ [AmmoItemId.Bullets]: { id: AmmoItemId.Bullets, ammoType: AmmoType.Bullets, quantity: 50, weaponAmmo: false },
1257
+ [AmmoItemId.Rockets]: { id: AmmoItemId.Rockets, ammoType: AmmoType.Rockets, quantity: 5, weaponAmmo: false },
1258
+ [AmmoItemId.Grenades]: { id: AmmoItemId.Grenades, ammoType: AmmoType.Grenades, quantity: 5, weaponAmmo: true },
1259
+ [AmmoItemId.Cells]: { id: AmmoItemId.Cells, ammoType: AmmoType.Cells, quantity: 50, weaponAmmo: false },
1260
+ [AmmoItemId.Slugs]: { id: AmmoItemId.Slugs, ammoType: AmmoType.Slugs, quantity: 10, weaponAmmo: false },
1261
+ [AmmoItemId.MagSlugs]: { id: AmmoItemId.MagSlugs, ammoType: AmmoType.MagSlugs, quantity: 10, weaponAmmo: false },
1262
+ [AmmoItemId.Flechettes]: { id: AmmoItemId.Flechettes, ammoType: AmmoType.Flechettes, quantity: 50, weaponAmmo: false },
1263
+ [AmmoItemId.Disruptor]: { id: AmmoItemId.Disruptor, ammoType: AmmoType.Disruptor, quantity: 15, weaponAmmo: false },
1264
+ [AmmoItemId.Tesla]: { id: AmmoItemId.Tesla, ammoType: AmmoType.Tesla, quantity: 5, weaponAmmo: false },
1265
+ [AmmoItemId.Trap]: { id: AmmoItemId.Trap, ammoType: AmmoType.Trap, quantity: 5, weaponAmmo: false },
1266
+ [AmmoItemId.Prox]: { id: AmmoItemId.Prox, ammoType: AmmoType.Prox, quantity: 5, weaponAmmo: false }
1267
+ };
1268
+ function getAmmoItemDefinition(id) {
1269
+ return AMMO_ITEM_DEFINITIONS[id];
1270
+ }
1271
+ function createAmmoInventory(caps = createBaseAmmoCaps(), seed) {
1272
+ const counts = Array(AMMO_TYPE_COUNT).fill(0);
1273
+ if (seed) {
1274
+ for (const [ammoType, count] of Object.entries(seed)) {
1275
+ counts[Number(ammoType)] = count;
1276
+ }
1277
+ }
1278
+ return { caps: caps.slice(), counts };
1279
+ }
1280
+ function createBaseAmmoCaps() {
1281
+ const caps = Array(AMMO_TYPE_COUNT).fill(50);
1282
+ caps[AmmoType.Bullets] = 200;
1283
+ caps[AmmoType.Shells] = 100;
1284
+ caps[AmmoType.Cells] = 200;
1285
+ caps[AmmoType.MagSlugs] = 50;
1286
+ caps[AmmoType.Flechettes] = 200;
1287
+ caps[AmmoType.Disruptor] = 200;
1288
+ caps[AmmoType.Tesla] = 50;
1289
+ caps[AmmoType.Trap] = 50;
1290
+ caps[AmmoType.Prox] = 50;
1291
+ return caps;
1292
+ }
1293
+ function clampAmmoCounts(counts, caps) {
1294
+ const limit = Math.min(counts.length, caps.length);
1295
+ const clamped = counts.slice(0, limit);
1296
+ for (let i = 0; i < limit; i++) {
1297
+ const cap = caps[i];
1298
+ if (cap !== void 0) {
1299
+ clamped[i] = Math.min(counts[i], cap);
1300
+ }
1301
+ }
1302
+ return clamped;
1303
+ }
1304
+ function addAmmo(inventory, ammoType, amount) {
1305
+ const cap = inventory.caps[ammoType];
1306
+ const current = inventory.counts[ammoType] ?? 0;
1307
+ if (cap !== void 0 && current >= cap) {
1308
+ return { ammoType, added: 0, newCount: current, capped: cap, pickedUp: false };
1309
+ }
1310
+ const uncapped = current + amount;
1311
+ const newCount = cap === void 0 ? uncapped : Math.min(uncapped, cap);
1312
+ const added = newCount - current;
1313
+ inventory.counts[ammoType] = newCount;
1314
+ return { ammoType, added, newCount, capped: cap ?? Number.POSITIVE_INFINITY, pickedUp: added > 0 };
1315
+ }
1316
+ function pickupAmmo(inventory, itemId, options = {}) {
1317
+ const def = getAmmoItemDefinition(itemId);
1318
+ const amount = options.countOverride ?? def.quantity;
1319
+ return addAmmo(inventory, def.ammoType, amount);
1320
+ }
1321
+
1289
1322
  // src/combat/damageFlags.ts
1290
1323
  var DamageFlags = /* @__PURE__ */ ((DamageFlags2) => {
1291
1324
  DamageFlags2[DamageFlags2["NONE"] = 0] = "NONE";
@@ -1397,119 +1430,103 @@ function applyPowerArmor(damage, flags, hitPoint, _hitNormal, state, options = {
1397
1430
  return { saved, remainingCells };
1398
1431
  }
1399
1432
 
1400
- // src/inventory/ammo.ts
1401
- var AMMO_ITEM_DEFINITIONS = {
1402
- [AmmoItemId.Shells]: { id: AmmoItemId.Shells, ammoType: AmmoType.Shells, quantity: 10, weaponAmmo: false },
1403
- [AmmoItemId.Bullets]: { id: AmmoItemId.Bullets, ammoType: AmmoType.Bullets, quantity: 50, weaponAmmo: false },
1404
- [AmmoItemId.Rockets]: { id: AmmoItemId.Rockets, ammoType: AmmoType.Rockets, quantity: 5, weaponAmmo: false },
1405
- [AmmoItemId.Grenades]: { id: AmmoItemId.Grenades, ammoType: AmmoType.Grenades, quantity: 5, weaponAmmo: true },
1406
- [AmmoItemId.Cells]: { id: AmmoItemId.Cells, ammoType: AmmoType.Cells, quantity: 50, weaponAmmo: false },
1407
- [AmmoItemId.Slugs]: { id: AmmoItemId.Slugs, ammoType: AmmoType.Slugs, quantity: 10, weaponAmmo: false },
1408
- [AmmoItemId.MagSlugs]: { id: AmmoItemId.MagSlugs, ammoType: AmmoType.MagSlugs, quantity: 10, weaponAmmo: false },
1409
- [AmmoItemId.Flechettes]: { id: AmmoItemId.Flechettes, ammoType: AmmoType.Flechettes, quantity: 50, weaponAmmo: false },
1410
- [AmmoItemId.Disruptor]: { id: AmmoItemId.Disruptor, ammoType: AmmoType.Disruptor, quantity: 15, weaponAmmo: false },
1411
- [AmmoItemId.Tesla]: { id: AmmoItemId.Tesla, ammoType: AmmoType.Tesla, quantity: 5, weaponAmmo: false },
1412
- [AmmoItemId.Trap]: { id: AmmoItemId.Trap, ammoType: AmmoType.Trap, quantity: 5, weaponAmmo: false },
1413
- [AmmoItemId.Prox]: { id: AmmoItemId.Prox, ammoType: AmmoType.Prox, quantity: 5, weaponAmmo: false }
1414
- };
1415
- function getAmmoItemDefinition(id) {
1416
- return AMMO_ITEM_DEFINITIONS[id];
1417
- }
1418
- function createAmmoInventory(caps = createBaseAmmoCaps(), seed) {
1419
- const counts = Array(AMMO_TYPE_COUNT).fill(0);
1420
- if (seed) {
1421
- for (const [ammoType, count] of Object.entries(seed)) {
1422
- counts[Number(ammoType)] = count;
1423
- }
1424
- }
1425
- return { caps: caps.slice(), counts };
1426
- }
1427
- function createBaseAmmoCaps() {
1428
- const caps = Array(AMMO_TYPE_COUNT).fill(50);
1429
- caps[AmmoType.Bullets] = 200;
1430
- caps[AmmoType.Shells] = 100;
1431
- caps[AmmoType.Cells] = 200;
1432
- caps[AmmoType.MagSlugs] = 50;
1433
- caps[AmmoType.Flechettes] = 200;
1434
- caps[AmmoType.Disruptor] = 200;
1435
- caps[AmmoType.Tesla] = 50;
1436
- caps[AmmoType.Trap] = 50;
1437
- caps[AmmoType.Prox] = 50;
1438
- return caps;
1439
- }
1440
- function clampAmmoCounts(counts, caps) {
1441
- const limit = Math.min(counts.length, caps.length);
1442
- const clamped = counts.slice(0, limit);
1443
- for (let i = 0; i < limit; i++) {
1444
- const cap = caps[i];
1445
- if (cap !== void 0) {
1446
- clamped[i] = Math.min(counts[i], cap);
1447
- }
1448
- }
1449
- return clamped;
1450
- }
1451
- function addAmmo(inventory, ammoType, amount) {
1452
- const cap = inventory.caps[ammoType];
1453
- const current = inventory.counts[ammoType] ?? 0;
1454
- if (cap !== void 0 && current >= cap) {
1455
- return { ammoType, added: 0, newCount: current, capped: cap, pickedUp: false };
1456
- }
1457
- const uncapped = current + amount;
1458
- const newCount = cap === void 0 ? uncapped : Math.min(uncapped, cap);
1459
- const added = newCount - current;
1460
- inventory.counts[ammoType] = newCount;
1461
- return { ammoType, added, newCount, capped: cap ?? Number.POSITIVE_INFINITY, pickedUp: added > 0 };
1462
- }
1463
- function pickupAmmo(inventory, itemId, options = {}) {
1464
- const def = getAmmoItemDefinition(itemId);
1465
- const amount = options.countOverride ?? def.quantity;
1466
- return addAmmo(inventory, def.ammoType, amount);
1467
- }
1468
-
1469
1433
  // src/inventory/playerInventory.ts
1434
+ var WeaponId = /* @__PURE__ */ ((WeaponId3) => {
1435
+ WeaponId3["Blaster"] = "blaster";
1436
+ WeaponId3["Shotgun"] = "shotgun";
1437
+ WeaponId3["SuperShotgun"] = "supershotgun";
1438
+ WeaponId3["Machinegun"] = "machinegun";
1439
+ WeaponId3["Chaingun"] = "chaingun";
1440
+ WeaponId3["GrenadeLauncher"] = "grenadelauncher";
1441
+ WeaponId3["RocketLauncher"] = "rocketlauncher";
1442
+ WeaponId3["HyperBlaster"] = "hyperblaster";
1443
+ WeaponId3["Railgun"] = "railgun";
1444
+ WeaponId3["BFG10K"] = "bfg10k";
1445
+ WeaponId3["HandGrenade"] = "grenades";
1446
+ WeaponId3["Grapple"] = "grapple";
1447
+ WeaponId3["IonRipper"] = "ionripper";
1448
+ WeaponId3["Phalanx"] = "phalanx";
1449
+ WeaponId3["Trap"] = "trap";
1450
+ WeaponId3["PlasmaBeam"] = "plasmabeam";
1451
+ WeaponId3["EtfRifle"] = "etfrifle";
1452
+ WeaponId3["ProxLauncher"] = "proxlauncher";
1453
+ WeaponId3["ChainFist"] = "chainfist";
1454
+ WeaponId3["Disruptor"] = "disruptor";
1455
+ return WeaponId3;
1456
+ })(WeaponId || {});
1457
+ var PowerupId = /* @__PURE__ */ ((PowerupId3) => {
1458
+ PowerupId3["QuadDamage"] = "quad";
1459
+ PowerupId3["Invulnerability"] = "invulnerability";
1460
+ PowerupId3["Silencer"] = "silencer";
1461
+ PowerupId3["Rebreather"] = "rebreather";
1462
+ PowerupId3["EnviroSuit"] = "enviro";
1463
+ PowerupId3["DoubleDamage"] = "double";
1464
+ PowerupId3["QuadFire"] = "quadfire";
1465
+ PowerupId3["Invisibility"] = "invisibility";
1466
+ PowerupId3["Bandolier"] = "bandolier";
1467
+ PowerupId3["AmmoPack"] = "pack";
1468
+ PowerupId3["IRGoggles"] = "goggles";
1469
+ PowerupId3["SphereVengeance"] = "vengeance";
1470
+ PowerupId3["SphereHunter"] = "hunter";
1471
+ PowerupId3["SphereDefender"] = "defender";
1472
+ PowerupId3["Doppelganger"] = "doppelganger";
1473
+ PowerupId3["TagToken"] = "tagtoken";
1474
+ PowerupId3["TechResistance"] = "tech_resistance";
1475
+ PowerupId3["TechStrength"] = "tech_strength";
1476
+ PowerupId3["TechHaste"] = "tech_haste";
1477
+ PowerupId3["TechRegeneration"] = "tech_regeneration";
1478
+ PowerupId3["Flashlight"] = "flashlight";
1479
+ PowerupId3["Compass"] = "compass";
1480
+ return PowerupId3;
1481
+ })(PowerupId || {});
1470
1482
  var KeyId = /* @__PURE__ */ ((KeyId2) => {
1471
- KeyId2["Blue"] = "blue";
1472
- KeyId2["Red"] = "red";
1473
- KeyId2["Green"] = "green";
1474
- KeyId2["Yellow"] = "yellow";
1475
- KeyId2["DataCD"] = "data_cd";
1476
- KeyId2["PowerCube"] = "power_cube";
1477
- KeyId2["ExplosiveCharges"] = "explosive_charges";
1478
- KeyId2["PowerCore"] = "power_core";
1479
- KeyId2["Pyramid"] = "pyramid";
1480
- KeyId2["DataSpinner"] = "data_spinner";
1481
- KeyId2["Pass"] = "pass";
1482
- KeyId2["CommanderHead"] = "commander_head";
1483
- KeyId2["Airstrike"] = "airstrike";
1484
- KeyId2["NukeContainer"] = "nuke_container";
1485
- KeyId2["Nuke"] = "nuke";
1486
- KeyId2["RedFlag"] = "red_flag";
1487
- KeyId2["BlueFlag"] = "blue_flag";
1483
+ KeyId2["Blue"] = "key_blue";
1484
+ KeyId2["Red"] = "key_red";
1485
+ KeyId2["Green"] = "key_green";
1486
+ KeyId2["Yellow"] = "key_yellow";
1487
+ KeyId2["DataCD"] = "key_data_cd";
1488
+ KeyId2["PowerCube"] = "key_power_cube";
1489
+ KeyId2["ExplosiveCharges"] = "key_explosive_charges";
1490
+ KeyId2["PowerCore"] = "key_power_core";
1491
+ KeyId2["Pyramid"] = "key_pyramid";
1492
+ KeyId2["DataSpinner"] = "key_data_spinner";
1493
+ KeyId2["Pass"] = "key_pass";
1494
+ KeyId2["CommanderHead"] = "key_commander_head";
1495
+ KeyId2["Airstrike"] = "key_airstrike";
1496
+ KeyId2["NukeContainer"] = "key_nuke_container";
1497
+ KeyId2["Nuke"] = "key_nuke";
1498
+ KeyId2["RedFlag"] = "key_red_flag";
1499
+ KeyId2["BlueFlag"] = "key_blue_flag";
1488
1500
  return KeyId2;
1489
1501
  })(KeyId || {});
1490
- function createPlayerInventory(options = {}) {
1491
- const ammo = createAmmoInventory(options.ammoCaps, options.ammo);
1492
- const ownedWeapons = new Set(options.weapons ?? []);
1493
- const powerups = new Map(options.powerups ?? []);
1494
- const keys = new Set(options.keys ?? []);
1495
- const items = new Set(options.items ?? []);
1496
- return {
1497
- ammo,
1498
- ownedWeapons,
1499
- currentWeapon: options.currentWeapon,
1500
- armor: options.armor ?? null,
1501
- powerups,
1502
- keys,
1503
- items
1504
- };
1502
+ function createPlayerInventory(init = {}) {
1503
+ const ammoCaps = init.ammoCaps;
1504
+ const inv = {
1505
+ ammo: createAmmoInventory(ammoCaps),
1506
+ ownedWeapons: new Set(init.weapons ?? ["blaster" /* Blaster */]),
1507
+ armor: null,
1508
+ powerups: /* @__PURE__ */ new Map(),
1509
+ keys: /* @__PURE__ */ new Set(),
1510
+ items: /* @__PURE__ */ new Set()
1511
+ };
1512
+ if (init.ammo) {
1513
+ for (const [type, count] of Object.entries(init.ammo)) {
1514
+ inv.ammo.counts[Number(type)] = count;
1515
+ }
1516
+ }
1517
+ if (init.currentWeapon) {
1518
+ inv.currentWeapon = init.currentWeapon;
1519
+ } else if (inv.ownedWeapons.size > 0) {
1520
+ if (inv.ownedWeapons.has("blaster" /* Blaster */)) inv.currentWeapon = "blaster" /* Blaster */;
1521
+ else if (inv.ownedWeapons.has("shotgun" /* Shotgun */)) inv.currentWeapon = "shotgun" /* Shotgun */;
1522
+ else inv.currentWeapon = [...inv.ownedWeapons][0];
1523
+ }
1524
+ return inv;
1505
1525
  }
1506
1526
  function setPickup(inventory, item, time) {
1507
1527
  inventory.pickupItem = item;
1508
1528
  inventory.pickupTime = time;
1509
1529
  }
1510
- function giveAmmo(inventory, ammoType, amount) {
1511
- return addAmmo(inventory.ammo, ammoType, amount);
1512
- }
1513
1530
  function giveAmmoItem(inventory, itemId, options) {
1514
1531
  return pickupAmmo(inventory.ammo, itemId, options);
1515
1532
  }
@@ -1630,27 +1647,27 @@ function pickupPowerup(client, item, time) {
1630
1647
  let icon = "";
1631
1648
  switch (item.id) {
1632
1649
  case "item_quad":
1633
- powerupId = PowerupId.QuadDamage;
1650
+ powerupId = "quad" /* QuadDamage */;
1634
1651
  icon = "p_quad";
1635
1652
  break;
1636
1653
  case "item_invulnerability":
1637
- powerupId = PowerupId.Invulnerability;
1654
+ powerupId = "invulnerability" /* Invulnerability */;
1638
1655
  icon = "p_invulnerability";
1639
1656
  break;
1640
1657
  case "item_silencer":
1641
- powerupId = PowerupId.Silencer;
1658
+ powerupId = "silencer" /* Silencer */;
1642
1659
  icon = "p_silencer";
1643
1660
  break;
1644
1661
  case "item_rebreather":
1645
- powerupId = PowerupId.Rebreather;
1662
+ powerupId = "rebreather" /* Rebreather */;
1646
1663
  icon = "p_rebreather";
1647
1664
  break;
1648
1665
  case "item_enviro":
1649
- powerupId = PowerupId.EnviroSuit;
1666
+ powerupId = "enviro" /* EnviroSuit */;
1650
1667
  icon = "p_envirosuit";
1651
1668
  break;
1652
1669
  case "item_double":
1653
- powerupId = PowerupId.DoubleDamage;
1670
+ powerupId = "double" /* DoubleDamage */;
1654
1671
  icon = "p_double";
1655
1672
  break;
1656
1673
  }
@@ -1658,9 +1675,9 @@ function pickupPowerup(client, item, time) {
1658
1675
  const expiresAt = inventory.powerups.get(powerupId);
1659
1676
  const newExpiresAt = expiresAt && expiresAt > time ? expiresAt + item.timer * 1e3 : time + item.timer * 1e3;
1660
1677
  inventory.powerups.set(powerupId, newExpiresAt);
1661
- if (powerupId === PowerupId.QuadDamage) {
1678
+ if (powerupId === "quad" /* QuadDamage */) {
1662
1679
  client.quad_time = newExpiresAt / 1e3;
1663
- } else if (powerupId === PowerupId.DoubleDamage) {
1680
+ } else if (powerupId === "double" /* DoubleDamage */) {
1664
1681
  client.double_time = newExpiresAt / 1e3;
1665
1682
  }
1666
1683
  setPickup(inventory, icon, time);
@@ -1688,19 +1705,19 @@ function pickupKey(inventory, item, time) {
1688
1705
  let icon = "";
1689
1706
  switch (item.id) {
1690
1707
  case "key_blue":
1691
- keyId = "blue" /* Blue */;
1708
+ keyId = "key_blue" /* Blue */;
1692
1709
  icon = "k_bluekey";
1693
1710
  break;
1694
1711
  case "key_red":
1695
- keyId = "red" /* Red */;
1712
+ keyId = "key_red" /* Red */;
1696
1713
  icon = "k_redkey";
1697
1714
  break;
1698
1715
  case "key_green":
1699
- keyId = "green" /* Green */;
1716
+ keyId = "key_green" /* Green */;
1700
1717
  icon = "k_security";
1701
1718
  break;
1702
1719
  case "key_yellow":
1703
- keyId = "yellow" /* Yellow */;
1720
+ keyId = "key_yellow" /* Yellow */;
1704
1721
  icon = "k_pyramid";
1705
1722
  break;
1706
1723
  }
@@ -4428,6 +4445,13 @@ function registerTriggerSpawns(registry) {
4428
4445
  }
4429
4446
 
4430
4447
  // src/combat/weapons/state.ts
4448
+ var WeaponStateEnum = /* @__PURE__ */ ((WeaponStateEnum2) => {
4449
+ WeaponStateEnum2[WeaponStateEnum2["WEAPON_READY"] = 0] = "WEAPON_READY";
4450
+ WeaponStateEnum2[WeaponStateEnum2["WEAPON_ACTIVATING"] = 1] = "WEAPON_ACTIVATING";
4451
+ WeaponStateEnum2[WeaponStateEnum2["WEAPON_DROPPING"] = 2] = "WEAPON_DROPPING";
4452
+ WeaponStateEnum2[WeaponStateEnum2["WEAPON_FIRING"] = 3] = "WEAPON_FIRING";
4453
+ return WeaponStateEnum2;
4454
+ })(WeaponStateEnum || {});
4431
4455
  function createPlayerWeaponStates() {
4432
4456
  return {
4433
4457
  states: /* @__PURE__ */ new Map()
@@ -4450,7 +4474,7 @@ function chaingunThink(player, sys) {
4450
4474
  if (!player.client) {
4451
4475
  return;
4452
4476
  }
4453
- const weaponState = getWeaponState(player.client.weaponStates, WeaponId.Chaingun);
4477
+ const weaponState = getWeaponState(player.client.weaponStates, "chaingun" /* Chaingun */);
4454
4478
  if (!(player.client.buttons & BUTTON_ATTACK) && weaponState.spinupCount && weaponState.spinupCount > 0) {
4455
4479
  sys.sound(player, 0, "weapons/chngnd1a.wav", 1, 0, 0);
4456
4480
  weaponState.spinupCount = 0;
@@ -4463,7 +4487,7 @@ var WEAPON_ITEMS = {
4463
4487
  type: "weapon",
4464
4488
  id: "weapon_blaster",
4465
4489
  name: "Blaster",
4466
- weaponId: WeaponId.Blaster,
4490
+ weaponId: "blaster" /* Blaster */,
4467
4491
  ammoType: null,
4468
4492
  initialAmmo: 0,
4469
4493
  pickupAmmo: 0,
@@ -4473,7 +4497,7 @@ var WEAPON_ITEMS = {
4473
4497
  type: "weapon",
4474
4498
  id: "weapon_shotgun",
4475
4499
  name: "Shotgun",
4476
- weaponId: WeaponId.Shotgun,
4500
+ weaponId: "shotgun" /* Shotgun */,
4477
4501
  ammoType: AmmoType.Shells,
4478
4502
  initialAmmo: 10,
4479
4503
  pickupAmmo: 10,
@@ -4483,7 +4507,7 @@ var WEAPON_ITEMS = {
4483
4507
  type: "weapon",
4484
4508
  id: "weapon_supershotgun",
4485
4509
  name: "Super Shotgun",
4486
- weaponId: WeaponId.SuperShotgun,
4510
+ weaponId: "supershotgun" /* SuperShotgun */,
4487
4511
  ammoType: AmmoType.Shells,
4488
4512
  initialAmmo: 10,
4489
4513
  pickupAmmo: 10,
@@ -4493,7 +4517,7 @@ var WEAPON_ITEMS = {
4493
4517
  type: "weapon",
4494
4518
  id: "weapon_machinegun",
4495
4519
  name: "Machinegun",
4496
- weaponId: WeaponId.Machinegun,
4520
+ weaponId: "machinegun" /* Machinegun */,
4497
4521
  ammoType: AmmoType.Bullets,
4498
4522
  initialAmmo: 50,
4499
4523
  pickupAmmo: 50,
@@ -4504,7 +4528,7 @@ var WEAPON_ITEMS = {
4504
4528
  type: "weapon",
4505
4529
  id: "weapon_chaingun",
4506
4530
  name: "Chaingun",
4507
- weaponId: WeaponId.Chaingun,
4531
+ weaponId: "chaingun" /* Chaingun */,
4508
4532
  ammoType: AmmoType.Bullets,
4509
4533
  initialAmmo: 50,
4510
4534
  pickupAmmo: 50,
@@ -4514,7 +4538,7 @@ var WEAPON_ITEMS = {
4514
4538
  type: "weapon",
4515
4539
  id: "weapon_grenades",
4516
4540
  name: "Hand Grenade",
4517
- weaponId: WeaponId.HandGrenade,
4541
+ weaponId: "grenades" /* HandGrenade */,
4518
4542
  ammoType: AmmoType.Grenades,
4519
4543
  initialAmmo: 5,
4520
4544
  pickupAmmo: 5,
@@ -4524,7 +4548,7 @@ var WEAPON_ITEMS = {
4524
4548
  type: "weapon",
4525
4549
  id: "weapon_grenadelauncher",
4526
4550
  name: "Grenade Launcher",
4527
- weaponId: WeaponId.GrenadeLauncher,
4551
+ weaponId: "grenadelauncher" /* GrenadeLauncher */,
4528
4552
  ammoType: AmmoType.Grenades,
4529
4553
  initialAmmo: 10,
4530
4554
  pickupAmmo: 10,
@@ -4534,7 +4558,7 @@ var WEAPON_ITEMS = {
4534
4558
  type: "weapon",
4535
4559
  id: "weapon_rocketlauncher",
4536
4560
  name: "Rocket Launcher",
4537
- weaponId: WeaponId.RocketLauncher,
4561
+ weaponId: "rocketlauncher" /* RocketLauncher */,
4538
4562
  ammoType: AmmoType.Rockets,
4539
4563
  initialAmmo: 5,
4540
4564
  pickupAmmo: 5,
@@ -4544,7 +4568,7 @@ var WEAPON_ITEMS = {
4544
4568
  type: "weapon",
4545
4569
  id: "weapon_hyperblaster",
4546
4570
  name: "HyperBlaster",
4547
- weaponId: WeaponId.HyperBlaster,
4571
+ weaponId: "hyperblaster" /* HyperBlaster */,
4548
4572
  ammoType: AmmoType.Cells,
4549
4573
  initialAmmo: 50,
4550
4574
  pickupAmmo: 50,
@@ -4554,7 +4578,7 @@ var WEAPON_ITEMS = {
4554
4578
  type: "weapon",
4555
4579
  id: "weapon_railgun",
4556
4580
  name: "Railgun",
4557
- weaponId: WeaponId.Railgun,
4581
+ weaponId: "railgun" /* Railgun */,
4558
4582
  ammoType: AmmoType.Slugs,
4559
4583
  initialAmmo: 10,
4560
4584
  pickupAmmo: 10,
@@ -4564,7 +4588,7 @@ var WEAPON_ITEMS = {
4564
4588
  type: "weapon",
4565
4589
  id: "weapon_bfg",
4566
4590
  name: "BFG10K",
4567
- weaponId: WeaponId.BFG10K,
4591
+ weaponId: "bfg10k" /* BFG10K */,
4568
4592
  ammoType: AmmoType.Cells,
4569
4593
  initialAmmo: 50,
4570
4594
  pickupAmmo: 50,
@@ -4576,7 +4600,7 @@ var WEAPON_ITEMS = {
4576
4600
  id: "weapon_boomer",
4577
4601
  // Ion Ripper
4578
4602
  name: "Ion Ripper",
4579
- weaponId: WeaponId.IonRipper,
4603
+ weaponId: "ionripper" /* IonRipper */,
4580
4604
  ammoType: AmmoType.Cells,
4581
4605
  initialAmmo: 50,
4582
4606
  pickupAmmo: 50,
@@ -4586,7 +4610,7 @@ var WEAPON_ITEMS = {
4586
4610
  type: "weapon",
4587
4611
  id: "weapon_phalanx",
4588
4612
  name: "Phalanx",
4589
- weaponId: WeaponId.Phalanx,
4613
+ weaponId: "phalanx" /* Phalanx */,
4590
4614
  ammoType: AmmoType.MagSlugs,
4591
4615
  initialAmmo: 50,
4592
4616
  pickupAmmo: 50,
@@ -4596,7 +4620,7 @@ var WEAPON_ITEMS = {
4596
4620
  type: "weapon",
4597
4621
  id: "weapon_beam",
4598
4622
  name: "Plasma Beam",
4599
- weaponId: WeaponId.PlasmaBeam,
4623
+ weaponId: "plasmabeam" /* PlasmaBeam */,
4600
4624
  ammoType: AmmoType.Cells,
4601
4625
  initialAmmo: 50,
4602
4626
  pickupAmmo: 50,
@@ -4606,7 +4630,7 @@ var WEAPON_ITEMS = {
4606
4630
  type: "weapon",
4607
4631
  id: "weapon_etf_rifle",
4608
4632
  name: "ETF Rifle",
4609
- weaponId: WeaponId.EtfRifle,
4633
+ weaponId: "etfrifle" /* EtfRifle */,
4610
4634
  ammoType: AmmoType.Flechettes,
4611
4635
  initialAmmo: 50,
4612
4636
  pickupAmmo: 50,
@@ -4616,7 +4640,7 @@ var WEAPON_ITEMS = {
4616
4640
  type: "weapon",
4617
4641
  id: "weapon_proxlauncher",
4618
4642
  name: "Prox Launcher",
4619
- weaponId: WeaponId.ProxLauncher,
4643
+ weaponId: "proxlauncher" /* ProxLauncher */,
4620
4644
  ammoType: AmmoType.Prox,
4621
4645
  initialAmmo: 5,
4622
4646
  pickupAmmo: 5,
@@ -13787,24 +13811,24 @@ function player_think(self, sys) {
13787
13811
 
13788
13812
  // src/entities/playerStats.ts
13789
13813
  var WEAPON_WHEEL_ORDER = [
13790
- WeaponId.Blaster,
13791
- WeaponId.Shotgun,
13792
- WeaponId.SuperShotgun,
13793
- WeaponId.Machinegun,
13794
- WeaponId.Chaingun,
13795
- WeaponId.GrenadeLauncher,
13796
- WeaponId.RocketLauncher,
13797
- WeaponId.HandGrenade,
13798
- WeaponId.HyperBlaster,
13799
- WeaponId.Railgun,
13800
- WeaponId.BFG10K
13814
+ "blaster" /* Blaster */,
13815
+ "shotgun" /* Shotgun */,
13816
+ "supershotgun" /* SuperShotgun */,
13817
+ "machinegun" /* Machinegun */,
13818
+ "chaingun" /* Chaingun */,
13819
+ "grenadelauncher" /* GrenadeLauncher */,
13820
+ "rocketlauncher" /* RocketLauncher */,
13821
+ "grenades" /* HandGrenade */,
13822
+ "hyperblaster" /* HyperBlaster */,
13823
+ "railgun" /* Railgun */,
13824
+ "bfg10k" /* BFG10K */
13801
13825
  ];
13802
13826
  var POWERUP_TIMERS = [
13803
- { id: PowerupId.QuadDamage, priority: 1 },
13804
- { id: PowerupId.Invulnerability, priority: 2 },
13805
- { id: PowerupId.EnviroSuit, priority: 3 },
13806
- { id: PowerupId.Rebreather, priority: 4 },
13807
- { id: PowerupId.Silencer, priority: 5 }
13827
+ { id: "quad" /* QuadDamage */, priority: 1 },
13828
+ { id: "invulnerability" /* Invulnerability */, priority: 2 },
13829
+ { id: "enviro" /* EnviroSuit */, priority: 3 },
13830
+ { id: "rebreather" /* Rebreather */, priority: 4 },
13831
+ { id: "silencer" /* Silencer */, priority: 5 }
13808
13832
  ];
13809
13833
  function populatePlayerStats(player, timeSeconds) {
13810
13834
  if (!player.client) return [];
@@ -14202,20 +14226,20 @@ function createGame(imports, engine, options) {
14202
14226
  const blend = [0, 0, 0, 0];
14203
14227
  if (!player || !player.client) return blend;
14204
14228
  const inventory = player.client.inventory;
14205
- if (inventory.powerups.has(PowerupId.QuadDamage)) {
14229
+ if (inventory.powerups.has("quad" /* QuadDamage */)) {
14206
14230
  blend[2] = 1;
14207
14231
  blend[3] = 0.08;
14208
14232
  }
14209
- if (inventory.powerups.has(PowerupId.Invulnerability)) {
14233
+ if (inventory.powerups.has("invulnerability" /* Invulnerability */)) {
14210
14234
  blend[0] = 1;
14211
14235
  blend[1] = 1;
14212
14236
  blend[3] = 0.08;
14213
14237
  }
14214
- if (inventory.powerups.has(PowerupId.EnviroSuit)) {
14238
+ if (inventory.powerups.has("enviro" /* EnviroSuit */)) {
14215
14239
  blend[1] = 1;
14216
14240
  blend[3] = 0.08;
14217
14241
  }
14218
- if (inventory.powerups.has(PowerupId.Rebreather)) {
14242
+ if (inventory.powerups.has("rebreather" /* Rebreather */)) {
14219
14243
  blend[0] = 0.4;
14220
14244
  blend[1] = 1;
14221
14245
  blend[2] = 0.4;
@@ -14520,6 +14544,7 @@ function createGame(imports, engine, options) {
14520
14544
  WEAPONS,
14521
14545
  WEAPON_ITEMS,
14522
14546
  WeaponId,
14547
+ WeaponStateEnum,
14523
14548
  WeaponType,
14524
14549
  addAmmo,
14525
14550
  addKey,
@@ -14570,7 +14595,6 @@ function createGame(imports, engine, options) {
14570
14595
  foundTarget,
14571
14596
  getAmmoItemDefinition,
14572
14597
  getWeaponState,
14573
- giveAmmo,
14574
14598
  giveAmmoItem,
14575
14599
  giveWeapon,
14576
14600
  hasAnyDamageFlag,
@@ -14602,7 +14626,6 @@ function createGame(imports, engine, options) {
14602
14626
  serializePlayerInventory,
14603
14627
  serializeRereleaseSave,
14604
14628
  setMovedir,
14605
- setPickup,
14606
14629
  spawnEntitiesFromText,
14607
14630
  spawnEntityFromDictionary,
14608
14631
  summarizeRereleaseSave,