@quake2ts/shared 0.0.869 → 0.0.874

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/dist/esm/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2
3
  var __export = (target, all) => {
3
4
  for (var name in all)
4
5
  __defProp(target, name, { get: all[name], enumerable: true });
5
6
  };
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
8
 
7
9
  // src/math/vec3.ts
8
10
  var ZERO_VEC3 = { x: 0, y: 0, z: 0 };
@@ -557,8 +559,8 @@ var LOWER_MASK = 2147483647;
557
559
  var TWO_POW_32 = 4294967296;
558
560
  var MersenneTwister19937 = class {
559
561
  constructor(seed = 5489) {
560
- this.state = new Uint32Array(STATE_SIZE);
561
- this.index = STATE_SIZE;
562
+ __publicField(this, "state", new Uint32Array(STATE_SIZE));
563
+ __publicField(this, "index", STATE_SIZE);
562
564
  this.seed(seed);
563
565
  }
564
566
  seed(seed) {
@@ -608,6 +610,7 @@ var MersenneTwister19937 = class {
608
610
  };
609
611
  var RandomGenerator = class {
610
612
  constructor(options = {}) {
613
+ __publicField(this, "mt");
611
614
  this.mt = new MersenneTwister19937(options.seed);
612
615
  }
613
616
  seed(seed) {
@@ -1551,9 +1554,9 @@ function pickBetterTrace(best, candidate) {
1551
1554
  }
1552
1555
  var CollisionEntityIndex = class {
1553
1556
  constructor() {
1554
- this.entities = /* @__PURE__ */ new Map();
1555
- this.entityNodes = /* @__PURE__ */ new Map();
1556
- this.rootNode = createSpatialTree();
1557
+ __publicField(this, "entities", /* @__PURE__ */ new Map());
1558
+ __publicField(this, "entityNodes", /* @__PURE__ */ new Map());
1559
+ __publicField(this, "rootNode", createSpatialTree());
1557
1560
  }
1558
1561
  link(entity) {
1559
1562
  const state = makeEntityState(entity);
@@ -4967,6 +4970,9 @@ var applyPmove = (state, cmd, trace, pointContents2) => {
4967
4970
  // src/io/binaryStream.ts
4968
4971
  var BinaryStream = class {
4969
4972
  constructor(buffer) {
4973
+ __publicField(this, "view");
4974
+ __publicField(this, "offset");
4975
+ __publicField(this, "length");
4970
4976
  if (buffer instanceof Uint8Array) {
4971
4977
  this.view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
4972
4978
  } else {
@@ -5099,6 +5105,10 @@ var BinaryStream = class {
5099
5105
  // src/io/binaryWriter.ts
5100
5106
  var BinaryWriter = class {
5101
5107
  constructor(sizeOrBuffer = 1400) {
5108
+ __publicField(this, "buffer");
5109
+ __publicField(this, "view");
5110
+ __publicField(this, "offset");
5111
+ __publicField(this, "fixed");
5102
5112
  if (typeof sizeOrBuffer === "number") {
5103
5113
  this.buffer = new Uint8Array(sizeOrBuffer);
5104
5114
  this.fixed = false;
@@ -5208,6 +5218,9 @@ var BinaryWriter = class {
5208
5218
  // src/io/messageBuilder.ts
5209
5219
  var NetworkMessageBuilder = class {
5210
5220
  constructor(initialSize = 1024) {
5221
+ __publicField(this, "buffer");
5222
+ __publicField(this, "view");
5223
+ __publicField(this, "offset");
5211
5224
  this.buffer = new Uint8Array(initialSize);
5212
5225
  this.view = new DataView(this.buffer.buffer);
5213
5226
  this.offset = 0;
@@ -5302,29 +5315,31 @@ var _NetChan = class _NetChan {
5302
5315
  constructor() {
5303
5316
  // 256KB
5304
5317
  // Public state
5305
- this.qport = 0;
5318
+ __publicField(this, "qport", 0);
5306
5319
  // qport value to distinguish multiple clients from same IP
5307
5320
  // Sequencing
5308
- this.incomingSequence = 0;
5309
- this.outgoingSequence = 0;
5310
- this.incomingAcknowledged = 0;
5321
+ __publicField(this, "incomingSequence", 0);
5322
+ __publicField(this, "outgoingSequence", 0);
5323
+ __publicField(this, "incomingAcknowledged", 0);
5311
5324
  // Reliable messaging
5312
- this.incomingReliableAcknowledged = false;
5325
+ __publicField(this, "incomingReliableAcknowledged", false);
5313
5326
  // single bit
5314
- this.incomingReliableSequence = 0;
5327
+ __publicField(this, "incomingReliableSequence", 0);
5315
5328
  // last reliable message sequence received
5316
- this.outgoingReliableSequence = 0;
5317
- this.reliableLength = 0;
5329
+ __publicField(this, "outgoingReliableSequence", 0);
5330
+ // reliable message sequence number to send
5331
+ __publicField(this, "reliableMessage");
5332
+ __publicField(this, "reliableLength", 0);
5318
5333
  // Fragmentation State (Sending)
5319
- this.fragmentSendOffset = 0;
5334
+ __publicField(this, "fragmentSendOffset", 0);
5320
5335
  // Fragmentation State (Receiving)
5321
- this.fragmentBuffer = null;
5322
- this.fragmentLength = 0;
5323
- this.fragmentReceived = 0;
5336
+ __publicField(this, "fragmentBuffer", null);
5337
+ __publicField(this, "fragmentLength", 0);
5338
+ __publicField(this, "fragmentReceived", 0);
5324
5339
  // Timing
5325
- this.lastReceived = 0;
5326
- this.lastSent = 0;
5327
- this.remoteAddress = null;
5340
+ __publicField(this, "lastReceived", 0);
5341
+ __publicField(this, "lastSent", 0);
5342
+ __publicField(this, "remoteAddress", null);
5328
5343
  this.reliableMessage = new BinaryWriter(_NetChan.MAX_RELIABLE_BUFFER);
5329
5344
  const now = Date.now();
5330
5345
  this.lastReceived = now;
@@ -5607,16 +5622,16 @@ var _NetChan = class _NetChan {
5607
5622
  }
5608
5623
  };
5609
5624
  // Constants from net_chan.c
5610
- _NetChan.MAX_MSGLEN = 1400;
5611
- _NetChan.FRAGMENT_SIZE = 1024;
5612
- _NetChan.PACKET_HEADER = 10;
5625
+ __publicField(_NetChan, "MAX_MSGLEN", 1400);
5626
+ __publicField(_NetChan, "FRAGMENT_SIZE", 1024);
5627
+ __publicField(_NetChan, "PACKET_HEADER", 10);
5613
5628
  // sequence(4) + ack(4) + qport(2)
5614
- _NetChan.HEADER_OVERHEAD = _NetChan.PACKET_HEADER + 2;
5629
+ __publicField(_NetChan, "HEADER_OVERHEAD", _NetChan.PACKET_HEADER + 2);
5615
5630
  // +2 for reliable length prefix
5616
5631
  // Increase internal reliable buffer to support large messages (fragmentation)
5617
5632
  // Quake 2 uses MAX_MSGLEN for the reliable buffer, limiting single messages to ~1400 bytes.
5618
5633
  // We expand this to allow larger messages (e.g. snapshots, downloads) which are then fragmented.
5619
- _NetChan.MAX_RELIABLE_BUFFER = 262144;
5634
+ __publicField(_NetChan, "MAX_RELIABLE_BUFFER", 262144);
5620
5635
  var NetChan = _NetChan;
5621
5636
 
5622
5637
  // src/items/weapons.ts