quake2ts 0.0.201 → 0.0.202
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/cgame/dist/index.cjs +1 -1
- package/packages/cgame/dist/index.cjs.map +1 -1
- package/packages/cgame/dist/index.js +2 -2
- package/packages/cgame/dist/index.js.map +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 +28 -14
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +28 -14
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/browser/index.global.js +10 -10
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +14 -7
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +14 -7
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/browser/index.global.js +2 -2
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +233 -55
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +233 -55
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/playerStats.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 +197 -52
- package/packages/shared/dist/cjs/index.cjs.map +1 -1
- package/packages/shared/dist/esm/index.js +191 -52
- package/packages/shared/dist/esm/index.js.map +1 -1
- package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/shared/dist/types/items/ammo.d.ts +8 -7
- package/packages/shared/dist/types/items/ammo.d.ts.map +1 -1
- package/packages/shared/dist/types/protocol/stats.d.ts +41 -8
- package/packages/shared/dist/types/protocol/stats.d.ts.map +1 -1
- package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -876,6 +876,78 @@ var TempEntity = /* @__PURE__ */ ((TempEntity2) => {
|
|
|
876
876
|
TempEntity2[TempEntity2["EXPLOSION2_NL"] = 63] = "EXPLOSION2_NL";
|
|
877
877
|
return TempEntity2;
|
|
878
878
|
})(TempEntity || {});
|
|
879
|
+
function toSigned16(val) {
|
|
880
|
+
return val << 16 >> 16;
|
|
881
|
+
}
|
|
882
|
+
function readUint16LE(stats, startIndex, byteOffset) {
|
|
883
|
+
const elementIndex = Math.floor(byteOffset / 2);
|
|
884
|
+
const isOdd = byteOffset % 2 !== 0;
|
|
885
|
+
const index = startIndex + elementIndex;
|
|
886
|
+
const val0 = stats[index] || 0;
|
|
887
|
+
if (!isOdd) {
|
|
888
|
+
return val0 & 65535;
|
|
889
|
+
} else {
|
|
890
|
+
const val1 = stats[index + 1] || 0;
|
|
891
|
+
const low = val0 >>> 8 & 255;
|
|
892
|
+
const high = val1 & 255;
|
|
893
|
+
return high << 8 | low;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
function writeUint16LE(stats, startIndex, byteOffset, value) {
|
|
897
|
+
const elementIndex = Math.floor(byteOffset / 2);
|
|
898
|
+
const isOdd = byteOffset % 2 !== 0;
|
|
899
|
+
const index = startIndex + elementIndex;
|
|
900
|
+
if (stats[index] === void 0) stats[index] = 0;
|
|
901
|
+
if (!isOdd) {
|
|
902
|
+
stats[index] = toSigned16(value);
|
|
903
|
+
} else {
|
|
904
|
+
if (stats[index + 1] === void 0) stats[index + 1] = 0;
|
|
905
|
+
const val0 = stats[index];
|
|
906
|
+
const val1 = stats[index + 1];
|
|
907
|
+
const newHigh0 = value & 255;
|
|
908
|
+
const newVal0 = val0 & 255 | newHigh0 << 8;
|
|
909
|
+
stats[index] = toSigned16(newVal0);
|
|
910
|
+
const newLow1 = value >>> 8 & 255;
|
|
911
|
+
const newVal1 = newLow1 | val1 & 65280;
|
|
912
|
+
stats[index + 1] = toSigned16(newVal1);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
function setCompressedInteger(stats, startIndex, id, count, bitsPerValue) {
|
|
916
|
+
const bitOffset = bitsPerValue * id;
|
|
917
|
+
const byteOffset = Math.floor(bitOffset / 8);
|
|
918
|
+
const bitShift = bitOffset % 8;
|
|
919
|
+
const mask = (1 << bitsPerValue) - 1 << bitShift;
|
|
920
|
+
let base = readUint16LE(stats, startIndex, byteOffset);
|
|
921
|
+
const valueToWrite = base & ~mask | count << bitShift & mask;
|
|
922
|
+
writeUint16LE(stats, startIndex, byteOffset, valueToWrite & 65535);
|
|
923
|
+
}
|
|
924
|
+
var PowerupId = /* @__PURE__ */ ((PowerupId22) => {
|
|
925
|
+
PowerupId22["QuadDamage"] = "quad";
|
|
926
|
+
PowerupId22["Invulnerability"] = "invulnerability";
|
|
927
|
+
PowerupId22["EnviroSuit"] = "enviro_suit";
|
|
928
|
+
PowerupId22["Rebreather"] = "rebreather";
|
|
929
|
+
PowerupId22["Silencer"] = "silencer";
|
|
930
|
+
PowerupId22["PowerScreen"] = "power_screen";
|
|
931
|
+
PowerupId22["PowerShield"] = "power_shield";
|
|
932
|
+
PowerupId22["QuadFire"] = "quad_fire";
|
|
933
|
+
PowerupId22["Invisibility"] = "invisibility";
|
|
934
|
+
PowerupId22["Bandolier"] = "bandolier";
|
|
935
|
+
PowerupId22["AmmoPack"] = "ammo_pack";
|
|
936
|
+
PowerupId22["IRGoggles"] = "ir_goggles";
|
|
937
|
+
PowerupId22["DoubleDamage"] = "double_damage";
|
|
938
|
+
PowerupId22["SphereVengeance"] = "sphere_vengeance";
|
|
939
|
+
PowerupId22["SphereHunter"] = "sphere_hunter";
|
|
940
|
+
PowerupId22["SphereDefender"] = "sphere_defender";
|
|
941
|
+
PowerupId22["Doppelganger"] = "doppelganger";
|
|
942
|
+
PowerupId22["TagToken"] = "tag_token";
|
|
943
|
+
PowerupId22["TechResistance"] = "tech_resistance";
|
|
944
|
+
PowerupId22["TechStrength"] = "tech_strength";
|
|
945
|
+
PowerupId22["TechHaste"] = "tech_haste";
|
|
946
|
+
PowerupId22["TechRegeneration"] = "tech_regeneration";
|
|
947
|
+
PowerupId22["Flashlight"] = "flashlight";
|
|
948
|
+
PowerupId22["Compass"] = "compass";
|
|
949
|
+
return PowerupId22;
|
|
950
|
+
})(PowerupId || {});
|
|
879
951
|
var PlayerStat = /* @__PURE__ */ ((PlayerStat2) => {
|
|
880
952
|
PlayerStat2[PlayerStat2["STAT_HEALTH_ICON"] = 0] = "STAT_HEALTH_ICON";
|
|
881
953
|
PlayerStat2[PlayerStat2["STAT_HEALTH"] = 1] = "STAT_HEALTH";
|
|
@@ -895,15 +967,150 @@ var PlayerStat = /* @__PURE__ */ ((PlayerStat2) => {
|
|
|
895
967
|
PlayerStat2[PlayerStat2["STAT_FLASHES"] = 15] = "STAT_FLASHES";
|
|
896
968
|
PlayerStat2[PlayerStat2["STAT_CHASE"] = 16] = "STAT_CHASE";
|
|
897
969
|
PlayerStat2[PlayerStat2["STAT_SPECTATOR"] = 17] = "STAT_SPECTATOR";
|
|
898
|
-
PlayerStat2[PlayerStat2["
|
|
899
|
-
PlayerStat2[PlayerStat2["
|
|
900
|
-
PlayerStat2[PlayerStat2["
|
|
970
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM1_PIC"] = 18] = "STAT_CTF_TEAM1_PIC";
|
|
971
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM1_CAPS"] = 19] = "STAT_CTF_TEAM1_CAPS";
|
|
972
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM2_PIC"] = 20] = "STAT_CTF_TEAM2_PIC";
|
|
973
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM2_CAPS"] = 21] = "STAT_CTF_TEAM2_CAPS";
|
|
974
|
+
PlayerStat2[PlayerStat2["STAT_CTF_FLAG_PIC"] = 22] = "STAT_CTF_FLAG_PIC";
|
|
975
|
+
PlayerStat2[PlayerStat2["STAT_CTF_JOINED_TEAM1_PIC"] = 23] = "STAT_CTF_JOINED_TEAM1_PIC";
|
|
976
|
+
PlayerStat2[PlayerStat2["STAT_CTF_JOINED_TEAM2_PIC"] = 24] = "STAT_CTF_JOINED_TEAM2_PIC";
|
|
977
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM1_HEADER"] = 25] = "STAT_CTF_TEAM1_HEADER";
|
|
978
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM2_HEADER"] = 26] = "STAT_CTF_TEAM2_HEADER";
|
|
979
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TECH"] = 27] = "STAT_CTF_TECH";
|
|
980
|
+
PlayerStat2[PlayerStat2["STAT_CTF_ID_VIEW"] = 28] = "STAT_CTF_ID_VIEW";
|
|
981
|
+
PlayerStat2[PlayerStat2["STAT_CTF_MATCH"] = 29] = "STAT_CTF_MATCH";
|
|
982
|
+
PlayerStat2[PlayerStat2["STAT_CTF_ID_VIEW_COLOR"] = 30] = "STAT_CTF_ID_VIEW_COLOR";
|
|
983
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAMINFO"] = 31] = "STAT_CTF_TEAMINFO";
|
|
984
|
+
PlayerStat2[PlayerStat2["STAT_WEAPONS_OWNED_1"] = 32] = "STAT_WEAPONS_OWNED_1";
|
|
985
|
+
PlayerStat2[PlayerStat2["STAT_WEAPONS_OWNED_2"] = 33] = "STAT_WEAPONS_OWNED_2";
|
|
986
|
+
PlayerStat2[PlayerStat2["STAT_AMMO_INFO_START"] = 34] = "STAT_AMMO_INFO_START";
|
|
987
|
+
PlayerStat2[PlayerStat2["STAT_POWERUP_INFO_START"] = 41] = "STAT_POWERUP_INFO_START";
|
|
988
|
+
PlayerStat2[PlayerStat2["STAT_KEY_A"] = 44] = "STAT_KEY_A";
|
|
989
|
+
PlayerStat2[PlayerStat2["STAT_KEY_B"] = 45] = "STAT_KEY_B";
|
|
990
|
+
PlayerStat2[PlayerStat2["STAT_KEY_C"] = 46] = "STAT_KEY_C";
|
|
991
|
+
PlayerStat2[PlayerStat2["STAT_ACTIVE_WHEEL_WEAPON"] = 47] = "STAT_ACTIVE_WHEEL_WEAPON";
|
|
992
|
+
PlayerStat2[PlayerStat2["STAT_COOP_RESPAWN"] = 48] = "STAT_COOP_RESPAWN";
|
|
993
|
+
PlayerStat2[PlayerStat2["STAT_LIVES"] = 49] = "STAT_LIVES";
|
|
994
|
+
PlayerStat2[PlayerStat2["STAT_HIT_MARKER"] = 50] = "STAT_HIT_MARKER";
|
|
995
|
+
PlayerStat2[PlayerStat2["STAT_SELECTED_ITEM_NAME"] = 51] = "STAT_SELECTED_ITEM_NAME";
|
|
996
|
+
PlayerStat2[PlayerStat2["STAT_HEALTH_BARS"] = 52] = "STAT_HEALTH_BARS";
|
|
997
|
+
PlayerStat2[PlayerStat2["STAT_ACTIVE_WEAPON"] = 53] = "STAT_ACTIVE_WEAPON";
|
|
998
|
+
PlayerStat2[PlayerStat2["STAT_LAST"] = 54] = "STAT_LAST";
|
|
901
999
|
return PlayerStat2;
|
|
902
1000
|
})(PlayerStat || {});
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1001
|
+
var AMMO_MAX = 12;
|
|
1002
|
+
var NUM_BITS_FOR_AMMO = 9;
|
|
1003
|
+
var NUM_AMMO_STATS = Math.ceil(AMMO_MAX * NUM_BITS_FOR_AMMO / 16);
|
|
1004
|
+
var POWERUP_MAX = 23;
|
|
1005
|
+
var NUM_BITS_FOR_POWERUP = 2;
|
|
1006
|
+
var NUM_POWERUP_STATS = Math.ceil(POWERUP_MAX * NUM_BITS_FOR_POWERUP / 16);
|
|
1007
|
+
var POWERUP_STAT_MAP = {
|
|
1008
|
+
[
|
|
1009
|
+
"power_screen"
|
|
1010
|
+
/* PowerScreen */
|
|
1011
|
+
]: 0,
|
|
1012
|
+
[
|
|
1013
|
+
"power_shield"
|
|
1014
|
+
/* PowerShield */
|
|
1015
|
+
]: 1,
|
|
1016
|
+
// 2 is POWERUP_AM_BOMB (not in PowerupId?)
|
|
1017
|
+
[
|
|
1018
|
+
"quad"
|
|
1019
|
+
/* QuadDamage */
|
|
1020
|
+
]: 3,
|
|
1021
|
+
[
|
|
1022
|
+
"quad_fire"
|
|
1023
|
+
/* QuadFire */
|
|
1024
|
+
]: 4,
|
|
1025
|
+
[
|
|
1026
|
+
"invulnerability"
|
|
1027
|
+
/* Invulnerability */
|
|
1028
|
+
]: 5,
|
|
1029
|
+
[
|
|
1030
|
+
"invisibility"
|
|
1031
|
+
/* Invisibility */
|
|
1032
|
+
]: 6,
|
|
1033
|
+
[
|
|
1034
|
+
"silencer"
|
|
1035
|
+
/* Silencer */
|
|
1036
|
+
]: 7,
|
|
1037
|
+
[
|
|
1038
|
+
"rebreather"
|
|
1039
|
+
/* Rebreather */
|
|
1040
|
+
]: 8,
|
|
1041
|
+
[
|
|
1042
|
+
"enviro_suit"
|
|
1043
|
+
/* EnviroSuit */
|
|
1044
|
+
]: 9,
|
|
1045
|
+
// 10 is POWERUP_ADRENALINE (not in PowerupId?)
|
|
1046
|
+
[
|
|
1047
|
+
"ir_goggles"
|
|
1048
|
+
/* IRGoggles */
|
|
1049
|
+
]: 11,
|
|
1050
|
+
[
|
|
1051
|
+
"double_damage"
|
|
1052
|
+
/* DoubleDamage */
|
|
1053
|
+
]: 12,
|
|
1054
|
+
[
|
|
1055
|
+
"sphere_vengeance"
|
|
1056
|
+
/* SphereVengeance */
|
|
1057
|
+
]: 13,
|
|
1058
|
+
[
|
|
1059
|
+
"sphere_hunter"
|
|
1060
|
+
/* SphereHunter */
|
|
1061
|
+
]: 14,
|
|
1062
|
+
[
|
|
1063
|
+
"sphere_defender"
|
|
1064
|
+
/* SphereDefender */
|
|
1065
|
+
]: 15,
|
|
1066
|
+
[
|
|
1067
|
+
"doppelganger"
|
|
1068
|
+
/* Doppelganger */
|
|
1069
|
+
]: 16,
|
|
1070
|
+
[
|
|
1071
|
+
"flashlight"
|
|
1072
|
+
/* Flashlight */
|
|
1073
|
+
]: 17,
|
|
1074
|
+
[
|
|
1075
|
+
"compass"
|
|
1076
|
+
/* Compass */
|
|
1077
|
+
]: 18,
|
|
1078
|
+
[
|
|
1079
|
+
"tech_resistance"
|
|
1080
|
+
/* TechResistance */
|
|
1081
|
+
]: 19,
|
|
1082
|
+
[
|
|
1083
|
+
"tech_strength"
|
|
1084
|
+
/* TechStrength */
|
|
1085
|
+
]: 20,
|
|
1086
|
+
[
|
|
1087
|
+
"tech_haste"
|
|
1088
|
+
/* TechHaste */
|
|
1089
|
+
]: 21,
|
|
1090
|
+
[
|
|
1091
|
+
"tech_regeneration"
|
|
1092
|
+
/* TechRegeneration */
|
|
1093
|
+
]: 22
|
|
1094
|
+
};
|
|
1095
|
+
function G_SetAmmoStat(stats, ammoId, count) {
|
|
1096
|
+
if (ammoId < 0 || ammoId >= AMMO_MAX) return;
|
|
1097
|
+
let val = count;
|
|
1098
|
+
if (val > 511) val = 511;
|
|
1099
|
+
if (val < 0) val = 0;
|
|
1100
|
+
setCompressedInteger(stats, 34, ammoId, val, NUM_BITS_FOR_AMMO);
|
|
1101
|
+
}
|
|
1102
|
+
function G_SetPowerupStat(stats, powerupId, val) {
|
|
1103
|
+
let index;
|
|
1104
|
+
if (typeof powerupId === "number") {
|
|
1105
|
+
index = powerupId;
|
|
1106
|
+
} else {
|
|
1107
|
+
index = POWERUP_STAT_MAP[powerupId];
|
|
1108
|
+
}
|
|
1109
|
+
if (index === void 0 || index < 0 || index >= POWERUP_MAX) return;
|
|
1110
|
+
let safeVal = val;
|
|
1111
|
+
if (safeVal > 3) safeVal = 3;
|
|
1112
|
+
if (safeVal < 0) safeVal = 0;
|
|
1113
|
+
setCompressedInteger(stats, 41, index, safeVal, NUM_BITS_FOR_POWERUP);
|
|
907
1114
|
}
|
|
908
1115
|
var entityFlags_exports = {};
|
|
909
1116
|
__export2(entityFlags_exports, {
|
|
@@ -1040,13 +1247,14 @@ var AmmoType = /* @__PURE__ */ ((AmmoType22) => {
|
|
|
1040
1247
|
AmmoType22[AmmoType22["Grenades"] = 3] = "Grenades";
|
|
1041
1248
|
AmmoType22[AmmoType22["Cells"] = 4] = "Cells";
|
|
1042
1249
|
AmmoType22[AmmoType22["Slugs"] = 5] = "Slugs";
|
|
1043
|
-
AmmoType22[AmmoType22["
|
|
1044
|
-
AmmoType22[AmmoType22["
|
|
1045
|
-
AmmoType22[AmmoType22["
|
|
1046
|
-
AmmoType22[AmmoType22["
|
|
1047
|
-
AmmoType22[AmmoType22["
|
|
1048
|
-
AmmoType22[AmmoType22["
|
|
1049
|
-
AmmoType22[AmmoType22["
|
|
1250
|
+
AmmoType22[AmmoType22["MagSlugs"] = 6] = "MagSlugs";
|
|
1251
|
+
AmmoType22[AmmoType22["Trap"] = 7] = "Trap";
|
|
1252
|
+
AmmoType22[AmmoType22["Flechettes"] = 8] = "Flechettes";
|
|
1253
|
+
AmmoType22[AmmoType22["Tesla"] = 9] = "Tesla";
|
|
1254
|
+
AmmoType22[AmmoType22["Disruptor"] = 10] = "Disruptor";
|
|
1255
|
+
AmmoType22[AmmoType22["Prox"] = 11] = "Prox";
|
|
1256
|
+
AmmoType22[AmmoType22["Nuke"] = 12] = "Nuke";
|
|
1257
|
+
AmmoType22[AmmoType22["Rounds"] = 13] = "Rounds";
|
|
1050
1258
|
return AmmoType22;
|
|
1051
1259
|
})(AmmoType || {});
|
|
1052
1260
|
var AMMO_TYPE_COUNT = Object.keys(AmmoType).length / 2;
|
|
@@ -1059,33 +1267,6 @@ var AmmoItemId = /* @__PURE__ */ ((AmmoItemId22) => {
|
|
|
1059
1267
|
AmmoItemId22["Slugs"] = "ammo_slugs";
|
|
1060
1268
|
return AmmoItemId22;
|
|
1061
1269
|
})(AmmoItemId || {});
|
|
1062
|
-
var PowerupId = /* @__PURE__ */ ((PowerupId22) => {
|
|
1063
|
-
PowerupId22["QuadDamage"] = "quad";
|
|
1064
|
-
PowerupId22["Invulnerability"] = "invulnerability";
|
|
1065
|
-
PowerupId22["EnviroSuit"] = "enviro_suit";
|
|
1066
|
-
PowerupId22["Rebreather"] = "rebreather";
|
|
1067
|
-
PowerupId22["Silencer"] = "silencer";
|
|
1068
|
-
PowerupId22["PowerScreen"] = "power_screen";
|
|
1069
|
-
PowerupId22["PowerShield"] = "power_shield";
|
|
1070
|
-
PowerupId22["QuadFire"] = "quad_fire";
|
|
1071
|
-
PowerupId22["Invisibility"] = "invisibility";
|
|
1072
|
-
PowerupId22["Bandolier"] = "bandolier";
|
|
1073
|
-
PowerupId22["AmmoPack"] = "ammo_pack";
|
|
1074
|
-
PowerupId22["IRGoggles"] = "ir_goggles";
|
|
1075
|
-
PowerupId22["DoubleDamage"] = "double_damage";
|
|
1076
|
-
PowerupId22["SphereVengeance"] = "sphere_vengeance";
|
|
1077
|
-
PowerupId22["SphereHunter"] = "sphere_hunter";
|
|
1078
|
-
PowerupId22["SphereDefender"] = "sphere_defender";
|
|
1079
|
-
PowerupId22["Doppelganger"] = "doppelganger";
|
|
1080
|
-
PowerupId22["TagToken"] = "tag_token";
|
|
1081
|
-
PowerupId22["TechResistance"] = "tech_resistance";
|
|
1082
|
-
PowerupId22["TechStrength"] = "tech_strength";
|
|
1083
|
-
PowerupId22["TechHaste"] = "tech_haste";
|
|
1084
|
-
PowerupId22["TechRegeneration"] = "tech_regeneration";
|
|
1085
|
-
PowerupId22["Flashlight"] = "flashlight";
|
|
1086
|
-
PowerupId22["Compass"] = "compass";
|
|
1087
|
-
return PowerupId22;
|
|
1088
|
-
})(PowerupId || {});
|
|
1089
1270
|
|
|
1090
1271
|
// src/combat/damageFlags.ts
|
|
1091
1272
|
var DamageFlags = /* @__PURE__ */ ((DamageFlags2) => {
|
|
@@ -12825,13 +13006,6 @@ var WEAPON_WHEEL_ORDER = [
|
|
|
12825
13006
|
WeaponId.Railgun,
|
|
12826
13007
|
WeaponId.BFG10K
|
|
12827
13008
|
];
|
|
12828
|
-
var AMMO_WHEEL_ORDER = [
|
|
12829
|
-
AmmoType.Shells,
|
|
12830
|
-
AmmoType.Bullets,
|
|
12831
|
-
AmmoType.Cells,
|
|
12832
|
-
AmmoType.Rockets,
|
|
12833
|
-
AmmoType.Slugs
|
|
12834
|
-
];
|
|
12835
13009
|
var POWERUP_TIMERS = [
|
|
12836
13010
|
{ id: PowerupId.QuadDamage, priority: 1 },
|
|
12837
13011
|
{ id: PowerupId.Invulnerability, priority: 2 },
|
|
@@ -12842,7 +13016,7 @@ var POWERUP_TIMERS = [
|
|
|
12842
13016
|
function populatePlayerStats(player, timeSeconds) {
|
|
12843
13017
|
if (!player.client) return [];
|
|
12844
13018
|
const inventory = player.client.inventory;
|
|
12845
|
-
const statArray = new Array(
|
|
13019
|
+
const statArray = new Array(64).fill(0);
|
|
12846
13020
|
statArray[PlayerStat.STAT_HEALTH] = player.health;
|
|
12847
13021
|
if (inventory.armor) {
|
|
12848
13022
|
statArray[PlayerStat.STAT_ARMOR] = inventory.armor.armorCount;
|
|
@@ -12859,18 +13033,22 @@ function populatePlayerStats(player, timeSeconds) {
|
|
|
12859
13033
|
statArray[PlayerStat.STAT_AMMO] = 0;
|
|
12860
13034
|
if (inventory.currentWeapon) {
|
|
12861
13035
|
const weaponItem = Object.values(WEAPON_ITEMS).find((item) => item.weaponId === inventory.currentWeapon);
|
|
12862
|
-
if (weaponItem && weaponItem.ammoType) {
|
|
13036
|
+
if (weaponItem && weaponItem.ammoType !== null && weaponItem.ammoType !== void 0) {
|
|
12863
13037
|
statArray[PlayerStat.STAT_AMMO] = inventory.ammo.counts[weaponItem.ammoType] || 0;
|
|
12864
13038
|
}
|
|
12865
13039
|
}
|
|
12866
|
-
for (let i = 0; i <
|
|
12867
|
-
const
|
|
12868
|
-
|
|
12869
|
-
|
|
13040
|
+
for (let i = 0; i < AMMO_MAX; i++) {
|
|
13041
|
+
const count = inventory.ammo.counts[i] || 0;
|
|
13042
|
+
G_SetAmmoStat(statArray, i, count);
|
|
13043
|
+
}
|
|
13044
|
+
const nowMs = timeSeconds * 1e3;
|
|
13045
|
+
for (const [id, expiresAt] of inventory.powerups) {
|
|
13046
|
+
if (expiresAt && expiresAt > nowMs) {
|
|
13047
|
+
G_SetPowerupStat(statArray, id, 1);
|
|
13048
|
+
}
|
|
12870
13049
|
}
|
|
12871
13050
|
let bestTime = Infinity;
|
|
12872
13051
|
let bestPowerup = null;
|
|
12873
|
-
const nowMs = timeSeconds * 1e3;
|
|
12874
13052
|
for (const { id } of POWERUP_TIMERS) {
|
|
12875
13053
|
const expiresAt = inventory.powerups.get(id);
|
|
12876
13054
|
if (expiresAt && expiresAt > nowMs) {
|