@quake2ts/client 0.0.754 → 0.0.757

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.
@@ -573,7 +573,9 @@ function buildRenderableEntities(latestEntities, previousEntities, alpha, config
573
573
  }
574
574
  const camVec = cameraPosition ? glMatrix.vec3.fromValues(cameraPosition.x, cameraPosition.y, cameraPosition.z) : null;
575
575
  for (const ent of latestEntities) {
576
+ console.log(`Processing Entity: ${ent.number} (frame: ${ent.frame})`);
576
577
  const prev = prevMap.get(ent.number) ?? ent;
578
+ console.log(`Matched Previous: ${prev === ent ? "SAME AS CURRENT" : "FOUND PREVIOUS"} (frame: ${prev.frame})`);
577
579
  const modelIndex = ent.modelIndex ?? ent.modelindex;
578
580
  const skinNum = ent.skinNum ?? ent.skinnum;
579
581
  if (modelIndex === void 0) continue;
@@ -714,12 +716,15 @@ var ClientNetworkHandler = class {
714
716
  }
715
717
  }
716
718
  onSpawnBaseline(entity) {
717
- this.baselines.set(entity.number, structuredClone(entity));
719
+ this.baselines.set(entity.number, JSON.parse(JSON.stringify(entity)));
718
720
  }
719
721
  onFrame(frame) {
720
722
  if (this.latestFrame) {
721
723
  this.previousFrame = this.latestFrame;
722
- this.previousEntities = this.entities;
724
+ this.previousEntities = /* @__PURE__ */ new Map();
725
+ for (const [k, v] of this.entities) {
726
+ this.previousEntities.set(k, JSON.parse(JSON.stringify(v)));
727
+ }
723
728
  }
724
729
  this.latestFrame = frame;
725
730
  this.stats = [...frame.playerState.stats];
@@ -727,7 +732,7 @@ var ClientNetworkHandler = class {
727
732
  const newEntities = /* @__PURE__ */ new Map();
728
733
  if (packetEntities.delta) {
729
734
  for (const [num, ent] of this.entities) {
730
- newEntities.set(num, structuredClone(ent));
735
+ newEntities.set(num, JSON.parse(JSON.stringify(ent)));
731
736
  }
732
737
  }
733
738
  for (const partial of packetEntities.entities) {
@@ -744,7 +749,7 @@ var ClientNetworkHandler = class {
744
749
  } else {
745
750
  source = engine.createEmptyEntityState();
746
751
  }
747
- const final = structuredClone(source);
752
+ const final = JSON.parse(JSON.stringify(source));
748
753
  engine.applyEntityDelta(final, partial);
749
754
  newEntities.set(number, final);
750
755
  }
@@ -2530,7 +2535,6 @@ var MultiplayerConnection = class {
2530
2535
  this.baselines.set(entity.number, entity);
2531
2536
  }
2532
2537
  onStuffText(msg) {
2533
- console.log(`Server StuffText: ${msg}`);
2534
2538
  if (msg.startsWith("precache")) {
2535
2539
  this.finishLoading();
2536
2540
  }
@@ -4544,6 +4548,12 @@ function createClient(imports) {
4544
4548
  chatManager.addMessage(0, msg);
4545
4549
  });
4546
4550
  const cg = cgame.GetCGameAPI(cgameImport);
4551
+ let netchan;
4552
+ const qportCvar = imports.host?.cvars?.get("net_qport");
4553
+ if (qportCvar && !isNaN(qportCvar.number)) {
4554
+ netchan = new shared.NetChan();
4555
+ netchan.setup(qportCvar.number);
4556
+ }
4547
4557
  const multiplayer = new MultiplayerConnection({
4548
4558
  get username() {
4549
4559
  return imports.host?.cvars?.get("name")?.string || "Player";
@@ -4556,7 +4566,8 @@ function createClient(imports) {
4556
4566
  },
4557
4567
  get fov() {
4558
4568
  return fovValue;
4559
- }
4569
+ },
4570
+ netchan
4560
4571
  });
4561
4572
  multiplayer.setDemoRecorder(demoRecorder);
4562
4573
  multiplayer.setEffectSystem(effectSystem);