@adatechnology/game-test-room 0.17.1 → 0.19.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 +8 -0
- package/dist/index.d.ts +127 -12
- package/dist/index.global.js +2587 -612
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1090 -199
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -130,6 +130,12 @@ Anything slow shows a spinner or a bar with a line of text over the room, so the
|
|
|
130
130
|
|
|
131
131
|
A module declares what is slow and the room does the rest: `ModuleControl.slow` (an action or a control that takes a third of a second or more) and `TestableItem.slow` (a vehicle) make the room's own panel and catalogue run the press or the spawn behind the indicator (`bench().act/set` and `spawn` stay synchronous for scenarios). A module with a job of its own (a house rebuilt after a seed change) calls `host.loading.busy(...)`. `LOADING_CSS` and `loadingMarkup` are the same card as static HTML, for a page that must show it before its scripts run (the default test room's first frame does).
|
|
132
132
|
|
|
133
|
+
## How long debris stays on screen
|
|
134
|
+
|
|
135
|
+
`debris: { fragmentLife, maxFragments, particles }` sets it for the whole room. `fragmentLife` is in seconds (default 12, `0` = forever) or a rule per fragment
|
|
136
|
+
(`(fragment, objectId) => seconds`, from its material, size and object). `maxFragments` is the live budget (default 160). `particles` tunes the sprites by kind, for
|
|
137
|
+
example `{ dust: { life: [10, 30] }, chips: { life: [60, 120] } }`. Loose pieces stay in the map with collision.
|
|
138
|
+
|
|
133
139
|
## Blasts shove what is around them
|
|
134
140
|
|
|
135
141
|
An `explosion` moves the loose items, the heavy furniture that is not fixed, and the bodies of the modules that answer it. One rule, `blastShove` of `@adatechnology/game-contracts`: `min(maxSpeed, sqrt(2 * energy * coupling / mass)) * (1 - d / r)^2` away from the centre with some lift, and nothing under `minSpeed`. The room's `blastShove` option sets the numbers (`coupling` 0.02, `maxSpeed` 20 m/s, `lift` 0.3, `minSpeed` 0.3, `falloffPower` 2) for the renderer's pieces and, as `host.blastShove`, for modules such as the characters area, which slide and knock their people down.
|
|
@@ -205,6 +211,8 @@ Every frame the room puts `root` at the player's feet turned to where the player
|
|
|
205
211
|
|
|
206
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.
|
|
207
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.
|
|
215
|
+
|
|
208
216
|
**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 **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 (`firstPerson: false` for no arms).
|
|
209
217
|
|
|
210
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.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,16 +2,41 @@ import * as THREE_NS from 'three';
|
|
|
2
2
|
import { AudioEngine } from '@adatechnology/game-audio';
|
|
3
3
|
import { Vec3 as Vec3$1, DestructionWorld, BlastOptions, DestructibleSpec, DestructionOptions, DestructionEvent } from '@adatechnology/game-destruction';
|
|
4
4
|
export { DestructionEvent, Vec3 } from '@adatechnology/game-destruction';
|
|
5
|
-
import { FurniturePushPhase, FurniturePushBlock, FurniturePushRules } from '@adatechnology/game-player';
|
|
6
|
-
import { BusySink, Vec3, HandTargets, ModuleControl, ControlValue, ModuleLayer, EnvironmentBus, BusyTask, BusyOptions, TestableModule, DestructibleImpl, AnimationClipSpec, GroundLayout, BlastShoveOptions } from '@adatechnology/game-contracts';
|
|
5
|
+
import { DoorUsePhase, FurniturePushPhase, FurniturePushBlock, FurniturePushRules, DoorUseRules } from '@adatechnology/game-player';
|
|
6
|
+
import { BusySink, ItemSeat, Vec3, HandTargets, ModuleControl, ControlValue, ModuleLayer, EnvironmentBus, BusyTask, BusyOptions, TestableModule, ModuleItemSeal, DestructibleImpl, AnimationClipSpec, GroundLayout, BlastShoveOptions } from '@adatechnology/game-contracts';
|
|
7
7
|
export { AnimationClipSpec, DestructibleImpl, ItemAnimationContract, ModuleScenario, TestableItem, TestableModule } from '@adatechnology/game-contracts';
|
|
8
|
-
import { DestructionRenderer, SpecFromObjectOptions, Quality } from '@adatechnology/game-destruction-three';
|
|
8
|
+
import { DestructionRenderer, SpecFromObjectOptions, Quality, FragmentLifeRule } from '@adatechnology/game-destruction-three';
|
|
9
9
|
import { Arsenal, WeaponState, WeaponDef } from '@adatechnology/game-weapons';
|
|
10
|
-
import { VfxWorld } from '@adatechnology/game-vfx';
|
|
10
|
+
import { VfxWorld, SpriteKindDef } from '@adatechnology/game-vfx';
|
|
11
11
|
import { Terrain, TerrainBudget } from '@adatechnology/game-terrain';
|
|
12
12
|
import { FilmBridge, FluidRenderer } from '@adatechnology/game-fluids-three';
|
|
13
13
|
import { FluidWorld, ContainerSpec, LiquidDef, ItemUseDef, SurfaceSpec } from '@adatechnology/game-fluids';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The room's side of opening and closing by hand: finds the leaf the eye rests on (a door, a lid, a drawer of furniture or of a vehicle: a part an `open_*` clip of the item moves),
|
|
17
|
+
* asks `createDoorUse` (game-player) how far it goes, tests the sweep of the leaf against what is around before each step and puts the hand on the handle.
|
|
18
|
+
* The leaf is posed along its item's own open clip, so the same opening the item's animation shows is the one the hand drives.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
type RoomDoorEventType = 'reach' | 'opened' | 'closed' | 'blocked' | 'locked' | 'stepped_back';
|
|
22
|
+
type RoomDoorEvent = {
|
|
23
|
+
readonly type: RoomDoorEventType;
|
|
24
|
+
readonly objectId: string;
|
|
25
|
+
readonly part: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
/** How open the leaf is, 0 to 1. */
|
|
28
|
+
readonly opening: number;
|
|
29
|
+
/** What stopped it (`blocked`): another object, the wall of the room, the player. */
|
|
30
|
+
readonly by?: string;
|
|
31
|
+
};
|
|
32
|
+
type RoomDoorState = {
|
|
33
|
+
readonly objectId: string;
|
|
34
|
+
readonly part: string;
|
|
35
|
+
readonly phase: DoorUsePhase;
|
|
36
|
+
readonly opening: number;
|
|
37
|
+
readonly goal: 0 | 1;
|
|
38
|
+
};
|
|
39
|
+
|
|
15
40
|
/**
|
|
16
41
|
* The room's side of pushing furniture: finds what the player leans on, asks `createFurniturePush` (game-player) how it goes, tests the volume of the piece before each
|
|
17
42
|
* step (the world, the walls of the arena, the blockers of the modules) and moves it with the player. The animations read `avatarState` and `handTargets`.
|
|
@@ -76,6 +101,20 @@ interface LoadingOptions {
|
|
|
76
101
|
declare const nextPaint: () => Promise<void>;
|
|
77
102
|
declare function createLoading(options: LoadingOptions): RoomLoading;
|
|
78
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The room's seats: puts the player on a seat an item brings (`TestRoomItem.seats`, the shape of a `game-interactables` seat) and back on its feet at the seat's exit.
|
|
106
|
+
* Seated, the keys do not walk and the view stays within reach of the seat's facing; a walk key or a jump gets up, and so does losing the seat (the item is gone).
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
/** The seat the player is on. */
|
|
110
|
+
type RoomSeat = {
|
|
111
|
+
readonly objectId: string;
|
|
112
|
+
readonly seatId: string;
|
|
113
|
+
readonly pose: ItemSeat['pose'];
|
|
114
|
+
/** Where the hips (sit) or the pelvis (lie) are, in the world. */
|
|
115
|
+
readonly hips: Vec3;
|
|
116
|
+
};
|
|
117
|
+
|
|
79
118
|
type NewEntry = NewLogEntry;
|
|
80
119
|
/** The log the room writes to (a `TestRoomLog` plus the write side). */
|
|
81
120
|
interface WritableLog extends TestRoomLog {
|
|
@@ -322,6 +361,8 @@ interface RoomAvatarItemUse {
|
|
|
322
361
|
readonly id: string;
|
|
323
362
|
readonly position: readonly [number, number, number];
|
|
324
363
|
readonly rotation: readonly [number, number, number];
|
|
364
|
+
/** How closed the other hand is when it works on the item (turning a cap off); the room brings it there with `reach`. */
|
|
365
|
+
readonly gripL?: number;
|
|
325
366
|
}
|
|
326
367
|
/** What the room tells the avatar every frame. */
|
|
327
368
|
interface RoomAvatarState {
|
|
@@ -344,6 +385,18 @@ interface RoomAvatarState {
|
|
|
344
385
|
readonly phase: 'grip' | 'push' | 'strain';
|
|
345
386
|
readonly progress: number;
|
|
346
387
|
} | null;
|
|
388
|
+
/** On a seat: the pose and how high the hips (or the pelvis) are above the feet. */
|
|
389
|
+
seat?: {
|
|
390
|
+
readonly pose: 'sit' | 'lie';
|
|
391
|
+
readonly hip: number;
|
|
392
|
+
} | null;
|
|
393
|
+
/** A hand on a door, lid or drawer: `reach` to the handle, `swing` with it (`pull` toward the body or pushed away), `release`, `rattle` on a locked one; `height` of the hand over the feet, metres. */
|
|
394
|
+
door?: {
|
|
395
|
+
readonly phase: 'reach' | 'swing' | 'release' | 'rattle';
|
|
396
|
+
readonly progress: number;
|
|
397
|
+
readonly height: number;
|
|
398
|
+
readonly pull: boolean;
|
|
399
|
+
} | null;
|
|
347
400
|
}
|
|
348
401
|
/** What the room tells the first-person arms every frame, after the modules have placed the tool in the hands. */
|
|
349
402
|
interface RoomFirstPersonState {
|
|
@@ -367,14 +420,15 @@ interface RoomAvatar {
|
|
|
367
420
|
update(dt: number, state: RoomAvatarState): void;
|
|
368
421
|
/** A socket at a hand: the carried item follows `hand('R')` in third person. */
|
|
369
422
|
hand?(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
423
|
+
/** The joint of a shoulder: in third person the room rests a long gun's stock in the pocket just inside the right one (`ModuleHost.holdFrame`). */
|
|
424
|
+
shoulder?(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
370
425
|
/**
|
|
371
|
-
*
|
|
372
|
-
*
|
|
426
|
+
* Where the body's eyes are after its pose (world space), sampled before `reach`: with it the room draws the body in both views, puts the first-person camera there (pulled back out of
|
|
427
|
+
* walls) and shoots, aims and reaches from there in both views. Without it the room keeps the player's own eye.
|
|
373
428
|
*/
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
};
|
|
429
|
+
eye?(out?: THREE_NS.Vector3): THREE_NS.Vector3;
|
|
430
|
+
/** Hides the head and neck from `camera` while the view is `first` (shadows, mirrors and other cameras keep seeing them). */
|
|
431
|
+
setView?(mode: CameraMode, camera: THREE_NS.Object3D | null): void;
|
|
378
432
|
/**
|
|
379
433
|
* Plays the strike `clipId` (on the body and on the arms) and answers the seconds until its impact, or null when this avatar has no such clip. The room then waits that long
|
|
380
434
|
* before the blow lands (`strikeClips`); an avatar without `strike`, or one that answers null, gets the blow at the click.
|
|
@@ -383,6 +437,18 @@ interface RoomAvatar {
|
|
|
383
437
|
leg?: 'left' | 'right';
|
|
384
438
|
hand?: 'left' | 'right';
|
|
385
439
|
}): number | null;
|
|
440
|
+
/**
|
|
441
|
+
* Brings the body's hands to the tool in them (`HandTargets`, world space: the module's). The room calls it in both views every frame, after the modules have placed the tool and
|
|
442
|
+
* before the render, with `view` (the eye's camera, and `contact` to keep the hands out of walls) in both views. An avatar without it keeps the hands where its own pose puts them.
|
|
443
|
+
*/
|
|
444
|
+
reach?(targets: HandTargets | null, view?: RoomReachView): void;
|
|
445
|
+
}
|
|
446
|
+
/** The first-person view the body's hands keep to: the camera, and the room's ray (`contact`) so a hand stops before a wall. */
|
|
447
|
+
interface RoomReachView {
|
|
448
|
+
camera: THREE_NS.Object3D;
|
|
449
|
+
keepOutside?: {
|
|
450
|
+
contact(origin: [number, number, number], direction: [number, number, number], maxDistance: number): number | null;
|
|
451
|
+
};
|
|
386
452
|
}
|
|
387
453
|
/** Which leg a kick uses: `alternate` swaps at each kick (right first). */
|
|
388
454
|
type KickLeg = 'alternate' | 'left' | 'right';
|
|
@@ -459,6 +525,8 @@ interface TestRoomItem {
|
|
|
459
525
|
specOptions?: SpecFromObjectOptions;
|
|
460
526
|
/** Can be grabbed and thrown (default: total mass <= `maxCarryKg`). Vehicles and trees are usually `false`. */
|
|
461
527
|
movable?: boolean;
|
|
528
|
+
/** A big piece that stands on the floor (a sofa, a wardrobe, a fridge) and can be pushed by leaning on it (`TestableItem.pushable`). Default false. */
|
|
529
|
+
pushable?: boolean;
|
|
462
530
|
/** Short note shown in the inspector. */
|
|
463
531
|
note?: string;
|
|
464
532
|
/** Building it takes a noticeable time (a vehicle): the catalogue shows the loading indicator while it spawns one. `true`, or the text to show. */
|
|
@@ -473,6 +541,11 @@ interface TestRoomItem {
|
|
|
473
541
|
uses?: string[];
|
|
474
542
|
offset?: Vec3$1;
|
|
475
543
|
};
|
|
544
|
+
/**
|
|
545
|
+
* The item is a sealed container (`ModuleItemSeal`): a use that empties it (`eat`, `drink`, `pour`) opens it first, by hand or with one of `openWith` (an item
|
|
546
|
+
* within reach or a weapon of the loadout), and refuses while it needs a tool there is not; a hole through it or a leak spoils it for eating and drinking.
|
|
547
|
+
*/
|
|
548
|
+
seal?: ModuleItemSeal;
|
|
476
549
|
/** The item is also a weapon the player can equip from the catalogue (e.g. a crowbar, a knife, a pistol on the table). */
|
|
477
550
|
weapon?: string;
|
|
478
551
|
/**
|
|
@@ -482,6 +555,8 @@ interface TestRoomItem {
|
|
|
482
555
|
impl?: (root: THREE_NS.Object3D, id: string) => DestructibleImpl;
|
|
483
556
|
/** Use animations the item brings (see `TestRoom.playAnimation`). Part poses move the child of the built object named after the part id. */
|
|
484
557
|
animations?: AnimationClipSpec[];
|
|
558
|
+
/** Where the player can sit or lie on it (see `TestRoom.sit`). */
|
|
559
|
+
seats?: readonly ItemSeat[];
|
|
485
560
|
/** Picture for the catalogue, the search results and the aimed-item label: an image URL or inline `<svg…>` markup (see `TestableItem.thumbnail`). */
|
|
486
561
|
thumbnail?: string;
|
|
487
562
|
/** Author and licence of the thumbnail, shown as the tooltip of the picture in the inspector. */
|
|
@@ -508,11 +583,12 @@ interface SceneryObject {
|
|
|
508
583
|
/**
|
|
509
584
|
* 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
|
|
510
585
|
* 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
|
|
511
|
-
* object and `dispose` when it removes it.
|
|
586
|
+
* object and `dispose` when it removes it. `update` (optional) is called every frame, after the renderer's: where the follower paints what it deferred.
|
|
512
587
|
*/
|
|
513
588
|
follow?: (root: THREE_NS.Object3D, world: DestructionWorld, objectId: string) => {
|
|
514
589
|
restore?(): void;
|
|
515
590
|
dispose?(): void;
|
|
591
|
+
update?(): void;
|
|
516
592
|
} | null | void;
|
|
517
593
|
/** Name shown in the inspector and the log (default the translated name of a default id, else the id). */
|
|
518
594
|
label?: string;
|
|
@@ -534,6 +610,8 @@ interface SceneryObject {
|
|
|
534
610
|
* not a pistol), make it a piece and shove it. Default false: the scenery stays put.
|
|
535
611
|
*/
|
|
536
612
|
free?: boolean;
|
|
613
|
+
/** Can also be pushed by leaning on it (needs `free`). Default false. */
|
|
614
|
+
pushable?: boolean;
|
|
537
615
|
}
|
|
538
616
|
/** 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. */
|
|
539
617
|
interface ProjectileQuery {
|
|
@@ -636,6 +714,8 @@ interface TestRoomOptions {
|
|
|
636
714
|
strikeClips?: Readonly<Record<string, string>>;
|
|
637
715
|
/** The numbers of pushing furniture (`FurniturePushRules` of game-player): the player's force, the friction by material, the hold time, the speed. */
|
|
638
716
|
push?: Partial<FurniturePushRules>;
|
|
717
|
+
/** The numbers of opening by hand (`DoorUseRules` of game-player): how long the hand takes to the handle, how fast a leaf of each mass swings. */
|
|
718
|
+
doors?: Partial<DoorUseRules>;
|
|
639
719
|
/** Which leg the kick uses: `alternate` (default) swaps at each kick starting with the right, or always `left` or `right`. */
|
|
640
720
|
kickLeg?: KickLeg;
|
|
641
721
|
/** Metres above the feet the kick looks for a target from (level, the way the player faces; the nearest hit wins), so it finds what stands low in front; default every 10 cm from 0.25 to 0.85 m (shin to hip). */
|
|
@@ -661,6 +741,19 @@ interface TestRoomOptions {
|
|
|
661
741
|
thirdPerson?: ThirdPersonOptions;
|
|
662
742
|
/** Room counters the bench panel shows and `TestRoom.metrics()` returns (default all); `false` for none. */
|
|
663
743
|
metrics?: readonly RoomMetricId[] | false;
|
|
744
|
+
/**
|
|
745
|
+
* How long what breaks off stays on screen. `fragmentLife`: seconds a resting fragment (a chip, a shard, a chunk) stays before it fades, 0 = forever, or a rule per
|
|
746
|
+
* fragment from its material, size and object (default 12 s); `maxFragments`: how many live at once, the oldest fades first (default 160). `particles` tunes the
|
|
747
|
+
* sprites (dust, smoke, chips, sparks...) by kind, e.g. `{ dust: { life: [10, 30] } }` (seconds, min and max). Loose pieces (what breaks off whole: a door, a leg,
|
|
748
|
+
* a slab) stay as part of the map, with collision.
|
|
749
|
+
*/
|
|
750
|
+
debris?: {
|
|
751
|
+
fragmentLife?: number | FragmentLifeRule;
|
|
752
|
+
maxFragments?: number;
|
|
753
|
+
particles?: Readonly<Record<string, Partial<SpriteKindDef> | null>>;
|
|
754
|
+
/** Milliseconds of destruction events the renderer applies per frame; the rest wait for the next frames (default 8). `Infinity` applies every event in the frame it happens, which a test comparing counts needs. */
|
|
755
|
+
eventBudgetMs?: number;
|
|
756
|
+
};
|
|
664
757
|
/** Blast options every explosion of the room starts with (`shelter`, `fragmentHits`, `confinement`; default all off). The HUD toggles them and `TestRoom.setBlast` changes them. */
|
|
665
758
|
blast?: BlastOptions;
|
|
666
759
|
/**
|
|
@@ -748,6 +841,15 @@ interface TestRoom {
|
|
|
748
841
|
readonly playerPosition: Vec3$1;
|
|
749
842
|
/** Grab what the camera looks at (or drop what is held). */
|
|
750
843
|
grab(): boolean;
|
|
844
|
+
/**
|
|
845
|
+
* Sits the player on a seat an item brings (`TestRoomItem.seats`): on `objectId` (default: what the camera looks at, within 3.2 m), on `seatId` (default: the seat nearest the
|
|
846
|
+
* player). Seated, the keys do not walk and the view stays near the seat's facing; a walk key or a jump gets up. Null when there is no seat there.
|
|
847
|
+
*/
|
|
848
|
+
sit(objectId?: string, seatId?: string): RoomSeat | null;
|
|
849
|
+
/** Gets up at the seat's exit; false when not seated or something stands on the exit. */
|
|
850
|
+
stand(): boolean;
|
|
851
|
+
/** The seat the player is on, or null. */
|
|
852
|
+
readonly seat: RoomSeat | null;
|
|
751
853
|
/**
|
|
752
854
|
* Pushing furniture, as holding E against it does: `begin` leans on what the camera looks at (false: nothing within reach to lean on), `setWalk` walks by script (world `[x, z]`, unit; null: the keys), `end`
|
|
753
855
|
* lets go, and `state` says the phase (`grip` while the hold timer fills, `push`, `strain`), the timer and what stops it (`too_heavy`, `obstacle`).
|
|
@@ -851,6 +953,19 @@ interface TestRoom {
|
|
|
851
953
|
* offsets from the rest pose, interpolated linearly; the item keeps the last pose. Events are logged (and `sound` events reach `onSound`).
|
|
852
954
|
*/
|
|
853
955
|
playAnimation(clipId: string, objectId?: string): boolean;
|
|
956
|
+
/**
|
|
957
|
+
* Opens or closes a leaf (a door, a lid, a drawer: a part an `open_*` clip of the item moves) as the hand does with E: the hand goes to the handle, the leaf swings at the speed of
|
|
958
|
+
* its mass and stops at what is in its way; a locked leaf only rattles. Default part: the first leaf of the object. Answers false when the object has no such leaf.
|
|
959
|
+
*/
|
|
960
|
+
useLeaf(objectId: string, part?: string): boolean;
|
|
961
|
+
/** How open a leaf is, 0 closed to 1 open (default part: the first leaf). */
|
|
962
|
+
leafOpening(objectId: string, part?: string): number;
|
|
963
|
+
/** The parts of an object that open by hand. */
|
|
964
|
+
leaves(objectId: string): string[];
|
|
965
|
+
/** Locks (or unlocks) a leaf, or every leaf of the object when `part` is left out: E then only rattles it. */
|
|
966
|
+
lockLeaf(objectId: string, locked?: boolean, part?: string): void;
|
|
967
|
+
/** The leaf being worked by hand now, or null. */
|
|
968
|
+
readonly door: RoomDoorState | null;
|
|
854
969
|
/** The bench of a loaded module (default the active one: the module of the last `openArea`, else the last loaded with a bench), or null. */
|
|
855
970
|
bench(moduleId?: string): BenchHandle | null;
|
|
856
971
|
/**
|
|
@@ -1057,4 +1172,4 @@ declare function encodeBenchState(controls: readonly BenchControl[], layers: rea
|
|
|
1057
1172
|
/** Reads an encoded state as hostile input: unknown ids, NaN, options not offered and malformed pairs are dropped; numbers are clamped. */
|
|
1058
1173
|
declare function decodeBenchState(encoded: string, controls: readonly ModuleControl[], layers: readonly ModuleLayer[]): Map<string, ControlValue>;
|
|
1059
1174
|
|
|
1060
|
-
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 RoomPushEvent, type RoomPushState, type RoomStrings, type ScenarioContext, type ScenarioReport, type SceneryObject, type SceneryTap, type SpawnedObject, type StrikeComboOption, 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 };
|
|
1175
|
+
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 RoomDoorEvent, type RoomDoorState, type RoomFirstPersonState, type RoomLoading, type RoomMetricId, type RoomPushEvent, type RoomPushState, type RoomReachView, type RoomSeat, type RoomStrings, type ScenarioContext, type ScenarioReport, type SceneryObject, type SceneryTap, type SpawnedObject, type StrikeComboOption, 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 };
|