@adatechnology/game-test-room 0.19.0 → 0.20.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 +2 -2
- package/dist/index.d.ts +16 -1
- package/dist/index.global.js +743 -134
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +78 -9
- package/dist/index.js.map +1 -1
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -211,9 +211,9 @@ Every frame the room puts `root` at the player's feet turned to where the player
|
|
|
211
211
|
|
|
212
212
|
**Pushing furniture.** Against a piece that stands on the floor, with bare hands, a tap on E grabs as ever and holding E fills a ring around the crosshair (longer the heavier). Then W pushes, S pulls, slower with the mass; letting go ends it. Before each step the volume of the piece is swept (`world.sweepBox`) against everything and the arena: at an obstacle the piece and the player stop and the player strains, and a piece too heavy for the player (`RoomOptions.push`, `FurniturePushRules` of game-player) never moves. A piece lower than a table is pushed from above, bent over it. Scripted: `room.push`. Try it: `?scene=push` in the example.
|
|
213
213
|
|
|
214
|
-
**Opening by hand.** A tap of E on a leaf (a part an `open_*` clip of the item moves: furniture doors, drawers and lids, vehicle doors, hood and trunk) opens it, and E again closes it; looking into what an open leaf opened, E closes that leaf. The player steps up to the handle, the hand goes to the free edge of the leaf (a drawer by its front) and follows it, pulling (the arm bends, the body leans back) or pushing; a door that swings into the player makes the player step back. The leaf swings along the item's own clip at a speed set by its mass, its sweep tested against the world (`world.sweepBox`) and the arena: it stops at what is in its way with a knock. A locked leaf (`room.lockLeaf`) only rattles. Latch, hinge creak, the leaf meeting the frame and the rattle play by material. Holding E still pushes the piece. Scripted: `room.useLeaf`, `room.leafOpening`, `room.leaves`, `room.door`; the numbers are `RoomOptions.doors` (`DoorUseRules` of game-player). A module that moves its own leaves (the doors of a house) asks for the same hand and body with `host.reachFor`. Try it: `?scene=doors` in the example.
|
|
214
|
+
**Opening by hand.** A tap of E on a leaf (a part an `open_*` clip of the item moves: furniture doors, drawers and lids, vehicle doors, hood and trunk) opens it, and E again closes it; looking into what an open leaf opened, E closes that leaf. The player steps up to the handle, the body's hand goes to the free edge of the leaf (a drawer by its front) through the same `reach` as a held tool, in both views, and follows it, pulling (the arm bends, the body leans back) or pushing; a door that swings into the player makes the player step back. The leaf swings along the item's own clip at a speed set by its mass, its sweep tested against the world (`world.sweepBox`) and the arena: it stops at what is in its way with a knock. A locked leaf (`room.lockLeaf`) only rattles. Latch, hinge creak, the leaf meeting the frame and the rattle play by material. Holding E still pushes the piece. Scripted: `room.useLeaf`, `room.leafOpening`, `room.leaves`, `room.door`; the numbers are `RoomOptions.doors` (`DoorUseRules` of game-player). A module that moves its own leaves (the doors of a house) asks for the same hand and body with `host.reachFor`. Try it: `?scene=doors` in the example.
|
|
215
215
|
|
|
216
|
-
**
|
|
216
|
+
**Hands and strikes.** The body is the only set of arms, in both views: the room hands its hands where the tool in them asks them to be (`reach`, every frame after the modules' frame hooks) and an avatar may answer `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 body (in both views) 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 **strike combo** is an ability the page gives (`strikeCombo`, such as `PUNCH_COMBO` of `game-characters-people`: jab, cross, hook, uppercut): while it is on (N, its button, `setStrikeCombo(true)`, `strikeComboOn`) each blow of its tools plays its next step (`{ clip, hand }`) and a pause longer than its `reset` starts it over; off, the tools strike as usual. The strike line carries `combo` and `step`. 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 .
|
|
217
217
|
|
|
218
218
|
`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.
|
|
219
219
|
|
package/dist/index.d.ts
CHANGED
|
@@ -308,6 +308,21 @@ interface InspectInfo {
|
|
|
308
308
|
/** Author and licence of the thumbnail (`TestRoomItem.thumbnailCredit`). */
|
|
309
309
|
thumbnailCredit?: string;
|
|
310
310
|
distance: number;
|
|
311
|
+
/** Set when the aim rests on the floor: what the ground is there (the room's terrain) instead of an object's part. */
|
|
312
|
+
ground?: GroundInspect;
|
|
313
|
+
}
|
|
314
|
+
/** The floor under the aim: its profile, the layer a blow reaches now and what has been done to it. */
|
|
315
|
+
interface GroundInspect {
|
|
316
|
+
/** Name of the ground profile (Dirt, Concrete slab). */
|
|
317
|
+
surface: string;
|
|
318
|
+
/** Name of the material exposed at that point (the turf, or the soil under it once dug). */
|
|
319
|
+
material: string;
|
|
320
|
+
/** Metres dug out under the untouched surface. */
|
|
321
|
+
dug: number;
|
|
322
|
+
/** Metres left before the digging limit (bedrock, or the bottom of a slab). */
|
|
323
|
+
remaining: number;
|
|
324
|
+
/** 0..1, how burnt the surface is. */
|
|
325
|
+
scorch: number;
|
|
311
326
|
}
|
|
312
327
|
interface HudState {
|
|
313
328
|
toolName: string;
|
|
@@ -430,7 +445,7 @@ interface RoomAvatar {
|
|
|
430
445
|
/** Hides the head and neck from `camera` while the view is `first` (shadows, mirrors and other cameras keep seeing them). */
|
|
431
446
|
setView?(mode: CameraMode, camera: THREE_NS.Object3D | null): void;
|
|
432
447
|
/**
|
|
433
|
-
* Plays the strike `clipId` (on the body
|
|
448
|
+
* Plays the strike `clipId` (on the body, in both views) and answers the seconds until its impact, or null when this avatar has no such clip. The room then waits that long
|
|
434
449
|
* before the blow lands (`strikeClips`); an avatar without `strike`, or one that answers null, gets the blow at the click.
|
|
435
450
|
*/
|
|
436
451
|
strike?(clipId: string, options?: {
|