@adatechnology/game-vehicles-three 0.3.7 → 0.4.0
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.d.ts +23 -2
- package/dist/index.global.js +122 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -302,6 +302,42 @@ function markDamageables(c, damageables) {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
+
// src/cabin-smoke.ts
|
|
306
|
+
import { cabinEnclosure } from "@adatechnology/game-vehicles";
|
|
307
|
+
function createCabinSmoke() {
|
|
308
|
+
const tracked = /* @__PURE__ */ new Map();
|
|
309
|
+
const end = (id, entry, effects) => {
|
|
310
|
+
if (entry.declared) effects?.enclose?.(id, null);
|
|
311
|
+
tracked.delete(id);
|
|
312
|
+
};
|
|
313
|
+
return {
|
|
314
|
+
track(id, source, frame) {
|
|
315
|
+
tracked.set(id, { source, frame, declared: false, placed: false });
|
|
316
|
+
},
|
|
317
|
+
untrack(id, effects) {
|
|
318
|
+
const entry = tracked.get(id);
|
|
319
|
+
if (entry) end(id, entry, effects);
|
|
320
|
+
},
|
|
321
|
+
sync(effects) {
|
|
322
|
+
if (!effects?.enclose) return;
|
|
323
|
+
for (const [id, entry] of tracked) {
|
|
324
|
+
if (!entry.frame.parent) {
|
|
325
|
+
if (entry.placed) end(id, entry, effects);
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
entry.placed = true;
|
|
329
|
+
const enclosure = cabinEnclosure(entry.source, { frame: entry.frame });
|
|
330
|
+
if (enclosure || entry.declared) effects.enclose(id, enclosure);
|
|
331
|
+
entry.declared = enclosure !== null;
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
clear(effects) {
|
|
335
|
+
for (const [id, entry] of [...tracked]) end(id, entry, effects);
|
|
336
|
+
},
|
|
337
|
+
ids: () => [...tracked.keys()]
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
305
341
|
// src/test-area/module.ts
|
|
306
342
|
import { discardObject3D } from "@adatechnology/game-shapes-three";
|
|
307
343
|
import { footprintBlocker } from "@adatechnology/game-contracts";
|
|
@@ -742,6 +778,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
742
778
|
const settings = { quality: "high", paint: false, seed: 1, palette: "auto", driving: "arcade", surface: "dry_asphalt" };
|
|
743
779
|
const kits = /* @__PURE__ */ new WeakMap();
|
|
744
780
|
const placed = /* @__PURE__ */ new Map();
|
|
781
|
+
const cabins = createCabinSmoke();
|
|
745
782
|
let host = null;
|
|
746
783
|
let three = null;
|
|
747
784
|
let counter = 0;
|
|
@@ -806,6 +843,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
806
843
|
const kit = r.userData.kit;
|
|
807
844
|
const d = createVehicleDestructible(kit, r.userData.vehicle, { id, frame: root, name: text.items[itemKey] ?? key });
|
|
808
845
|
tapEffects(d);
|
|
846
|
+
cabins.track(id, d, root);
|
|
809
847
|
r.userData.destructible = d;
|
|
810
848
|
return d;
|
|
811
849
|
},
|
|
@@ -1061,6 +1099,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
1061
1099
|
}
|
|
1062
1100
|
if (host?.bench && boxKey() !== helpersShown && (host.bench.layer("damageables") || host.bench.layer("zones") || helpersShown !== "")) refreshLayers();
|
|
1063
1101
|
lane?.step(dt);
|
|
1102
|
+
cabins.sync(effects());
|
|
1064
1103
|
};
|
|
1065
1104
|
const count2 = () => {
|
|
1066
1105
|
let drawCalls = 0;
|
|
@@ -1161,6 +1200,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
1161
1200
|
stopChange?.();
|
|
1162
1201
|
stopFrame();
|
|
1163
1202
|
stopBlocker?.();
|
|
1203
|
+
cabins.clear(effects());
|
|
1164
1204
|
clearHelpers();
|
|
1165
1205
|
clearLane();
|
|
1166
1206
|
host = null;
|
|
@@ -1189,6 +1229,7 @@ export {
|
|
|
1189
1229
|
VEHICLE_SCENARIO_IDS,
|
|
1190
1230
|
classColor,
|
|
1191
1231
|
classify,
|
|
1232
|
+
createCabinSmoke,
|
|
1192
1233
|
createVehiclesTestModule,
|
|
1193
1234
|
createVehiclesThree,
|
|
1194
1235
|
defaultEffectIds,
|