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
|
@@ -710,6 +710,78 @@ var TempEntity = /* @__PURE__ */ ((TempEntity2) => {
|
|
|
710
710
|
TempEntity2[TempEntity2["EXPLOSION2_NL"] = 63] = "EXPLOSION2_NL";
|
|
711
711
|
return TempEntity2;
|
|
712
712
|
})(TempEntity || {});
|
|
713
|
+
function toSigned16(val) {
|
|
714
|
+
return val << 16 >> 16;
|
|
715
|
+
}
|
|
716
|
+
function readUint16LE(stats, startIndex, byteOffset) {
|
|
717
|
+
const elementIndex = Math.floor(byteOffset / 2);
|
|
718
|
+
const isOdd = byteOffset % 2 !== 0;
|
|
719
|
+
const index = startIndex + elementIndex;
|
|
720
|
+
const val0 = stats[index] || 0;
|
|
721
|
+
if (!isOdd) {
|
|
722
|
+
return val0 & 65535;
|
|
723
|
+
} else {
|
|
724
|
+
const val1 = stats[index + 1] || 0;
|
|
725
|
+
const low = val0 >>> 8 & 255;
|
|
726
|
+
const high = val1 & 255;
|
|
727
|
+
return high << 8 | low;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
function writeUint16LE(stats, startIndex, byteOffset, value) {
|
|
731
|
+
const elementIndex = Math.floor(byteOffset / 2);
|
|
732
|
+
const isOdd = byteOffset % 2 !== 0;
|
|
733
|
+
const index = startIndex + elementIndex;
|
|
734
|
+
if (stats[index] === void 0) stats[index] = 0;
|
|
735
|
+
if (!isOdd) {
|
|
736
|
+
stats[index] = toSigned16(value);
|
|
737
|
+
} else {
|
|
738
|
+
if (stats[index + 1] === void 0) stats[index + 1] = 0;
|
|
739
|
+
const val0 = stats[index];
|
|
740
|
+
const val1 = stats[index + 1];
|
|
741
|
+
const newHigh0 = value & 255;
|
|
742
|
+
const newVal0 = val0 & 255 | newHigh0 << 8;
|
|
743
|
+
stats[index] = toSigned16(newVal0);
|
|
744
|
+
const newLow1 = value >>> 8 & 255;
|
|
745
|
+
const newVal1 = newLow1 | val1 & 65280;
|
|
746
|
+
stats[index + 1] = toSigned16(newVal1);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function setCompressedInteger(stats, startIndex, id, count, bitsPerValue) {
|
|
750
|
+
const bitOffset = bitsPerValue * id;
|
|
751
|
+
const byteOffset = Math.floor(bitOffset / 8);
|
|
752
|
+
const bitShift = bitOffset % 8;
|
|
753
|
+
const mask = (1 << bitsPerValue) - 1 << bitShift;
|
|
754
|
+
let base = readUint16LE(stats, startIndex, byteOffset);
|
|
755
|
+
const valueToWrite = base & ~mask | count << bitShift & mask;
|
|
756
|
+
writeUint16LE(stats, startIndex, byteOffset, valueToWrite & 65535);
|
|
757
|
+
}
|
|
758
|
+
var PowerupId = /* @__PURE__ */ ((PowerupId22) => {
|
|
759
|
+
PowerupId22["QuadDamage"] = "quad";
|
|
760
|
+
PowerupId22["Invulnerability"] = "invulnerability";
|
|
761
|
+
PowerupId22["EnviroSuit"] = "enviro_suit";
|
|
762
|
+
PowerupId22["Rebreather"] = "rebreather";
|
|
763
|
+
PowerupId22["Silencer"] = "silencer";
|
|
764
|
+
PowerupId22["PowerScreen"] = "power_screen";
|
|
765
|
+
PowerupId22["PowerShield"] = "power_shield";
|
|
766
|
+
PowerupId22["QuadFire"] = "quad_fire";
|
|
767
|
+
PowerupId22["Invisibility"] = "invisibility";
|
|
768
|
+
PowerupId22["Bandolier"] = "bandolier";
|
|
769
|
+
PowerupId22["AmmoPack"] = "ammo_pack";
|
|
770
|
+
PowerupId22["IRGoggles"] = "ir_goggles";
|
|
771
|
+
PowerupId22["DoubleDamage"] = "double_damage";
|
|
772
|
+
PowerupId22["SphereVengeance"] = "sphere_vengeance";
|
|
773
|
+
PowerupId22["SphereHunter"] = "sphere_hunter";
|
|
774
|
+
PowerupId22["SphereDefender"] = "sphere_defender";
|
|
775
|
+
PowerupId22["Doppelganger"] = "doppelganger";
|
|
776
|
+
PowerupId22["TagToken"] = "tag_token";
|
|
777
|
+
PowerupId22["TechResistance"] = "tech_resistance";
|
|
778
|
+
PowerupId22["TechStrength"] = "tech_strength";
|
|
779
|
+
PowerupId22["TechHaste"] = "tech_haste";
|
|
780
|
+
PowerupId22["TechRegeneration"] = "tech_regeneration";
|
|
781
|
+
PowerupId22["Flashlight"] = "flashlight";
|
|
782
|
+
PowerupId22["Compass"] = "compass";
|
|
783
|
+
return PowerupId22;
|
|
784
|
+
})(PowerupId || {});
|
|
713
785
|
var PlayerStat = /* @__PURE__ */ ((PlayerStat2) => {
|
|
714
786
|
PlayerStat2[PlayerStat2["STAT_HEALTH_ICON"] = 0] = "STAT_HEALTH_ICON";
|
|
715
787
|
PlayerStat2[PlayerStat2["STAT_HEALTH"] = 1] = "STAT_HEALTH";
|
|
@@ -729,15 +801,150 @@ var PlayerStat = /* @__PURE__ */ ((PlayerStat2) => {
|
|
|
729
801
|
PlayerStat2[PlayerStat2["STAT_FLASHES"] = 15] = "STAT_FLASHES";
|
|
730
802
|
PlayerStat2[PlayerStat2["STAT_CHASE"] = 16] = "STAT_CHASE";
|
|
731
803
|
PlayerStat2[PlayerStat2["STAT_SPECTATOR"] = 17] = "STAT_SPECTATOR";
|
|
732
|
-
PlayerStat2[PlayerStat2["
|
|
733
|
-
PlayerStat2[PlayerStat2["
|
|
734
|
-
PlayerStat2[PlayerStat2["
|
|
804
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM1_PIC"] = 18] = "STAT_CTF_TEAM1_PIC";
|
|
805
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM1_CAPS"] = 19] = "STAT_CTF_TEAM1_CAPS";
|
|
806
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM2_PIC"] = 20] = "STAT_CTF_TEAM2_PIC";
|
|
807
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM2_CAPS"] = 21] = "STAT_CTF_TEAM2_CAPS";
|
|
808
|
+
PlayerStat2[PlayerStat2["STAT_CTF_FLAG_PIC"] = 22] = "STAT_CTF_FLAG_PIC";
|
|
809
|
+
PlayerStat2[PlayerStat2["STAT_CTF_JOINED_TEAM1_PIC"] = 23] = "STAT_CTF_JOINED_TEAM1_PIC";
|
|
810
|
+
PlayerStat2[PlayerStat2["STAT_CTF_JOINED_TEAM2_PIC"] = 24] = "STAT_CTF_JOINED_TEAM2_PIC";
|
|
811
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM1_HEADER"] = 25] = "STAT_CTF_TEAM1_HEADER";
|
|
812
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAM2_HEADER"] = 26] = "STAT_CTF_TEAM2_HEADER";
|
|
813
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TECH"] = 27] = "STAT_CTF_TECH";
|
|
814
|
+
PlayerStat2[PlayerStat2["STAT_CTF_ID_VIEW"] = 28] = "STAT_CTF_ID_VIEW";
|
|
815
|
+
PlayerStat2[PlayerStat2["STAT_CTF_MATCH"] = 29] = "STAT_CTF_MATCH";
|
|
816
|
+
PlayerStat2[PlayerStat2["STAT_CTF_ID_VIEW_COLOR"] = 30] = "STAT_CTF_ID_VIEW_COLOR";
|
|
817
|
+
PlayerStat2[PlayerStat2["STAT_CTF_TEAMINFO"] = 31] = "STAT_CTF_TEAMINFO";
|
|
818
|
+
PlayerStat2[PlayerStat2["STAT_WEAPONS_OWNED_1"] = 32] = "STAT_WEAPONS_OWNED_1";
|
|
819
|
+
PlayerStat2[PlayerStat2["STAT_WEAPONS_OWNED_2"] = 33] = "STAT_WEAPONS_OWNED_2";
|
|
820
|
+
PlayerStat2[PlayerStat2["STAT_AMMO_INFO_START"] = 34] = "STAT_AMMO_INFO_START";
|
|
821
|
+
PlayerStat2[PlayerStat2["STAT_POWERUP_INFO_START"] = 41] = "STAT_POWERUP_INFO_START";
|
|
822
|
+
PlayerStat2[PlayerStat2["STAT_KEY_A"] = 44] = "STAT_KEY_A";
|
|
823
|
+
PlayerStat2[PlayerStat2["STAT_KEY_B"] = 45] = "STAT_KEY_B";
|
|
824
|
+
PlayerStat2[PlayerStat2["STAT_KEY_C"] = 46] = "STAT_KEY_C";
|
|
825
|
+
PlayerStat2[PlayerStat2["STAT_ACTIVE_WHEEL_WEAPON"] = 47] = "STAT_ACTIVE_WHEEL_WEAPON";
|
|
826
|
+
PlayerStat2[PlayerStat2["STAT_COOP_RESPAWN"] = 48] = "STAT_COOP_RESPAWN";
|
|
827
|
+
PlayerStat2[PlayerStat2["STAT_LIVES"] = 49] = "STAT_LIVES";
|
|
828
|
+
PlayerStat2[PlayerStat2["STAT_HIT_MARKER"] = 50] = "STAT_HIT_MARKER";
|
|
829
|
+
PlayerStat2[PlayerStat2["STAT_SELECTED_ITEM_NAME"] = 51] = "STAT_SELECTED_ITEM_NAME";
|
|
830
|
+
PlayerStat2[PlayerStat2["STAT_HEALTH_BARS"] = 52] = "STAT_HEALTH_BARS";
|
|
831
|
+
PlayerStat2[PlayerStat2["STAT_ACTIVE_WEAPON"] = 53] = "STAT_ACTIVE_WEAPON";
|
|
832
|
+
PlayerStat2[PlayerStat2["STAT_LAST"] = 54] = "STAT_LAST";
|
|
735
833
|
return PlayerStat2;
|
|
736
834
|
})(PlayerStat || {});
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
835
|
+
var AMMO_MAX = 12;
|
|
836
|
+
var NUM_BITS_FOR_AMMO = 9;
|
|
837
|
+
var NUM_AMMO_STATS = Math.ceil(AMMO_MAX * NUM_BITS_FOR_AMMO / 16);
|
|
838
|
+
var POWERUP_MAX = 23;
|
|
839
|
+
var NUM_BITS_FOR_POWERUP = 2;
|
|
840
|
+
var NUM_POWERUP_STATS = Math.ceil(POWERUP_MAX * NUM_BITS_FOR_POWERUP / 16);
|
|
841
|
+
var POWERUP_STAT_MAP = {
|
|
842
|
+
[
|
|
843
|
+
"power_screen"
|
|
844
|
+
/* PowerScreen */
|
|
845
|
+
]: 0,
|
|
846
|
+
[
|
|
847
|
+
"power_shield"
|
|
848
|
+
/* PowerShield */
|
|
849
|
+
]: 1,
|
|
850
|
+
// 2 is POWERUP_AM_BOMB (not in PowerupId?)
|
|
851
|
+
[
|
|
852
|
+
"quad"
|
|
853
|
+
/* QuadDamage */
|
|
854
|
+
]: 3,
|
|
855
|
+
[
|
|
856
|
+
"quad_fire"
|
|
857
|
+
/* QuadFire */
|
|
858
|
+
]: 4,
|
|
859
|
+
[
|
|
860
|
+
"invulnerability"
|
|
861
|
+
/* Invulnerability */
|
|
862
|
+
]: 5,
|
|
863
|
+
[
|
|
864
|
+
"invisibility"
|
|
865
|
+
/* Invisibility */
|
|
866
|
+
]: 6,
|
|
867
|
+
[
|
|
868
|
+
"silencer"
|
|
869
|
+
/* Silencer */
|
|
870
|
+
]: 7,
|
|
871
|
+
[
|
|
872
|
+
"rebreather"
|
|
873
|
+
/* Rebreather */
|
|
874
|
+
]: 8,
|
|
875
|
+
[
|
|
876
|
+
"enviro_suit"
|
|
877
|
+
/* EnviroSuit */
|
|
878
|
+
]: 9,
|
|
879
|
+
// 10 is POWERUP_ADRENALINE (not in PowerupId?)
|
|
880
|
+
[
|
|
881
|
+
"ir_goggles"
|
|
882
|
+
/* IRGoggles */
|
|
883
|
+
]: 11,
|
|
884
|
+
[
|
|
885
|
+
"double_damage"
|
|
886
|
+
/* DoubleDamage */
|
|
887
|
+
]: 12,
|
|
888
|
+
[
|
|
889
|
+
"sphere_vengeance"
|
|
890
|
+
/* SphereVengeance */
|
|
891
|
+
]: 13,
|
|
892
|
+
[
|
|
893
|
+
"sphere_hunter"
|
|
894
|
+
/* SphereHunter */
|
|
895
|
+
]: 14,
|
|
896
|
+
[
|
|
897
|
+
"sphere_defender"
|
|
898
|
+
/* SphereDefender */
|
|
899
|
+
]: 15,
|
|
900
|
+
[
|
|
901
|
+
"doppelganger"
|
|
902
|
+
/* Doppelganger */
|
|
903
|
+
]: 16,
|
|
904
|
+
[
|
|
905
|
+
"flashlight"
|
|
906
|
+
/* Flashlight */
|
|
907
|
+
]: 17,
|
|
908
|
+
[
|
|
909
|
+
"compass"
|
|
910
|
+
/* Compass */
|
|
911
|
+
]: 18,
|
|
912
|
+
[
|
|
913
|
+
"tech_resistance"
|
|
914
|
+
/* TechResistance */
|
|
915
|
+
]: 19,
|
|
916
|
+
[
|
|
917
|
+
"tech_strength"
|
|
918
|
+
/* TechStrength */
|
|
919
|
+
]: 20,
|
|
920
|
+
[
|
|
921
|
+
"tech_haste"
|
|
922
|
+
/* TechHaste */
|
|
923
|
+
]: 21,
|
|
924
|
+
[
|
|
925
|
+
"tech_regeneration"
|
|
926
|
+
/* TechRegeneration */
|
|
927
|
+
]: 22
|
|
928
|
+
};
|
|
929
|
+
function G_SetAmmoStat(stats, ammoId, count) {
|
|
930
|
+
if (ammoId < 0 || ammoId >= AMMO_MAX) return;
|
|
931
|
+
let val = count;
|
|
932
|
+
if (val > 511) val = 511;
|
|
933
|
+
if (val < 0) val = 0;
|
|
934
|
+
setCompressedInteger(stats, 34, ammoId, val, NUM_BITS_FOR_AMMO);
|
|
935
|
+
}
|
|
936
|
+
function G_SetPowerupStat(stats, powerupId, val) {
|
|
937
|
+
let index;
|
|
938
|
+
if (typeof powerupId === "number") {
|
|
939
|
+
index = powerupId;
|
|
940
|
+
} else {
|
|
941
|
+
index = POWERUP_STAT_MAP[powerupId];
|
|
942
|
+
}
|
|
943
|
+
if (index === void 0 || index < 0 || index >= POWERUP_MAX) return;
|
|
944
|
+
let safeVal = val;
|
|
945
|
+
if (safeVal > 3) safeVal = 3;
|
|
946
|
+
if (safeVal < 0) safeVal = 0;
|
|
947
|
+
setCompressedInteger(stats, 41, index, safeVal, NUM_BITS_FOR_POWERUP);
|
|
741
948
|
}
|
|
742
949
|
var entityFlags_exports = {};
|
|
743
950
|
__export(entityFlags_exports, {
|
|
@@ -874,13 +1081,14 @@ var AmmoType = /* @__PURE__ */ ((AmmoType22) => {
|
|
|
874
1081
|
AmmoType22[AmmoType22["Grenades"] = 3] = "Grenades";
|
|
875
1082
|
AmmoType22[AmmoType22["Cells"] = 4] = "Cells";
|
|
876
1083
|
AmmoType22[AmmoType22["Slugs"] = 5] = "Slugs";
|
|
877
|
-
AmmoType22[AmmoType22["
|
|
878
|
-
AmmoType22[AmmoType22["
|
|
879
|
-
AmmoType22[AmmoType22["
|
|
880
|
-
AmmoType22[AmmoType22["
|
|
881
|
-
AmmoType22[AmmoType22["
|
|
882
|
-
AmmoType22[AmmoType22["
|
|
883
|
-
AmmoType22[AmmoType22["
|
|
1084
|
+
AmmoType22[AmmoType22["MagSlugs"] = 6] = "MagSlugs";
|
|
1085
|
+
AmmoType22[AmmoType22["Trap"] = 7] = "Trap";
|
|
1086
|
+
AmmoType22[AmmoType22["Flechettes"] = 8] = "Flechettes";
|
|
1087
|
+
AmmoType22[AmmoType22["Tesla"] = 9] = "Tesla";
|
|
1088
|
+
AmmoType22[AmmoType22["Disruptor"] = 10] = "Disruptor";
|
|
1089
|
+
AmmoType22[AmmoType22["Prox"] = 11] = "Prox";
|
|
1090
|
+
AmmoType22[AmmoType22["Nuke"] = 12] = "Nuke";
|
|
1091
|
+
AmmoType22[AmmoType22["Rounds"] = 13] = "Rounds";
|
|
884
1092
|
return AmmoType22;
|
|
885
1093
|
})(AmmoType || {});
|
|
886
1094
|
var AMMO_TYPE_COUNT = Object.keys(AmmoType).length / 2;
|
|
@@ -893,33 +1101,6 @@ var AmmoItemId = /* @__PURE__ */ ((AmmoItemId22) => {
|
|
|
893
1101
|
AmmoItemId22["Slugs"] = "ammo_slugs";
|
|
894
1102
|
return AmmoItemId22;
|
|
895
1103
|
})(AmmoItemId || {});
|
|
896
|
-
var PowerupId = /* @__PURE__ */ ((PowerupId22) => {
|
|
897
|
-
PowerupId22["QuadDamage"] = "quad";
|
|
898
|
-
PowerupId22["Invulnerability"] = "invulnerability";
|
|
899
|
-
PowerupId22["EnviroSuit"] = "enviro_suit";
|
|
900
|
-
PowerupId22["Rebreather"] = "rebreather";
|
|
901
|
-
PowerupId22["Silencer"] = "silencer";
|
|
902
|
-
PowerupId22["PowerScreen"] = "power_screen";
|
|
903
|
-
PowerupId22["PowerShield"] = "power_shield";
|
|
904
|
-
PowerupId22["QuadFire"] = "quad_fire";
|
|
905
|
-
PowerupId22["Invisibility"] = "invisibility";
|
|
906
|
-
PowerupId22["Bandolier"] = "bandolier";
|
|
907
|
-
PowerupId22["AmmoPack"] = "ammo_pack";
|
|
908
|
-
PowerupId22["IRGoggles"] = "ir_goggles";
|
|
909
|
-
PowerupId22["DoubleDamage"] = "double_damage";
|
|
910
|
-
PowerupId22["SphereVengeance"] = "sphere_vengeance";
|
|
911
|
-
PowerupId22["SphereHunter"] = "sphere_hunter";
|
|
912
|
-
PowerupId22["SphereDefender"] = "sphere_defender";
|
|
913
|
-
PowerupId22["Doppelganger"] = "doppelganger";
|
|
914
|
-
PowerupId22["TagToken"] = "tag_token";
|
|
915
|
-
PowerupId22["TechResistance"] = "tech_resistance";
|
|
916
|
-
PowerupId22["TechStrength"] = "tech_strength";
|
|
917
|
-
PowerupId22["TechHaste"] = "tech_haste";
|
|
918
|
-
PowerupId22["TechRegeneration"] = "tech_regeneration";
|
|
919
|
-
PowerupId22["Flashlight"] = "flashlight";
|
|
920
|
-
PowerupId22["Compass"] = "compass";
|
|
921
|
-
return PowerupId22;
|
|
922
|
-
})(PowerupId || {});
|
|
923
1104
|
|
|
924
1105
|
// src/combat/damageFlags.ts
|
|
925
1106
|
var DamageFlags = /* @__PURE__ */ ((DamageFlags2) => {
|
|
@@ -12659,13 +12840,6 @@ var WEAPON_WHEEL_ORDER = [
|
|
|
12659
12840
|
WeaponId.Railgun,
|
|
12660
12841
|
WeaponId.BFG10K
|
|
12661
12842
|
];
|
|
12662
|
-
var AMMO_WHEEL_ORDER = [
|
|
12663
|
-
AmmoType.Shells,
|
|
12664
|
-
AmmoType.Bullets,
|
|
12665
|
-
AmmoType.Cells,
|
|
12666
|
-
AmmoType.Rockets,
|
|
12667
|
-
AmmoType.Slugs
|
|
12668
|
-
];
|
|
12669
12843
|
var POWERUP_TIMERS = [
|
|
12670
12844
|
{ id: PowerupId.QuadDamage, priority: 1 },
|
|
12671
12845
|
{ id: PowerupId.Invulnerability, priority: 2 },
|
|
@@ -12676,7 +12850,7 @@ var POWERUP_TIMERS = [
|
|
|
12676
12850
|
function populatePlayerStats(player, timeSeconds) {
|
|
12677
12851
|
if (!player.client) return [];
|
|
12678
12852
|
const inventory = player.client.inventory;
|
|
12679
|
-
const statArray = new Array(
|
|
12853
|
+
const statArray = new Array(64).fill(0);
|
|
12680
12854
|
statArray[PlayerStat.STAT_HEALTH] = player.health;
|
|
12681
12855
|
if (inventory.armor) {
|
|
12682
12856
|
statArray[PlayerStat.STAT_ARMOR] = inventory.armor.armorCount;
|
|
@@ -12693,18 +12867,22 @@ function populatePlayerStats(player, timeSeconds) {
|
|
|
12693
12867
|
statArray[PlayerStat.STAT_AMMO] = 0;
|
|
12694
12868
|
if (inventory.currentWeapon) {
|
|
12695
12869
|
const weaponItem = Object.values(WEAPON_ITEMS).find((item) => item.weaponId === inventory.currentWeapon);
|
|
12696
|
-
if (weaponItem && weaponItem.ammoType) {
|
|
12870
|
+
if (weaponItem && weaponItem.ammoType !== null && weaponItem.ammoType !== void 0) {
|
|
12697
12871
|
statArray[PlayerStat.STAT_AMMO] = inventory.ammo.counts[weaponItem.ammoType] || 0;
|
|
12698
12872
|
}
|
|
12699
12873
|
}
|
|
12700
|
-
for (let i = 0; i <
|
|
12701
|
-
const
|
|
12702
|
-
|
|
12703
|
-
|
|
12874
|
+
for (let i = 0; i < AMMO_MAX; i++) {
|
|
12875
|
+
const count = inventory.ammo.counts[i] || 0;
|
|
12876
|
+
G_SetAmmoStat(statArray, i, count);
|
|
12877
|
+
}
|
|
12878
|
+
const nowMs = timeSeconds * 1e3;
|
|
12879
|
+
for (const [id, expiresAt] of inventory.powerups) {
|
|
12880
|
+
if (expiresAt && expiresAt > nowMs) {
|
|
12881
|
+
G_SetPowerupStat(statArray, id, 1);
|
|
12882
|
+
}
|
|
12704
12883
|
}
|
|
12705
12884
|
let bestTime = Infinity;
|
|
12706
12885
|
let bestPowerup = null;
|
|
12707
|
-
const nowMs = timeSeconds * 1e3;
|
|
12708
12886
|
for (const { id } of POWERUP_TIMERS) {
|
|
12709
12887
|
const expiresAt = inventory.powerups.get(id);
|
|
12710
12888
|
if (expiresAt && expiresAt > nowMs) {
|