@modlock/modlock 0.1.80 → 0.1.81

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.
Files changed (3) hide show
  1. package/index.js +17 -2
  2. package/package.json +6 -6
  3. package/strays.d.ts +6 -0
package/index.js CHANGED
@@ -17656,6 +17656,12 @@ var strayBlow = 1e6;
17656
17656
  var Strays = class {
17657
17657
  /** since maps each stray pawn to when it was first seen with no player. */
17658
17658
  since = /* @__PURE__ */ new Map();
17659
+ /**
17660
+ * gone holds the controller handles strays name that no longer resolve. A
17661
+ * handle carries its entity's serial, so it never resolves again, and each
17662
+ * failed read logs on the host: a sweep reads it once.
17663
+ */
17664
+ gone = /* @__PURE__ */ new Set();
17659
17665
  sweptAt = -Infinity;
17660
17666
  /**
17661
17667
  * sweep lays down each hero pawn that has belonged to no player for
@@ -17675,8 +17681,9 @@ var Strays = class {
17675
17681
  }
17676
17682
  }
17677
17683
  const since = /* @__PURE__ */ new Map();
17684
+ const gone = /* @__PURE__ */ new Set();
17678
17685
  for (const entity of findEntities("player")) {
17679
- if (held.has(entity) || ownHero(entity)) {
17686
+ if (held.has(entity) || ownHero(entity, this.gone, gone)) {
17680
17687
  continue;
17681
17688
  }
17682
17689
  const first = this.since.get(entity) ?? now4;
@@ -17686,9 +17693,10 @@ var Strays = class {
17686
17693
  }
17687
17694
  }
17688
17695
  this.since = since;
17696
+ this.gone = gone;
17689
17697
  }
17690
17698
  };
17691
- function ownHero(entity) {
17699
+ function ownHero(entity, known2, seen) {
17692
17700
  const controller = readField(
17693
17701
  entity,
17694
17702
  "CBasePlayerPawn",
@@ -17698,6 +17706,10 @@ function ownHero(entity) {
17698
17706
  if (typeof controller !== "number") {
17699
17707
  return false;
17700
17708
  }
17709
+ if (known2.has(controller)) {
17710
+ seen.add(controller);
17711
+ return false;
17712
+ }
17701
17713
  const connected = readField(
17702
17714
  controller,
17703
17715
  "CBasePlayerController",
@@ -17713,6 +17725,9 @@ function ownHero(entity) {
17713
17725
  "m_hHeroPawn",
17714
17726
  "handle"
17715
17727
  );
17728
+ if (connected === void 0 && hero === void 0) {
17729
+ seen.add(controller);
17730
+ }
17716
17731
  return hero === entity;
17717
17732
  }
17718
17733
  function layDown(entity) {
package/package.json CHANGED
@@ -7,11 +7,11 @@
7
7
  "license": "MIT",
8
8
  "name": "@modlock/modlock",
9
9
  "optionalDependencies": {
10
- "@modlock/darwin-arm64": "0.1.80",
11
- "@modlock/darwin-x64": "0.1.80",
12
- "@modlock/linux-arm64": "0.1.80",
13
- "@modlock/linux-x64": "0.1.80",
14
- "@modlock/win32-x64": "0.1.80"
10
+ "@modlock/darwin-arm64": "0.1.81",
11
+ "@modlock/darwin-x64": "0.1.81",
12
+ "@modlock/linux-arm64": "0.1.81",
13
+ "@modlock/linux-x64": "0.1.81",
14
+ "@modlock/win32-x64": "0.1.81"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -20,5 +20,5 @@
20
20
  "sideEffects": false,
21
21
  "type": "module",
22
22
  "types": "index.d.ts",
23
- "version": "0.1.80"
23
+ "version": "0.1.81"
24
24
  }
package/strays.d.ts CHANGED
@@ -7,6 +7,12 @@ export declare const strayGraceSeconds = 3;
7
7
  export declare class Strays {
8
8
  /** since maps each stray pawn to when it was first seen with no player. */
9
9
  private since;
10
+ /**
11
+ * gone holds the controller handles strays name that no longer resolve. A
12
+ * handle carries its entity's serial, so it never resolves again, and each
13
+ * failed read logs on the host: a sweep reads it once.
14
+ */
15
+ private gone;
10
16
  private sweptAt;
11
17
  /**
12
18
  * sweep lays down each hero pawn that has belonged to no player for