@adatechnology/game-floorplan-three 0.8.1 → 0.8.3

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.
@@ -21739,11 +21739,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21739
21739
  return { oid: so.objectId, parts, centre };
21740
21740
  };
21741
21741
  const role = (p) => p.structure && p.structure.role;
21742
+ const listening = [];
21742
21743
  const events = (room) => {
21743
21744
  const list2 = [];
21744
- room.world.on("*", (e) => list2.push(e));
21745
+ listening.push(room.world.on("*", (e) => list2.push(e)));
21745
21746
  return list2;
21746
21747
  };
21748
+ const stopListening = () => {
21749
+ for (const off of listening.splice(0)) off?.();
21750
+ };
21747
21751
  const collapsed = (list2) => list2.filter((e) => e.type === "collapse").flatMap((e) => e.parts.map((p) => p.id || p));
21748
21752
  const whole = (room, oid, pid) => {
21749
21753
  const p = room.world.part(oid, pid);
@@ -21757,7 +21761,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21757
21761
  const bullet = (room, oid, pid, point, energy) => {
21758
21762
  room.world.hitPart(oid, pid, { type: "ballistic", point, direction: [0, 0, -1], energy, caliber: 9 });
21759
21763
  };
21760
- return [
21764
+ const scenarios = [
21761
21765
  {
21762
21766
  id: "house_one_pillar",
21763
21767
  name: text.scenarios.house_one_pillar,
@@ -21851,6 +21855,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
21851
21855
  }
21852
21856
  }
21853
21857
  ];
21858
+ return scenarios.map((scenario) => ({
21859
+ ...scenario,
21860
+ run(context) {
21861
+ try {
21862
+ return scenario.run(context);
21863
+ } finally {
21864
+ stopListening();
21865
+ }
21866
+ }
21867
+ }));
21854
21868
  }
21855
21869
 
21856
21870
  // src/test-area/specimens.ts