@adatechnology/game-weapons-three 0.20.0 → 0.21.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.
@@ -1185,15 +1185,15 @@
1185
1185
  "found": "commons: GP-25 grenade launcher"
1186
1186
  },
1187
1187
  "ag36": {
1188
- "title": "File:AG36.png",
1189
- "page": "https://commons.wikimedia.org/wiki/File:AG36.png",
1190
- "url": "https://upload.wikimedia.org/wikipedia/commons/a/a8/AG36.png?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail_unscaled",
1191
- "width": 350,
1192
- "height": 150,
1193
- "author": "Pjedvaj",
1194
- "license": "CC BY-SA 3.0",
1195
- "licenseUrl": "https://creativecommons.org/licenses/by-sa/3.0",
1196
- "found": "commons: AG36 grenade launcher"
1188
+ "title": "File:HK G36 with AG36.jpg",
1189
+ "page": "https://commons.wikimedia.org/wiki/File:HK_G36_with_AG36.jpg",
1190
+ "url": "https://thumb.wikimedia.org/wikipedia/commons/thumb/8/8a/HK_G36_with_AG36.jpg/960px-HK_G36_with_AG36.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
1191
+ "width": 1279,
1192
+ "height": 344,
1193
+ "author": "sonaz",
1194
+ "license": "CC BY-SA 2.5",
1195
+ "licenseUrl": "https://creativecommons.org/licenses/by-sa/2.5",
1196
+ "found": "pinned"
1197
1197
  },
1198
1198
  "flashbang": {
1199
1199
  "title": "File:M-84-Flash-Bang-Grenade.jpg",
@@ -1380,6 +1380,7 @@
1380
1380
  "taurus_g2c": "File:Taurus G2C 9mm Sn 1C014003 L DSC0277.jpg",
1381
1381
  "taurus_pt100": "File:TaurusPT92.jpg",
1382
1382
  "taurus_smt9": "File:Taurus SMT9 with IA2 crop.jpg",
1383
- "sledgehammer": "File:C&O Railway Heritage Center - Sledgehammer.jpg"
1383
+ "sledgehammer": "File:C&O Railway Heritage Center - Sledgehammer.jpg",
1384
+ "ag36": "File:HK G36 with AG36.jpg"
1384
1385
  }
1385
1386
  }
@@ -1526,15 +1526,15 @@ var weapon_references_default = {
1526
1526
  found: "commons: GP-25 grenade launcher"
1527
1527
  },
1528
1528
  ag36: {
1529
- title: "File:AG36.png",
1530
- page: "https://commons.wikimedia.org/wiki/File:AG36.png",
1531
- url: "https://upload.wikimedia.org/wikipedia/commons/a/a8/AG36.png?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail_unscaled",
1532
- width: 350,
1533
- height: 150,
1534
- author: "Pjedvaj",
1535
- license: "CC BY-SA 3.0",
1536
- licenseUrl: "https://creativecommons.org/licenses/by-sa/3.0",
1537
- found: "commons: AG36 grenade launcher"
1529
+ title: "File:HK G36 with AG36.jpg",
1530
+ page: "https://commons.wikimedia.org/wiki/File:HK_G36_with_AG36.jpg",
1531
+ url: "https://thumb.wikimedia.org/wikipedia/commons/thumb/8/8a/HK_G36_with_AG36.jpg/960px-HK_G36_with_AG36.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
1532
+ width: 1279,
1533
+ height: 344,
1534
+ author: "sonaz",
1535
+ license: "CC BY-SA 2.5",
1536
+ licenseUrl: "https://creativecommons.org/licenses/by-sa/2.5",
1537
+ found: "pinned"
1538
1538
  },
1539
1539
  flashbang: {
1540
1540
  title: "File:M-84-Flash-Bang-Grenade.jpg",
@@ -1721,7 +1721,8 @@ var weapon_references_default = {
1721
1721
  taurus_g2c: "File:Taurus G2C 9mm Sn 1C014003 L DSC0277.jpg",
1722
1722
  taurus_pt100: "File:TaurusPT92.jpg",
1723
1723
  taurus_smt9: "File:Taurus SMT9 with IA2 crop.jpg",
1724
- sledgehammer: "File:C&O Railway Heritage Center - Sledgehammer.jpg"
1724
+ sledgehammer: "File:C&O Railway Heritage Center - Sledgehammer.jpg",
1725
+ ag36: "File:HK G36 with AG36.jpg"
1725
1726
  }
1726
1727
  };
