@adatechnology/game-weapons-three 0.24.2 → 0.24.4
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/README.md +1 -1
- package/dist/{chunk-UUBO6H5O.js → chunk-4MNVYCNY.js} +209 -43
- package/dist/chunk-4MNVYCNY.js.map +1 -0
- package/dist/index.d.ts +59 -8
- package/dist/index.global.js +463 -80
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +10 -10
- package/dist/chunk-UUBO6H5O.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The muzzle flash, the smoke, the backblast of a launched rocket and the flame je
|
|
|
8
8
|
|
|
9
9
|
**On the body.** The weapon is the body's own, at its real size, in first and third person alike (spec 004: no first-person scale-down, no offset in front of the camera). `ModuleHost.holdFrame` lends the pocket of the right shoulder turned to the aim; a host with no body gets the same pocket under the camera's eye (`BODY_HOLD.eyeToPocket`). A shouldered long gun rests its stock in it (a gun with no stock slides forward so its grip is never behind the eye), a handgun or a short two-hand gun goes to mid-chest, a one-hand tool low. The grips of the hands are kept above the bottom of the view (`HAND_IN_VIEW`, up to 0.3 m of lift) and the weapon comes back from a wall (`WALL_PULL`, `contact`, up to 1.2 m); the hands follow it through `avatar.reach`, which also pulls them back from surfaces. The generic props (`box-fx`) ride the body the same way.
|
|
10
10
|
|
|
11
|
-
**Put away on the body.** A weapon the hands put away to carry or push something (`HostEvent` `holster`) is drawn at the place of the body that took it, read every frame from `ModuleHost.bodySlot`: a pistol muzzle down on the hip holster, a long gun across the back with the muzzle over the off shoulder (`HOLSTER_PLACEMENT`); drawn back in hand it is hidden. `createHolsteredWeapons` does it in the weapons area; `holsteredModel(THREE, weapon, slot)` builds one. The test `holstered.test.ts` puts them on the player's body and finds no face on a plane of the body's.
|
|
11
|
+
**Put away on the body.** A weapon the hands put away to carry or push something (`HostEvent` `holster`) is drawn at the place of the body that took it, read every frame from `ModuleHost.bodySlot`: a pistol muzzle down on the hip holster, a long gun across the back with the muzzle over the off shoulder (`HOLSTER_PLACEMENT`); drawn back in hand it is hidden. `createHolsteredWeapons` does it in the weapons area; `holsteredModel(THREE, weapon, slot)` builds one. The test `holstered.test.ts` puts them on the player's body and finds no face on a plane of the body's. With `from` and `seconds` on the event (owner, 2026-11-25) the move is seen: the weapon goes from the hand to its place, and back, with the right hand on its grip (`handTargets()`, the grip `holdOfModel` gives the weapon in the hands); the slot `ground` tosses it down and ahead, the hand letting go on the way, for the host to drop the world item where it lands. A rifle or shotgun on its `sling` hangs from the front of the chest by its weight (only the body's turn about the vertical), muzzle down toward the off side, with a strap over the off shoulder, and swings with the body (`createSlingSwing` of `game-weapons`: forward off the chest when the body stops, to the side in a turn, never into the chest). `buildHolsterRig` builds the parts.
|
|
12
12
|
**Safety (destravar).** Turning the safety on or off (the `safety` event, B in the test room) plays `safety_on` / `safety_off` on every model: the weapon cants to the right and rises a little toward the eye, the shooting hand slides up its grip so the thumb reaches the lever (`thumb_safety` in `src/data/hand-work.json`; an AK-style rifle's support hand goes over to the big lever on the right, `lever_right`), the lever flicks (when the model draws one, the `safety` part) and the weapon settles. The seconds and radians are `SAFETY_MOTION` of `src/animation/shot-clips.ts`.
|
|
13
13
|
|
|
14
14
|
**Weapons the gallery did not model.** The melee weapons and tools with no gallery model (the bat, the axe, the machete, the knife, the hammer, the crowbar, the crossbow, the wrench, the extinguisher, the blowtorch...) are drawn with the team's item model of `@adatechnology/game-items-three` (Itens do Vale Cinzento), on the counters and in the hands: `buildItemWeaponModel` lays it along +x, flat, the head at +x, with an empty `handle` where the hand closes. The item is the one with the weapon's id, or the one `registerWeaponItemModel(weaponId, { item, turn, flip })` names (`wrench` → `adjustable_wrench`); `registerWeaponItemModel(id, null)` keeps the low-poly prop. The host lends the item models as `items` (`createWeaponFx`, `createWeaponsTestModule`, `createExplosivesTestModule`, `buildWeaponModel`, `worldExplosiveItem`): pass `itemModels` of `@adatechnology/game-items-three` (the recommended path; the kit's preset does). Without `items` the weapons still draw with `itemModels` of `game-items-three` as before; that default is deprecated and removed in the next major. Only a weapon with neither model falls back to the low-poly boxes of its category (`weaponProp`), and the kit's scene check (`tools/kit-audit/scene.mjs`) lists those as pending.
|
|
@@ -12989,8 +12989,12 @@ function createWeaponFx(options) {
|
|
|
12989
12989
|
}
|
|
12990
12990
|
|
|
12991
12991
|
// src/fx/holstered.ts
|
|
12992
|
+
import { createSlingSwing } from "@adatechnology/game-weapons";
|
|
12992
12993
|
import { discardObject3D as discardObject3D5 } from "@adatechnology/game-shapes-three";
|
|
12993
12994
|
|
|
12995
|
+
// src/fx/holster-rig.ts
|
|
12996
|
+
import { catenary as catenary3, createCord as createCord3 } from "@adatechnology/game-shapes-three";
|
|
12997
|
+
|
|
12994
12998
|
// src/modeled-prop.ts
|
|
12995
12999
|
import { markKitOrigin as markKitOrigin5 } from "@adatechnology/game-contracts";
|
|
12996
13000
|
import { itemMakeup, makeupSpec, tagMakeupParts } from "@adatechnology/game-items-three";
|
|
@@ -13042,67 +13046,224 @@ function modeledPropSpec(root, def, name) {
|
|
|
13042
13046
|
return { name, parts: [{ id: MODEL_BODY, material: "steel", shape: { kind: "box", size }, position: [0, size[1] / 2, 0], mass: def.mass }], joints: [], tags: ["weapon"] };
|
|
13043
13047
|
}
|
|
13044
13048
|
|
|
13045
|
-
// src/fx/
|
|
13049
|
+
// src/fx/holster-rig.ts
|
|
13046
13050
|
var HOLSTER_PLACEMENT = {
|
|
13047
13051
|
hip: { muzzle: [0, -1, 0], out: [-1, 0, 0] },
|
|
13048
|
-
back: { muzzle: [0.55, 0.835, 0], out: [0, 0, -1] }
|
|
13052
|
+
back: { muzzle: [0.55, 0.835, 0], out: [0, 0, -1] },
|
|
13053
|
+
sling: { muzzle: [0.32, -0.947, 0], out: [0, 0, 1] }
|
|
13054
|
+
};
|
|
13055
|
+
var SLING_HANG = { pivotBehind: 0.3, frontSwivel: 0.3, shoulder: [0.19, 0.2, -0.04], strapRadius: 8e-3, sag: 0.03, color: 4146217 };
|
|
13056
|
+
var gripOfProp = (THREE, weapon, footprint) => {
|
|
13057
|
+
const model = buildWeaponModelById(THREE, weapon);
|
|
13058
|
+
const right = model ? holdOfModel(THREE, model, 1).right : null;
|
|
13059
|
+
if (!model || !right) return { position: new THREE.Vector3(-footprint[0] * 0.15, footprint[1] * 0.3, 0), quaternion: new THREE.Quaternion() };
|
|
13060
|
+
const box2 = new THREE.Box3().setFromObject(model.root);
|
|
13061
|
+
const center = box2.getCenter(new THREE.Vector3());
|
|
13062
|
+
const frame = new THREE.Group();
|
|
13063
|
+
frame.add(model.root);
|
|
13064
|
+
model.root.position.set(-center.x, -box2.min.y, -center.z);
|
|
13065
|
+
frame.updateMatrixWorld(true);
|
|
13066
|
+
return { position: right.part.localToWorld(right.offset.clone()), quaternion: right.quaternion.clone() };
|
|
13049
13067
|
};
|
|
13050
|
-
var
|
|
13051
|
-
const place = HOLSTER_PLACEMENT[slot];
|
|
13052
|
-
const model = place ? buildModeledProp(THREE, { id: weapon }, weapon, void 0, items) : void 0;
|
|
13053
|
-
if (!place || !model) return void 0;
|
|
13068
|
+
var placeModel = (THREE, model, place, middle) => {
|
|
13054
13069
|
const [, height, thickness] = model.userData.footprint ?? [0, 0, 0];
|
|
13055
13070
|
const muzzle = new THREE.Vector3(...place.muzzle).normalize();
|
|
13056
13071
|
const out = new THREE.Vector3(...place.out).normalize();
|
|
13057
13072
|
const top = new THREE.Vector3().crossVectors(out, muzzle).normalize();
|
|
13058
13073
|
model.quaternion.setFromRotationMatrix(new THREE.Matrix4().makeBasis(muzzle, top, out));
|
|
13059
|
-
model.position.copy(
|
|
13074
|
+
model.position.copy(middle).addScaledVector(top, -height / 2).addScaledVector(out, thickness / 2);
|
|
13075
|
+
};
|
|
13076
|
+
var buildHolsterRig = (THREE, weapon, slot, options = {}) => {
|
|
13077
|
+
const place = HOLSTER_PLACEMENT[slot];
|
|
13078
|
+
const model = place ? buildModeledProp(THREE, { id: weapon }, weapon, void 0, options.items) : void 0;
|
|
13079
|
+
if (!place || !model) return void 0;
|
|
13080
|
+
const footprint = model.userData.footprint ?? [0, 0, 0];
|
|
13060
13081
|
const holder = new THREE.Group();
|
|
13061
13082
|
holder.name = `holstered_${weapon}`;
|
|
13062
|
-
|
|
13063
|
-
|
|
13083
|
+
const slung = slot === "sling" && options.strapMaterial !== void 0;
|
|
13084
|
+
const swing = slung ? new THREE.Group() : holder;
|
|
13085
|
+
if (slung) holder.add(swing);
|
|
13086
|
+
const muzzle = new THREE.Vector3(...place.muzzle).normalize();
|
|
13087
|
+
const middle = slung ? muzzle.clone().multiplyScalar(footprint[0] * SLING_HANG.pivotBehind) : new THREE.Vector3();
|
|
13088
|
+
placeModel(THREE, model, place, middle);
|
|
13089
|
+
swing.add(model);
|
|
13090
|
+
const strap = [];
|
|
13091
|
+
if (slung && options.strapMaterial) {
|
|
13092
|
+
const out = new THREE.Vector3(...place.out).normalize();
|
|
13093
|
+
const front = middle.clone().addScaledVector(muzzle, footprint[0] * SLING_HANG.frontSwivel).addScaledVector(out, footprint[2] / 2);
|
|
13094
|
+
strap.push(createCord3(THREE, catenary3([0, 0, 0], SLING_HANG.shoulder, SLING_HANG.sag, 8), SLING_HANG.strapRadius, options.strapMaterial));
|
|
13095
|
+
strap.push(createCord3(THREE, catenary3([front.x, front.y, front.z], [0, 0, 0], SLING_HANG.sag, 8), SLING_HANG.strapRadius, options.strapMaterial));
|
|
13096
|
+
holder.add(strap[0]);
|
|
13097
|
+
swing.add(strap[1]);
|
|
13098
|
+
}
|
|
13099
|
+
holder.updateMatrixWorld(true);
|
|
13100
|
+
const inProp = gripOfProp(THREE, weapon, footprint);
|
|
13101
|
+
const position = model.localToWorld(inProp.position.clone());
|
|
13102
|
+
const quaternion2 = model.quaternion.clone().multiply(inProp.quaternion);
|
|
13103
|
+
return { holder, swing, grip: { position, quaternion: quaternion2 }, strap };
|
|
13104
|
+
};
|
|
13105
|
+
|
|
13106
|
+
// src/fx/holstered.ts
|
|
13107
|
+
var GROUND_SLOT = "ground";
|
|
13108
|
+
var HOLSTER_TOSS = { drop: 0.8, ahead: 0.3, turn: 1.3, release: 0.4 };
|
|
13109
|
+
var MOVE_GRIP = 0.9;
|
|
13110
|
+
var MAX_SWING_ACCELERATION = 40;
|
|
13111
|
+
var holsteredModel = (THREE, weapon, slot, items) => buildHolsterRig(THREE, weapon, slot, items ? { items } : {})?.holder;
|
|
13112
|
+
var ease4 = (t) => {
|
|
13113
|
+
const k = Math.min(1, Math.max(0, t));
|
|
13114
|
+
return k * k * (3 - 2 * k);
|
|
13064
13115
|
};
|
|
13065
13116
|
var createHolsteredWeapons = (options) => {
|
|
13066
13117
|
const { THREE } = options;
|
|
13067
|
-
const
|
|
13118
|
+
const rigs = /* @__PURE__ */ new Map();
|
|
13068
13119
|
const away = /* @__PURE__ */ new Map();
|
|
13069
|
-
const
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13120
|
+
const strapMaterial = new THREE.MeshStandardMaterial({ color: SLING_HANG.color, roughness: 0.85, metalness: 0 });
|
|
13121
|
+
const frameOf = (pose) => ({ position: new THREE.Vector3(...pose.position), quaternion: new THREE.Quaternion(...pose.quaternion) });
|
|
13122
|
+
const scratch3 = { position: new THREE.Vector3(), quaternion: new THREE.Quaternion(), inverse: new THREE.Quaternion(), acceleration: new THREE.Vector3(), velocity: new THREE.Vector3() };
|
|
13123
|
+
const holderOnHand = (rig, hand) => {
|
|
13124
|
+
const quaternion2 = hand.quaternion.clone().multiply(rig.grip.quaternion.clone().invert());
|
|
13125
|
+
return { position: hand.position.clone().sub(rig.grip.position.clone().applyQuaternion(quaternion2)), quaternion: quaternion2 };
|
|
13126
|
+
};
|
|
13127
|
+
const relativeTo = (frame, base) => {
|
|
13128
|
+
const inverse = base.quaternion.clone().invert();
|
|
13129
|
+
return { position: frame.position.clone().sub(base.position).applyQuaternion(inverse), quaternion: inverse.multiply(frame.quaternion) };
|
|
13130
|
+
};
|
|
13131
|
+
const inFrame = (local, base) => ({ position: local.position.clone().applyQuaternion(base.quaternion).add(base.position), quaternion: base.quaternion.clone().multiply(local.quaternion) });
|
|
13132
|
+
const holdFrame = () => {
|
|
13133
|
+
const pose = options.holdFrame?.();
|
|
13134
|
+
return pose ? frameOf(pose) : null;
|
|
13135
|
+
};
|
|
13136
|
+
const goal = (entry) => {
|
|
13137
|
+
if (entry.motion?.kind === "toss") {
|
|
13138
|
+
const start = entry.motion.start;
|
|
13139
|
+
const ahead = new THREE.Vector3(0, 0, -1).applyQuaternion(holdFrame()?.quaternion ?? start.quaternion).setY(0).normalize();
|
|
13140
|
+
const turn2 = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3().crossVectors(ahead, new THREE.Vector3(0, 1, 0)).normalize(), HOLSTER_TOSS.turn);
|
|
13141
|
+
return { position: start.position.clone().addScaledVector(ahead, HOLSTER_TOSS.ahead).add(new THREE.Vector3(0, -HOLSTER_TOSS.drop, 0)), quaternion: turn2.multiply(start.quaternion.clone()) };
|
|
13142
|
+
}
|
|
13143
|
+
if (entry.motion?.kind === "back") {
|
|
13144
|
+
const base = holdFrame();
|
|
13145
|
+
return base && entry.taken ? inFrame(entry.taken, base) : null;
|
|
13146
|
+
}
|
|
13147
|
+
const pose = options.bodySlot(entry.slot);
|
|
13148
|
+
if (!pose) return null;
|
|
13149
|
+
return entry.swing ? hanging(entry, frameOf(pose)) : frameOf(pose);
|
|
13150
|
+
};
|
|
13151
|
+
const hanging = (entry, frame) => {
|
|
13152
|
+
const forward = new THREE.Vector3(0, 0, 1).applyQuaternion(frame.quaternion);
|
|
13153
|
+
const up = new THREE.Vector3(0, 1, 0).applyQuaternion(frame.quaternion);
|
|
13154
|
+
forward.y = 0;
|
|
13155
|
+
if (forward.lengthSq() < 1e-8) return frame;
|
|
13156
|
+
forward.normalize();
|
|
13157
|
+
entry.lean = Math.atan2(up.dot(forward), up.y);
|
|
13158
|
+
return { position: frame.position, quaternion: new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0, 0, 1), forward) };
|
|
13159
|
+
};
|
|
13160
|
+
const place = (entry, frame) => {
|
|
13161
|
+
entry.rig.holder.position.copy(frame.position);
|
|
13162
|
+
entry.rig.holder.quaternion.copy(frame.quaternion);
|
|
13163
|
+
entry.rig.holder.updateMatrixWorld(true);
|
|
13164
|
+
};
|
|
13165
|
+
const swingOf = (entry, frame, dt) => {
|
|
13166
|
+
if (!entry.swing || dt <= 0) return;
|
|
13167
|
+
const { velocity, acceleration, inverse } = scratch3;
|
|
13168
|
+
velocity.copy(frame.position).sub(entry.last ?? frame.position).divideScalar(dt);
|
|
13169
|
+
acceleration.copy(velocity).sub(entry.last ? entry.speed : velocity).divideScalar(dt).clampLength(0, MAX_SWING_ACCELERATION);
|
|
13170
|
+
entry.last = (entry.last ?? new THREE.Vector3()).copy(frame.position);
|
|
13171
|
+
entry.speed.copy(velocity);
|
|
13172
|
+
acceleration.applyQuaternion(inverse.copy(frame.quaternion).invert());
|
|
13173
|
+
const state = entry.swing.step(dt, [-acceleration.x, acceleration.y, acceleration.z]);
|
|
13174
|
+
entry.rig.swing.rotation.set(-(state.forward + Math.max(0, -entry.lean)), 0, -state.side);
|
|
13175
|
+
entry.rig.holder.updateMatrixWorld(true);
|
|
13176
|
+
};
|
|
13177
|
+
const hide = (weapon) => {
|
|
13178
|
+
const entry = away.get(weapon);
|
|
13179
|
+
if (!entry) return;
|
|
13180
|
+
entry.rig.holder.visible = false;
|
|
13181
|
+
away.delete(weapon);
|
|
13182
|
+
};
|
|
13183
|
+
const step = (entry, dt) => {
|
|
13184
|
+
const motion = entry.motion;
|
|
13185
|
+
const target = goal(entry);
|
|
13186
|
+
entry.rig.holder.visible = target !== null;
|
|
13187
|
+
const body = entry.rig.strap[0];
|
|
13188
|
+
if (body) body.visible = motion === null;
|
|
13189
|
+
if (!target) return;
|
|
13190
|
+
if (!motion) {
|
|
13191
|
+
place(entry, target);
|
|
13192
|
+
swingOf(entry, target, dt);
|
|
13193
|
+
return;
|
|
13194
|
+
}
|
|
13195
|
+
motion.time = Math.min(motion.seconds, motion.time + dt);
|
|
13196
|
+
const k = ease4(motion.time / motion.seconds);
|
|
13197
|
+
place(entry, { position: motion.start.position.clone().lerp(target.position, k), quaternion: motion.start.quaternion.clone().slerp(target.quaternion, k) });
|
|
13198
|
+
if (motion.time < motion.seconds) return;
|
|
13199
|
+
if (motion.kind === "away") {
|
|
13200
|
+
entry.motion = null;
|
|
13201
|
+
if (body) body.visible = true;
|
|
13202
|
+
}
|
|
13203
|
+
if (motion.kind === "toss") hide(entry.weapon);
|
|
13204
|
+
};
|
|
13205
|
+
const rigOf = (weapon, slot) => {
|
|
13206
|
+
const key = `${weapon}@${slot}`;
|
|
13207
|
+
const known = rigs.get(key);
|
|
13208
|
+
if (known) return known;
|
|
13209
|
+
const rig = buildHolsterRig(THREE, weapon, slot === GROUND_SLOT ? "hip" : slot, { ...options.items ? { items: options.items } : {}, strapMaterial });
|
|
13210
|
+
if (!rig) return void 0;
|
|
13211
|
+
options.scene.add(rig.holder);
|
|
13212
|
+
rig.holder.visible = false;
|
|
13213
|
+
rigs.set(key, rig);
|
|
13214
|
+
return rig;
|
|
13215
|
+
};
|
|
13216
|
+
const putAway = (event, seconds) => {
|
|
13217
|
+
if (!options.arsenal.weapons.has(event.weapon)) return;
|
|
13218
|
+
hide(event.weapon);
|
|
13219
|
+
const rig = rigOf(event.weapon, event.slot);
|
|
13220
|
+
if (!rig) return;
|
|
13221
|
+
rig.swing.rotation.set(0, 0, 0);
|
|
13222
|
+
const entry = { weapon: event.weapon, slot: event.slot, rig, motion: null, taken: null, swing: event.slot === "sling" ? createSlingSwing() : null, last: null, speed: new THREE.Vector3(), lean: 0 };
|
|
13223
|
+
if (event.from && seconds > 0) {
|
|
13224
|
+
const start = holderOnHand(rig, frameOf(event.from));
|
|
13225
|
+
const base = holdFrame();
|
|
13226
|
+
entry.taken = base ? relativeTo(start, base) : null;
|
|
13227
|
+
entry.motion = { kind: event.slot === GROUND_SLOT ? "toss" : "away", time: 0, seconds, start };
|
|
13228
|
+
} else if (event.slot === GROUND_SLOT) return;
|
|
13229
|
+
away.set(event.weapon, entry);
|
|
13230
|
+
step(entry, 0);
|
|
13077
13231
|
};
|
|
13078
13232
|
return {
|
|
13079
13233
|
handle(event) {
|
|
13080
|
-
const
|
|
13081
|
-
if (
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
if (!options.arsenal.weapons.has(event.weapon)) return;
|
|
13088
|
-
if (!models.has(key)) {
|
|
13089
|
-
const holder = holsteredModel(THREE, event.weapon, event.slot, options.items);
|
|
13090
|
-
if (!holder) return;
|
|
13091
|
-
options.scene.add(holder);
|
|
13092
|
-
models.set(key, holder);
|
|
13093
|
-
}
|
|
13094
|
-
away.set(event.weapon, event.slot);
|
|
13095
|
-
place(event.weapon, event.slot);
|
|
13234
|
+
const seconds = event.seconds ?? 0;
|
|
13235
|
+
if (event.on) return putAway(event, seconds);
|
|
13236
|
+
const entry = away.get(event.weapon);
|
|
13237
|
+
if (!entry || seconds <= 0 || !entry.taken || !holdFrame()) return hide(event.weapon);
|
|
13238
|
+
entry.motion = { kind: "back", time: 0, seconds, start: { position: entry.rig.holder.position.clone(), quaternion: entry.rig.holder.quaternion.clone() } };
|
|
13239
|
+
entry.swing?.reset();
|
|
13240
|
+
entry.rig.swing.rotation.set(0, 0, 0);
|
|
13096
13241
|
},
|
|
13097
|
-
|
|
13098
|
-
|
|
13242
|
+
inHand(weapon) {
|
|
13243
|
+
if (away.get(weapon)?.motion?.kind !== "toss") hide(weapon);
|
|
13244
|
+
},
|
|
13245
|
+
update(dt = 0) {
|
|
13246
|
+
for (const entry of [...away.values()]) step(entry, dt);
|
|
13247
|
+
},
|
|
13248
|
+
handTargets() {
|
|
13249
|
+
for (const entry of away.values()) {
|
|
13250
|
+
const motion = entry.motion;
|
|
13251
|
+
if (!motion || !entry.rig.holder.visible) continue;
|
|
13252
|
+
if (motion.kind === "toss" && motion.time / motion.seconds > HOLSTER_TOSS.release) continue;
|
|
13253
|
+
const { position, quaternion: quaternion2 } = scratch3;
|
|
13254
|
+
position.copy(entry.rig.grip.position).applyMatrix4(entry.rig.holder.matrixWorld);
|
|
13255
|
+
quaternion2.copy(entry.rig.holder.quaternion).multiply(entry.rig.grip.quaternion);
|
|
13256
|
+
return { R: { position: [position.x, position.y, position.z], quaternion: [quaternion2.x, quaternion2.y, quaternion2.z, quaternion2.w] }, grip: MOVE_GRIP };
|
|
13257
|
+
}
|
|
13258
|
+
return null;
|
|
13099
13259
|
},
|
|
13100
13260
|
get drawn() {
|
|
13101
|
-
return [...away.
|
|
13261
|
+
return [...away.values()].filter((entry) => entry.motion?.kind !== "toss").map((entry) => entry.weapon);
|
|
13102
13262
|
},
|
|
13103
13263
|
dispose() {
|
|
13104
|
-
discardObject3D5([...
|
|
13105
|
-
|
|
13264
|
+
discardObject3D5([...rigs.values()].map((rig) => rig.holder));
|
|
13265
|
+
strapMaterial.dispose();
|
|
13266
|
+
rigs.clear();
|
|
13106
13267
|
away.clear();
|
|
13107
13268
|
}
|
|
13108
13269
|
};
|
|
@@ -14569,7 +14730,7 @@ function createWeaponsTestModule(options = {}) {
|
|
|
14569
14730
|
});
|
|
14570
14731
|
const worldEffects = createWorldEffects({ arsenal });
|
|
14571
14732
|
const bodySlot = lent.bodySlot?.bind(lent);
|
|
14572
|
-
const holstered = bodySlot ? createHolsteredWeapons({ THREE: lent.THREE, scene: lent.scene, arsenal, ...options.items ? { items: options.items } : {}, bodySlot }) : null;
|
|
14733
|
+
const holstered = bodySlot ? createHolsteredWeapons({ THREE: lent.THREE, scene: lent.scene, arsenal, ...options.items ? { items: options.items } : {}, bodySlot, holdFrame: () => lent.holdFrame?.("R") ?? null }) : null;
|
|
14573
14734
|
const offEvents = lent.on((event) => {
|
|
14574
14735
|
worldEffects.handle(event, lent.effects);
|
|
14575
14736
|
if (event.type === "holster") {
|
|
@@ -14583,6 +14744,7 @@ function createWeaponsTestModule(options = {}) {
|
|
|
14583
14744
|
return;
|
|
14584
14745
|
}
|
|
14585
14746
|
const tool = lent.tool();
|
|
14747
|
+
if (event.type === "tool") holstered?.inHand(event.weapon);
|
|
14586
14748
|
created.handle(event, tool);
|
|
14587
14749
|
if (event.type === "reload" && event.phase === "start") {
|
|
14588
14750
|
const clip = created.clips.find((entry) => entry.name.startsWith("reload"));
|
|
@@ -14595,9 +14757,9 @@ function createWeaponsTestModule(options = {}) {
|
|
|
14595
14757
|
});
|
|
14596
14758
|
const offFrame = lent.onFrame((dt) => {
|
|
14597
14759
|
created.update(dt);
|
|
14598
|
-
holstered?.update();
|
|
14760
|
+
holstered?.update(dt);
|
|
14599
14761
|
});
|
|
14600
|
-
const offHands = lent.setHandTargets?.(() => created.handTargets());
|
|
14762
|
+
const offHands = lent.setHandTargets?.(() => holstered?.handTargets() ?? created.handTargets());
|
|
14601
14763
|
const offMuzzle = lent.setMuzzleSource?.((hand) => created.muzzle(hand));
|
|
14602
14764
|
created.handle({ type: "tool", weapon: lent.tool().weapon }, lent.tool());
|
|
14603
14765
|
return () => {
|
|
@@ -15747,6 +15909,10 @@ export {
|
|
|
15747
15909
|
buildTripodMountedProp,
|
|
15748
15910
|
modeledPropSpec,
|
|
15749
15911
|
HOLSTER_PLACEMENT,
|
|
15912
|
+
SLING_HANG,
|
|
15913
|
+
buildHolsterRig,
|
|
15914
|
+
GROUND_SLOT,
|
|
15915
|
+
HOLSTER_TOSS,
|
|
15750
15916
|
holsteredModel,
|
|
15751
15917
|
createHolsteredWeapons,
|
|
15752
15918
|
WEAPON_THUMBNAILS,
|
|
@@ -15773,4 +15939,4 @@ export {
|
|
|
15773
15939
|
DEFAULT_EXPLOSIVES_SCENE,
|
|
15774
15940
|
createExplosivesTestModule
|
|
15775
15941
|
};
|
|
15776
|
-
//# sourceMappingURL=chunk-
|
|
15942
|
+
//# sourceMappingURL=chunk-4MNVYCNY.js.map
|