@korial29/tiny-fps 0.165.1 → 0.166.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.
@@ -0,0 +1,33 @@
1
+ import type { PlayerState } from '../shared/types';
2
+ import type { Floor } from './gait';
3
+ import type { Pose } from './rig';
4
+ /** How far the xenomorph's foot is tipped down from flat on its ball, radians: steep, the arch of its sole showing. */
5
+ export declare const FOOT_UP = 1;
6
+ /** Floor speeds, m/s: past the first it drops on all fours (a sprint: its run is 6.6), under the second it stands again. */
7
+ export declare const DROP: number, RISE: number;
8
+ /**
9
+ * The gaits, per paw (hind left, hind right, fore left, fore right): where in the stride it touches
10
+ * down and the share of the stride it stays down. GALLOP is a cheetah's rotary gallop: the hind
11
+ * pair a beat apart and the fore pair the other way round, a flight between them with the back
12
+ * stretched out and one after with it gathered, the fore paws down for less time. CRAWL is a
13
+ * lizard's trot: the diagonal pairs together, the body bending side to side between them.
14
+ */
15
+ export declare const GALLOP: {
16
+ at: number[];
17
+ duty: number[];
18
+ };
19
+ export declare const CRAWL: {
20
+ at: number[];
21
+ duty: number[];
22
+ };
23
+ export interface Fours {
24
+ /** Moves to the state `p` after dt seconds; `floor` is the height of the ground under a point. */
25
+ update(p: PlayerState, dt: number, floor?: Floor): void;
26
+ /** `pose` with the body on all fours laid over it, as far as it has blended in. */
27
+ apply(pose: Pose): Pose;
28
+ /** How far on all fours, 0 to 1. */
29
+ readonly weight: number;
30
+ /** The stride's phase, in cycles. */
31
+ readonly phase: number;
32
+ }
33
+ export declare const createFours: () => Fours;
@@ -1,6 +1,7 @@
1
1
  import type { Choice, PlayerState, Rover } from '../shared/types';
2
2
  import type { World } from '../shared/world';
3
3
  import type { Gait, Seat } from './gait';
4
+ import type { Fours } from './fours';
4
5
  import type { Pieces } from './store';
5
6
  import type { Tracer } from './beams';
6
7
  import type { Piece } from './limbs';
@@ -14,6 +15,8 @@ export interface Runner {
14
15
  /** The player as last seen. */
15
16
  p: PlayerState;
16
17
  gait: Gait;
18
+ /** The xenomorph's gait on all fours (fours.ts): none for the others. */
19
+ fours?: Fours;
17
20
  /** How much of a dash it is in, eased from 0 to 1: the length of the streaks. */
18
21
  dash: number;
19
22
  /** Seconds since its last shot, and how far its gun arm is raised to aim, eased from 0 to 1. */
@@ -133,7 +136,6 @@ export declare const fried: (p: PlayerState) => number;
133
136
  * thins to nothing.
134
137
  */
135
138
  export declare const dissolve: (out: Out, from: number, k: number) => void;
136
- /** The runner's pose this frame, solved: the gait, the fall and sink of one down, and the weapon's hold; and the way the body faces. */
137
139
  export declare const stance: (r: Runner) => {
138
140
  s: {
139
141
  pos: Vec3[];
@@ -53,9 +53,9 @@ export declare const backOf: (lod: number) => Back;
53
53
  * on (the back's is in the skin, backOf()), each vertebra a bead pinched at its joints with a spine
54
54
  * standing out of it but near the tip, as bonesOf() bends and sways it; the stinger at its end, a
55
55
  * blade swelling to a barb, then a point, glowing in the team's `color`. Written straight into
56
- * `out`. `lod` 0 far, 1 near, 3 close.
56
+ * `out`. `lod` 0 far, 1 near, 3 close. `fours` (0 to 1): how far the body is on all fours (fours.ts).
57
57
  */
58
- export declare const tail: (out: Out, s: Solved, t: number, run: number, sting: number, color: number[], lod: number) => void;
58
+ export declare const tail: (out: Out, s: Solved, t: number, run: number, sting: number, color: number[], lod: number, fours?: number) => void;
59
59
  /** Bone: its claws and teeth, nothing else. */
60
60
  export declare const BONE: number[];
61
61
  /** Where the metatarsal (the foot) ends, from the ankle, in the foot joint's frame: longer than the rig's foot. */
@@ -7,6 +7,8 @@ export declare const TAU: number;
7
7
  export declare const norm: (a: number) => number;
8
8
  /** Unit vector the player faces at yaw, on the floor plane: yaw 0 looks toward -z. */
9
9
  export declare const forward: (yaw: number) => [x: number, z: number];
10
+ /** The unit vector from a player toward a wall or a ledge on each SIDE. */
11
+ export declare const TOWARD: number[][];
10
12
  /** The movement fields of a player at rest on a floor, for a state built by hand. */
11
13
  export declare const STILL: {
12
14
  vx: number;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@korial29/tiny-fps",
3
3
  "description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.165.1",
5
+ "version": "0.166.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"