@adatechnology/game-weapons-three 0.24.3 → 0.25.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/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.
@@ -62,3 +62,9 @@ Cenários: `explosives_p13_shot`, `explosives_p13_valve`, `explosives_p13_fire`,
62
62
  `createWeaponProps({ packs, patch, remove })` makes the weapon item model overrides of its own: the shipped ones plus `packs`. `packs` is a list of objects `{ [weaponId]: WeaponItemModel | null }` (`[{ axe: { item: 'hammer' }, baseball_bat: null }]`; `null` keeps the low-poly prop).
63
63
  `patch` merges fields by weapon id (`item`, `turn`, `flip`), `remove` lists weapon ids whose override is taken out. `props.buildModel`, `props.buildItemModel` and `props.itemModelOf` read that set; `buildModeledProp`, `buildTripodMountedProp` and `createWeaponsTestModule` take it as `props`.
64
64
  The global `registerWeaponItemModel` and the rest are deprecated delegates of `defaultWeaponProps()`.
65
+
66
+ ## Loose pieces in the physics engine (spec 008, T4.3)
67
+
68
+ `createWeaponFx({ physics })` takes a `SeamWorld` of `@adatechnology/game-physics`: the casings that the gallery's models eject become bodies of it (`casingCollider`: a cylinder along x, C_rr 0.015,
69
+ swept), roll, sleep and bounce by the world's floor; the host's loop steps the world. Without it they keep the gallery's own bounce. `spawnLoose`, `syncLoose`
70
+ and `dropLoose` put a loose piece in the world, copy its pose onto a mesh (reporting a bounce and sleep) and take it out. Measured on the kit's floor (`KIT_WORLD`): 200 of 200 casings asleep 5 s after the last, none under the floor.