@adatechnology/game-weapons-three 0.11.1 → 0.11.2

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.js CHANGED
@@ -3288,7 +3288,7 @@ var models_default = {
3288
3288
  };
3289
3289
 
3290
3290
  // src/models/kit.ts
3291
- import { shapeGeometries } from "@adatechnology/game-shapes-three";
3291
+ import { markShared, shapeGeometries } from "@adatechnology/game-shapes-three";
3292
3292
 
3293
3293
  // src/models/rounded-box.ts
3294
3294
  var uvAlong = (THREE, faceDirection, normal, uvAxis, projectionAxis, radius, sideLength) => {
@@ -3360,7 +3360,7 @@ var createMaterials = (THREE) => {
3360
3360
  const standard = (color, roughness = 0.7, metalness = 0.2, extra = {}) => new THREE.MeshStandardMaterial({ color, roughness, metalness, ...extra });
3361
3361
  const basic = (color, extra = {}) => new THREE.MeshBasicMaterial({ color, ...extra });
3362
3362
  const additive = { transparent: true, opacity: 0.95, blending: THREE.AdditiveBlending, depthWrite: false };
3363
- return {
3363
+ const materials = {
3364
3364
  metal: standard(3422010, 0.42, 0.75),
3365
3365
  steel: standard(7106418, 0.32, 0.85),
3366
3366
  steelL: standard(9080208, 0.28, 0.9),
@@ -3399,6 +3399,8 @@ var createMaterials = (THREE) => {
3399
3399
  bakelite: standard(6958620, 0.6, 0),
3400
3400
  polyMag: standard(2763302, 0.85, 0)
3401
3401
  };
3402
+ markShared(...Object.values(materials));
3403
+ return materials;
3402
3404
  };
3403
3405
  var kits = /* @__PURE__ */ new WeakMap();
3404
3406
  function modelKit(host) {
@@ -3427,6 +3429,7 @@ function modelKit(host) {
3427
3429
  let geometry = geometries.get(key);
3428
3430
  if (!geometry) {
3429
3431
  geometry = radius > 25e-5 ? createRoundedBoxGeometry(THREE, w, h, d, 2, radius) : new THREE.BoxGeometry(w, h, d);
3432
+ markShared(geometry);
3430
3433
  geometries.set(key, geometry);
3431
3434
  }
3432
3435
  const mesh = place(parent, shadowed(new THREE.Mesh(geometry, material)), x, y, z);
@@ -5208,6 +5211,7 @@ function createBoxFx(options) {
5208
5211
  }
5209
5212
 
5210
5213
  // src/fx/viewmodel.ts
5214
+ import { discardObject3D as discardObject3D3 } from "@adatechnology/game-shapes-three";
5211
5215
  import { createToolClipPlayer, toolAnimationStep } from "@adatechnology/game-contracts";
5212
5216
  import { createRng as createRng2, muzzleEnergy as muzzleEnergy3 } from "@adatechnology/game-weapons";
5213
5217
 
@@ -6265,6 +6269,7 @@ function createEffects(THREE, sink, random) {
6265
6269
  }
6266
6270
 
6267
6271
  // src/fx/heavy.ts
6272
+ import { discardObject3D } from "@adatechnology/game-shapes-three";
6268
6273
  var PI12 = Math.PI;
6269
6274
  var ROCKET_LIGHT_NAME = "rocket-light";
6270
6275
  var rocketsInFlight = /* @__PURE__ */ new WeakMap();
@@ -6318,7 +6323,7 @@ function launchRocket(context, flyRound = true) {
6318
6323
  if (random() < 0.9) context.effects.smoke(rocket.position.clone().addScaledVector(forward, -0.12), new THREE.Vector3((random() - 0.5) * 0.1, 0.05, (random() - 0.5) * 0.1), 0.02 + random() * 0.015, 2.2, 0.5);
6319
6324
  },
6320
6325
  () => {
6321
- rocket.removeFromParent();
6326
+ discardObject3D(rocket);
6322
6327
  exhaust.geometry.dispose();
6323
6328
  exhaust.material.dispose();
6324
6329
  const remaining = (rocketsInFlight.get(light) ?? 1) - 1;
@@ -6494,6 +6499,7 @@ var toWorld = (session, vector, scaled = false) => {
6494
6499
  };
6495
6500
 
6496
6501
  // src/fx/viewmodel-events.ts
6502
+ import { discardObject3D as discardObject3D2 } from "@adatechnology/game-shapes-three";
6497
6503
  import { muzzleSmokeOf } from "@adatechnology/game-weapons";
6498
6504
  var PI13 = Math.PI;
6499
6505
  var UGL_FLASH = 1.6;
@@ -6656,7 +6662,7 @@ function createClipEventHandler(world, session) {
6656
6662
  session.model.inner.add(shell);
6657
6663
  shell.position.set(-0.25, 0, 0);
6658
6664
  world.schedule(0.02, 0.4, (eased) => shell.position.x = -0.25 + 0.6 * eased, () => {
6659
- shell.removeFromParent();
6665
+ discardObject3D2(shell);
6660
6666
  });
6661
6667
  }
6662
6668
  }
@@ -7217,7 +7223,7 @@ function createViewmodel(options) {
7217
7223
  const release = () => {
7218
7224
  if (!session) return;
7219
7225
  session.attachments?.dispose();
7220
- session.model.root.removeFromParent();
7226
+ discardObject3D3(session.model.root);
7221
7227
  player = null;
7222
7228
  session = null;
7223
7229
  tasks = [];
@@ -8860,6 +8866,7 @@ import { EXPLOSIONS } from "@adatechnology/game-vfx";
8860
8866
  import { createArsenal as createArsenal2 } from "@adatechnology/game-weapons";
8861
8867
 
8862
8868
  // src/explosives-bench.ts
8869
+ import { discardObject3D as discardObject3D4 } from "@adatechnology/game-shapes-three";
8863
8870
  import { markKitOrigin as markKitOrigin5 } from "@adatechnology/game-contracts";
8864
8871
 
8865
8872
  // src/explosives-text.ts
@@ -9136,7 +9143,7 @@ function createExplosivesBench(options) {
9136
9143
  vessel.rings = group;
9137
9144
  };
9138
9145
  const clearRings = (vessel) => {
9139
- vessel.rings?.removeFromParent();
9146
+ if (vessel.rings) discardObject3D4(vessel.rings);
9140
9147
  vessel.rings = void 0;
9141
9148
  };
9142
9149
  const phaseOf = (vessel) => {
@@ -9225,7 +9232,7 @@ function createExplosivesBench(options) {
9225
9232
  }
9226
9233
  };
9227
9234
  const clearShells = () => {
9228
- for (const shell of shells) shell.mesh.removeFromParent();
9235
+ discardObject3D4(shells.map((shell) => shell.mesh));
9229
9236
  shells.length = 0;
9230
9237
  };
9231
9238
  const fullVitality = /* @__PURE__ */ new Map();