quake2ts 0.0.429 → 0.0.431
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 +94 -2
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +94 -2
- 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 +9 -9
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +123 -2
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +120 -2
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/demo/analyzer.d.ts +6 -1
- package/packages/engine/dist/types/demo/analyzer.d.ts.map +1 -1
- package/packages/engine/dist/types/demo/camera.d.ts +17 -0
- package/packages/engine/dist/types/demo/camera.d.ts.map +1 -0
- package/packages/engine/dist/types/demo/playback.d.ts +13 -1
- package/packages/engine/dist/types/demo/playback.d.ts.map +1 -1
- package/packages/engine/dist/types/index.d.ts +5 -0
- package/packages/engine/dist/types/index.d.ts.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -8968,6 +8968,7 @@ var DemoAnalyzer = class {
|
|
|
8968
8968
|
this.statistics = null;
|
|
8969
8969
|
this.playerStats = /* @__PURE__ */ new Map();
|
|
8970
8970
|
this.weaponStats = /* @__PURE__ */ new Map();
|
|
8971
|
+
this.activeEntities = /* @__PURE__ */ new Set();
|
|
8971
8972
|
this.buffer = buffer;
|
|
8972
8973
|
}
|
|
8973
8974
|
analyze() {
|
|
@@ -9003,9 +9004,28 @@ var DemoAnalyzer = class {
|
|
|
9003
9004
|
onSpawnBaseline: (entity) => {
|
|
9004
9005
|
},
|
|
9005
9006
|
onFrame: (frame) => {
|
|
9007
|
+
const currentFrameEntities = /* @__PURE__ */ new Set();
|
|
9008
|
+
if (frame.packetEntities && frame.packetEntities.entities) {
|
|
9009
|
+
for (const ent of frame.packetEntities.entities) {
|
|
9010
|
+
currentFrameEntities.add(ent.number);
|
|
9011
|
+
if (!this.activeEntities.has(ent.number)) {
|
|
9012
|
+
this.recordEvent({
|
|
9013
|
+
type: 5,
|
|
9014
|
+
frame: currentFrameIndex,
|
|
9015
|
+
time: currentTime,
|
|
9016
|
+
entityId: ent.number,
|
|
9017
|
+
position: { x: ent.origin.x, y: ent.origin.y, z: ent.origin.z },
|
|
9018
|
+
description: `Entity ${ent.number} spawned`
|
|
9019
|
+
});
|
|
9020
|
+
}
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
9023
|
+
this.activeEntities = currentFrameEntities;
|
|
9024
|
+
if (frame.playerState && this.header) {
|
|
9025
|
+
}
|
|
9006
9026
|
},
|
|
9007
9027
|
onPrint: (level, msg) => {
|
|
9008
|
-
if (msg.includes("died") || msg.includes("killed")) {
|
|
9028
|
+
if (msg.includes("died") || msg.includes("killed") || msg.includes("suicide")) {
|
|
9009
9029
|
this.summary.totalDeaths++;
|
|
9010
9030
|
this.recordEvent({
|
|
9011
9031
|
type: 4,
|
|
@@ -9014,6 +9034,14 @@ var DemoAnalyzer = class {
|
|
|
9014
9034
|
description: msg.trim()
|
|
9015
9035
|
});
|
|
9016
9036
|
}
|
|
9037
|
+
if (msg.startsWith("You got the ")) {
|
|
9038
|
+
this.recordEvent({
|
|
9039
|
+
type: 3,
|
|
9040
|
+
frame: currentFrameIndex,
|
|
9041
|
+
time: currentTime,
|
|
9042
|
+
description: msg.trim()
|
|
9043
|
+
});
|
|
9044
|
+
}
|
|
9017
9045
|
},
|
|
9018
9046
|
onCenterPrint: () => {
|
|
9019
9047
|
},
|
|
@@ -9054,6 +9082,10 @@ var DemoAnalyzer = class {
|
|
|
9054
9082
|
description: `Took ${ind.damage} damage`
|
|
9055
9083
|
});
|
|
9056
9084
|
this.summary.damageReceived += ind.damage;
|
|
9085
|
+
if (this.header) {
|
|
9086
|
+
const pStats = this.getOrCreatePlayerStats(this.header.playerNum);
|
|
9087
|
+
pStats.damageReceived += ind.damage;
|
|
9088
|
+
}
|
|
9057
9089
|
}
|
|
9058
9090
|
}
|
|
9059
9091
|
};
|
|
@@ -9081,7 +9113,9 @@ var DemoAnalyzer = class {
|
|
|
9081
9113
|
header: this.header,
|
|
9082
9114
|
configStrings: this.configStrings,
|
|
9083
9115
|
serverInfo: this.serverInfo,
|
|
9084
|
-
statistics: this.statistics
|
|
9116
|
+
statistics: this.statistics,
|
|
9117
|
+
playerStats: this.playerStats,
|
|
9118
|
+
weaponStats: this.weaponStats
|
|
9085
9119
|
};
|
|
9086
9120
|
}
|
|
9087
9121
|
handleWeaponFire(ent, weapon, frame, time) {
|
|
@@ -9095,6 +9129,8 @@ var DemoAnalyzer = class {
|
|
|
9095
9129
|
});
|
|
9096
9130
|
const count = this.summary.weaponUsage.get(weapon) || 0;
|
|
9097
9131
|
this.summary.weaponUsage.set(weapon, count + 1);
|
|
9132
|
+
const wStats = this.getOrCreateWeaponStat(ent, weapon);
|
|
9133
|
+
wStats.shotsFired++;
|
|
9098
9134
|
}
|
|
9099
9135
|
recordEvent(event) {
|
|
9100
9136
|
this.events.push(event);
|
|
@@ -9107,6 +9143,33 @@ var DemoAnalyzer = class {
|
|
|
9107
9143
|
}
|
|
9108
9144
|
}
|
|
9109
9145
|
}
|
|
9146
|
+
getOrCreatePlayerStats(playerNum) {
|
|
9147
|
+
let stats = this.playerStats.get(playerNum);
|
|
9148
|
+
if (!stats) {
|
|
9149
|
+
stats = {
|
|
9150
|
+
kills: 0,
|
|
9151
|
+
deaths: 0,
|
|
9152
|
+
damageDealt: 0,
|
|
9153
|
+
damageReceived: 0,
|
|
9154
|
+
suicides: 0
|
|
9155
|
+
};
|
|
9156
|
+
this.playerStats.set(playerNum, stats);
|
|
9157
|
+
}
|
|
9158
|
+
return stats;
|
|
9159
|
+
}
|
|
9160
|
+
getOrCreateWeaponStat(entityId, weaponId) {
|
|
9161
|
+
let statsList = this.weaponStats.get(entityId);
|
|
9162
|
+
if (!statsList) {
|
|
9163
|
+
statsList = [];
|
|
9164
|
+
this.weaponStats.set(entityId, statsList);
|
|
9165
|
+
}
|
|
9166
|
+
let stat = statsList.find((s) => s.weaponId === weaponId);
|
|
9167
|
+
if (!stat) {
|
|
9168
|
+
stat = { weaponId, shotsFired: 0, hits: 0, kills: 0 };
|
|
9169
|
+
statsList.push(stat);
|
|
9170
|
+
}
|
|
9171
|
+
return stat;
|
|
9172
|
+
}
|
|
9110
9173
|
};
|
|
9111
9174
|
var PlaybackState = /* @__PURE__ */ ((PlaybackState22) => {
|
|
9112
9175
|
PlaybackState22[PlaybackState22["Stopped"] = 0] = "Stopped";
|
|
@@ -9134,6 +9197,11 @@ var DemoPlaybackController = class {
|
|
|
9134
9197
|
this.cachedConfigStrings = null;
|
|
9135
9198
|
this.cachedServerInfo = null;
|
|
9136
9199
|
this.cachedStatistics = null;
|
|
9200
|
+
this.cachedPlayerStats = null;
|
|
9201
|
+
this.cachedWeaponStats = null;
|
|
9202
|
+
this.cameraMode = 0;
|
|
9203
|
+
this.thirdPersonDistance = 80;
|
|
9204
|
+
this.thirdPersonOffset = { x: 0, y: 0, z: 0 };
|
|
9137
9205
|
}
|
|
9138
9206
|
setHandler(handler) {
|
|
9139
9207
|
this.handler = handler;
|
|
@@ -9159,6 +9227,8 @@ var DemoPlaybackController = class {
|
|
|
9159
9227
|
this.cachedConfigStrings = null;
|
|
9160
9228
|
this.cachedServerInfo = null;
|
|
9161
9229
|
this.cachedStatistics = null;
|
|
9230
|
+
this.cachedPlayerStats = null;
|
|
9231
|
+
this.cachedWeaponStats = null;
|
|
9162
9232
|
}
|
|
9163
9233
|
play() {
|
|
9164
9234
|
if (this.reader && this.state !== 1) {
|
|
@@ -9525,6 +9595,14 @@ var DemoPlaybackController = class {
|
|
|
9525
9595
|
this.ensureAnalysis();
|
|
9526
9596
|
return this.cachedStatistics;
|
|
9527
9597
|
}
|
|
9598
|
+
getPlayerStatistics(playerIndex) {
|
|
9599
|
+
this.ensureAnalysis();
|
|
9600
|
+
return this.cachedPlayerStats?.get(playerIndex) || null;
|
|
9601
|
+
}
|
|
9602
|
+
getWeaponStatistics(entityId) {
|
|
9603
|
+
this.ensureAnalysis();
|
|
9604
|
+
return this.cachedWeaponStats?.get(entityId) || null;
|
|
9605
|
+
}
|
|
9528
9606
|
ensureAnalysis() {
|
|
9529
9607
|
if (!this.cachedEvents && this.buffer) {
|
|
9530
9608
|
const analyzer = new DemoAnalyzer(this.buffer);
|
|
@@ -9535,8 +9613,22 @@ var DemoPlaybackController = class {
|
|
|
9535
9613
|
this.cachedConfigStrings = result.configStrings;
|
|
9536
9614
|
this.cachedServerInfo = result.serverInfo;
|
|
9537
9615
|
this.cachedStatistics = result.statistics;
|
|
9616
|
+
this.cachedPlayerStats = result.playerStats;
|
|
9617
|
+
this.cachedWeaponStats = result.weaponStats;
|
|
9538
9618
|
}
|
|
9539
9619
|
}
|
|
9620
|
+
setCameraMode(mode) {
|
|
9621
|
+
this.cameraMode = mode;
|
|
9622
|
+
}
|
|
9623
|
+
getCameraMode() {
|
|
9624
|
+
return this.cameraMode;
|
|
9625
|
+
}
|
|
9626
|
+
setThirdPersonDistance(distance2) {
|
|
9627
|
+
this.thirdPersonDistance = distance2;
|
|
9628
|
+
}
|
|
9629
|
+
setThirdPersonOffset(offset) {
|
|
9630
|
+
this.thirdPersonOffset = offset;
|
|
9631
|
+
}
|
|
9540
9632
|
};
|
|
9541
9633
|
var DemoRecorder = class {
|
|
9542
9634
|
// -1 means start of demo
|