@adatechnology/game-characters-three 0.9.5 → 0.10.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 CHANGED
@@ -1,5 +1,5 @@
1
- import { T as Three, B as BestSpec, a as BestPose, P as PersonSpec, b as PersonCharacter, c as PersonGroupSpec, L as LegRig, A as ArmRig, d as PersonExtra, R as RichRig, e as BloodLook, F as FluidsBridge, C as CharacterSound, f as AvatarItemUsePose, g as AvatarViewMode, h as ReachView, i as PlayerAvatar } from './testing-CqU1CJ_y.js';
2
- export { j as AVATAR_AREA_ID, k as AreaContext, l as AvatarEvent, m as AvatarTestOptions, n as AvatarUpdate, o as BODY_MATERIAL_DEF, p as BODY_SOUNDS, q as BloodAge, r as BloodLookOptions, s as BloodSink, t as BodySegment, u as BodySoundRule, v as CHARACTERS_AREA_ID, w as CharacterSoundOptions, x as CharacterSoundSink, y as CharacterSoundStyle, z as CharactersTestOptions, D as FilmSink, E as FluidsBridgeOptions, H as HIT_PRESETS, G as HitPreset, I as PERSON_ITEM_PREFIX, J as PLAYER_SOUNDS, K as PlayPoseOptions, M as PlayerAvatarColors, N as PlayerAvatarOptions, O as PlayerAvatarSpec, Q as PoseTargets, S as ProfessionCard, U as RigAnimator, V as RigAnimatorOptions, W as UNDEAD_VOICES, X as UNDEAD_VOICE_SOURCES, Y as UndeadCard, Z as UndeadLike, _ as UndeadVoice, $ as VoiceMoment, a0 as VoiceStep, a1 as WoundSpray, a2 as ZOMBIE_ITEM_PREFIX, a3 as bloodLookOfAge, a4 as createAvatarTestModule, a5 as createCharacterSound, a6 as createCharactersTestModule, a7 as createFluidsBridge, a8 as createPlayerAvatar, a9 as createRigAnimator, aa as personSpecOf, ab as registerBodyMaterial } from './testing-CqU1CJ_y.js';
1
+ import { T as Three, B as BestSpec, a as BestPose, P as PersonSpec, b as PersonCharacter, c as PersonGroupSpec, L as LegRig, A as ArmRig, d as PersonExtra, R as RichRig, e as BloodLook, F as FluidsBridge, C as CharacterSound, f as AvatarItemUsePose, g as AvatarViewMode, h as AvatarViewOptions, i as ReachView, j as PlayerAvatar } from './testing-7EIhFq92.js';
2
+ export { k as AVATAR_AREA_ID, l as AreaContext, m as AvatarEvent, n as AvatarTestOptions, o as AvatarUpdate, p as BODY_MATERIAL_DEF, q as BODY_SOUNDS, r as BloodAge, s as BloodLookOptions, t as BloodSink, u as BodySegment, v as BodySoundRule, w as CHARACTERS_AREA_ID, x as CharacterSoundOptions, y as CharacterSoundSink, z as CharacterSoundStyle, D as CharactersTestOptions, E as FilmSink, G as FluidsBridgeOptions, H as HIT_PRESETS, I as HitPreset, J as PERSON_ITEM_PREFIX, K as PLAYER_SOUNDS, M as PlayPoseOptions, N as PlayerAvatarColors, O as PlayerAvatarOptions, Q as PlayerAvatarSpec, S as PoseTargets, U as ProfessionCard, V as RigAnimator, W as RigAnimatorOptions, X as UNDEAD_VOICES, Y as UNDEAD_VOICE_SOURCES, Z as UndeadCard, _ as UndeadLike, $ as UndeadVoice, a0 as VoiceMoment, a1 as VoiceStep, a2 as WoundSpray, a3 as ZOMBIE_ITEM_PREFIX, a4 as bloodLookOfAge, a5 as createAvatarTestModule, a6 as createCharacterSound, a7 as createCharactersTestModule, a8 as createFluidsBridge, a9 as createPlayerAvatar, aa as createRigAnimator, ab as personSpecOf, ac as registerBodyMaterial } from './testing-7EIhFq92.js';
3
3
  import { BodySpec, SegmentId, PoseClip, PoseClipEvent, FirstPersonClip } from '@adatechnology/game-characters';
4
4
  import * as THREE_NS from 'three';
