@adatechnology/game-test-room 0.15.0 → 0.16.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 +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.global.js +267 -52
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +48 -6
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -202,7 +202,7 @@ interface RoomAvatar {
|
|
|
202
202
|
|
|
203
203
|
Every frame the room puts `root` at the player's feet turned to where the player looks (the body's front is +z, as the catalogue items'; `rotation.y` is the yaw plus pi) and calls `update` with the ground speed of the player's movement, Shift, `armed` (a firearm is the tool in hand) and the camera `pitch` (radians, positive looking up). `crouch` and `down` are not known to the room: a player module sets them with `room.setAvatarState({ crouch, down })` (`avatarState()` reads them back). `@adatechnology/game-characters-three` has such a body: `toRoomAvatar(createPlayerAvatar(THREE))`.
|
|
204
204
|
|
|
205
|
-
**First-person arms and strikes.** An avatar may carry `firstPerson` (arms drawn in the camera's space; the room shows them only in the first person, updates them every frame after the modules' frame hooks and hands them where the tool in the hands asks the hands to be) and `strike(clipId)`. The hand targets come from the module that places the tool (`host.setHandTargets(source)`, `HandTargets` of `@adatechnology/game-contracts`: world-space poses of the right and left hand plus the grip closure and the size of the hands), else from the carried item, else null; the stance is `hold` when there are targets, else `handStances[toolId]` (default `{ fists: 'fists' }`) or `relaxed`. A melee strike (`fists`, `shove`, Shift+V kick) no longer lands at the click: the room calls `avatar.strike(strikeClips[toolId])` (default `{ fists: 'punch_right', shove: 'shove_two_hands', kick: 'front_kick' }`), which plays the clip on the arms and on the body and answers the seconds to its impact, writes a `strike` line to the log, and calls the existing `meleeUse` at that second with the aim read again. A tool without a clip, or an avatar that answers null, keeps the instant blow; a strike pending blocks the same tool. `toRoomAvatar(createPlayerAvatar(THREE))` already gives all of it (`firstPerson: false` for no arms).
|
|
205
|
+
**First-person arms and strikes.** An avatar may carry `firstPerson` (arms drawn in the camera's space; the room shows them only in the first person, updates them every frame after the modules' frame hooks and hands them where the tool in the hands asks the hands to be) and `strike(clipId)`. The hand targets come from the module that places the tool (`host.setHandTargets(source)`, `HandTargets` of `@adatechnology/game-contracts`: world-space poses of the right and left hand plus the grip closure and the size of the hands), else from the carried item, else null; the stance is `hold` when there are targets, else `handStances[toolId]` (default `{ fists: 'fists' }`) or `relaxed`. A melee strike (`fists`, `shove`, Shift+V kick) no longer lands at the click: the room calls `avatar.strike(strikeClips[toolId])` (default `{ fists: 'punch_right', shove: 'shove_two_hands', kick: 'front_kick' }`), which plays the clip on the arms and on the body and answers the seconds to its impact, writes a `strike` line to the log, and calls the existing `meleeUse` at that second with the aim read again. The left click with bare hands (`hand`, the default tool) punches too (E or the right button grab). Punches alternate hands, right first (`punchHand`: `alternate`, `left`, `right`; `punchTools`, default `['hand', 'fists']`): the room calls `strike(clip, { hand })` and logs the hand, as the kick does with `kickLeg` and `{ leg }`. A tool without a clip, or an avatar that answers null, keeps the instant blow; a strike pending blocks the same tool. `toRoomAvatar(createPlayerAvatar(THREE))` already gives all of it (`firstPerson: false` for no arms).
|
|
206
206
|
|
|
207
207
|
`room.setCameraMode('first' | 'third')` (option `cameraMode`, property `cameraMode`, event `room.on('camera', fn)`; every change is a `camera` action in the log). V toggles it when a body is set. In `first` the body is hidden; in `third` it is shown, the camera stands over the shoulder, and a carried item rides `avatar.hand('R')` instead of the camera frame. Option `thirdPerson` changes the view; the defaults are the team game's shoulder camera (`zombiada-modo-livre.html`, `cameraUpdate`, line 76546): `back` 3.8 m, `side` 0.9 m to the right, `up` 1.95 m (`crouchUp` 1.4 m), `lift` 0.1 m, three probe rays (`probes` 0 and +-0.2 m) that pull the camera in `margin` 0.3 m short of a wall (never closer than `minDistance` 0.2 m) and let it out at `recover` 4 per second.
|
|
208
208
|
|
package/dist/index.d.ts
CHANGED
|
@@ -348,10 +348,13 @@ interface RoomAvatar {
|
|
|
348
348
|
*/
|
|
349
349
|
strike?(clipId: string, options?: {
|
|
350
350
|
leg?: 'left' | 'right';
|
|
351
|
+
hand?: 'left' | 'right';
|
|
351
352
|
}): number | null;
|
|
352
353
|
}
|
|
353
354
|
/** Which leg a kick uses: `alternate` swaps at each kick (right first). */
|
|
354
355
|
type KickLeg = 'alternate' | 'left' | 'right';
|
|
356
|
+
/** Which hand a punch uses: `alternate` swaps at each punch (right first). */
|
|
357
|
+
type PunchHand = 'alternate' | 'left' | 'right';
|
|
355
358
|
type CameraMode = 'first' | 'third';
|
|
356
359
|
/** Which clip a melee tool plays before its blow lands (`TestRoomOptions.strikeClips`). */
|
|
357
360
|
declare const DEFAULT_STRIKE_CLIPS: Readonly<Record<string, string>>;
|
|
@@ -457,6 +460,15 @@ interface SceneryObject {
|
|
|
457
460
|
* draws one plain mesh per part with `buildFromSpec`.
|
|
458
461
|
*/
|
|
459
462
|
build?: (THREE: ThreeNamespace) => THREE_NS.Object3D;
|
|
463
|
+
/**
|
|
464
|
+
* Lets the drawing follow the object in the destruction world, for what the room's destruction renderer cannot draw on it (a house wall redraws its
|
|
465
|
+
* courses without the bricks that shots knock out). Called once the object is in the world as `objectId`; the room calls `restore` when it resets the
|
|
466
|
+
* object and `dispose` when it removes it.
|
|
467
|
+
*/
|
|
468
|
+
follow?: (root: THREE_NS.Object3D, world: DestructionWorld, objectId: string) => {
|
|
469
|
+
restore?(): void;
|
|
470
|
+
dispose?(): void;
|
|
471
|
+
} | null | void;
|
|
460
472
|
/** Name shown in the inspector and the log (default the translated name of a default id, else the id). */
|
|
461
473
|
label?: string;
|
|
462
474
|
/**
|
|
@@ -471,6 +483,11 @@ interface SceneryObject {
|
|
|
471
483
|
* Where a water tap of the piece pours (a sink, a tub), in the spec's space: the room's tap (its stream and its HUD button) pours there, and the piece's own model is the tap. The first piece with a `spout` wins over the table tap.
|
|
472
484
|
*/
|
|
473
485
|
spout?: Vec3$1;
|
|
486
|
+
/**
|
|
487
|
+
* Stands free on the floor (a bookcase, a wardrobe), not fixed to the room: a blast, or shots whose push is enough to move its mass (a shotgun,
|
|
488
|
+
* not a pistol), make it a piece and shove it. Default false: the scenery stays put.
|
|
489
|
+
*/
|
|
490
|
+
free?: boolean;
|
|
474
491
|
}
|
|
475
492
|
/** What the room asks when something thrown or set down needs a model: the tool in the hand, the explosive it carries (an id of the arsenal) and how it is used. */
|
|
476
493
|
interface ProjectileQuery {
|
|
@@ -571,6 +588,10 @@ interface TestRoomOptions {
|
|
|
571
588
|
strikeClips?: Readonly<Record<string, string>>;
|
|
572
589
|
/** Which leg the kick uses: `alternate` (default) swaps at each kick starting with the right, or always `left` or `right`. */
|
|
573
590
|
kickLeg?: KickLeg;
|
|
591
|
+
/** Which hand throws the one-handed strikes (`punchTools`): `alternate` (default) swaps at each punch starting with the right, or always `left` or `right`. */
|
|
592
|
+
punchHand?: PunchHand;
|
|
593
|
+
/** The tools whose strike is thrown with one hand, so `punchHand` picks it (default `['hand', 'fists']`); the shove and the kick are not. */
|
|
594
|
+
punchTools?: readonly string[];
|
|
574
595
|
/** The first-person stance of the arms by tool id, for the tools that hold nothing the module places (default `{ fists: 'fists' }`; any other tool holds, or is `relaxed` with nothing to hold). */
|
|
575
596
|
handStances?: Readonly<Record<string, string>>;
|
|
576
597
|
/** The over-the-shoulder view of the `third` mode: distance, shoulder, height, wall probes. Defaults are the team game's. */
|
|
@@ -953,4 +974,4 @@ declare function encodeBenchState(controls: readonly BenchControl[], layers: rea
|
|
|
953
974
|
/** Reads an encoded state as hostile input: unknown ids, NaN, options not offered and malformed pairs are dropped; numbers are clamped. */
|
|
954
975
|
declare function decodeBenchState(encoded: string, controls: readonly ModuleControl[], layers: readonly ModuleLayer[]): Map<string, ControlValue>;
|
|
955
976
|
|
|
956
|
-
export { type AnimationInfo, type BenchControl, type BenchHandle, type BenchLayer, type BuildFromSpecOptions, type CameraMode, DEFAULT_HAND_STANCES, DEFAULT_STRIKE_CLIPS, DEFAULT_TRIALS, type HudState, type InspectInfo, type KickLeg, LOADING_CLASS, LOADING_CSS, type LoadingOptions, type LoadingState, type LogEntry, MATERIAL_COLORS, type ModuleReport, type NewEntry, type NewLogEntry, type ProjectileModel, type ProjectileQuery, type RoomAvatar, type RoomAvatarState, type RoomFirstPersonState, type RoomLoading, type RoomMetricId, type RoomStrings, type ScenarioContext, type ScenarioReport, type SceneryObject, type SceneryTap, type SpawnedObject, TRIAL_KINDS, type TestRoom, type TestRoomItem, type TestRoomLocale, type TestRoomLog, type TestRoomOptions, type TestRoomScenario, type TestTable, type TestTableContext, type TestTableObject, type TestTableOptions, type TestTablePage, type ThirdPersonOptions, type ThreeNamespace, type TrialKind, type TrialTool, type WritableLog, brickWallSpec, buildFromSpec, createLoading, createLog, createTestRoom, createTestTable, decodeBenchState, encodeBenchState, fitRow, loadingMarkup, locales, nextPaint, resolveStrings, rowCentres, trialView };
|
|
977
|
+
export { type AnimationInfo, type BenchControl, type BenchHandle, type BenchLayer, type BuildFromSpecOptions, type CameraMode, DEFAULT_HAND_STANCES, DEFAULT_STRIKE_CLIPS, DEFAULT_TRIALS, type HudState, type InspectInfo, type KickLeg, LOADING_CLASS, LOADING_CSS, type LoadingOptions, type LoadingState, type LogEntry, MATERIAL_COLORS, type ModuleReport, type NewEntry, type NewLogEntry, type ProjectileModel, type ProjectileQuery, type PunchHand, type RoomAvatar, type RoomAvatarState, type RoomFirstPersonState, type RoomLoading, type RoomMetricId, type RoomStrings, type ScenarioContext, type ScenarioReport, type SceneryObject, type SceneryTap, type SpawnedObject, TRIAL_KINDS, type TestRoom, type TestRoomItem, type TestRoomLocale, type TestRoomLog, type TestRoomOptions, type TestRoomScenario, type TestTable, type TestTableContext, type TestTableObject, type TestTableOptions, type TestTablePage, type ThirdPersonOptions, type ThreeNamespace, type TrialKind, type TrialTool, type WritableLog, brickWallSpec, buildFromSpec, createLoading, createLog, createTestRoom, createTestTable, decodeBenchState, encodeBenchState, fitRow, loadingMarkup, locales, nextPaint, resolveStrings, rowCentres, trialView };
|