@adatechnology/game-player 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/{chunk-TFDLGOOE.js → chunk-EN2Z57NX.js} +20 -8
- package/dist/chunk-EN2Z57NX.js.map +1 -0
- package/dist/hud.d.ts +1 -1
- package/dist/index.d.ts +157 -6
- package/dist/index.global.js +226 -11
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +208 -5
- package/dist/index.js.map +1 -1
- package/dist/{player-Bjhc2M8F.d.ts → player-B-CNsXV5.d.ts} +15 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +4 -2
- package/dist/chunk-TFDLGOOE.js.map +0 -1
package/README.md
CHANGED
|
@@ -99,3 +99,17 @@ weapon hand, and the weapon stays in its hand; one of both hands (a big thing ca
|
|
|
99
99
|
the hip for a pistol, a sling on the back for a rifle) and, with none, drops it to the ground. A two-handed weapon (a rifle, a shotgun) leaves no hand free, so any interaction puts it
|
|
100
100
|
away or drops it. `drawBackOf(plan)` says what comes back to the hands when the interaction ends: what was put away, never what fell. `interactionHandsFor({ massKg, size })` says
|
|
101
101
|
whether a thing goes in one hand (up to 4 kg and 0.7 m, `HANDS_DEFAULTS`). The hands and slot of each weapon come from `weaponHandsOf` of `@adatechnology/game-weapons`.
|
|
102
|
+
|
|
103
|
+
A long gun on its sling (owner, 2026-11-25) is not dropped: its slot is `sling` (`move: 'sling'`), it hangs on the body and stays there after the interaction until the player
|
|
104
|
+
brings it back; with no sling worn it goes to the next slot that takes it (`SLOT_FALLBACKS`: the back). Every move is seen: `planTakeSequence(plan)` lays the steps (each weapon
|
|
105
|
+
`stow`, `sling` or `drop`, the off hand first, then `reach`, `close`, `lift`; `HANDS_TIMING` in seconds), `planDrawSequence(moves)` the way back (`draw`), and
|
|
106
|
+
`createTakeTimeline(sequence).advance(dt)` says which steps began and ended in the host's frame and how far into the current one (eased). `gripOfItem(size, hand)` is how a hand closes on
|
|
107
|
+
a thing: its longest side through the fist along the thumb, its thinnest across the palm, its middle a palm's thickness plus half that side under the middle of the palm, the
|
|
108
|
+
fingers closed by its thickness; `itemPoseInHand(hand, grip)` and `handPoseOnItem(item, grip)` turn one into the other (the hand reaches the thing where it lies, and carries it in the
|
|
109
|
+
palm). The pose algebra they use is exported too (`composePose`, `poseHolding`, `blendPoses`, `quaternionOfBasis`).
|
|
110
|
+
|
|
111
|
+
## Walking by the physics controller (spec 008, T4.1)
|
|
112
|
+
|
|
113
|
+
`createPhysicsController(world, { position, collider })` (over `PhysicsWorld.createCharacter` of `@adatechnology/game-physics`) goes in `PlayerWorld.controller`
|
|
114
|
+
(`move`, `read`, `teleport`): the player's `x`, `y`, `z` are then the controller's feet, steps up to 18 cm, climbs 30 degrees, pushes a 30 kg crate and is pushed, and `blocked`
|
|
115
|
+
is not asked. Call `player.update(h, input)` in the loop's `beforeStep` (the `actors` phase) with the fixed step, not the frame's `dt`. Without a controller the grid walk is unchanged.
|
|
@@ -231,6 +231,7 @@ function createPlayer(options = {}) {
|
|
|
231
231
|
const fist = options.fist ?? PLAYER_DEFAULTS.fist;
|
|
232
232
|
const listeners = /* @__PURE__ */ new Map();
|
|
233
233
|
let P = freshState(derived, options.position);
|
|
234
|
+
const feet = new Float64Array(3);
|
|
234
235
|
let defaultWorld = options.world ?? {};
|
|
235
236
|
let world = defaultWorld;
|
|
236
237
|
const emit = (event, payload) => {
|
|
@@ -464,9 +465,10 @@ function createPlayer(options = {}) {
|
|
|
464
465
|
const k = 1 - P.vaultTimer / numbers.vaultSeconds;
|
|
465
466
|
P.x = lerp(P.vault[0], P.vault[2], k);
|
|
466
467
|
P.z = lerp(P.vault[1], P.vault[3], k);
|
|
467
|
-
P.y = Math.sin(k * Math.PI) * numbers.vaultHeight;
|
|
468
|
+
P.y = feet[1] + Math.sin(k * Math.PI) * numbers.vaultHeight;
|
|
468
469
|
if (P.vaultTimer <= 0) {
|
|
469
|
-
P.y =
|
|
470
|
+
P.y = feet[1];
|
|
471
|
+
world.controller?.teleport(P.x, P.y, P.z);
|
|
470
472
|
noise(P.x, P.z, numbers.vaultNoise);
|
|
471
473
|
const surface = surfaceHere();
|
|
472
474
|
sound("step", numbers.vaultLandVolume, [landSoundId(surface, 0)], surface);
|
|
@@ -518,11 +520,20 @@ function createPlayer(options = {}) {
|
|
|
518
520
|
const tvz = want ? mz / ml * sp : 0;
|
|
519
521
|
P.vx = lerp(P.vx, tvx, Math.min(1, dt * numbers.acceleration));
|
|
520
522
|
P.vz = lerp(P.vz, tvz, Math.min(1, dt * numbers.acceleration));
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
523
|
+
const controller = world.controller;
|
|
524
|
+
if (controller) {
|
|
525
|
+
controller.move(P.vx, P.vz, dt);
|
|
526
|
+
controller.read(feet);
|
|
527
|
+
P.x = feet[0] ?? P.x;
|
|
528
|
+
P.y = feet[1] ?? P.y;
|
|
529
|
+
P.z = feet[2] ?? P.z;
|
|
530
|
+
} else {
|
|
531
|
+
const r = numbers.radius * heightScale;
|
|
532
|
+
const nx = P.x + P.vx * dt;
|
|
533
|
+
const nz = P.z + P.vz * dt;
|
|
534
|
+
if (!blocked(nx + Math.sign(P.vx) * r, P.z)) P.x = nx;
|
|
535
|
+
if (!blocked(P.x, nz + Math.sign(P.vz) * r)) P.z = nz;
|
|
536
|
+
}
|
|
526
537
|
world.afterMove?.(P);
|
|
527
538
|
if (crowd) {
|
|
528
539
|
const n = crowd.count();
|
|
@@ -631,6 +642,7 @@ function createPlayer(options = {}) {
|
|
|
631
642
|
save: () => ({ state: structuredClone(P), attributes }),
|
|
632
643
|
load(save) {
|
|
633
644
|
P = structuredClone(save.state);
|
|
645
|
+
world.controller?.teleport(P.x, P.y, P.z);
|
|
634
646
|
},
|
|
635
647
|
setWorld(next) {
|
|
636
648
|
defaultWorld = next;
|
|
@@ -1032,4 +1044,4 @@ export {
|
|
|
1032
1044
|
createPlayer,
|
|
1033
1045
|
createPlayerTestModule
|
|
1034
1046
|
};
|
|
1035
|
-
//# sourceMappingURL=chunk-
|
|
1047
|
+
//# sourceMappingURL=chunk-EN2Z57NX.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 // the controller's feet, read every step it walks: a vault lifts the body over them\n const feet = new Float64Array(3)\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 = feet[1] + Math.sin(k * Math.PI) * numbers.vaultHeight\n if (P.vaultTimer <= 0) {\n P.y = feet[1]\n world.controller?.teleport(P.x, P.y, P.z)\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 controller = world.controller\n if (controller) {\n controller.move(P.vx, P.vz, dt)\n controller.read(feet)\n P.x = feet[0] ?? P.x\n P.y = feet[1] ?? P.y\n P.z = feet[2] ?? P.z\n } else {\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 }\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 world.controller?.teleport(P.x, P.y, P.z)\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,WAAa,EAAE,MAAQ,KAAK,OAAS,CAAC,EAAE;AAAA,IACxC,eAAiB,EAAE,MAAQ,KAAK,OAAS,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,QAAU,IAAI;AAAA,IAC1E,WAAa,EAAE,MAAQ,IAAI,OAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,EAAE;AAAA,EACtE;AAAA,EACA,QAAU;AAAA,IACR,SAAW,EAAE,OAAS,KAAK,iBAAmB,MAAM,QAAU,MAAM;AAAA,IACpE,YAAc,EAAE,OAAS,KAAK,iBAAmB,MAAM,QAAU,KAAK;AAAA,IACtE,MAAQ,EAAE,OAAS,KAAK,iBAAmB,GAAG,QAAU,KAAK;AAAA,EAC/D;AAAA,EACA,WAAa;AAAA,IACX,cAAgB;AAAA,IAChB,iBAAmB;AAA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ED
|
@@ -1,8 +1,36 @@
|
|
|
1
|
-
import { a as PlayerMessageId, K as KnownDeathCause } from './player-
|
|
2
|
-
export { A as AttributeId,
|
|
1
|
+
import { a as PlayerCollider, b as PlayerController, c as PlayerMessageId, K as KnownDeathCause } from './player-B-CNsXV5.js';
|
|
2
|
+
export { A as AttributeId, d as Attributes, D as DeathCause, e as Derived, f as DerivedFormulas, g as DerivedId, I as InfectionRule, L as LinearFormula, M as MeleeItem, h as PLAYER_DEFAULTS, P as Player, i as PlayerAction, j as PlayerCrowd, k as PlayerEvent, l as PlayerEventMap, m as PlayerEventName, n as PlayerInput, o as PlayerNumbers, p as PlayerOptions, q as PlayerSave, r as PlayerSoundId, s as PlayerState, t as PlayerWorld, W as WoundRule, u as WoundTable, v as createPlayer, w as deriveVitals, x as drawWound } from './player-B-CNsXV5.js';
|
|
3
|
+
import { Vec3, CharacterId, PhysicsWorld } from '@adatechnology/game-physics';
|
|
3
4
|
import { SurfaceId } from '@adatechnology/game-contracts';
|
|
4
5
|
export { PlayerTestModule, PlayerTestModuleOptions, createPlayerTestModule } from './testing.js';
|
|
5
6
|
|
|
7
|
+
/** The part of the physics contract the player's body uses: any `PhysicsWorld` (or the loop's `SeamWorld`) has it. */
|
|
8
|
+
type PlayerPhysicsWorld = Pick<PhysicsWorld, 'createCharacter' | 'moveCharacter' | 'pushCharacter' | 'readCharacter' | 'teleportCharacter' | 'removeCharacter' | 'characterSupported'>;
|
|
9
|
+
type PhysicsControllerOptions = {
|
|
10
|
+
/** Where the feet are. */
|
|
11
|
+
readonly position: Vec3;
|
|
12
|
+
/** What `player.collider()` says: the capsule is made as tall and as wide as the standing body. */
|
|
13
|
+
readonly collider: PlayerCollider;
|
|
14
|
+
/** Kilograms, default 75. */
|
|
15
|
+
readonly mass?: number;
|
|
16
|
+
/** Most force (N) it pushes a prop with, default 400: a 30 kg crate over wood, not a wardrobe. */
|
|
17
|
+
readonly strength?: number;
|
|
18
|
+
};
|
|
19
|
+
type PhysicsPlayerController = PlayerController & {
|
|
20
|
+
readonly id: CharacterId;
|
|
21
|
+
/** Shoves the body: `impulse` in N s (a blow, a blast, a car's bumper); the controller feels it as impulse / mass, fading in a quarter of a second. */
|
|
22
|
+
push(impulse: Vec3): void;
|
|
23
|
+
supported(): boolean;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
};
|
|
26
|
+
declare const PLAYER_MASS_KG = 75;
|
|
27
|
+
declare const PLAYER_PUSH_STRENGTH_NEWTONS = 400;
|
|
28
|
+
/**
|
|
29
|
+
* The player's controller in a physics world: a capsule as tall as the standing body (a crouch does not shrink it) that steps up, climbs, pushes props and is
|
|
30
|
+
* pushed. Put it in `PlayerWorld.controller` and call `player.update(h, input)` from a `beforeStep(h)` of the loop's `actors` phase, never with the frame's `dt`.
|
|
31
|
+
*/
|
|
32
|
+
declare const createPhysicsController: (world: PlayerPhysicsWorld, options: PhysicsControllerOptions) => PhysicsPlayerController;
|
|
33
|
+
|
|
6
34
|
/** Deterministic mulberry32 generator; returns floats in [0, 1). */
|
|
7
35
|
declare function createRng(seed: number): () => number;
|
|
8
36
|
|
|
@@ -207,6 +235,8 @@ declare function createDoorUse(rules?: Partial<DoorUseRules>): DoorUse;
|
|
|
207
235
|
* hold the weapon, and the weapon stays in its hand; one of both hands (a big thing carried, a push, a climb) first puts the weapon away in a slot of the body that takes it
|
|
208
236
|
* (a holster at the hip, a sling or back slot for a long gun) and, with none, lets it fall to the ground. A two-handed weapon (a rifle, a shotgun) leaves no hand free, so any
|
|
209
237
|
* interaction puts it away or drops it. When the interaction ends, what was put away comes back to its hand; what fell stays on the ground.
|
|
238
|
+
* A long gun on its sling (decision of the owner, 2026-11-25) is not put away: it swings onto the sling and hangs on the body (`sling`), and stays there after the interaction until
|
|
239
|
+
* the player brings it back to the hands; with no sling worn it goes to the next slot that takes it (`SLOT_FALLBACKS`: the back).
|
|
210
240
|
* Engine-agnostic: the host says what is in each hand and which slots the body wears; this says which hand acts and what happens to each weapon.
|
|
211
241
|
*/
|
|
212
242
|
/** `R` the weapon hand, `L` the other one. */
|
|
@@ -225,11 +255,19 @@ interface HandsRules {
|
|
|
225
255
|
};
|
|
226
256
|
}
|
|
227
257
|
declare const HANDS_DEFAULTS: HandsRules;
|
|
228
|
-
/**
|
|
258
|
+
/** The slot a weapon goes to when the body wears none of its own: a long gun with no sling goes across the back. */
|
|
259
|
+
declare const SLOT_FALLBACKS: Readonly<Record<string, readonly string[]>>;
|
|
260
|
+
/** The slot of a long gun that hangs on its sling. */
|
|
261
|
+
declare const SLING_SLOT = "sling";
|
|
262
|
+
/**
|
|
263
|
+
* What a weapon does when the hands are wanted: `holster` goes to `slot` and comes back after; `sling` hangs on the body by its sling and stays there until it is brought back;
|
|
264
|
+
* `drop` falls to the ground and stays there.
|
|
265
|
+
*/
|
|
266
|
+
type HandsMoveKind = 'holster' | 'sling' | 'drop';
|
|
229
267
|
interface HandsMove {
|
|
230
268
|
readonly hand: BodyHand;
|
|
231
269
|
readonly weapon: string;
|
|
232
|
-
readonly move:
|
|
270
|
+
readonly move: HandsMoveKind;
|
|
233
271
|
readonly slot?: string;
|
|
234
272
|
}
|
|
235
273
|
interface HandsPlan {
|
|
@@ -248,6 +286,8 @@ interface PlanHandsParams {
|
|
|
248
286
|
};
|
|
249
287
|
/** The slots the body wears and that are empty (a holster, a sling); one weapon each. */
|
|
250
288
|
readonly slots: readonly string[];
|
|
289
|
+
/** The slots tried when a weapon's own is not worn; default `SLOT_FALLBACKS`. */
|
|
290
|
+
readonly fallbacks?: Readonly<Record<string, readonly string[]>>;
|
|
251
291
|
}
|
|
252
292
|
/** How many hands it takes to carry a thing of `massKg` and `size` (metres, any order). */
|
|
253
293
|
declare function interactionHandsFor(thing: {
|
|
@@ -256,12 +296,123 @@ declare function interactionHandsFor(thing: {
|
|
|
256
296
|
}, rules?: HandsRules): 1 | 2;
|
|
257
297
|
/** Which hand acts and what happens to each weapon in the way. */
|
|
258
298
|
declare function planHands(params: PlanHandsParams): HandsPlan;
|
|
259
|
-
/** What comes back to the hands once the interaction ends: the weapons that were put away, each to its hand; the
|
|
299
|
+
/** What comes back to the hands once the interaction ends: the weapons that were put away, each to its hand; the slung ones stay on the sling and the dropped ones on the ground. */
|
|
260
300
|
declare function drawBackOf(plan: HandsPlan): readonly {
|
|
261
301
|
readonly hand: BodyHand;
|
|
262
302
|
readonly weapon: string;
|
|
263
303
|
}[];
|
|
264
304
|
|
|
305
|
+
/**
|
|
306
|
+
* The little pose algebra the hands need, engine-agnostic: a pose is a position and a unit quaternion `[x, y, z, w]` (local to world), as `HandPose` of game-contracts.
|
|
307
|
+
*/
|
|
308
|
+
type Vec3Tuple = readonly [number, number, number];
|
|
309
|
+
type QuatTuple = readonly [number, number, number, number];
|
|
310
|
+
interface Pose {
|
|
311
|
+
readonly position: Vec3Tuple;
|
|
312
|
+
readonly quaternion: QuatTuple;
|
|
313
|
+
}
|
|
314
|
+
/** The rotation whose local x, y and z go to `x`, `y` and `z` (an orthonormal, right-handed basis). */
|
|
315
|
+
declare function quaternionOfBasis(x: readonly number[], y: readonly number[], z: readonly number[]): [number, number, number, number];
|
|
316
|
+
declare function multiplyQuaternions(a: QuatTuple, b: QuatTuple): [number, number, number, number];
|
|
317
|
+
declare function conjugateQuaternion(q: QuatTuple): [number, number, number, number];
|
|
318
|
+
declare function rotateVector(q: QuatTuple, v: Vec3Tuple): [number, number, number];
|
|
319
|
+
/** `parent` then `local`: the pose of a thing given in the frame of `parent`. */
|
|
320
|
+
declare function composePose(parent: Pose, local: Pose): Pose;
|
|
321
|
+
/** The pose whose frame puts `local` at `world`: `composePose(result, local)` is `world`. */
|
|
322
|
+
declare function poseHolding(world: Pose, local: Pose): Pose;
|
|
323
|
+
/** Between `a` (k 0) and `b` (k 1): the position on the line, the turn the short way round. */
|
|
324
|
+
declare function blendPoses(a: Pose, b: Pose, k: number): Pose;
|
|
325
|
+
/** Slow in, slow out: a hand speeds up off its start and settles on its target. */
|
|
326
|
+
declare function easeInOut(t: number): number;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* How a hand closes on a thing it picks up (decision of the owner, 2026-11-25: the hand on the thing's real grip, the fingers closed around it, the thing in the palm, aligned with
|
|
330
|
+
* the hand in both views). Engine-agnostic: the thing is its box (`size`, metres, in its own frame), the hand frame is the one of `HandTargets`: +x along the fingers, +y the back
|
|
331
|
+
* of the hand, the thumb at -z for a right hand and +z for a left one. The thing's longest side runs through the fist along the thumb (a bottle stands up in a hand held thumb up),
|
|
332
|
+
* its thinnest side across the palm (the palm lies on its broad face), and its middle sits a palm's thickness plus half that side under the middle of the palm.
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
declare const ITEM_GRIP: {
|
|
336
|
+
/** Half the thickness of a palm (m): what lies between the middle of the palm and the thing. */
|
|
337
|
+
readonly palm: 0.011;
|
|
338
|
+
/** The closure of the fingers (0 open, 1 a fist) on a thing this thick (m) or thinner. */
|
|
339
|
+
readonly fistAt: 0.03;
|
|
340
|
+
readonly closed: 0.95;
|
|
341
|
+
/** How much the closure opens per metre the thing is thicker than `fistAt`, and the most it opens to. */
|
|
342
|
+
readonly openPerMetre: 4;
|
|
343
|
+
readonly open: 0.35;
|
|
344
|
+
/** The fingers before they close on it, as the hand comes to the thing. */
|
|
345
|
+
readonly reaching: 0.15;
|
|
346
|
+
};
|
|
347
|
+
interface ItemGrip {
|
|
348
|
+
/** The thing's middle and turn in the frame of the hand. */
|
|
349
|
+
readonly local: Pose;
|
|
350
|
+
/** How closed the fingers are on it (`HandTargets.grip`). */
|
|
351
|
+
readonly grip: number;
|
|
352
|
+
}
|
|
353
|
+
/** The grip of a hand on a thing of box `size` (its own frame, metres). */
|
|
354
|
+
declare function gripOfItem(size: readonly number[], hand: BodyHand): ItemGrip;
|
|
355
|
+
/** Where the thing is with the hand at `hand` holding it by `grip`. */
|
|
356
|
+
declare function itemPoseInHand(hand: Pose, grip: ItemGrip): Pose;
|
|
357
|
+
/** Where the hand goes to take the thing where it lies (`item`, its middle and turn) by `grip`. */
|
|
358
|
+
declare function handPoseOnItem(item: Pose, grip: ItemGrip): Pose;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* The hands take a thing in steps one can see (decision of the owner, 2026-11-25): first each weapon in the way goes off the hands (`stow` to its holster, `sling` onto its sling, or
|
|
362
|
+
* `drop`: tossed to the ground), then the hand `reach`es the thing's grip, the fingers `close` on it, and it is `lift`ed to where it is carried. A weapon comes back to the hands the
|
|
363
|
+
* same way round (`draw`). Engine-agnostic and clock-free: the host advances it by its own frame's `dt` and does what each step says.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
/** Seconds each step takes. */
|
|
367
|
+
interface HandsTiming {
|
|
368
|
+
readonly stow: number;
|
|
369
|
+
readonly sling: number;
|
|
370
|
+
readonly drop: number;
|
|
371
|
+
readonly reach: number;
|
|
372
|
+
readonly close: number;
|
|
373
|
+
readonly lift: number;
|
|
374
|
+
readonly draw: number;
|
|
375
|
+
}
|
|
376
|
+
declare const HANDS_TIMING: HandsTiming;
|
|
377
|
+
type TakeStepKind = 'stow' | 'sling' | 'drop' | 'reach' | 'close' | 'lift' | 'draw';
|
|
378
|
+
interface TakeStep {
|
|
379
|
+
readonly kind: TakeStepKind;
|
|
380
|
+
/** The weapon the step moves (`stow`, `sling`, `drop`, `draw`). */
|
|
381
|
+
readonly move?: HandsMove;
|
|
382
|
+
readonly start: number;
|
|
383
|
+
readonly end: number;
|
|
384
|
+
}
|
|
385
|
+
interface TakeSequence {
|
|
386
|
+
readonly steps: readonly TakeStep[];
|
|
387
|
+
readonly duration: number;
|
|
388
|
+
}
|
|
389
|
+
/** The steps of taking a thing with `plan`: the weapons off the hands (the off hand first), then reach, close and lift. `take` false leaves the thing out (a push). */
|
|
390
|
+
declare function planTakeSequence(plan: HandsPlan, options?: {
|
|
391
|
+
readonly timing?: HandsTiming;
|
|
392
|
+
readonly take?: boolean;
|
|
393
|
+
}): TakeSequence;
|
|
394
|
+
/** The steps of bringing weapons back to the hands, one after the other. */
|
|
395
|
+
declare function planDrawSequence(moves: readonly HandsMove[], timing?: HandsTiming): TakeSequence;
|
|
396
|
+
interface TakeProgress {
|
|
397
|
+
/** The step going on now, null once the sequence is over. */
|
|
398
|
+
readonly step: TakeStep | null;
|
|
399
|
+
/** How far into it, 0..1, eased (slow in, slow out). */
|
|
400
|
+
readonly progress: number;
|
|
401
|
+
/** The steps that began during this advance, in order. */
|
|
402
|
+
readonly started: readonly TakeStep[];
|
|
403
|
+
/** The steps that ended during this advance, in order. */
|
|
404
|
+
readonly ended: readonly TakeStep[];
|
|
405
|
+
readonly done: boolean;
|
|
406
|
+
}
|
|
407
|
+
interface TakeTimeline {
|
|
408
|
+
readonly sequence: TakeSequence;
|
|
409
|
+
/** Seconds since it began. */
|
|
410
|
+
readonly time: number;
|
|
411
|
+
/** Moves the timeline on by `dt` seconds (the host's frame). The first call with 0 starts the first step. */
|
|
412
|
+
advance(dt: number): TakeProgress;
|
|
413
|
+
}
|
|
414
|
+
declare function createTakeTimeline(sequence: TakeSequence): TakeTimeline;
|
|
415
|
+
|
|
265
416
|
/**
|
|
266
417
|
* Draws a body that moves in fixed steps between two of them: remember the last two step poses, blend by the scheduler's `alpha` (CLAUDE.md §15).
|
|
267
418
|
* Drawn at the step pose, a body moves 0, 1 or 2 steps per frame at a display that is not the step's rate: it stutters.
|
|
@@ -288,4 +439,4 @@ declare const STEP_POSE_DEFAULTS: {
|
|
|
288
439
|
};
|
|
289
440
|
declare function createStepPose(start: StepPosition, options?: StepPoseOptions): StepPose;
|
|
290
441
|
|
|
291
|
-
export { type BodyHand, DOOR_ARM_REACH, DOOR_SHOULDER_HEIGHT, DOOR_USE_DEFAULTS, type DoorUse, type DoorUseBlock, type DoorUseHand, type DoorUsePhase, type DoorUseRules, type DoorUseStep, type DoorUseTarget, type DragMark, FURNITURE_PUSH_DEFAULTS, type FurniturePush, type FurniturePushBlock, type FurniturePushInput, type FurniturePushLoad, type FurniturePushPhase, type FurniturePushRules, type FurniturePushStep, type FurniturePushTarget, HANDS_DEFAULTS, type HandWeapon, type HandsMove, type HandsPlan, type HandsRules, KnownDeathCause, PLAYER_TEXT, type PlanHandsParams, PlayerMessageId, type PlayerText, STEP_POSE_DEFAULTS, type StepPose, type StepPoseOptions, type StepPosition, canPush, createDoorUse, createFurniturePush, createRng, createStepPose, dragMarkFor, drawBackOf, frictionFor, gripSecondsFor, interactionHandsFor, planHands, playerTextOf, pushAccelerationFor, pushSpeedFor, slipsOnTop, swingSecondsFor };
|
|
442
|
+
export { type BodyHand, DOOR_ARM_REACH, DOOR_SHOULDER_HEIGHT, DOOR_USE_DEFAULTS, type DoorUse, type DoorUseBlock, type DoorUseHand, type DoorUsePhase, type DoorUseRules, type DoorUseStep, type DoorUseTarget, type DragMark, FURNITURE_PUSH_DEFAULTS, type FurniturePush, type FurniturePushBlock, type FurniturePushInput, type FurniturePushLoad, type FurniturePushPhase, type FurniturePushRules, type FurniturePushStep, type FurniturePushTarget, HANDS_DEFAULTS, HANDS_TIMING, type HandWeapon, type HandsMove, type HandsMoveKind, type HandsPlan, type HandsRules, type HandsTiming, ITEM_GRIP, type ItemGrip, KnownDeathCause, PLAYER_MASS_KG, PLAYER_PUSH_STRENGTH_NEWTONS, PLAYER_TEXT, type PhysicsControllerOptions, type PhysicsPlayerController, type PlanHandsParams, PlayerCollider, PlayerController, PlayerMessageId, type PlayerPhysicsWorld, type PlayerText, type Pose, type QuatTuple, SLING_SLOT, SLOT_FALLBACKS, STEP_POSE_DEFAULTS, type StepPose, type StepPoseOptions, type StepPosition, type TakeProgress, type TakeSequence, type TakeStep, type TakeStepKind, type TakeTimeline, type Vec3Tuple, blendPoses, canPush, composePose, conjugateQuaternion, createDoorUse, createFurniturePush, createPhysicsController, createRng, createStepPose, createTakeTimeline, dragMarkFor, drawBackOf, easeInOut, frictionFor, gripOfItem, gripSecondsFor, handPoseOnItem, interactionHandsFor, itemPoseInHand, multiplyQuaternions, planDrawSequence, planHands, planTakeSequence, playerTextOf, poseHolding, pushAccelerationFor, pushSpeedFor, quaternionOfBasis, rotateVector, slipsOnTop, swingSecondsFor };
|