@adatechnology/game-vehicles-three 0.3.6 → 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 +261 -35
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +44 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -302,7 +302,44 @@ 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
|
|
342
|
+
import { discardObject3D } from "@adatechnology/game-shapes-three";
|
|
306
343
|
import { footprintBlocker } from "@adatechnology/game-contracts";
|
|
307
344
|
import { buildVehicleItem, createVehicleDestructible, createVehicleKit } from "@adatechnology/game-vehicles";
|
|
308
345
|
import { createArcadeDriver as createArcadeDriver2, createSemiSimDriver as createSemiSimDriver2, createSurfaces as createSurfaces2, vehicleCorners as vehicleCorners2 } from "@adatechnology/game-vehicles-driving";
|
|
@@ -741,6 +778,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
741
778
|
const settings = { quality: "high", paint: false, seed: 1, palette: "auto", driving: "arcade", surface: "dry_asphalt" };
|
|
742
779
|
const kits = /* @__PURE__ */ new WeakMap();
|
|
743
780
|
const placed = /* @__PURE__ */ new Map();
|
|
781
|
+
const cabins = createCabinSmoke();
|
|
744
782
|
let host = null;
|
|
745
783
|
let three = null;
|
|
746
784
|
let counter = 0;
|
|
@@ -805,6 +843,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
805
843
|
const kit = r.userData.kit;
|
|
806
844
|
const d = createVehicleDestructible(kit, r.userData.vehicle, { id, frame: root, name: text.items[itemKey] ?? key });
|
|
807
845
|
tapEffects(d);
|
|
846
|
+
cabins.track(id, d, root);
|
|
808
847
|
r.userData.destructible = d;
|
|
809
848
|
return d;
|
|
810
849
|
},
|
|
@@ -880,10 +919,10 @@ function createVehiclesTestModule(options = {}) {
|
|
|
880
919
|
};
|
|
881
920
|
const clearHelpers = () => {
|
|
882
921
|
for (const entry of placed.values()) {
|
|
883
|
-
|
|
922
|
+
discardObject3D(entry.helpers);
|
|
884
923
|
entry.helpers = [];
|
|
885
924
|
}
|
|
886
|
-
|
|
925
|
+
discardObject3D(axes);
|
|
887
926
|
axes = [];
|
|
888
927
|
helpersShown = "";
|
|
889
928
|
};
|
|
@@ -1060,6 +1099,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
1060
1099
|
}
|
|
1061
1100
|
if (host?.bench && boxKey() !== helpersShown && (host.bench.layer("damageables") || host.bench.layer("zones") || helpersShown !== "")) refreshLayers();
|
|
1062
1101
|
lane?.step(dt);
|
|
1102
|
+
cabins.sync(effects());
|
|
1063
1103
|
};
|
|
1064
1104
|
const count2 = () => {
|
|
1065
1105
|
let drawCalls = 0;
|
|
@@ -1160,6 +1200,7 @@ function createVehiclesTestModule(options = {}) {
|
|
|
1160
1200
|
stopChange?.();
|
|
1161
1201
|
stopFrame();
|
|
1162
1202
|
stopBlocker?.();
|
|
1203
|
+
cabins.clear(effects());
|
|
1163
1204
|
clearHelpers();
|
|
1164
1205
|
clearLane();
|
|
1165
1206
|
host = null;
|
|
@@ -1188,6 +1229,7 @@ export {
|
|
|
1188
1229
|
VEHICLE_SCENARIO_IDS,
|
|
1189
1230
|
classColor,
|
|
1190
1231
|
classify,
|
|
1232
|
+
createCabinSmoke,
|
|
1191
1233
|
createVehiclesTestModule,
|
|
1192
1234
|
createVehiclesThree,
|
|
1193
1235
|
defaultEffectIds,
|