@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.
- package/dist/index.global.js +16 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -8245,11 +8245,15 @@ function createHouseScenarios(text, at = SPECIMEN_AT) {
|
|
|
8245
8245
|
return { oid: so.objectId, parts, centre };
|
|
8246
8246
|
};
|
|
8247
8247
|
const role = (p) => p.structure && p.structure.role;
|
|
8248
|
+
const listening = [];
|
|
8248
8249
|
const events = (room) => {
|
|
8249
8250
|
const list = [];
|
|
8250
|
-
room.world.on("*", (e) => list.push(e));
|
|
8251
|
+
listening.push(room.world.on("*", (e) => list.push(e)));
|
|
8251
8252
|
return list;
|
|
8252
8253
|
};
|
|
8254
|
+
const stopListening = () => {
|
|
8255
|
+
for (const off of listening.splice(0)) off?.();
|
|
8256
|
+
};
|
|
8253
8257
|
const collapsed = (list) => list.filter((e) => e.type === "collapse").flatMap((e) => e.parts.map((p) => p.id || p));
|
|
8254
8258
|
const whole = (room, oid, pid) => {
|
|
8255
8259
|
const p = room.world.part(oid, pid);
|
|
@@ -8263,7 +8267,7 @@ function createHouseScenarios(text, at = SPECIMEN_AT) {
|
|
|
8263
8267
|
const bullet = (room, oid, pid, point, energy) => {
|
|
8264
8268
|
room.world.hitPart(oid, pid, { type: "ballistic", point, direction: [0, 0, -1], energy, caliber: 9 });
|
|
8265
8269
|
};
|
|
8266
|
-
|
|
8270
|
+
const scenarios = [
|
|
8267
8271
|
{
|
|
8268
8272
|
id: "house_one_pillar",
|
|
8269
8273
|
name: text.scenarios.house_one_pillar,
|
|
@@ -8357,6 +8361,16 @@ function createHouseScenarios(text, at = SPECIMEN_AT) {
|
|
|
8357
8361
|
}
|
|
8358
8362
|
}
|
|
8359
8363
|
];
|
|
8364
|
+
return scenarios.map((scenario) => ({
|
|
8365
|
+
...scenario,
|
|
8366
|
+
run(context) {
|
|
8367
|
+
try {
|
|
8368
|
+
return scenario.run(context);
|
|
8369
|
+
} finally {
|
|
8370
|
+
stopListening();
|
|
8371
|
+
}
|
|
8372
|
+
}
|
|
8373
|
+
}));
|
|
8360
8374
|
}
|
|
8361
8375
|
|
|
8362
8376
|
// src/test-area/specimens.ts
|