@adatechnology/game-player 0.6.3 → 0.7.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 +24 -1
- package/dist/chunk-HYJIZT2V.js +52 -0
- package/dist/chunk-HYJIZT2V.js.map +1 -0
- package/dist/{chunk-RUFQCNZH.js → chunk-TFDLGOOE.js} +20 -53
- package/dist/chunk-TFDLGOOE.js.map +1 -0
- package/dist/hud.d.ts +127 -0
- package/dist/hud.js +370 -0
- package/dist/hud.js.map +1 -0
- package/dist/index.d.ts +23 -6
- package/dist/index.global.js +115 -38
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +65 -37
- package/dist/index.js.map +1 -1
- package/dist/{testing-CD4p4NR5.d.ts → player-BRl5ea2y.d.ts} +15 -20
- package/dist/testing.d.ts +22 -2
- package/dist/testing.js +2 -1
- package/package.json +8 -3
- package/dist/chunk-RUFQCNZH.js.map +0 -1
package/README.md
CHANGED
|
@@ -50,6 +50,29 @@ player.grab(agentIndex) // 3 s to break free
|
|
|
50
50
|
player.knock(1.5)
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
## HUD and death screen (`./hud`)
|
|
54
|
+
|
|
55
|
+
`@adatechnology/game-player/hud` is the body's screen, in DOM and with no three.js, laid over the game's view: the health and stamina bars with the
|
|
56
|
+
bleeding, the infection stage and the wounds under them (bottom left), the weapon in the hand and its rounds (bottom right, only when the hand holds
|
|
57
|
+
one), a name at the top left, the body's `message` events at the top centre and the crosshair in the first person. Nothing in it takes the mouse.
|
|
58
|
+
The death screen opens once the body has been dead `delaySeconds` (1.5 s: the death camera settles first), frees the pointer lock and shows the
|
|
59
|
+
cause, the time survived and two buttons: restart the scene (also Enter or R) and back to the start. Each hook fires once until the body lives
|
|
60
|
+
again. The words are `pt-BR` (default) and `en`.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { createDeathScreen, createPlayerHud, playerHudViewOf } from '@adatechnology/game-player/hud'
|
|
64
|
+
|
|
65
|
+
const hud = createPlayerHud({ container, locale: 'pt-BR', title: 'Level 1' })
|
|
66
|
+
const death = createDeathScreen({ container, onRestart: rebuildFromSeed, onBackToStart: () => player.load(startSave) })
|
|
67
|
+
player.on('message', ({ id, seconds }) => hud.message(playerTextOf(id), seconds))
|
|
68
|
+
|
|
69
|
+
// every frame
|
|
70
|
+
hud.update(playerHudViewOf(player))
|
|
71
|
+
hud.setView(camera.isFirstPerson() ? 'first' : 'third')
|
|
72
|
+
hud.setWeapon(gun ? { name: gun.name, ammo: `${gun.mag} / ${gun.reserve}` } : null)
|
|
73
|
+
death.update({ alive: player.state.alive, deathTime: player.state.deathTime, cause: player.state.cause, survivedSeconds })
|
|
74
|
+
```
|
|
75
|
+
|
|
53
76
|
## Test area
|
|
54
77
|
|
|
55
78
|
`createPlayerTestModule()` (`player_area`, only the generic contracts) makes the room's camera the player body and puts the vitals on the bench;
|
|
@@ -63,4 +86,4 @@ The walk with the piece speeds up and brakes like a person's (`accel`: the force
|
|
|
63
86
|
|
|
64
87
|
## Opening doors by hand
|
|
65
88
|
|
|
66
|
-
`createDoorUse(rules?)` is the logic of working a door, lid or drawer by hand: `begin({ opening, massKg, locked })` answers where the leaf goes (1 open, 0 closed; a second `begin` in the middle of a swing turns it round) or null for a locked leaf, which only rattles. `step(dt, isFree)` then goes through `reach` (the hand to the handle), `swing` (the leaf follows the hand, a little at a time so it stops at the first thing in its way, `block: 'obstacle'`) and `release`. A heavier leaf swings slower (`swingSecondsFor`); every number is in `DoorUseRules` (`DOOR_USE_DEFAULTS`).
|
|
89
|
+
`createDoorUse(rules?)` is the logic of working a door, lid or drawer by hand: `begin({ opening, massKg, locked })` answers where the leaf goes (1 open, 0 closed; a second `begin` in the middle of a swing turns it round) or null for a locked leaf, which only rattles. `step(dt, isFree, hand?)` then goes through `reach` (the hand to the handle), `swing` (the leaf follows the hand, a little at a time so it stops at the first thing in its way, `block: 'obstacle'`) and `release`. The player does not follow the leaf: when `hand.reaches()` says the handle left the arm (`DOOR_ARM_REACH` from the shoulder), a leaf that goes away gets a shove (`push`, `hand.pull` false) and one that comes toward the body is let go (`release`), and the leaf finishes on its own to its goal. A heavier leaf swings slower (`swingSecondsFor`); every number is in `DoorUseRules` (`DOOR_USE_DEFAULTS`).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/locales/index.ts
|
|
2
|
+
var PT_BR = {
|
|
3
|
+
grabbed: "AGARRADO! Aperte E v\xE1rias vezes para empurrar ou F para a faca",
|
|
4
|
+
grabbed_drown: "O AFOGADO TE PUXA PARA O FUNDO! E v\xE1rias vezes ou F para a faca",
|
|
5
|
+
bitten: "Voc\xEA foi mordido. N\xE3o h\xE1 cura.",
|
|
6
|
+
bandaged: "Curativo feito",
|
|
7
|
+
knife_head: "Faca na cabe\xE7a!",
|
|
8
|
+
knife_miss: "Errou a facada",
|
|
9
|
+
pushed_off: "Empurrou!",
|
|
10
|
+
drowning: "Afogando! Solte-se!",
|
|
11
|
+
no_jaw: "Sem mand\xEDbula: s\xF3 arranhou",
|
|
12
|
+
stood_up: "De p\xE9!",
|
|
13
|
+
infected: "Morreu infectado",
|
|
14
|
+
killed: "Morto pela horda",
|
|
15
|
+
bitten_to_death: "Mordido",
|
|
16
|
+
infection: "A infec\xE7\xE3o venceu",
|
|
17
|
+
bled_out: "Sangrou at\xE9 a morte",
|
|
18
|
+
hunger_thirst: "Fome e sede",
|
|
19
|
+
drowned: "Afogado",
|
|
20
|
+
burned: "Queimado"
|
|
21
|
+
};
|
|
22
|
+
var EN = {
|
|
23
|
+
grabbed: "GRABBED! Press E repeatedly to push or F for the knife",
|
|
24
|
+
grabbed_drown: "THE DROWNED PULLS YOU UNDER! E repeatedly or F for the knife",
|
|
25
|
+
bitten: "You were bitten. There is no cure.",
|
|
26
|
+
bandaged: "Wound dressed",
|
|
27
|
+
knife_head: "Knife to the head!",
|
|
28
|
+
knife_miss: "The stab missed",
|
|
29
|
+
pushed_off: "Pushed off!",
|
|
30
|
+
drowning: "Drowning! Break free!",
|
|
31
|
+
no_jaw: "No jaw: only a scratch",
|
|
32
|
+
stood_up: "Back on your feet!",
|
|
33
|
+
infected: "Died infected",
|
|
34
|
+
killed: "Killed by the horde",
|
|
35
|
+
bitten_to_death: "Bitten",
|
|
36
|
+
infection: "The infection won",
|
|
37
|
+
bled_out: "Bled to death",
|
|
38
|
+
hunger_thirst: "Hunger and thirst",
|
|
39
|
+
drowned: "Drowned",
|
|
40
|
+
burned: "Burned"
|
|
41
|
+
};
|
|
42
|
+
var PLAYER_TEXT = { en: EN, "pt-BR": PT_BR };
|
|
43
|
+
var playerTextOf = (id, locale = "pt-BR") => {
|
|
44
|
+
const table = locale.toLowerCase().startsWith("en") ? EN : PT_BR;
|
|
45
|
+
return table[id] ?? id;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
PLAYER_TEXT,
|
|
50
|
+
playerTextOf
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=chunk-HYJIZT2V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/locales/index.ts"],"sourcesContent":["import type { KnownDeathCause, PlayerMessageId } from '../types'\n\nexport type PlayerText = Readonly<Record<PlayerMessageId | KnownDeathCause, string>>\n\n/** The game's own words (G 68434, 68452, 68518, 68525-68541, 68547) and the death causes it shows (G 68448, 68454, 68510, 68519, 68539). */\nconst PT_BR: PlayerText = {\n grabbed: 'AGARRADO! Aperte E várias vezes para empurrar ou F para a faca',\n grabbed_drown: 'O AFOGADO TE PUXA PARA O FUNDO! E várias vezes ou F para a faca',\n bitten: 'Você foi mordido. Não há cura.',\n bandaged: 'Curativo feito',\n knife_head: 'Faca na cabeça!',\n knife_miss: 'Errou a facada',\n pushed_off: 'Empurrou!',\n drowning: 'Afogando! Solte-se!',\n no_jaw: 'Sem mandíbula: só arranhou',\n stood_up: 'De pé!',\n infected: 'Morreu infectado',\n killed: 'Morto pela horda',\n bitten_to_death: 'Mordido',\n infection: 'A infecção venceu',\n bled_out: 'Sangrou até a morte',\n hunger_thirst: 'Fome e sede',\n drowned: 'Afogado',\n burned: 'Queimado',\n}\n\nconst EN: PlayerText = {\n grabbed: 'GRABBED! Press E repeatedly to push or F for the knife',\n grabbed_drown: 'THE DROWNED PULLS YOU UNDER! E repeatedly or F for the knife',\n bitten: 'You were bitten. There is no cure.',\n bandaged: 'Wound dressed',\n knife_head: 'Knife to the head!',\n knife_miss: 'The stab missed',\n pushed_off: 'Pushed off!',\n drowning: 'Drowning! Break free!',\n no_jaw: 'No jaw: only a scratch',\n stood_up: 'Back on your feet!',\n infected: 'Died infected',\n killed: 'Killed by the horde',\n bitten_to_death: 'Bitten',\n infection: 'The infection won',\n bled_out: 'Bled to death',\n hunger_thirst: 'Hunger and thirst',\n drowned: 'Drowned',\n burned: 'Burned',\n}\n\nexport const PLAYER_TEXT: Readonly<Record<'en' | 'pt-BR', PlayerText>> = { en: EN, 'pt-BR': PT_BR }\n\n/** The text of a message or death cause id in a locale (`pt-BR` or `en`, the language part is enough); unknown ids come back as they are. */\nexport const playerTextOf = (id: string, locale = 'pt-BR'): string => {\n const table = locale.toLowerCase().startsWith('en') ? EN : PT_BR\n return (table as Readonly<Record<string, string>>)[id] ?? id\n}\n"],"mappings":";AAKA,IAAM,QAAoB;AAAA,EACxB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AAAA,EACf,SAAS;AAAA,EACT,QAAQ;AACV;AAEA,IAAM,KAAiB;AAAA,EACrB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AAAA,EACf,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,IAAM,cAA4D,EAAE,IAAI,IAAI,SAAS,MAAM;AAG3F,IAAM,eAAe,CAAC,IAAY,SAAS,YAAoB;AACpE,QAAM,QAAQ,OAAO,YAAY,EAAE,WAAW,IAAI,IAAI,KAAK;AAC3D,SAAQ,MAA2C,EAAE,KAAK;AAC5D;","names":[]}
|
|
@@ -1,49 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
grabbed_drown: "O AFOGADO TE PUXA PARA O FUNDO! E v\xE1rias vezes ou F para a faca",
|
|
5
|
-
bitten: "Voc\xEA foi mordido. N\xE3o h\xE1 cura.",
|
|
6
|
-
bandaged: "Curativo feito",
|
|
7
|
-
knife_head: "Faca na cabe\xE7a!",
|
|
8
|
-
knife_miss: "Errou a facada",
|
|
9
|
-
pushed_off: "Empurrou!",
|
|
10
|
-
drowning: "Afogando! Solte-se!",
|
|
11
|
-
no_jaw: "Sem mand\xEDbula: s\xF3 arranhou",
|
|
12
|
-
stood_up: "De p\xE9!",
|
|
13
|
-
infected: "Morreu infectado",
|
|
14
|
-
killed: "Morto pela horda",
|
|
15
|
-
bitten_to_death: "Mordido",
|
|
16
|
-
infection: "A infec\xE7\xE3o venceu",
|
|
17
|
-
bled_out: "Sangrou at\xE9 a morte",
|
|
18
|
-
hunger_thirst: "Fome e sede",
|
|
19
|
-
drowned: "Afogado",
|
|
20
|
-
burned: "Queimado"
|
|
21
|
-
};
|
|
22
|
-
var EN = {
|
|
23
|
-
grabbed: "GRABBED! Press E repeatedly to push or F for the knife",
|
|
24
|
-
grabbed_drown: "THE DROWNED PULLS YOU UNDER! E repeatedly or F for the knife",
|
|
25
|
-
bitten: "You were bitten. There is no cure.",
|
|
26
|
-
bandaged: "Wound dressed",
|
|
27
|
-
knife_head: "Knife to the head!",
|
|
28
|
-
knife_miss: "The stab missed",
|
|
29
|
-
pushed_off: "Pushed off!",
|
|
30
|
-
drowning: "Drowning! Break free!",
|
|
31
|
-
no_jaw: "No jaw: only a scratch",
|
|
32
|
-
stood_up: "Back on your feet!",
|
|
33
|
-
infected: "Died infected",
|
|
34
|
-
killed: "Killed by the horde",
|
|
35
|
-
bitten_to_death: "Bitten",
|
|
36
|
-
infection: "The infection won",
|
|
37
|
-
bled_out: "Bled to death",
|
|
38
|
-
hunger_thirst: "Hunger and thirst",
|
|
39
|
-
drowned: "Drowned",
|
|
40
|
-
burned: "Burned"
|
|
41
|
-
};
|
|
42
|
-
var PLAYER_TEXT = { en: EN, "pt-BR": PT_BR };
|
|
43
|
-
var playerTextOf = (id, locale = "pt-BR") => {
|
|
44
|
-
const table = locale.toLowerCase().startsWith("en") ? EN : PT_BR;
|
|
45
|
-
return table[id] ?? id;
|
|
46
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
playerTextOf
|
|
3
|
+
} from "./chunk-HYJIZT2V.js";
|
|
47
4
|
|
|
48
5
|
// src/player.ts
|
|
49
6
|
import { SWING_LEAD_SECONDS, footstepSoundId, hitSoundId, landSoundId, surfaceOfMaterial, swingSoundId } from "@adatechnology/game-contracts";
|
|
@@ -133,6 +90,8 @@ var defaults_default = {
|
|
|
133
90
|
regenMoving: 4,
|
|
134
91
|
regenStill: 8,
|
|
135
92
|
acceleration: 10,
|
|
93
|
+
heightMetres: 1.8,
|
|
94
|
+
crouchHeightRatio: 0.65,
|
|
136
95
|
radius: 0.3,
|
|
137
96
|
blockHeight: 0.4,
|
|
138
97
|
pushApartRadius: 0.55,
|
|
@@ -262,6 +221,11 @@ function createPlayer(options = {}) {
|
|
|
262
221
|
const formulas = { ...PLAYER_DEFAULTS.derived, ...options.derived };
|
|
263
222
|
const derived = deriveVitals(attributes, formulas);
|
|
264
223
|
const numbers = { ...PLAYER_DEFAULTS.numbers, ...options.numbers };
|
|
224
|
+
const heightMetres = options.heightMetres ?? numbers.heightMetres;
|
|
225
|
+
if (!Number.isFinite(heightMetres) || heightMetres < 0.8 || heightMetres > 3) {
|
|
226
|
+
throw new RangeError(`Player height ${String(heightMetres)} m is outside supported range [0.8, 3.0] m.`);
|
|
227
|
+
}
|
|
228
|
+
const heightScale = heightMetres / numbers.heightMetres;
|
|
265
229
|
const wounds = options.wounds ?? PLAYER_DEFAULTS.wounds;
|
|
266
230
|
const infection = options.infection === void 0 || options.infection === false ? null : options.infection === true ? PLAYER_DEFAULTS.infection : { ...PLAYER_DEFAULTS.infection, ...options.infection };
|
|
267
231
|
const fist = options.fist ?? PLAYER_DEFAULTS.fist;
|
|
@@ -554,7 +518,7 @@ function createPlayer(options = {}) {
|
|
|
554
518
|
const tvz = want ? mz / ml * sp : 0;
|
|
555
519
|
P.vx = lerp(P.vx, tvx, Math.min(1, dt * numbers.acceleration));
|
|
556
520
|
P.vz = lerp(P.vz, tvz, Math.min(1, dt * numbers.acceleration));
|
|
557
|
-
const r = numbers.radius;
|
|
521
|
+
const r = numbers.radius * heightScale;
|
|
558
522
|
const nx = P.x + P.vx * dt;
|
|
559
523
|
const nz = P.z + P.vz * dt;
|
|
560
524
|
if (!blocked(nx + Math.sign(P.vx) * r, P.z)) P.x = nx;
|
|
@@ -626,6 +590,11 @@ function createPlayer(options = {}) {
|
|
|
626
590
|
get state() {
|
|
627
591
|
return P;
|
|
628
592
|
},
|
|
593
|
+
heightMetres,
|
|
594
|
+
collider: () => ({
|
|
595
|
+
heightMetres: P.crouch ? heightMetres * numbers.crouchHeightRatio : heightMetres,
|
|
596
|
+
radiusMetres: numbers.radius * heightScale
|
|
597
|
+
}),
|
|
629
598
|
attributes,
|
|
630
599
|
derived,
|
|
631
600
|
numbers,
|
|
@@ -670,7 +639,7 @@ function createPlayer(options = {}) {
|
|
|
670
639
|
}
|
|
671
640
|
|
|
672
641
|
// src/bench/locale.ts
|
|
673
|
-
var
|
|
642
|
+
var EN = {
|
|
674
643
|
group: "Player",
|
|
675
644
|
name: "Player area",
|
|
676
645
|
controls: {
|
|
@@ -722,7 +691,7 @@ var EN2 = {
|
|
|
722
691
|
yes: "yes",
|
|
723
692
|
no: "no"
|
|
724
693
|
};
|
|
725
|
-
var
|
|
694
|
+
var PT_BR = {
|
|
726
695
|
group: "Jogador",
|
|
727
696
|
name: "\xC1rea do jogador",
|
|
728
697
|
controls: {
|
|
@@ -774,7 +743,7 @@ var PT_BR2 = {
|
|
|
774
743
|
yes: "sim",
|
|
775
744
|
no: "n\xE3o"
|
|
776
745
|
};
|
|
777
|
-
var playerBenchTextOf = (locale) => locale.toLowerCase().startsWith("en") ?
|
|
746
|
+
var playerBenchTextOf = (locale) => locale.toLowerCase().startsWith("en") ? EN : PT_BR;
|
|
778
747
|
|
|
779
748
|
// src/bench/module.ts
|
|
780
749
|
var MOVING_SPEED = 0.2;
|
|
@@ -1061,8 +1030,6 @@ export {
|
|
|
1061
1030
|
deriveVitals,
|
|
1062
1031
|
drawWound,
|
|
1063
1032
|
createPlayer,
|
|
1064
|
-
PLAYER_TEXT,
|
|
1065
|
-
playerTextOf,
|
|
1066
1033
|
createPlayerTestModule
|
|
1067
1034
|
};
|
|
1068
|
-
//# sourceMappingURL=chunk-
|
|
1035
|
+
//# sourceMappingURL=chunk-TFDLGOOE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/player.ts","../src/data/defaults.json","../src/rng.ts","../src/bench/locale.ts","../src/bench/module.ts"],"sourcesContent":["import { SWING_LEAD_SECONDS, footstepSoundId, hitSoundId, landSoundId, surfaceOfMaterial, swingSoundId } from '@adatechnology/game-contracts'\nimport type { BlowId, BodyFoleyId, SurfaceId } from '@adatechnology/game-contracts'\n\nimport defaults from './data/defaults.json'\nimport { createRng } from './rng'\nimport type {\n Attributes,\n DeathCause,\n Derived,\n DerivedFormulas,\n DerivedId,\n InfectionRule,\n LinearFormula,\n MeleeItem,\n PlayerAction,\n PlayerCrowd,\n PlayerEventMap,\n PlayerEventName,\n PlayerInput,\n PlayerMessageId,\n PlayerNumbers,\n PlayerSave,\n PlayerSoundId,\n PlayerState,\n PlayerWorld,\n WoundTable,\n} from './types'\n\nexport const PLAYER_DEFAULTS = defaults as unknown as {\n readonly sources: Readonly<Record<string, string>>\n readonly attributes: Attributes\n readonly derived: DerivedFormulas\n readonly wounds: WoundTable\n readonly infection: InfectionRule\n readonly numbers: PlayerNumbers\n readonly fist: MeleeItem\n}\n\nexport type PlayerOptions = {\n /** The random stream (the game passes its single stream). Default `createRng(seed)`. */\n readonly random?: () => number\n readonly seed?: number\n /** The sheet: every attribute 5 by default. */\n readonly attributes?: Partial<Attributes>\n readonly derived?: Partial<DerivedFormulas>\n readonly wounds?: WoundTable\n /** An individual infection (`true` uses the defaults; an object patches them). Off by default: the normal world comes first. */\n readonly infection?: boolean | Partial<InfectionRule>\n readonly numbers?: Partial<PlayerNumbers>\n readonly fist?: MeleeItem\n readonly position?: { readonly x?: number; readonly z?: number; readonly yaw?: number }\n /** Standing skull-top height in metres (default `numbers.heightMetres`, 1.80 m). Scales collider height and radius (Spec 012 R3/H5). */\n readonly heightMetres?: number\n readonly world?: PlayerWorld\n}\n\n/** Player capsule/cylinder collider dimensions in metres (follows standing vs crouched state and `heightMetres`). */\nexport type PlayerCollider = {\n readonly heightMetres: number\n readonly radiusMetres: number\n}\n\nexport type Player = {\n readonly state: PlayerState\n /** Declared standing height in metres. */\n readonly heightMetres: number\n /** Current collider height and radius in metres (adapts to crouch and `heightMetres`). */\n collider(): PlayerCollider\n readonly attributes: Attributes\n readonly derived: Derived\n readonly numbers: PlayerNumbers\n readonly infection: InfectionRule | null\n update(dt: number, input?: PlayerInput, world?: PlayerWorld): void\n /** A hit that opens a wound (drawn from the wound table) and may infect. `by` is the agent that hit, if any. */\n hurt(amount: number, by?: number): void\n /** A bite: damage, bleeding, a bite wound and (with an infection rule) the infection. */\n bite(by?: number): void\n grab(by: number, noJaw?: boolean, drown?: boolean): void\n release(): void\n knock(seconds: number): void\n infect(source: string): void\n /** Kills the player with a cause (the host's deaths: a fall, a fire). */\n die(cause: DeathCause): void\n /** Infection stage: `none`, `malaise`, `fever`, `delirium`. */\n stage(): 'none' | 'malaise' | 'fever' | 'delirium'\n /** Seconds the infection has left, or null. */\n timeLeft(): number | null\n /** What the player's state does to aim spread (panic, fever, moving); the weapon multiplies its own spread by it. */\n spreadFactor(): number\n /** The agents in front (nearest first) within `range` m and a cone of `cosMin`, as `[distance, index]`. */\n front(range: number, cosMin: number, yaw: number, crowd?: PlayerCrowd): [number, number][]\n on<K extends PlayerEventName>(event: K, listener: (event: PlayerEventMap[K]) => void): () => void\n save(): PlayerSave\n load(save: PlayerSave): void\n /** The world `update` uses when it is given none. */\n setWorld(world: PlayerWorld): void\n}\n\nconst TAU_APPROX = 6.2832\n\nconst evaluate = (formula: LinearFormula, attributes: Attributes): number => {\n let value = formula.base\n for (const [attribute, coefficient] of formula.terms) value += coefficient * attributes[attribute]\n return formula.divide === undefined ? value : value / formula.divide\n}\n\n/** The derived values of a sheet (the game's `DERIV`). */\nexport const deriveVitals = (attributes: Attributes, formulas: DerivedFormulas = PLAYER_DEFAULTS.derived): Derived => {\n const out = {} as Record<DerivedId, number>\n for (const id of Object.keys(formulas) as DerivedId[]) out[id] = evaluate(formulas[id], attributes)\n return out\n}\n\n/** Which wound a hit opens: one draw, the kinds in the listed order, the last one takes the rest (the game's `FERIDA` draw). */\nexport const drawWound = (wounds: WoundTable, random: () => number): string => {\n const kinds = Object.keys(wounds)\n const draw = random()\n let acc = 0\n for (let k = 0; k < kinds.length - 1; k++) {\n acc += wounds[kinds[k]!]!.share\n if (draw < acc) return kinds[k]!\n }\n return kinds[kinds.length - 1]!\n}\n\nconst clamp = (v: number, a: number, b: number): number => (v < a ? a : v > b ? b : v)\nconst lerp = (a: number, b: number, t: number): number => a + (b - a) * t\n\nconst freshState = (derived: Derived, position: PlayerOptions['position']): PlayerState => ({\n x: position?.x ?? 0,\n z: position?.z ?? 0,\n y: 0,\n vx: 0,\n vz: 0,\n yaw: position?.yaw ?? 0,\n floor: 0,\n alive: true,\n turned: false,\n health: derived.maxHealth,\n stamina: derived.maxStamina,\n crouch: false,\n running: false,\n stepTimer: 0,\n phase: 0,\n hip: 0,\n grabbedBy: -1,\n grabTimer: 0,\n grabPushes: 0,\n grabNoJaw: false,\n grabDrown: false,\n infected: false,\n infectionTime: 0,\n infectionSource: '',\n wounds: [],\n bleeding: 0,\n blind: 0,\n screamBoost: 0,\n panic: 0,\n hurtFlash: 0,\n deathTime: 0,\n cause: '',\n downTimer: 0,\n burnTimer: 0,\n scentTimer: 0,\n vaultTimer: 0,\n vault: null,\n})\n\n/**\n * The player body: a literal port of the team game's `player` and `playerUpdate` (G 68427-68640) with the world, the crowd and the input as\n * arguments instead of globals. The draws on `random` happen in the game's order (wound kind, infection, the fever cough, the knife when grabbed,\n * the melee region), so a game that passes its own stream keeps its sequence.\n */\nexport function createPlayer(options: PlayerOptions = {}): Player {\n const random = options.random ?? createRng(options.seed ?? 1)\n const attributes: Attributes = { ...PLAYER_DEFAULTS.attributes, ...options.attributes }\n const formulas: DerivedFormulas = { ...PLAYER_DEFAULTS.derived, ...options.derived }\n const derived = deriveVitals(attributes, formulas)\n const numbers: PlayerNumbers = { ...PLAYER_DEFAULTS.numbers, ...options.numbers }\n const heightMetres = options.heightMetres ?? numbers.heightMetres\n if (!Number.isFinite(heightMetres) || heightMetres < 0.8 || heightMetres > 3.0) {\n throw new RangeError(`Player height ${String(heightMetres)} m is outside supported range [0.8, 3.0] m.`)\n }\n const heightScale = heightMetres / numbers.heightMetres\n const wounds = options.wounds ?? PLAYER_DEFAULTS.wounds\n const infection: InfectionRule | null =\n options.infection === undefined || options.infection === false ? null : options.infection === true ? PLAYER_DEFAULTS.infection : { ...PLAYER_DEFAULTS.infection, ...options.infection }\n const fist = options.fist ?? PLAYER_DEFAULTS.fist\n const listeners = new Map<PlayerEventName, Set<(event: never) => void>>()\n let P = freshState(derived, options.position)\n let defaultWorld: PlayerWorld = options.world ?? {}\n let world: PlayerWorld = defaultWorld\n\n const emit = <K extends PlayerEventName>(event: K, payload: PlayerEventMap[K]): void => {\n const set = listeners.get(event)\n if (set) for (const listener of set) (listener as (event: PlayerEventMap[K]) => void)(payload)\n }\n const sound = (id: PlayerSoundId, volume: number, ids: readonly BodyFoleyId[], surface?: SurfaceId, at?: readonly number[]): void =>\n emit('sound', { sound: id, ids, volume, position: [P.x, P.y, P.z], ...(surface ? { surface } : {}), ...(at ? { at } : {}) })\n // what is under the feet: the host's word this frame, else the world's, else concrete; water wins over everything\n let surfaceHint: string | undefined\n const surfaceHere = (): SurfaceId => (inWater(P.x, P.z) ? 'water' : surfaceOfMaterial(surfaceHint ?? world.surfaceAt?.(P.x, P.z)))\n // set by the first `footfall` the host sends: from then on its feet, not the stride timer, decide the footsteps\n let hostFeet = false\n const blowOf = (item: MeleeItem): BlowId => item.blow ?? (item === fist ? 'punch' : (item.crit ?? 0) > 0 ? 'blade' : 'blunt')\n const noise = (x: number, z: number, radius: number): void => emit('noise', { x, z, radius })\n const message = (id: PlayerMessageId | DeathCause, seconds: number): void => emit('message', { id, seconds })\n const inWater = (x: number, z: number): boolean => world.inWater?.(x, z) ?? false\n const solidAt = (x: number, z: number, y: number): boolean => world.solidAt?.(x, z, y) ?? false\n const cellKind = (x: number, z: number): number => world.cellKind?.(x, z) ?? 0\n const blocked = (x: number, z: number): boolean => (world.blocked ? world.blocked(x, z) : solidAt(x, z, numbers.blockHeight))\n const chanceOf = (kind: string): number => infection?.chances?.[kind] ?? wounds[kind]?.infectionChance ?? 0\n\n const die = (cause: DeathCause): void => {\n if (!P.alive) return\n P.alive = false\n P.cause = cause\n P.deathTime = 0\n P.grabbedBy = -1\n message(cause, 6)\n emit('died', { cause })\n }\n const infect = (source: string): void => {\n if (P.infected || !infection) return\n P.infected = true\n P.infectionTime = 0\n P.infectionSource = source\n emit('infected', { source })\n }\n const release = (how: PlayerEventMap['released']['how'] = 'free'): void => {\n const by = P.grabbedBy\n P.grabbedBy = -1\n if (by >= 0) emit('released', { by, how })\n }\n const hurt = (amount: number): void => {\n if (!P.alive) return\n P.health -= amount\n P.hurtFlash = numbers.hurtFlash\n sound('flesh', numbers.hurtVolume, ['player_hurt'])\n const kind = drawWound(wounds, random)\n P.wounds.push(kind)\n if (wounds[kind]?.bleeds) P.bleeding = 1\n emit('hurt', { amount, wound: kind })\n if (infection && !P.infected && random() < chanceOf(kind)) infect(kind)\n if (P.health <= 0) die(P.infected ? 'infected' : 'killed')\n }\n const bite = (): void => {\n P.health -= numbers.biteDamage\n P.hurtFlash = numbers.biteFlash\n P.bleeding = 1\n P.wounds.push('bite')\n sound('flesh', numbers.biteVolume, ['bite', 'player_hurt'])\n emit('hurt', { amount: numbers.biteDamage, wound: 'bite' })\n infect('bite')\n message('bitten', 5)\n if (P.health <= 0) die('bitten_to_death')\n }\n const grab = (by: number, noJaw = false, drown = false): void => {\n P.grabbedBy = by\n P.grabTimer = numbers.grabSeconds\n P.grabPushes = 0\n P.grabNoJaw = noJaw\n P.grabDrown = drown\n message(drown ? 'grabbed_drown' : 'grabbed', 3)\n sound('flesh', numbers.grabVolume, ['grab'])\n emit('grabbed', { by, noJaw, drown })\n }\n\n const front = (range: number, cosMin: number, yaw: number, crowd: PlayerCrowd | undefined = world.crowd): [number, number][] => {\n const out: [number, number][] = []\n if (!crowd) return out\n const fx = -Math.sin(yaw)\n const fz = -Math.cos(yaw)\n const n = crowd.count()\n for (let i = 0; i < n; i++) {\n if (!crowd.active(i) || crowd.floor(i) !== P.floor) continue\n const ex = crowd.x(i) - P.x\n const ez = crowd.z(i) - P.z\n const d = Math.hypot(ex, ez)\n if (d < range && (ex * fx + ez * fz) / (d || 1) > cosMin) out.push([d, i])\n }\n return out.sort((a, b) => a[0] - b[0])\n }\n\n const shove = (yaw: number): void => {\n sound('step', numbers.shoveVolume, ['shove_two_hands'])\n const crowd = world.crowd\n const targets: number[] = []\n for (const [d, i] of front(numbers.shoveRange, numbers.shoveCone, yaw)) {\n crowd!.stun(i, numbers.shoveStun, ((crowd!.x(i) - P.x) / d) * numbers.shoveSpeed, ((crowd!.z(i) - P.z) / d) * numbers.shoveSpeed)\n targets.push(i)\n }\n emit('shove', { targets })\n }\n\n const melee = (item: MeleeItem, yaw: number): void => {\n const t = front(numbers.meleeRangeBase + (item.reach ?? 0), numbers.meleeCone, yaw)[0]\n const blow = blowOf(item)\n const swing = swingSoundId(blow)\n if (!t) {\n sound('flesh', numbers.meleeVolume, swing ? [swing] : [])\n noise(P.x, P.z, item.noise || 1)\n return\n }\n const crowd = world.crowd!\n const i = t[1]\n // a blow to the head is x3 in melee; on the ground or crawling it is an execution\n const region = crowd.down(i) ? 0 : random() < numbers.meleeHeadChance ? 0 : random() < numbers.meleeArmChance ? 1 : 2 + Math.floor(random() * 2)\n const hit = hitSoundId(blow, region === 0 ? 'head' : 'body')\n if (swing) sound('flesh', numbers.meleeVolume, [swing, hit], undefined, [0, SWING_LEAD_SECONDS[blow]])\n else sound('flesh', numbers.meleeVolume, [hit])\n noise(P.x, P.z, item.noise || 1)\n const damage = item.damage * (1 + (attributes.strength - numbers.meleeStrengthBase) * numbers.meleeStrengthPerPoint)\n const cut = Math.min(1, (item.crit || 0) / numbers.meleeCritToCut)\n crowd.damage(i, { region, amount: damage, distance: t[0], cut })\n emit('melee', { target: i, region, damage, distance: t[0], cut })\n }\n\n const update = (dt: number, input: PlayerInput = {}, frameWorld?: PlayerWorld): void => {\n world = frameWorld ?? defaultWorld\n surfaceHint = input.surface\n if (!P.alive) {\n P.deathTime += dt\n if (P.infected && infection && !P.turned && P.deathTime >= infection.reanimateSeconds) {\n P.turned = true\n emit('turned', { x: P.x, z: P.z, floor: P.floor })\n }\n return\n }\n const pressed: Partial<Record<PlayerAction, boolean>> = { ...input.pressed }\n const wasPressed = (action: PlayerAction): boolean => {\n const v = pressed[action] === true\n pressed[action] = false\n return v\n }\n const viewYaw = input.yaw ?? 0\n const crowd = world.crowd\n P.screamBoost = Math.max(0, P.screamBoost - dt)\n P.blind = Math.max(0, P.blind - dt)\n P.hurtFlash = Math.max(0, P.hurtFlash - dt)\n // infection on its own clock\n if (P.infected && infection) {\n const before = P.infectionTime\n P.infectionTime += dt\n if (before <= infection.feverSeconds && P.infectionTime > infection.feverSeconds) emit('stage', { stage: 'fever' })\n if (before <= infection.deliriumSeconds && P.infectionTime > infection.deliriumSeconds) emit('stage', { stage: 'delirium' })\n const every = 1 / infection.feverNoiseEvery\n if (P.infectionTime > infection.feverSeconds && Math.floor(P.infectionTime * every) !== Math.floor((P.infectionTime - dt) * every) && random() < infection.feverNoiseChance) {\n noise(P.x, P.z, infection.feverNoiseRadius)\n sound('step', infection.feverNoiseVolume, ['cloth_rustle'])\n }\n if (P.infectionTime > infection.deathSeconds) {\n P.health = 0\n die('infection')\n return\n }\n }\n if (P.burnTimer > 0) {\n P.burnTimer -= dt\n P.health -= numbers.burnPerSecond * dt\n if (inWater(P.x, P.z)) P.burnTimer = 0\n }\n P.scentTimer = Math.max(0, P.scentTimer - dt)\n if (P.bleeding) {\n P.health -= dt * numbers.bleedPerSecond\n if (input.bandage && P.bleeding) {\n P.bleeding = 0\n message('bandaged', 2)\n }\n }\n if (P.health <= 0) {\n die(P.infected ? 'infected' : P.bleeding ? 'bled_out' : 'hunger_thirst')\n return\n }\n // grabbed: seconds to react\n if (P.grabbedBy >= 0) {\n const i = P.grabbedBy\n P.grabTimer -= dt\n if (crowd) {\n const k = 1 - Math.exp(-dt * numbers.grabFollow) // glued to the body without a jump\n crowd.hold(i, P.x - Math.sin(P.yaw) * numbers.grabOffset, P.z - Math.cos(P.yaw) * numbers.grabOffset, k, P.x, P.z)\n }\n if (wasPressed('push') && P.stamina > numbers.grabPushMinStamina) {\n P.grabPushes++\n P.stamina -= numbers.grabPushCost\n sound('step', numbers.grabPushVolume, ['shove_two_hands'])\n }\n if (wasPressed('knife')) {\n if (random() < numbers.grabKnifeChance) {\n crowd?.damage(i, { region: numbers.grabKnifeRegion, amount: numbers.grabKnifeDamage, distance: numbers.grabKnifeDistance, cut: numbers.grabKnifeCut })\n message('knife_head', 1.5)\n release('knife')\n return\n } else message('knife_miss', 1)\n }\n if (P.grabPushes >= numbers.grabPushes) {\n crowd?.stun(i, numbers.grabPushStun, -Math.sin(viewYaw) * numbers.grabPushSpeed, -Math.cos(viewYaw) * numbers.grabPushSpeed)\n release('push')\n message('pushed_off', 1.2)\n return\n }\n if (P.grabTimer <= 0) {\n if (P.grabDrown) {\n P.health -= numbers.drownDamage\n P.hurtFlash = numbers.drownFlash\n message('drowning', 2)\n if (P.health <= 0) {\n die('drowned')\n return\n }\n P.grabTimer = numbers.grabSeconds\n P.grabPushes = 0\n return\n }\n if (P.grabNoJaw) {\n hurt(numbers.noJawDamage)\n message('no_jaw', 2)\n } else bite()\n crowd?.chase(i, numbers.grabAttackCooldown)\n release(P.grabNoJaw ? 'scratch' : 'bite')\n }\n return\n }\n // knocked down\n if (P.downTimer > 0) {\n P.downTimer -= dt\n P.vx = P.vz = 0\n if (P.downTimer <= 0) message('stood_up', 0.8)\n return\n }\n if (world.busy?.(dt)) return\n // vaulting a low wall\n if (P.vaultTimer > 0 && P.vault) {\n P.vaultTimer -= dt\n const k = 1 - P.vaultTimer / numbers.vaultSeconds\n P.x = lerp(P.vault[0], P.vault[2], k)\n P.z = lerp(P.vault[1], P.vault[3], k)\n P.y = Math.sin(k * Math.PI) * numbers.vaultHeight\n if (P.vaultTimer <= 0) {\n P.y = 0\n noise(P.x, P.z, numbers.vaultNoise)\n const surface = surfaceHere()\n sound('step', numbers.vaultLandVolume, [landSoundId(surface, 0)], surface)\n }\n return\n }\n if (wasPressed('vault') && P.stamina > numbers.vaultCost && (world.canVault?.() ?? !P.floor)) {\n const fx0 = -Math.sin(viewYaw)\n const fz0 = -Math.cos(viewYaw)\n for (let a = numbers.vaultScanFrom; a <= numbers.vaultScanTo; a += numbers.vaultScanStep) {\n const c = cellKind(P.x + fx0 * a, P.z + fz0 * a)\n if (c === 2) {\n for (let e = a + numbers.vaultLandFrom; e <= a + numbers.vaultLandTo; e += numbers.vaultScanStep) {\n const ex = P.x + fx0 * e\n const ez = P.z + fz0 * e\n if (!solidAt(ex, ez, numbers.vaultCheckHeight) && !solidAt(ex + fx0 * numbers.vaultClearance, ez + fz0 * numbers.vaultClearance, numbers.vaultCheckHeight)) {\n P.vault = [P.x, P.z, ex, ez]\n P.vaultTimer = numbers.vaultSeconds\n P.stamina -= numbers.vaultCost\n sound('step', numbers.vaultStartVolume, ['jump'])\n emit('vault', { from: [P.x, P.z], to: [ex, ez] })\n return\n }\n }\n break\n }\n if (c > 0 && c !== 3) break\n }\n }\n // movement\n const f = input.forward ?? 0\n const s = input.right ?? 0\n if (wasPressed('crouch')) P.crouch = !P.crouch\n const want = f || s\n P.running = !!(input.run && want && P.stamina > numbers.runMinStamina && !input.aim && !P.crouch)\n const fever = P.infected && infection !== null && P.infectionTime > infection.feverSeconds\n let sp = P.running ? derived.runSpeed : P.crouch ? numbers.crouchSpeed : derived.walkSpeed * numbers.walkFactor\n if (fever) sp *= infection!.feverSpeed\n if (input.aim) sp = Math.min(sp, numbers.aimSpeedCap)\n const wet = inWater(P.x, P.z)\n if (wet) sp *= numbers.waterSpeed\n if (P.running) P.stamina = Math.max(0, P.stamina - numbers.runDrain * dt)\n else P.stamina = Math.min(derived.maxStamina, P.stamina + (want ? numbers.regenMoving : numbers.regenStill) * dt)\n const fx = -Math.sin(viewYaw)\n const fz = -Math.cos(viewYaw)\n const mx = fx * f - fz * s\n const mz = fz * f + fx * s\n const ml = Math.hypot(mx, mz) || 1\n const tvx = want ? (mx / ml) * sp : 0\n const tvz = want ? (mz / ml) * sp : 0\n P.vx = lerp(P.vx, tvx, Math.min(1, dt * numbers.acceleration))\n P.vz = lerp(P.vz, tvz, Math.min(1, dt * numbers.acceleration))\n const r = numbers.radius * heightScale\n const nx = P.x + P.vx * dt\n const nz = P.z + P.vz * dt\n if (!blocked(nx + Math.sign(P.vx) * r, P.z)) P.x = nx\n if (!blocked(P.x, nz + Math.sign(P.vz) * r)) P.z = nz\n world.afterMove?.(P)\n // the player does not walk through the crowd: agents pressed against the body push it out\n if (crowd) {\n const n = crowd.count()\n const rr = numbers.pushApartRadius\n for (let i = 0; i < n; i++) {\n if (!crowd.active(i) || Math.abs(crowd.y(i) - P.y) > numbers.pushApartHeight) continue\n const ex = P.x - crowd.x(i)\n const ez = P.z - crowd.z(i)\n const e2 = ex * ex + ez * ez\n if (e2 < rr * rr && e2 > 1e-5) {\n const e = Math.sqrt(e2)\n const k = ((rr - e) / e) * 0.5\n if (!solidAt(P.x + ex * k, P.z + ez * k, numbers.blockHeight)) {\n P.x += ex * k\n P.z += ez * k\n }\n }\n }\n }\n const spd = Math.hypot(P.vx, P.vz)\n // the legs follow the move even with the torso on the aim; walking backwards flips the stride\n {\n const cy = Math.cos(P.yaw)\n const sy = Math.sin(P.yaw)\n const lx = P.vx * cy - P.vz * sy\n const lz = P.vx * sy + P.vz * cy\n const back = lz < numbers.backwardsBelow ? -1 : 1\n const hip = spd > numbers.hipMinSpeed ? clamp(Math.atan2(lx * back, lz * back), -numbers.hipLimit, numbers.hipLimit) : 0\n P.hip = P.hip + (hip - P.hip) * Math.min(1, dt * numbers.hipFollow)\n P.phase += dt * (spd < numbers.cadenceMinSpeed ? 0 : numbers.cadenceBase + numbers.cadencePerSpeed * spd) * back\n }\n // the body follows the view (fast, no snap); aiming or firing, at once\n {\n const target = viewYaw + Math.PI\n let dy = target - P.yaw\n dy -= Math.round(dy / TAU_APPROX) * TAU_APPROX\n P.yaw += input.aim || input.firing ? dy : dy * Math.min(1, dt * numbers.turnFollow)\n }\n // footsteps make noise: walk 3 m, run 8 m, crouched 1 m (x the sheet's footstep noise, x2 in water)\n // the host's feet (`input.footfall`) once it sends them, else the stride timer\n if (input.footfall) hostFeet = true\n P.stepTimer -= dt * spd\n const stepNow = hostFeet ? input.footfall === true : P.stepTimer <= 0 && spd > numbers.stepMinSpeed\n if (stepNow) {\n P.stepTimer = numbers.stepEvery\n noise(P.x, P.z, (P.running ? numbers.stepNoiseRun : P.crouch ? numbers.stepNoiseCrouch : numbers.stepNoiseWalk) * derived.footstepNoise * (wet ? numbers.stepNoiseWater : 1))\n const surface = surfaceHere()\n sound('step', P.running ? numbers.stepVolumeRun : numbers.stepVolumeWalk, [footstepSoundId(surface, P.running ? 'run' : 'walk')], surface)\n emit('step', { x: P.x, z: P.z, yaw: P.yaw })\n }\n // shove and melee\n if (wasPressed('push') && P.stamina > numbers.shoveCost) {\n P.stamina -= numbers.shoveCost\n shove(viewYaw)\n }\n if (wasPressed('throw')) emit('throw', {})\n if (wasPressed('knife') && P.stamina > numbers.meleeMinStamina) {\n const item = input.melee ?? fist\n P.stamina -= (item.kg ?? 0) > numbers.meleeHeavyKg ? numbers.meleeCostHeavy : numbers.meleeCostLight\n melee(item, viewYaw)\n }\n // panic: chasing agents in sight nearby\n let near = 0\n if (crowd) {\n const n = crowd.count()\n for (let i = 0; i < n; i++) if (crowd.active(i) && crowd.chasing(i)) near += crowd.panicWeight?.(i) ?? 1\n }\n P.panic = clamp(P.panic + (near * numbers.panicGain - (near ? 0 : numbers.panicDecay)) * dt, 0, numbers.panicMax)\n }\n\n return {\n get state() {\n return P\n },\n heightMetres,\n collider: () => ({\n heightMetres: P.crouch ? heightMetres * numbers.crouchHeightRatio : heightMetres,\n radiusMetres: numbers.radius * heightScale,\n }),\n attributes,\n derived,\n numbers,\n infection,\n update,\n hurt: (amount) => hurt(amount),\n bite: () => bite(),\n grab,\n release: () => release('free'),\n knock(seconds) {\n if (!P.alive) return\n P.downTimer = Math.max(P.downTimer, seconds)\n P.crouch = false\n },\n infect,\n die,\n stage() {\n if (!P.infected || !infection) return 'none'\n return P.infectionTime > infection.deliriumSeconds ? 'delirium' : P.infectionTime > infection.feverSeconds ? 'fever' : 'malaise'\n },\n timeLeft: () => (P.infected && infection ? Math.max(0, infection.deathSeconds - P.infectionTime) : null),\n spreadFactor() {\n const panic = P.panic > derived.composure * numbers.panicSpreadAt ? numbers.panicSpread : 1\n const fever = P.infected && infection && P.infectionTime > infection.feverSeconds ? infection.feverSpread : 1\n return panic * fever * (1 + Math.hypot(P.vx, P.vz) * numbers.moveSpread)\n },\n front,\n on(event, listener) {\n let set = listeners.get(event)\n if (!set) listeners.set(event, (set = new Set()))\n set.add(listener as (event: never) => void)\n return () => void set.delete(listener as (event: never) => void)\n },\n save: () => ({ state: structuredClone(P), attributes }),\n load(save) {\n P = structuredClone(save.state)\n },\n setWorld(next) {\n defaultWorld = next\n },\n }\n}\n","{\n \"sources\": {\n \"game\": \"specs/001-migracao-entregas-dos-times/artefatos/2UG1Mhe9LqJkQKKVsJkTWR/jogo.js\",\n \"attributes\": \"G 62004 FICHA (Personagens 3.2: every attribute 5, no traits)\",\n \"derived\": \"G 62005-62012 DERIV\",\n \"wounds\": \"G 62016 FERIDA (Personagens 3.7): share of each wound kind, and its infection chance (used only when an infection rule is on)\",\n \"infection\": \"G 62015 INFEC (the slice's accelerated clock: fever 30 s, delirium 70 s, death 120 s, reanimation 8 s after); G 68509 fever noise\",\n \"numbers\": \"G 68427-68640 player, playerUpdate, frontZombies, shove, knife; G 68678-68681 the aim spread modifiers; G 65507 walkCad\"\n },\n \"attributes\": { \"strength\": 5, \"vigor\": 5, \"agility\": 5, \"perception\": 5, \"intellect\": 5, \"presence\": 5 },\n \"derived\": {\n \"maxHealth\": { \"base\": 70, \"terms\": [[\"vigor\", 6]] },\n \"maxStamina\": { \"base\": 40, \"terms\": [[\"vigor\", 6], [\"agility\", 4]] },\n \"runSpeed\": { \"base\": 5.2, \"terms\": [[\"agility\", 0.12]] },\n \"walkSpeed\": { \"base\": 1.6, \"terms\": [] },\n \"footstepNoise\": { \"base\": 100, \"terms\": [[\"agility\", -4]], \"divide\": 100 },\n \"composure\": { \"base\": 20, \"terms\": [[\"vigor\", 3], [\"presence\", 4]] }\n },\n \"wounds\": {\n \"scratch\": { \"share\": 0.6, \"infectionChance\": 0.06, \"bleeds\": false },\n \"laceration\": { \"share\": 0.3, \"infectionChance\": 0.22, \"bleeds\": true },\n \"bite\": { \"share\": 0.1, \"infectionChance\": 1, \"bleeds\": true }\n },\n \"infection\": {\n \"feverSeconds\": 30,\n \"deliriumSeconds\": 70,\n \"deathSeconds\": 120,\n \"reanimateSeconds\": 8,\n \"feverNoiseEvery\": 2,\n \"feverNoiseChance\": 0.5,\n \"feverNoiseRadius\": 10,\n \"feverNoiseVolume\": 2,\n \"feverSpeed\": 0.85,\n \"feverSpread\": 1.5\n },\n \"numbers\": {\n \"hurtFlash\": 0.4,\n \"hurtVolume\": 0.8,\n \"biteDamage\": 25,\n \"biteFlash\": 0.8,\n \"biteVolume\": 1.2,\n \"burnPerSecond\": 3,\n \"bleedPerSecond\": 0.15,\n \"grabSeconds\": 3,\n \"grabVolume\": 1,\n \"grabFollow\": 12,\n \"grabOffset\": 0.55,\n \"grabPushCost\": 6,\n \"grabPushMinStamina\": 5,\n \"grabPushVolume\": 1.5,\n \"grabPushes\": 6,\n \"grabPushStun\": 1.2,\n \"grabPushSpeed\": 3,\n \"grabKnifeChance\": 0.7,\n \"grabKnifeRegion\": 0,\n \"grabKnifeDamage\": 22,\n \"grabKnifeDistance\": 0.5,\n \"grabKnifeCut\": 0.7,\n \"drownDamage\": 30,\n \"drownFlash\": 0.8,\n \"noJawDamage\": 8,\n \"grabAttackCooldown\": 2,\n \"vaultSeconds\": 0.7,\n \"vaultCost\": 15,\n \"vaultHeight\": 1.9,\n \"vaultScanFrom\": 0.3,\n \"vaultScanTo\": 1.0,\n \"vaultScanStep\": 0.1,\n \"vaultLandFrom\": 0.4,\n \"vaultLandTo\": 1.4,\n \"vaultClearance\": 0.3,\n \"vaultCheckHeight\": 0.4,\n \"vaultNoise\": 6,\n \"vaultStartVolume\": 0.8,\n \"vaultLandVolume\": 1,\n \"crouchSpeed\": 1.0,\n \"walkFactor\": 1.35,\n \"aimSpeedCap\": 1.4,\n \"waterSpeed\": 0.55,\n \"runMinStamina\": 1,\n \"runDrain\": 12,\n \"regenMoving\": 4,\n \"regenStill\": 8,\n \"acceleration\": 10,\n \"heightMetres\": 1.8,\n \"crouchHeightRatio\": 0.65,\n \"radius\": 0.3,\n \"blockHeight\": 0.4,\n \"pushApartRadius\": 0.55,\n \"pushApartHeight\": 1.2,\n \"hipFollow\": 10,\n \"hipMinSpeed\": 0.3,\n \"hipLimit\": 0.9,\n \"backwardsBelow\": -0.1,\n \"cadenceBase\": 0.5,\n \"cadencePerSpeed\": 0.3,\n \"cadenceMinSpeed\": 0.05,\n \"turnFollow\": 12,\n \"stepEvery\": 0.75,\n \"stepMinSpeed\": 0.3,\n \"stepNoiseRun\": 8,\n \"stepNoiseWalk\": 3,\n \"stepNoiseCrouch\": 1,\n \"stepNoiseWater\": 2,\n \"stepVolumeRun\": 0.6,\n \"stepVolumeWalk\": 0.3,\n \"shoveCost\": 10,\n \"shoveVolume\": 1.2,\n \"shoveRange\": 1.6,\n \"shoveCone\": 0.3,\n \"shoveStun\": 0.9,\n \"shoveSpeed\": 2.5,\n \"meleeMinStamina\": 5,\n \"meleeCostLight\": 5,\n \"meleeCostHeavy\": 12,\n \"meleeHeavyKg\": 1.5,\n \"meleeVolume\": 0.6,\n \"meleeRangeBase\": 0.9,\n \"meleeCone\": 0.5,\n \"meleeHeadChance\": 0.35,\n \"meleeArmChance\": 0.5,\n \"meleeStrengthPerPoint\": 0.06,\n \"meleeStrengthBase\": 5,\n \"meleeCritToCut\": 60,\n \"panicGain\": 1.2,\n \"panicDecay\": 3,\n \"panicMax\": 100,\n \"panicSpreadAt\": 0.6,\n \"panicSpread\": 1.4,\n \"moveSpread\": 0.4\n },\n \"fist\": { \"damage\": 8, \"crit\": 0, \"reach\": 0.5, \"noise\": 1 }\n}\n","const FNV_OFFSET = 0x811c9dc5\nconst FNV_PRIME = 0x01000193\nconst MIX = 0x9e3779b1\n\n/** Deterministic mulberry32 generator; returns floats in [0, 1). */\nexport function createRng(seed: number): () => number {\n let state = seed >>> 0\n return () => {\n state = (state + 0x6d2b79f5) >>> 0\n let mixed = Math.imul(state ^ (state >>> 15), state | 1)\n mixed ^= mixed + Math.imul(mixed ^ (mixed >>> 7), mixed | 61)\n return ((mixed ^ (mixed >>> 14)) >>> 0) / 4294967296\n }\n}\n\n/** A seed for the stream called `name`: the same seed gives each name its own sequence, so lightning never shifts the schedule. */\nexport function streamSeed(seed: number, name: string): number {\n let hash = FNV_OFFSET\n for (let index = 0; index < name.length; index++) hash = Math.imul(hash ^ name.charCodeAt(index), FNV_PRIME) >>> 0\n return Math.imul((seed >>> 0) ^ hash, MIX) >>> 0\n}\n\nexport function createStream(seed: number, name: string): () => number {\n return createRng(streamSeed(seed, name))\n}\n\nexport function drawBetween(rng: () => number, range: readonly [min: number, max: number]): number {\n return range[0] + rng() * (range[1] - range[0])\n}\n","export type PlayerBenchText = {\n readonly group: string\n readonly name: string\n readonly controls: Readonly<Record<'infection' | 'agility' | 'vigor' | 'seed' | 'hurt' | 'bite' | 'grab' | 'push' | 'knife' | 'bandage' | 'knock' | 'crouch' | 'reset', string>>\n readonly hints: Readonly<Record<'infection' | 'agility' | 'vigor' | 'seed' | 'grab' | 'push', string>>\n readonly metrics: Readonly<Record<'health' | 'stamina' | 'bleeding' | 'wounds' | 'stage' | 'time_left' | 'panic' | 'spread' | 'grab' | 'noise' | 'steps' | 'message', string>>\n readonly stages: Readonly<Record<'none' | 'malaise' | 'fever' | 'delirium' | 'dead', string>>\n readonly scenarios: Readonly<Record<'stamina' | 'bleed_bandage' | 'normal_world' | 'infection_kills' | 'grab_break_free' | 'determinism', string>>\n readonly yes: string\n readonly no: string\n}\n\nconst EN: PlayerBenchText = {\n group: 'Player',\n name: 'Player area',\n controls: {\n infection: 'Individual infection',\n agility: 'Agility',\n vigor: 'Vigor',\n seed: 'Seed',\n hurt: 'Take a hit (10)',\n bite: 'Bite',\n grab: 'Get grabbed',\n push: 'Push (E)',\n knife: 'Knife (F)',\n bandage: 'Bandage (B)',\n knock: 'Knocked down 1.5 s',\n crouch: 'Crouch (C)',\n reset: 'Start again',\n },\n hints: {\n infection: 'Off: a normal world, wounds never infect. On: the game rule (scratch 6%, laceration 22%, bite 100%; fever at 30 s, death at 120 s).',\n agility: 'The sheet: stamina, run speed and footstep noise come from it.',\n vigor: 'The sheet: health, stamina and composure come from it.',\n seed: 'The same seed gives the same wounds and the same knife rolls.',\n grab: 'Something grabs you from behind: 3 s to push it off (6 pushes) or to land the knife (70%).',\n push: 'Shoves what is in front, or pushes off what holds you.',\n },\n metrics: {\n health: 'Health',\n stamina: 'Stamina',\n bleeding: 'Bleeding',\n wounds: 'Wounds',\n stage: 'Infection',\n time_left: 'Time left',\n panic: 'Panic',\n spread: 'Aim spread x',\n grab: 'Grab timer',\n noise: 'Last noise',\n steps: 'Footsteps',\n message: 'Message',\n },\n stages: { none: 'None', malaise: 'Malaise', fever: 'Fever', delirium: 'Delirium', dead: 'Dead' },\n scenarios: {\n stamina: 'Running drains stamina and resting gives it back',\n bleed_bandage: 'A laceration bleeds until it is dressed',\n normal_world: 'In a normal world a bite hurts and bleeds but never infects',\n infection_kills: 'With the infection on, a bite brings fever and kills at its time',\n grab_break_free: 'Six pushes break a grab before the bite',\n determinism: 'The same seed gives the same wounds',\n },\n yes: 'yes',\n no: 'no',\n}\n\nconst PT_BR: PlayerBenchText = {\n group: 'Jogador',\n name: 'Área do jogador',\n controls: {\n infection: 'Infecção individual',\n agility: 'Agilidade',\n vigor: 'Vigor',\n seed: 'Semente',\n hurt: 'Levar um golpe (10)',\n bite: 'Mordida',\n grab: 'Ser agarrado',\n push: 'Empurrar (E)',\n knife: 'Faca (F)',\n bandage: 'Curativo (B)',\n knock: 'Derrubado 1,5 s',\n crouch: 'Agachar (C)',\n reset: 'Recomeçar',\n },\n hints: {\n infection: 'Desligada: mundo normal, ferida nunca infecta. Ligada: a regra do jogo (arranhão 6%, laceração 22%, mordida 100%; febre aos 30 s, morte aos 120 s).',\n agility: 'A ficha: fôlego, velocidade de corrida e ruído dos passos saem dela.',\n vigor: 'A ficha: vida, fôlego e compostura saem dela.',\n seed: 'A mesma semente dá as mesmas feridas e os mesmos golpes de faca.',\n grab: 'Algo te agarra por trás: 3 s para empurrar (6 empurrões) ou acertar a faca (70%).',\n push: 'Empurra o que está na frente, ou se solta do que te segura.',\n },\n metrics: {\n health: 'Vida',\n stamina: 'Fôlego',\n bleeding: 'Sangrando',\n wounds: 'Feridas',\n stage: 'Infecção',\n time_left: 'Tempo restante',\n panic: 'Pânico',\n spread: 'Dispersão x',\n grab: 'Agarrão',\n noise: 'Último ruído',\n steps: 'Passos',\n message: 'Mensagem',\n },\n stages: { none: 'Nenhuma', malaise: 'Mal-estar', fever: 'Febre', delirium: 'Delírio', dead: 'Morto' },\n scenarios: {\n stamina: 'Correr gasta fôlego e descansar devolve',\n bleed_bandage: 'Uma laceração sangra até o curativo',\n normal_world: 'No mundo normal a mordida machuca e sangra, mas não infecta',\n infection_kills: 'Com a infecção ligada, a mordida dá febre e mata no tempo dela',\n grab_break_free: 'Seis empurrões soltam o agarrão antes da mordida',\n determinism: 'A mesma semente dá as mesmas feridas',\n },\n yes: 'sim',\n no: 'não',\n}\n\nexport const playerBenchTextOf = (locale: string): PlayerBenchText => (locale.toLowerCase().startsWith('en') ? EN : PT_BR)\n","import type { BenchChange, GaitId, ModuleControl, ModuleHost, ModuleMetric, ModuleScenario, SurfaceId, TestableModule } from '@adatechnology/game-contracts'\n\nimport { playerTextOf } from '../locales'\nimport { createPlayer } from '../player'\nimport type { Player, PlayerOptions } from '../player'\nimport type { PlayerAction, PlayerCrowd, PlayerInput } from '../types'\nimport { playerBenchTextOf } from './locale'\n\nexport type PlayerTestModuleOptions = PlayerOptions & { readonly locale?: string }\n\n/** What the scenarios use of the context the test room passes. */\nexport interface PlayerScenarioLike {\n expect(condition: boolean, label: string, data?: Record<string, unknown>): void\n}\n\nexport type PlayerTestModule = TestableModule<PlayerScenarioLike> & {\n /** The player in use (replaced when the bench changes the sheet, the seed or the infection). */\n readonly player: Player\n}\n\ntype CameraLike = { position: { x: number; y: number; z: number }; rotation?: { y: number }; getWorldDirection?(target: unknown): { x: number; z: number } }\ntype ThreeLike = { Vector3?: new () => { x: number; y: number; z: number } }\n\nconst MOVING_SPEED = 0.2\n/** Metres per second above which a move of the view is a jump of the camera, not the body walking. */\nconst TELEPORT_SPEED = 10\nconst SPRINT_SPEED = 3.4\nconst FRAME = 1 / 30\n\n/**\n * One agent standing behind the player for the grab test: the bench has no crowd, so this is the hand that holds. It follows `hold`, takes\n * the shove and the knife, and leaves the count once it lets go.\n */\nconst createGrabber = () => {\n const agent = { x: 0, z: 0, on: false, stunned: 0, hits: 0 }\n const crowd: PlayerCrowd = {\n count: () => (agent.on ? 1 : 0),\n active: () => agent.on,\n x: () => agent.x,\n z: () => agent.z,\n y: () => 0,\n floor: () => 0,\n chasing: () => agent.on,\n down: () => agent.stunned > 0,\n hold(_i, x, z, k) {\n agent.x += (x - agent.x) * k\n agent.z += (z - agent.z) * k\n },\n stun(_i, seconds) {\n agent.stunned = seconds\n agent.on = false\n },\n chase() {\n agent.on = false\n },\n damage() {\n agent.hits += 1\n agent.on = false\n },\n }\n return { agent, crowd }\n}\n\n/**\n * The player area of a test room, against the generic contracts only. The room's camera is the player: where it walks, the player walks; its speed\n * decides walking or running, so stamina, footsteps and their noise follow the viewer. The bench hurts, bites, grabs and knocks the player down,\n * switches the individual infection (off by default: a normal world) and sets the sheet. Footsteps and flesh sounds go to `host.audio`.\n */\nexport function createPlayerTestModule(options: PlayerTestModuleOptions = {}): PlayerTestModule {\n const locale = options.locale ?? 'pt-BR'\n const text = playerBenchTextOf(locale)\n const { locale: _locale, ...playerOptions } = options\n void _locale\n const settings = { infection: options.infection === undefined ? false : options.infection !== false, agility: options.attributes?.agility ?? 5, vigor: options.attributes?.vigor ?? 5, seed: options.seed ?? 1 }\n let host: ModuleHost | null = null\n const grabber = createGrabber()\n let lastNoise = 0\n let steps = 0\n let lastMessage = ''\n let pending: Partial<Record<PlayerAction, boolean>> = {}\n let bandage = false\n let footfall = false\n let surface: SurfaceId | undefined\n let gait: GaitId | undefined\n let last: { x: number; z: number } | null = null\n const offs: (() => void)[] = []\n\n const build = (): Player => {\n for (const off of offs.splice(0)) off()\n const made = createPlayer({ ...playerOptions, seed: settings.seed, infection: settings.infection, attributes: { ...playerOptions.attributes, agility: settings.agility, vigor: settings.vigor } })\n offs.push(made.on('noise', (e) => void (lastNoise = e.radius)))\n offs.push(made.on('step', () => void (steps += 1)))\n offs.push(made.on('message', (e) => void (lastMessage = playerTextOf(e.id, locale))))\n // the body sounds of each event (a footstep on its surface, the swing and then the hit of a blow); the team's class only when it names none\n offs.push(\n made.on('sound', (e) => {\n if (e.ids.length === 0) return\n e.ids.forEach((id, index) => {\n const delay = e.at?.[index] ?? 0\n host?.audio?.play({ sound: id, volume: e.volume, position: e.position, urgent: true, ...(delay > 0 ? { delay } : {}) })\n })\n }),\n )\n offs.push(made.on('died', (e) => host?.log(`player died: ${e.cause}`, { cause: e.cause })))\n lastNoise = 0\n steps = 0\n lastMessage = ''\n return made\n }\n let player = build()\n\n const view = (): { x: number; z: number; yaw: number } | null => {\n const camera = host?.camera as CameraLike | undefined\n if (!camera?.position) return null\n const Vector3 = (host?.THREE as ThreeLike | undefined)?.Vector3\n if (camera.getWorldDirection && Vector3) {\n const look = camera.getWorldDirection(new Vector3())\n return { x: camera.position.x, z: camera.position.z, yaw: Math.atan2(-look.x, -look.z) }\n }\n return { x: camera.position.x, z: camera.position.z, yaw: camera.rotation?.y ?? 0 }\n }\n\n const frame = (dt: number): void => {\n const here = view()\n const raw = here && last && dt > 0 ? Math.hypot(here.x - last.x, here.z - last.z) / dt : 0\n // faster than anyone runs is the view put somewhere else (an area opening, a scripted look), not a walk: no footstep for it\n const speed = raw > TELEPORT_SPEED ? 0 : raw\n if (here) {\n player.state.x = here.x\n player.state.z = here.z\n }\n const input: PlayerInput = { forward: speed > MOVING_SPEED ? 1 : 0, run: gait ? gait === 'run' : speed > SPRINT_SPEED, yaw: here?.yaw ?? 0, bandage, pressed: pending, footfall, ...(surface ? { surface } : {}) }\n pending = {}\n footfall = false\n bandage = false\n player.update(dt, input, { crowd: grabber.crowd })\n if (here) {\n player.state.x = here.x\n player.state.z = here.z\n last = { x: here.x, z: here.z }\n }\n if (grabber.agent.stunned > 0) grabber.agent.stunned = Math.max(0, grabber.agent.stunned - dt)\n }\n\n const grab = (): void => {\n const P = player.state\n grabber.agent.on = true\n grabber.agent.x = P.x - Math.sin(P.yaw) * player.numbers.grabOffset\n grabber.agent.z = P.z - Math.cos(P.yaw) * player.numbers.grabOffset\n player.grab(0)\n }\n\n const onChange = (change: BenchChange): void => {\n if (change.kind === 'action') {\n const id = change.id\n if (id === 'hurt') player.hurt(10)\n else if (id === 'bite') player.bite()\n else if (id === 'grab') grab()\n else if (id === 'knock') player.knock(1.5)\n else if (id === 'bandage') bandage = true\n else if (id === 'push' || id === 'knife' || id === 'crouch') pending = { ...pending, [id]: true }\n else if (id === 'reset') player = build()\n return\n }\n if (change.kind !== 'control') return\n const { id, value } = change\n if (id === 'infection' && typeof value === 'boolean' && value !== settings.infection) settings.infection = value\n else if ((id === 'agility' || id === 'vigor' || id === 'seed') && typeof value === 'number' && value !== settings[id]) settings[id] = value\n else return\n player = build()\n }\n\n const controls = (): ModuleControl[] => [\n { kind: 'boolean', id: 'infection', name: text.controls.infection, hint: text.hints.infection, default: settings.infection },\n { kind: 'number', id: 'agility', name: text.controls.agility, hint: text.hints.agility, min: 1, max: 8, step: 1, default: settings.agility },\n { kind: 'number', id: 'vigor', name: text.controls.vigor, hint: text.hints.vigor, min: 1, max: 8, step: 1, default: settings.vigor },\n { kind: 'number', id: 'seed', name: text.controls.seed, hint: text.hints.seed, min: 1, max: 9999, step: 1, default: settings.seed },\n { kind: 'action', id: 'hurt', name: text.controls.hurt },\n { kind: 'action', id: 'bite', name: text.controls.bite },\n { kind: 'action', id: 'grab', name: text.controls.grab, hint: text.hints.grab },\n { kind: 'action', id: 'push', name: text.controls.push, hint: text.hints.push },\n { kind: 'action', id: 'knife', name: text.controls.knife },\n { kind: 'action', id: 'bandage', name: text.controls.bandage },\n { kind: 'action', id: 'knock', name: text.controls.knock },\n { kind: 'action', id: 'crouch', name: text.controls.crouch },\n { kind: 'action', id: 'reset', name: text.controls.reset },\n ]\n\n const stageName = (): string => (player.state.alive ? text.stages[player.stage()] : text.stages.dead)\n const metrics = (): ModuleMetric[] => [\n { id: 'health', name: text.metrics.health, digits: 1, max: player.derived.maxHealth, read: () => Math.max(0, player.state.health) },\n { id: 'stamina', name: text.metrics.stamina, digits: 1, max: player.derived.maxStamina, read: () => player.state.stamina },\n { id: 'bleeding', name: text.metrics.bleeding, read: () => (player.state.bleeding ? text.yes : text.no) },\n { id: 'wounds', name: text.metrics.wounds, digits: 0, read: () => player.state.wounds.length },\n { id: 'stage', name: text.metrics.stage, read: stageName },\n { id: 'time_left', name: text.metrics.time_left, unit: 's', digits: 0, read: () => player.timeLeft() ?? 0 },\n { id: 'panic', name: text.metrics.panic, digits: 1, read: () => player.state.panic },\n { id: 'spread', name: text.metrics.spread, digits: 2, read: () => player.spreadFactor() },\n { id: 'grab_timer', name: text.metrics.grab, unit: 's', digits: 1, read: () => (player.state.grabbedBy >= 0 ? player.state.grabTimer : 0) },\n { id: 'noise', name: text.metrics.noise, unit: 'm', digits: 1, read: () => lastNoise },\n { id: 'steps', name: text.metrics.steps, digits: 0, read: () => steps },\n { id: 'message', name: text.metrics.message, read: () => lastMessage },\n ]\n\n // each scenario runs its own player, so the bench's live one is not touched\n const fresh = (extra: PlayerOptions = {}): Player => createPlayer({ ...playerOptions, ...extra })\n const run = (made: Player, seconds: number, input: PlayerInput = {}, crowd?: PlayerCrowd): void => {\n for (let t = 0; t < seconds; t += FRAME) made.update(FRAME, input, crowd ? { crowd } : undefined)\n }\n const scenarios = (): Array<ModuleScenario<PlayerScenarioLike>> => [\n {\n id: 'player_stamina',\n name: text.scenarios.stamina,\n run: ({ expect }) => {\n const made = fresh({ seed: 1 })\n const full = made.state.stamina\n run(made, 4, { forward: 1, run: true })\n const tired = made.state.stamina\n expect(tired < full - 40, 'four seconds of running spend 48 of stamina', { full, tired })\n run(made, 3)\n expect(made.state.stamina > tired, 'standing still gives it back', { tired, rested: made.state.stamina })\n },\n },\n {\n id: 'player_bleed_bandage',\n name: text.scenarios.bleed_bandage,\n run: ({ expect }) => {\n const made = fresh({ seed: 1 })\n made.bite()\n const after = made.state.health\n run(made, 2)\n expect(made.state.bleeding === 1 && made.state.health < after, 'the wound bleeds', { health: made.state.health })\n run(made, FRAME, { bandage: true })\n const dressed = made.state.health\n run(made, 2)\n expect(made.state.bleeding === 0 && made.state.health === dressed, 'dressed, it stops', { health: made.state.health })\n },\n },\n {\n id: 'player_normal_world',\n name: text.scenarios.normal_world,\n run: ({ expect }) => {\n const made = fresh({ seed: 1, infection: false })\n made.bite()\n run(made, 10)\n expect(!made.state.infected && made.state.health < made.derived.maxHealth, 'bitten, hurt, not infected', { health: made.state.health })\n },\n },\n {\n id: 'player_infection_kills',\n name: text.scenarios.infection_kills,\n run: ({ expect }) => {\n const made = fresh({ seed: 1, infection: true })\n made.bite()\n run(made, FRAME, { bandage: true })\n run(made, 40)\n expect(made.stage() === 'fever', 'fever after 30 s', { stage: made.stage() })\n run(made, 90)\n expect(!made.state.alive && made.state.cause === 'infection', 'dead at 120 s', { cause: made.state.cause })\n },\n },\n {\n id: 'player_grab_break_free',\n name: text.scenarios.grab_break_free,\n run: ({ expect }) => {\n const made = fresh({ seed: 1 })\n const { agent, crowd } = createGrabber()\n agent.on = true\n made.grab(0)\n for (let push = 0; push < 6; push++) {\n made.update(FRAME, { pressed: { push: true } }, { crowd })\n made.update(FRAME, {}, { crowd })\n }\n expect(made.state.grabbedBy === -1 && made.state.wounds.length === 0, 'free, and no bite', { grabbedBy: made.state.grabbedBy })\n },\n },\n {\n id: 'player_determinism',\n name: text.scenarios.determinism,\n run: ({ expect }) => {\n const wounds = (seed: number): string => {\n const made = fresh({ seed })\n for (let k = 0; k < 12; k++) made.hurt(1)\n return made.state.wounds.join(',')\n }\n expect(wounds(4) === wounds(4), 'the same seed gives the same wounds')\n expect(wounds(4) !== wounds(5), 'another seed gives others')\n },\n },\n ]\n\n const module: PlayerTestModule = {\n id: 'player_area',\n name: text.name,\n ground: { surface: 'dirt' },\n group: text.group,\n get player() {\n return player\n },\n items: () => [],\n controls: () => controls(),\n metrics: () => metrics(),\n scenarios: () => scenarios(),\n attach(lent) {\n host = lent\n last = null\n const off = lent.bench?.onChange(onChange)\n const offFrame = lent.onFrame(frame)\n // the host's body puts its feet down: the footsteps follow it (and what it says is under them)\n const offFeet = lent.on((event) => {\n if (event.type !== 'footfall') return\n footfall = true\n surface = event.surface\n gait = event.gait\n })\n return () => {\n off?.()\n offFrame()\n offFeet()\n host = null\n }\n },\n }\n return module\n}\n"],"mappings":";;;;;AAAA,SAAS,oBAAoB,iBAAiB,YAAY,aAAa,mBAAmB,oBAAoB;;;ACA9G;AAAA,EACE,SAAW;AAAA,IACT,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,SAAW;AAAA,IACX,QAAU;AAAA,IACV,WAAa;AAAA,IACb,SAAW;AAAA,EACb;AAAA,EACA,YAAc,EAAE,UAAY,GAAG,OAAS,GAAG,SAAW,GAAG,YAAc,GAAG,WAAa,GAAG,UAAY,EAAE;AAAA,EACxG,SAAW;AAAA,IACT,WAAa,EAAE,MAAQ,IAAI,OAAS,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE;AAAA,IACnD,YAAc,EAAE,MAAQ,IAAI,OAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE;AAAA,IACpE,UAAY,EAAE,MAAQ,KAAK,OAAS,CAAC,CAAC,WAAW,IAAI,CAAC,EAAE;AAAA,IACxD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A,SAAO;AACT;","names":["id"]}
|
package/dist/hud.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { f as Player } from './player-BRl5ea2y.js';
|
|
2
|
+
import '@adatechnology/game-contracts';
|
|
3
|
+
|
|
4
|
+
/** An infection stage as `Player.stage()` answers it. */
|
|
5
|
+
type InfectionStage = ReturnType<Player['stage']>;
|
|
6
|
+
/** What the HUD shows of a body, read from its state: plain numbers, so a game with its own body fills it too. */
|
|
7
|
+
type PlayerHudView = {
|
|
8
|
+
readonly alive: boolean;
|
|
9
|
+
readonly health: number;
|
|
10
|
+
readonly maxHealth: number;
|
|
11
|
+
readonly stamina: number;
|
|
12
|
+
readonly maxStamina: number;
|
|
13
|
+
readonly bleeding: boolean;
|
|
14
|
+
/** The open wounds by kind, oldest first (`scratch`, `laceration`, `bite`, or a game's own kinds). */
|
|
15
|
+
readonly wounds: readonly string[];
|
|
16
|
+
readonly infection: InfectionStage;
|
|
17
|
+
};
|
|
18
|
+
/** The HUD's view of a `game-player` body now, as a new object (a frame loop refills one with `writePlayerHudView`). */
|
|
19
|
+
declare const playerHudViewOf: (player: Pick<Player, "state" | "derived" | "stage">) => PlayerHudView;
|
|
20
|
+
/** A view the host keeps and refills every frame (`writePlayerHudView`), so the frame allocates nothing. */
|
|
21
|
+
type MutablePlayerHudView = {
|
|
22
|
+
-readonly [K in keyof PlayerHudView]: PlayerHudView[K];
|
|
23
|
+
};
|
|
24
|
+
/** An empty view to refill. */
|
|
25
|
+
declare const createPlayerHudView: () => MutablePlayerHudView;
|
|
26
|
+
/** Writes the body's numbers now into `view` (no allocation) and answers it. */
|
|
27
|
+
declare function writePlayerHudView(player: Pick<Player, 'state' | 'derived' | 'stage'>, view: MutablePlayerHudView): MutablePlayerHudView;
|
|
28
|
+
|
|
29
|
+
/** The weapon in the hand: its name and, for a gun, the rounds as the game writes them (`12 / 48`). */
|
|
30
|
+
type PlayerHudWeapon = {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly ammo?: string;
|
|
33
|
+
};
|
|
34
|
+
type PlayerHudOptions = {
|
|
35
|
+
/** The box the HUD is laid over (the game's canvas box). */
|
|
36
|
+
readonly container: HTMLElement;
|
|
37
|
+
/** `pt-BR` (default) or `en`. */
|
|
38
|
+
readonly locale?: string;
|
|
39
|
+
/** A name shown at the top left (the level, the scenario); absent, nothing there. */
|
|
40
|
+
readonly title?: string;
|
|
41
|
+
};
|
|
42
|
+
type PlayerHud = {
|
|
43
|
+
/** The body's numbers now (call it every frame; it writes the DOM only when a shown value changes). */
|
|
44
|
+
update(view: PlayerHudView): void;
|
|
45
|
+
setTitle(title: string | null): void;
|
|
46
|
+
/** The weapon in the hand, or null when the hand is empty. */
|
|
47
|
+
setWeapon(weapon: PlayerHudWeapon | null): void;
|
|
48
|
+
/** The crosshair is drawn in the first person only (the third person aims with the body). */
|
|
49
|
+
setView(view: 'first' | 'third'): void;
|
|
50
|
+
/** A line at the top centre for `seconds` (the body's `message` events, in `playerTextOf` words). */
|
|
51
|
+
message(text: string, seconds: number): void;
|
|
52
|
+
dispose(): void;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The player's HUD over the game's view (DOM, no three.js): the health and stamina bars with the bleeding, the infection and the wounds under them at the bottom left, the
|
|
56
|
+
* weapon and its rounds at the bottom right, a name at the top left, the body's messages at the top centre and the crosshair in the first person. Small boxes at the edges:
|
|
57
|
+
* the view stays clear, and nothing takes the mouse.
|
|
58
|
+
*/
|
|
59
|
+
declare function createPlayerHud({ container, locale, title }: PlayerHudOptions): PlayerHud;
|
|
60
|
+
|
|
61
|
+
type DeathScreenOptions = {
|
|
62
|
+
readonly container: HTMLElement;
|
|
63
|
+
/** `pt-BR` (default) or `en`. */
|
|
64
|
+
readonly locale?: string;
|
|
65
|
+
/** Seconds after the death before the panel opens: the death camera settles on the body first. Default 1.5. */
|
|
66
|
+
readonly delaySeconds?: number;
|
|
67
|
+
/** Rebuilds the scene from its seed. Enter and R press it too. */
|
|
68
|
+
readonly onRestart: () => void;
|
|
69
|
+
/** Puts the body back at the start with the world as it is. */
|
|
70
|
+
readonly onBackToStart: () => void;
|
|
71
|
+
/** What takes the focus back when the panel shuts (the game's canvas); absent, what had it before the panel opened. */
|
|
72
|
+
readonly returnFocus?: HTMLElement;
|
|
73
|
+
};
|
|
74
|
+
/** The body as the death screen reads it: `game-player`'s `state.alive`, `state.deathTime` and `state.cause`, and the seconds the game ran before the death. */
|
|
75
|
+
type DeathScreenState = {
|
|
76
|
+
readonly alive: boolean;
|
|
77
|
+
/** Seconds since the death. */
|
|
78
|
+
readonly deathTime: number;
|
|
79
|
+
/** The cause id (`killed`, `bled_out`...), shown in `playerTextOf` words. */
|
|
80
|
+
readonly cause?: string;
|
|
81
|
+
readonly survivedSeconds: number;
|
|
82
|
+
};
|
|
83
|
+
type DeathScreen = {
|
|
84
|
+
/** Call it every frame: it opens once the body has been dead `delaySeconds`, and closes when the body is alive again. */
|
|
85
|
+
update(state: DeathScreenState): void;
|
|
86
|
+
readonly isOpen: boolean;
|
|
87
|
+
dispose(): void;
|
|
88
|
+
};
|
|
89
|
+
declare const DEATH_SCREEN_DELAY_SECONDS = 1.5;
|
|
90
|
+
/**
|
|
91
|
+
* The death screen (DOM, no three.js): a panel in the lower third (the death camera keeps the body at the centre) with "you died", the cause, the time survived and two buttons,
|
|
92
|
+
* restart the scene and back to the start. It opens once the death camera has settled, frees the mouse from the pointer lock and focuses the restart button (Enter presses the focused
|
|
93
|
+
* button, R restarts from anywhere), calls each hook once until the body lives again, and gives the focus back when it shuts.
|
|
94
|
+
*/
|
|
95
|
+
declare function createDeathScreen({ container, locale, delaySeconds, onRestart, onBackToStart, returnFocus }: DeathScreenOptions): DeathScreen;
|
|
96
|
+
|
|
97
|
+
/** The words of the player's HUD and of the death screen, in a locale. */
|
|
98
|
+
type PlayerHudText = {
|
|
99
|
+
readonly health: string;
|
|
100
|
+
readonly stamina: string;
|
|
101
|
+
readonly bleeding: string;
|
|
102
|
+
readonly wounds: string;
|
|
103
|
+
readonly infected: string;
|
|
104
|
+
readonly stageMalaise: string;
|
|
105
|
+
readonly stageFever: string;
|
|
106
|
+
readonly stageDelirium: string;
|
|
107
|
+
readonly woundScratch: string;
|
|
108
|
+
readonly woundLaceration: string;
|
|
109
|
+
readonly woundBite: string;
|
|
110
|
+
readonly died: string;
|
|
111
|
+
readonly survived: string;
|
|
112
|
+
readonly restart: string;
|
|
113
|
+
readonly backToStart: string;
|
|
114
|
+
};
|
|
115
|
+
declare const PLAYER_HUD_TEXT: Readonly<Record<'en' | 'pt-BR', PlayerHudText>>;
|
|
116
|
+
/** The HUD's words for a locale (`pt-BR` or `en`, the language part is enough; anything else is `pt-BR`). */
|
|
117
|
+
declare const playerHudTextOf: (locale?: string) => PlayerHudText;
|
|
118
|
+
/** A wound kind in words; a kind the table does not know (a game's own) comes back as it is. */
|
|
119
|
+
declare const woundTextOf: (text: PlayerHudText, kind: string) => string;
|
|
120
|
+
/** An infection stage in words (`none` gives an empty text). */
|
|
121
|
+
declare const stageTextOf: (text: PlayerHudText, stage: string) => string;
|
|
122
|
+
/** Seconds as `m:ss` (or `h:mm:ss` past the hour). */
|
|
123
|
+
declare const formatSurvived: (seconds: number) => string;
|
|
124
|
+
|
|
125
|
+
declare const PLAYER_HUD_CSS = "\n.gp-hud{position:absolute;inset:0;pointer-events:none;font:12px/1.35 system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif;color:#e8eaee;overflow:hidden;z-index:10}\n.gp-hud *{box-sizing:border-box}\n.gp-hud-pill{background:rgba(10,12,16,.72);padding:4px 12px;border-radius:6px;font-size:14px;font-weight:600}\n.gp-hud-pill small{font-weight:400;opacity:.8;margin-left:8px}\n.gp-hud-title{position:absolute;top:8px;left:8px;display:none}\n.gp-hud-message{position:absolute;top:8px;left:50%;transform:translateX(-50%);max-width:60vw;text-align:center;color:#ffd23f;text-shadow:0 1px 2px #000;font-size:14px;font-weight:600;display:none}\n.gp-hud-vitals{position:absolute;left:8px;bottom:8px;width:210px;background:rgba(10,12,16,.72);border-radius:6px;padding:6px 8px;display:flex;flex-direction:column;gap:4px}\n.gp-hud-row{display:grid;grid-template-columns:62px 1fr 30px;align-items:center;gap:6px}\n.gp-hud-row span:first-child{color:#9aa3b2}\n.gp-hud-row output{text-align:right;font-variant-numeric:tabular-nums}\n.gp-hud-bar{height:7px;background:#2a2e36;border-radius:4px;overflow:hidden}\n.gp-hud-bar i{display:block;height:100%;width:0;background:#4fc3f7}\n.gp-hud-bar.hp i{background:#66bb6a}.gp-hud-bar.warn i{background:#ffb300}.gp-hud-bar.bad i{background:#ef5350}\n.gp-hud-status{display:flex;flex-wrap:wrap;gap:4px}\n.gp-hud-status:empty{display:none}\n.gp-hud-tag{border-radius:4px;padding:0 6px;background:#2a2e36}\n.gp-hud-tag.bad{background:rgba(183,28,28,.9);color:#fff}.gp-hud-tag.warn{background:rgba(120,90,10,.9);color:#fff}\n.gp-hud-weapon{position:absolute;right:8px;bottom:8px;display:none}\n.gp-hud-cross{position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-9px 0 0 -9px;display:none}\n.gp-hud-cross:before,.gp-hud-cross:after{content:\"\";position:absolute;background:#fff;opacity:.85;box-shadow:0 0 2px #000}\n.gp-hud-cross:before{left:8px;top:0;width:2px;height:18px}.gp-hud-cross:after{top:8px;left:0;height:2px;width:18px}\n.gp-hud-cross i{position:absolute;left:6px;top:6px;width:6px;height:6px;background:#0b0c0e;border-radius:50%;z-index:1}\n.gp-death{position:absolute;inset:0;display:none;align-items:flex-end;justify-content:center;padding-bottom:12vh;background:linear-gradient(transparent 45%,rgba(0,0,0,.55));font:13px/1.4 system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif;color:#e8eaee;z-index:20}\n.gp-death.open{display:flex}\n.gp-death-panel{min-width:min(320px,90vw);max-width:90vw;background:rgba(12,14,19,.92);border:1px solid #2c313b;border-radius:8px;padding:18px 22px;text-align:center;box-shadow:0 4px 18px rgba(0,0,0,.5)}\n.gp-death-panel h2{margin:0 0 6px;font-size:22px;color:#ef5350}\n.gp-death-panel p{margin:2px 0;color:#9aa3b2}\n.gp-death-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:14px}\n.gp-death-actions button{background:#232831;border:1px solid #3a404c;color:#e8eaee;border-radius:5px;padding:6px 14px;cursor:pointer;font:inherit}\n.gp-death-actions button:hover,.gp-death-actions button:focus-visible{background:#2d3440;border-color:#ffd23f}\n.gp-death-actions button:disabled{opacity:.5;cursor:default}\n.gp-death-actions kbd{background:#2a2e36;border:1px solid #4a505c;border-radius:3px;padding:0 4px;font:inherit;font-weight:700;margin-left:6px}\n";
|
|
126
|
+
|
|
127
|
+
export { DEATH_SCREEN_DELAY_SECONDS, type DeathScreen, type DeathScreenOptions, type DeathScreenState, type InfectionStage, type MutablePlayerHudView, PLAYER_HUD_CSS, PLAYER_HUD_TEXT, type PlayerHud, type PlayerHudOptions, type PlayerHudText, type PlayerHudView, type PlayerHudWeapon, createDeathScreen, createPlayerHud, createPlayerHudView, formatSurvived, playerHudTextOf, playerHudViewOf, stageTextOf, woundTextOf, writePlayerHudView };
|