1727
1728
 
@@ -8824,7 +8825,7 @@ var reloadCueSteps = (id, profile = DEFAULT_SOUND_PROFILE, table = RELOAD_CUES)
8824
8825
  };
8825
8826
 
8826
8827
  // src/audio/samples.ts
8827
- import { sampleBankFromManifest } from "@adatechnology/game-audio";
8828
+ import { CASING_DEFAULTS, droppedPartDefaults, sampleBankFromManifest } from "@adatechnology/game-audio";
8828
8829
 
8829
8830
  // src/data/reload-sample-hits.json
8830
8831
  var reload_sample_hits_default = {
@@ -8873,7 +8874,6 @@ var SUPPRESSED_SAMPLE = { ...GUNSHOT_SAMPLE, gain: 0.55, crossover: { from: 10,
8873
8874
  var LAUNCH_SAMPLE = { bus: "weapons", gain: 0.9, pitch: 0.04, falloff: { model: "inverse_square", k: 1e-3, minGain: 1e-3 }, cutoffK: 0.03, priority: 3 };
8874
8875
  var LAUNCH_IDS = /* @__PURE__ */ new Set(["launcher_40mm", "rocket_launch"]);
8875
8876
  var RELOAD_SAMPLE = { bus: "weapons", gain: 0.32, pitch: 0.05, falloff: { model: "inverse_square", k: 0.05, minGain: 2e-3 }, cutoffK: 0.02, priority: 2 };
8876
- var CASING_SAMPLE = { bus: "weapons", gain: 0.22, pitch: 0.06, falloff: { model: "inverse_square", k: 0.08, minGain: 3e-3 }, cutoffK: 0.03, priority: 1 };
8877
8877
  var casingSampleId = (sample) => sample.replace(/_(pistol|rifle|shell)$/, "");
8878
8878
  var RELOAD_SAMPLE_HITS = reload_sample_hits_default.hits;
8879
8879
  var WEIGHT_INTENSITY = { light: 0.1, medium: 0.5, heavy: 0.9 };
@@ -8881,7 +8881,7 @@ var CUES_IN_SAMPLE = { mag_release: "mag_out", mag_insert: "mag_seat" };
8881
8881
  var isGunshot = (id) => GUNSHOT_SAMPLE_IDS.includes(id);
8882
8882
  function weaponSampleDefaults(sound3, overrides = {}) {
8883
8883
  if (sound3.category !== "armas") return void 0;
8884
- const base = LAUNCH_IDS.has(sound3.id) ? LAUNCH_SAMPLE : sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : sound3.id.startsWith("casing_drop_") || sound3.id.startsWith("mag_drop_") ? CASING_SAMPLE : RELOAD_SAMPLE;
8884
+ const base = LAUNCH_IDS.has(sound3.id) ? LAUNCH_SAMPLE : sound3.id.startsWith("suppressed_") ? SUPPRESSED_SAMPLE : isGunshot(sound3.id) ? GUNSHOT_SAMPLE : droppedPartDefaults(sound3.id) ?? RELOAD_SAMPLE;
8885
8885
  return { ...base, ...overrides[sound3.id] };
8886
8886
  }
8887
8887
  function weaponSampleBank(options) {
@@ -10941,36 +10941,93 @@ var buildTripod = ({ kit }) => {
10941
10941
  };
10942
10942
 
10943
10943
  // src/models/attachments/ugl.ts
10944
- var LAUNCHERS = {
10945
- m203: { tubeRadius: 0.0215, tubeFraction: 0.8, housing: [0.1, 0.05, 0.05], hasFrontGrip: false },
10946
- gp_25: { tubeRadius: 0.023, tubeFraction: 0.78, housing: [0.08, 0.055, 0.05], hasFrontGrip: false },
10947
- ag36: { tubeRadius: 0.02, tubeFraction: 0.8, housing: [0.13, 0.06, 0.05], hasFrontGrip: true }
10944
+ var PI14 = Math.PI;
10945
+ var clamp = (kit, fixed, from, to) => {
10946
+ const { M, box: box2 } = kit;
10947
+ kit.roundness = 0.15;
10948
+ box2(fixed, to - from, 0.022, 0.03, M.dark, (from + to) / 2, 9e-3, 0);
10949
+ kit.roundness = null;
10950
+ for (const x of [from + 0.02, to - 0.02]) box2(fixed, 0.012, 6e-3, 0.036, M.metal, x, 0.016, 0);
10948
10951
  };
10949
- var drawFixed = (kit, group, look, length) => {
10950
- const { M, box: box2, cylinderY } = kit;
10951
- const [housingLength, housingHeight, housingWidth] = look.housing;
10952
- box2(group, housingLength, housingHeight, housingWidth, M.dark, housingLength / 2 - 0.02, -look.tubeRadius, 0);
10953
- box2(group, 0.05, 4e-3, 0.012, M.metal, housingLength * 0.45, -look.tubeRadius - housingHeight / 2 - 4e-3, 0);
10954
- box2(group, 4e-3, 0.02, 8e-3, M.dark, housingLength * 0.6, -look.tubeRadius - housingHeight / 2 - 0.016, 0);
10955
- if (look.hasFrontGrip) {
10956
- cylinderY(group, 0.012, 0.07, M.poly, length * 0.55, -look.tubeRadius - 0.04, 0, 12);
10957
- box2(group, 0.04, 0.01, 0.03, M.dark, length * 0.55, -look.tubeRadius - 4e-3, 0);
10952
+ var pistolGrip = (kit, fixed, top, length) => {
10953
+ const { M, box: box2 } = kit;
10954
+ const grip = kit.pivot(fixed, top[0], top[1], 0);
10955
+ grip.rotation.z = -0.3;
10956
+ kit.roundness = 0.3;
10957
+ box2(grip, 0.032, length, 0.03, M.poly, -0.016, -length / 2, 0);
10958
+ kit.roundness = null;
10959
+ for (let i = 0; i < 3; i++) box2(grip, 6e-3, 0.012, 0.028, M.poly, 1e-3, -length * 0.25 - i * 0.02, 0);
10960
+ };
10961
+ var triggerGuard = (kit, fixed, back, front, bottom) => {
10962
+ const { M, box: box2 } = kit;
10963
+ const drop = 0.03;
10964
+ box2(fixed, front - back, 5e-3, 0.01, M.dark, (back + front) / 2, bottom - drop, 0);
10965
+ box2(fixed, 5e-3, drop, 0.01, M.dark, front, bottom - drop / 2, 0);
10966
+ box2(fixed, 5e-3, 0.02, 6e-3, M.metal, back + (front - back) * 0.45, bottom - 0.011, 0, 0.25);
10967
+ };
10968
+ var m203 = (kit, fixed) => {
10969
+ const { M, box: box2 } = kit;
10970
+ const tube = { from: 0, to: 0.305, radius: 0.025, axisY: -0.03 };
10971
+ clamp(kit, fixed, -0.075, 0.29);
10972
+ kit.roundness = 0.18;
10973
+ box2(fixed, 0.078, 0.056, 0.05, M.dark, -0.037, tube.axisY + 2e-3, 0);
10974
+ kit.roundness = null;
10975
+ box2(fixed, 0.02, 0.012, 0.052, M.metal, -0.07, tube.axisY + 0.012, 0);
10976
+ triggerGuard(kit, fixed, -0.07, -0.012, tube.axisY - 0.026);
10977
+ return tube;
10978
+ };
10979
+ var gp25 = (kit, fixed) => {
10980
+ const { M, box: box2 } = kit;
10981
+ const tube = { from: 0.07, to: 0.275, radius: 0.024, axisY: -0.032 };
10982
+ clamp(kit, fixed, -0.04, 0.27);
10983
+ kit.roundness = 0.2;
10984
+ box2(fixed, 0.125, 0.054, 0.046, M.metal, 0.012, tube.axisY + 1e-3, 0);
10985
+ kit.roundness = null;
10986
+ box2(fixed, 0.03, 0.026, 6e-3, M.dark, 0.03, tube.axisY + 6e-3, -0.026);
10987
+ pistolGrip(kit, fixed, [-0.012, tube.axisY - 0.022], 0.1);
10988
+ box2(fixed, 5e-3, 0.022, 6e-3, M.metal, 0.012, tube.axisY - 0.034, 0, 0.3);
10989
+ box2(fixed, 0.03, 4e-3, 8e-3, M.dark, 0.016, tube.axisY - 0.046, 0);
10990
+ return tube;
10991
+ };
10992
+ var ag36 = (kit, fixed) => {
10993
+ const { M, box: box2 } = kit;
10994
+ const tube = { from: 0.04, to: 0.295, radius: 0.022, axisY: -0.066 };
10995
+ kit.roundness = 0.12;
10996
+ box2(fixed, 0.315, 0.044, 0.05, M.poly, 0.13, -0.02, 0);
10997
+ box2(fixed, 0.09, 0.03, 0.046, M.poly, 0.01, -0.054, 0);
10998
+ kit.roundness = null;
10999
+ clamp(kit, fixed, -0.02, 0.28);
11000
+ box2(fixed, 0.24, 4e-3, 0.051, M.dark, 0.16, -0.03, 0);
11001
+ box2(fixed, 0.04, 0.022, 5e-3, M.dark, 0.02, -8e-3, -0.028);
11002
+ pistolGrip(kit, fixed, [-0.012, -0.069], 0.105);
11003
+ triggerGuard(kit, fixed, 0, 0.06, -0.069);
11004
+ return tube;
11005
+ };
11006
+ var LAUNCHERS = { m203, gp_25: gp25, ag36 };
11007
+ var drawTube = (kit, slide2, tube, ribbed) => {
11008
+ const { M, box: box2, cylinderX } = kit;
11009
+ const length = tube.to - tube.from;
11010
+ cylinderX(slide2, tube.radius, length, M.metal, tube.from + length / 2, tube.axisY, 0, 24);
11011
+ if (ribbed) {
11012
+ cylinderX(slide2, tube.radius * 1.1, length * 0.68, M.poly, tube.from + length * 0.42, tube.axisY, 0, 24);
11013
+ for (let i = 0; i < 9; i++) {
11014
+ for (const angle of [PI14 / 2, -PI14 / 2, PI14]) {
11015
+ box2(slide2, 4e-3, 0.022, 3e-3, M.dark, tube.from + length * 0.14 + i * length * 0.065, tube.axisY + Math.cos(angle) * tube.radius * 1.1, Math.sin(angle) * tube.radius * 1.1, 0, 0, angle - PI14 / 2);
11016
+ }
11017
+ }
10958
11018
  }
11019
+ cylinderX(slide2, tube.radius * 1.08, 0.012, M.dark, tube.to - 6e-3, tube.axisY, 0, 24);
11020
+ cylinderX(slide2, tube.radius * 0.8, 4e-3, M.hole, tube.to + 5e-4, tube.axisY, 0, 20);
11021
+ const muzzle = kit.mark(slide2, tube.to + 0.01, tube.axisY, 0);
11022
+ muzzle.name = "ugl_muzzle";
11023
+ return muzzle;
10959
11024
  };
10960
11025
  var buildUnderbarrelLauncher = ({ kit, attachment, slide: slide2 }) => {
10961
- const look = LAUNCHERS[attachment.model];
10962
- if (!look || !slide2) return null;
10963
- const { M, cylinderX } = kit;
10964
- const length = attachment.dims?.length ?? 0.35;
11026
+ const draw = LAUNCHERS[attachment.model];
11027
+ if (!draw || !slide2) return null;
10965
11028
  const fixed = kit.group();
10966
- drawFixed(kit, fixed, look, length);
10967
- const tubeLength = length * look.tubeFraction;
10968
- const start = -0.02;
10969
- cylinderX(slide2, look.tubeRadius, tubeLength, M.metal, start + tubeLength / 2, -look.tubeRadius, 0, 18);
10970
- cylinderX(slide2, look.tubeRadius * 1.12, 0.012, M.dark, start + tubeLength - 6e-3, -look.tubeRadius, 0, 18);
10971
- cylinderX(slide2, look.tubeRadius * 0.7, 4e-3, M.hole, start + tubeLength + 5e-4, -look.tubeRadius, 0, 14);
10972
- const muzzle = kit.mark(slide2, start + tubeLength + 0.01, -look.tubeRadius, 0);
10973
- muzzle.name = "ugl_muzzle";
11029
+ const tube = draw(kit, fixed);
11030
+ const muzzle = drawTube(kit, slide2, tube, attachment.model === "m203");
10974
11031
  return {
10975
11032
  object: fixed,
10976
11033
  muzzle,
@@ -11282,7 +11339,7 @@ function createEffects(THREE, sink, random) {
11282
11339
  // src/fx/heavy.ts
11283
11340
  import { LIGHT_PRIORITY as LIGHT_PRIORITY2, geometryKey, materialKey } from "@adatechnology/game-render-three";
11284
11341
  import { discardObject3D as discardObject3D2 } from "@adatechnology/game-shapes-three";
11285
- var PI14 = Math.PI;
11342
+ var PI15 = Math.PI;
11286
11343
  var ROCKET_LIGHT_NAME = "rocket-light";
11287
11344
  var ROCKET_LIGHT_COLOR = 16751168;
11288
11345
  var ROCKET_LIGHT_INTENSITY = 3;
@@ -11327,7 +11384,7 @@ function launchRocket(context, flyRound = true) {
11327
11384
  rocket.position.copy(muzzle);
11328
11385
  scene.add(rocket);
11329
11386
  const exhaust = new THREE.Mesh(new THREE.ConeGeometry(0.018, 0.12, 8, 1, true), new THREE.MeshBasicMaterial({ color: 16760896, transparent: true, opacity: 0.9, depthWrite: false }));
11330
- exhaust.rotation.z = PI14 / 2;
11387
+ exhaust.rotation.z = PI15 / 2;
11331
11388
  exhaust.position.x = -0.08;
11332
11389
  rocket.add(exhaust);
11333
11390
  const flame = context.lights?.acquire({ owner: "weapons.rocket", priority: LIGHT_PRIORITY2.rocket, urgent: true, color: ROCKET_LIGHT_COLOR, intensity: ROCKET_LIGHT_INTENSITY, distance: ROCKET_LIGHT_DISTANCE, position: [muzzle.x, muzzle.y, muzzle.z] });
@@ -11562,7 +11619,7 @@ var toWorld = (session, vector, scaled = false) => {
11562
11619
  // src/fx/viewmodel-events.ts
11563
11620
  import { discardObject3D as discardObject3D3 } from "@adatechnology/game-shapes-three";
11564
11621
  import { muzzleSmokeOf } from "@adatechnology/game-weapons";
11565
- var PI15 = Math.PI;
11622
+ var PI16 = Math.PI;
11566
11623
  var UGL_FLASH = 1.6;
11567
11624
  var restFlat = (object) => {
11568
11625
  object.rotation.x = 0;
@@ -11637,14 +11694,14 @@ function createClipEventHandler(world, session) {
11637
11694
  root.updateWorldMatrix(true, true);
11638
11695
  const copy = parts.mag.clone(true);
11639
11696
  parts.mag.matrixWorld.decompose(copy.position, copy.quaternion, copy.scale);
11640
- particles.spawn(copy, toWorld(session, vector(up ? -0.25 : 0.05, up ? 0.9 : -0.3, 0.18)), { kind: "magazine", life: 25, radius: 0.014, bounce: 0.15, spin: vector(1.5, 0.5, 2.5), onRest: (object) => object.rotation.set(0, object.rotation.y, PI15 / 2) });
11697
+ particles.spawn(copy, toWorld(session, vector(up ? -0.25 : 0.05, up ? 0.9 : -0.3, 0.18)), { kind: "magazine", life: 25, radius: 0.014, bounce: 0.15, spin: vector(1.5, 0.5, 2.5), onRest: (object) => object.rotation.set(0, object.rotation.y, PI16 / 2) });
11641
11698
  };
11642
11699
  const stuckCase = () => {
11643
11700
  if (!session.cartridge || !parts.eject) return;
11644
11701
  const casing = buildCasing(kit, session.cartridge.dims, session.cartridge.shape);
11645
11702
  const at2 = root.worldToLocal(offsetFrom(positionOf(parts.eject), 0, casing.length * 0.35, 0));
11646
11703
  casing.group.position.copy(at2);
11647
- casing.group.rotation.set(0, 0, PI15 / 2 - 0.25);
11704
+ casing.group.rotation.set(0, 0, PI16 / 2 - 0.25);
11648
11705
  root.add(casing.group);
11649
11706
  session.stuckCase = casing.group;
11650
11707
  };
@@ -12212,7 +12269,7 @@ function workWeights(works, running) {
12212
12269
  }
12213
12270
 
12214
12271
  // src/fx/viewmodel.ts
12215
- var PI16 = Math.PI;
12272
+ var PI17 = Math.PI;
12216
12273
  var HEAT_DISPLAY_MAX_FALLBACK = 750;
12217
12274
  var SMOKE_WISPS_PER_SECOND = 10;
12218
12275
  var SMOKE_THICKNESS_GAIN = 1.7;
@@ -12222,7 +12279,7 @@ var LAUNCH_VOLUME = 0.6;
12222
12279
  var fittedOf2 = (parts) => parts.map((part) => ({ id: part.id, mount: part.mount, ...part.integral ? { integral: true } : {}, ...part.on === void 0 ? {} : { on: part.on } }));
12223
12280
  var collapsedStockPose = (move2) => {
12224
12281
  if (move2.kind === "retract") return { position: [move2.travel, 0, 0] };
12225
- return { rotation: [move2.axis === "x" ? PI16 : 0, move2.axis === "y" ? PI16 : 0, move2.axis === "z" ? PI16 : 0] };
12282
+ return { rotation: [move2.axis === "x" ? PI17 : 0, move2.axis === "y" ? PI17 : 0, move2.axis === "z" ? PI17 : 0] };
12226
12283
  };
12227
12284
  var underbarrelStep = (step, tool) => tool.underbarrelActive && step.type === "play" && (step.clip === "shot" || step.clip === "reload") ? { ...step, variant: "ugl" } : step;
12228
12285
  var caliberOf = (arsenal, def) => def.action.kind === "firearm" ? arsenal.calibers.get(def.action.caliber) : void 0;
@@ -12275,7 +12332,7 @@ function createViewmodel(options) {
12275
12332
  const rocketLight = options.lights ? void 0 : createRocketLight(THREE);
12276
12333
  if (rocketLight) scene.add(rocketLight);
12277
12334
  const holder = new THREE.Group();
12278
- holder.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), PI16 / 2);
12335
+ holder.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), PI17 / 2);
12279
12336
  hand.add(holder);
12280
12337
  let tasks = [];
12281
12338
  let stockRig = null;
@@ -12488,7 +12545,7 @@ function createViewmodel(options) {
12488
12545
  const liftToKeepInView = () => {
12489
12546
  const held = heldHold();
12490
12547
  if (!held || !session || !("fov" in camera)) return 0;
12491
- const tanHalf = Math.tan((camera.fov ?? 70) * PI16 / 360);
12548
+ const tanHalf = Math.tan((camera.fov ?? 70) * PI17 / 360);
12492
12549
  eyeTurn.copy(camera.quaternion).invert();
12493
12550
  const rest = targetsOf(THREE, held, session.model.root.getWorldQuaternion(rootQuaternion), 0);
12494
12551
  let needed = 0;
@@ -15489,4 +15546,4 @@ export {
15489
15546
  DEFAULT_EXPLOSIVES_SCENE,
15490
15547
  createExplosivesTestModule
15491
15548
  };
15492
- //# sourceMappingURL=chunk-FOW6RIBT.js.map
15549
+ //# sourceMappingURL=chunk-7WOQSHOL.js.map