5
5
  import { LightBudget, SourceHandle } from '@adatechnology/game-render-three';
@@ -989,8 +989,8 @@ type RoomAvatarLike = {
989
989
  shoulder(side: 'R' | 'L'): THREE_NS.Object3D;
990
990
  /** Where the body's eyes are after its pose (`RoomAvatar.eye`): the room draws the body in both views and puts the first-person camera there. */
991
991
  eye(out?: THREE_NS.Vector3): THREE_NS.Vector3;
992
- /** Hides the head and neck from `camera` in first person (`RoomAvatar.setView`). */
993
- setView(mode: AvatarViewMode, camera: THREE_NS.Object3D | null): void;
992
+ /** Hides the head and neck from `camera` in first person, and the arms with `arms` (`RoomAvatar.setView`). */
993
+ setView(mode: AvatarViewMode, camera: THREE_NS.Object3D | null, options?: AvatarViewOptions): void;
994
994
  /** Brings the body's hands to the tool in them, in both views; `view` keeps them in the first-person view (`RoomAvatar.reach`). */
995
995
  reach(targets: HandTargets | null, view?: ReachView | null): void;
996
996
  /** Plays a strike on the body (the only source of it, in both views) and answers the seconds to its impact (`RoomAvatar.strike`). */
@@ -1199,4 +1199,4 @@ type TwoBone = {
1199
1199
  */
1200
1200
  declare const solveTwoBone: (root: THREE_NS.Vector3, target: THREE_NS.Vector3, upper: number, lower: number, pole: THREE_NS.Vector3, out: TwoBone) => TwoBone;
1201
1201
 
1202
- export { ACCESSORY_BIT, type AccessoryAttach, ArmRig, AvatarItemUsePose, AvatarViewMode, BAKE_NEUTRAL_POSE, BODY_CHUNK, type BakeBuilders, type BakeSpec, type BakedBody, type BestBuilder, type BestBuilderOptions, type BestTypeCard, type BlobShadowBatch, type BlobShadowOptions, BloodLook, type BodyBatch, type BodyBatchMesh, type BodyBatchOptions, type BodyChunkOptions, type BodyInstance, type BodyJoints, type BodyMaterialParams, type BodyVariant, type BuildInstancedBodyParams, CHARACTER_SOUNDS, CHARACTER_SOUND_BANK, CLIPS_BIT, CLIP_BONES, CLIP_LIMIT, CLIP_RATE, CLIP_TEXELS, CharacterSound, type ClipLimp, EXTRAS, type EyeOptions, type Eyes, FACE_FEATURES, FIRST_PERSON_BOB, FIRST_PERSON_COLORS, FIRST_PERSON_RIG, FIRST_PERSON_STANCES, type FirstPersonArms, type FirstPersonArmsOptions, type FirstPersonArmsState, type FirstPersonBob, type FirstPersonColors, type FirstPersonEvent, type FirstPersonRig, FluidsBridge, type FlyingLimb, type FlyingLimbs, type FlyingLimbsOptions, type FlyingPiece, type FlyingPieces, type FlyingPiecesOptions, GAIT_STYLE, type GaitStyle, HAND_ITEMS, HATS, IMPOSTOR_ANGLES, IMPOSTOR_FRAMES, type IdentityLook, type ImpostorAtlas, type ImpostorAtlasOptions, type ImpostorBatch, type ImpostorBatchOptions, type ImpostorBody, type ImpostorBox, type ImpostorInstance, KIT_ACCESSORIES, type KitAccessory, LOD_BAKE, LOD_BATCH_CAPACITY, LOD_CASTS_SHADOW, LOD_DISTANCES, LOD_SEGMENTS, LegRig, type LimbEffects, type LimbLaunch, PENDULUM, type Pendulum, type PersonBuilder, type PersonBuilderOptions, PersonCharacter, PersonExtra, PersonGroupSpec, PersonSpec, PlayerAvatar, ReachView, type RestPose, RichRig, type RoomAvatarLike, SEGMENT_CLIPS, STAGGER_POSE, type SegmentClipSet, type SegmentClipSpec, type SegmentClipUniforms, type StanceDef, TROUSER_PALETTE, Three, type ToRoomAvatarOptions, type TwoBone, UNDEAD_VOICE_GROUP, type VariantBatchesOptions, type VariantType, type WoundBody, type WoundMaterials, type WoundNode, type Wounds, type WoundsOptions, accessoryPlacement, bakeBody, bakeImpostorAtlas, bakeSegmentClips, bakeVariants, blobGeometry, blobRadii, buildInstancedBody, buildKitAccessory, clipIndexOf, clipSpeedOf, createBestBuilder, createBlobShadowBatch, createBodyBatch, createBodyChunk, createBodyChunkExt, createBodyMaterial, createEye, createFirstPersonArms, createFlyingLimbs, createFlyingPieces, createGlowTexture, createImpostorBatch, createPendulum, createPersonBuilder, createSegmentClipUniforms, createVariantBatches, createWoundMaterials, createWounds, exitWound, explodeChunks, findEyes, gouge, jointsOf, lodAt, makeCut, makeStump, packIdentity, ringWound, solveTwoBone, starGeometry, stepPendulum, toRoomAvatar, unpackIdentity, walkPoseVertex, woundBodyOf, woundDecal };
1202
+ export { ACCESSORY_BIT, type AccessoryAttach, ArmRig, AvatarItemUsePose, AvatarViewMode, AvatarViewOptions, BAKE_NEUTRAL_POSE, BODY_CHUNK, type BakeBuilders, type BakeSpec, type BakedBody, type BestBuilder, type BestBuilderOptions, type BestTypeCard, type BlobShadowBatch, type BlobShadowOptions, BloodLook, type BodyBatch, type BodyBatchMesh, type BodyBatchOptions, type BodyChunkOptions, type BodyInstance, type BodyJoints, type BodyMaterialParams, type BodyVariant, type BuildInstancedBodyParams, CHARACTER_SOUNDS, CHARACTER_SOUND_BANK, CLIPS_BIT, CLIP_BONES, CLIP_LIMIT, CLIP_RATE, CLIP_TEXELS, CharacterSound, type ClipLimp, EXTRAS, type EyeOptions, type Eyes, FACE_FEATURES, FIRST_PERSON_BOB, FIRST_PERSON_COLORS, FIRST_PERSON_RIG, FIRST_PERSON_STANCES, type FirstPersonArms, type FirstPersonArmsOptions, type FirstPersonArmsState, type FirstPersonBob, type FirstPersonColors, type FirstPersonEvent, type FirstPersonRig, FluidsBridge, type FlyingLimb, type FlyingLimbs, type FlyingLimbsOptions, type FlyingPiece, type FlyingPieces, type FlyingPiecesOptions, GAIT_STYLE, type GaitStyle, HAND_ITEMS, HATS, IMPOSTOR_ANGLES, IMPOSTOR_FRAMES, type IdentityLook, type ImpostorAtlas, type ImpostorAtlasOptions, type ImpostorBatch, type ImpostorBatchOptions, type ImpostorBody, type ImpostorBox, type ImpostorInstance, KIT_ACCESSORIES, type KitAccessory, LOD_BAKE, LOD_BATCH_CAPACITY, LOD_CASTS_SHADOW, LOD_DISTANCES, LOD_SEGMENTS, LegRig, type LimbEffects, type LimbLaunch, PENDULUM, type Pendulum, type PersonBuilder, type PersonBuilderOptions, PersonCharacter, PersonExtra, PersonGroupSpec, PersonSpec, PlayerAvatar, ReachView, type RestPose, RichRig, type RoomAvatarLike, SEGMENT_CLIPS, STAGGER_POSE, type SegmentClipSet, type SegmentClipSpec, type SegmentClipUniforms, type StanceDef, TROUSER_PALETTE, Three, type ToRoomAvatarOptions, type TwoBone, UNDEAD_VOICE_GROUP, type VariantBatchesOptions, type VariantType, type WoundBody, type WoundMaterials, type WoundNode, type Wounds, type WoundsOptions, accessoryPlacement, bakeBody, bakeImpostorAtlas, bakeSegmentClips, bakeVariants, blobGeometry, blobRadii, buildInstancedBody, buildKitAccessory, clipIndexOf, clipSpeedOf, createBestBuilder, createBlobShadowBatch, createBodyBatch, createBodyChunk, createBodyChunkExt, createBodyMaterial, createEye, createFirstPersonArms, createFlyingLimbs, createFlyingPieces, createGlowTexture, createImpostorBatch, createPendulum, createPersonBuilder, createSegmentClipUniforms, createVariantBatches, createWoundMaterials, createWounds, exitWound, explodeChunks, findEyes, gouge, jointsOf, lodAt, makeCut, makeStump, packIdentity, ringWound, solveTwoBone, starGeometry, stepPendulum, toRoomAvatar, unpackIdentity, walkPoseVertex, woundBodyOf, woundDecal };
@@ -197,7 +197,7 @@ var GameCharactersThree = (() => {
197
197
  var HIP_PIVOT = "vec3(0.,0.95,0.)";
198
198
  var createBodyChunk = ({ hipHeight = 0.95 } = {}) => hipHeight === 0.95 ? BODY_CHUNK : BODY_CHUNK.replaceAll(HIP_PIVOT, `vec3(0.,${hipHeight},0.)`);
199
199
 
200
- // ../game-shapes/dist/chunk-M5N2SHNL.js
200
+ // ../game-shapes/dist/chunk-FZQTELDQ.js
201
201
  function canonicalJson(value) {
202
202
  if (value === null) return "null";
203
203
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -1073,17 +1073,19 @@ var GameCharactersThree = (() => {
1073
1073
  if (p2.prevZ) p2.prevZ.nextZ = p2.nextZ;
1074
1074
  if (p2.nextZ) p2.nextZ.prevZ = p2.prevZ;
1075
1075
  }
1076
- function Node(i, x, y) {
1077
- this.i = i;
1078
- this.x = x;
1079
- this.y = y;
1080
- this.prev = null;
1081
- this.next = null;
1082
- this.z = 0;
1083
- this.prevZ = null;
1084
- this.nextZ = null;
1085
- this.steiner = false;
1086
- }
1076
+ var Node = class {
1077
+ constructor(i, x, y) {
1078
+ this.i = i;
1079
+ this.x = x;
1080
+ this.y = y;
1081
+ this.prev = null;
1082
+ this.next = null;
1083
+ this.z = 0;
1084
+ this.prevZ = null;
1085
+ this.nextZ = null;
1086
+ this.steiner = false;
1087
+ }
1088
+ };
1087
1089
  function signedArea(data, start, end, dim) {
1088
1090
  let sum = 0;
1089
1091
  for (let i = start, j = end - dim; i < end; i += dim) {
@@ -8575,7 +8577,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
8575
8577
  };
8576
8578
  };
8577
8579
 
8578
- // ../game-audio/dist/chunk-C2K7XN2K.js
8580
+ // ../game-audio/dist/chunk-UUWKSG4J.js
8579
8581
  var DISTANCE_CURVES = {
8580
8582
  /** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
8581
8583
  game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
@@ -11661,6 +11663,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
11661
11663
  eyeSocket.position.set(BUILDER_EYE[0] + eyeOffset[0], BUILDER_EYE[1] + eyeOffset[1], BUILDER_EYE[2] + eyeOffset[2]);
11662
11664
  rig.headG.children[0].add(eyeSocket);
11663
11665
  const headHider = createHeadHider([rig.headG, ...rig.neck ? [rig.neck] : []]);
11666
+ const armsHider = createHeadHider(rig.arms.map((arm) => arm.g));
11664
11667
  const eyeLocal = new THREE.Vector3();
11665
11668
  let bob = 0;
11666
11669
  let hipWithoutBob = null;
@@ -12008,7 +12011,10 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
12008
12011
  root.updateWorldMatrix(true, false);
12009
12012
  return root.localToWorld(out.copy(eyeLocal));
12010
12013
  },
12011
- setView: (mode, camera) => headHider.setView(mode, camera),
12014
+ setView: (mode, camera, viewOptions) => {
12015
+ headHider.setView(mode, camera);
12016
+ armsHider.setView(viewOptions?.arms ? mode : "third", camera);
12017
+ },
12012
12018
  play(clip, playOptions = {}) {
12013
12019
  const found = typeof clip === "string" ? clips.get(clip) : clip;
12014
12020
  if (!found) throw new Error(`Unknown pose clip: ${String(clip)}`);
@@ -12514,7 +12520,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
12514
12520
  root: avatar.root,
12515
12521
  avatar,
12516
12522
  eye: (out) => avatar.eye(out),
12517
- setView: (mode, camera) => avatar.setView(mode, camera),
12523
+ setView: (mode, camera, options2) => avatar.setView(mode, camera, options2),
12518
12524
  update: (dt, state) => {
12519
12525
  stepGuard(dt, state);
12520
12526
  updateFeet(state);