@korial29/tiny-fps 0.205.1 → 0.207.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/dist/server.js CHANGED
@@ -1090,7 +1090,10 @@ var spawn = (id, w, n, team = 0, kit = KITS[0]) => {
1090
1090
  hp: kit.hp,
1091
1091
  ...kit.hunter && {
1092
1092
  ammo: kit.ammo,
1093
- mag: kit.mag
1093
+ mag: kit.mag,
1094
+ rail: 0,
1095
+ cap: 0,
1096
+ charge: 0
1094
1097
  },
1095
1098
  blade: !!kit.katana,
1096
1099
  wield: !!kit.katana
@@ -1968,10 +1971,11 @@ var roll = (...n) => {
1968
1971
  /**
1969
1972
  * The cut the keys held when FIRE starts a swing give: LEFT or RIGHT, one of them, cuts across from
1970
1973
  * that side; else FORWARD thrusts; else (back or no key) it slashes. Both sides held are neither.
1974
+ * The Hunter's wrist blades do not thrust (`thrust` false, the user 2026-11-23): FORWARD slashes.
1971
1975
  */
1972
- var cutOf = (keys) => {
1976
+ var cutOf = (keys, thrust = true) => {
1973
1977
  const [l, r] = [keys & KEY.LEFT, keys & KEY.RIGHT];
1974
- return l && !r ? CUT.LEFT : r && !l ? CUT.RIGHT : keys & KEY.FORWARD ? CUT.THRUST : CUT.SLASH;
1978
+ return l && !r ? CUT.LEFT : r && !l ? CUT.RIGHT : thrust && keys & KEY.FORWARD ? CUT.THRUST : CUT.SLASH;
1975
1979
  };
1976
1980
  /**
1977
1981
  * The swing `p` is in, its numbers as CUTS has them (`table`; the xenomorph's is TAILS): the cut's
@@ -6873,14 +6877,21 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6873
6877
  false,
6874
6878
  0
6875
6879
  ];
6880
+ const own = kit.hunter;
6881
+ if (own) [p.rail, p.cap, p.rifle, p.nades] = [
6882
+ 0,
6883
+ 0,
6884
+ -1,
6885
+ 0
6886
+ ];
6876
6887
  if (armed && gear && inside && !p.rack) [p.ammo, p.mag] = [kit.ammo, kit.mag];
6877
6888
  p.rack = inside;
6878
6889
  p.blade = !!kit.katana || !!p.blade || armed && gear && !!blade && within(p, blade, 1.2);
6879
6890
  const inRail = !!rail && within(p, rail, 1.2);
6880
- if (armed && gear && inRail && !p.inRail) [p.rail, p.cap] = [kit.rail, kit.cap];
6891
+ if (armed && gear && !own && inRail && !p.inRail) [p.rail, p.cap] = [kit.rail, kit.cap];
6881
6892
  p.inRail = inRail;
6882
6893
  const inRifle = !!rifle && within(p, rifle, 1.2);
6883
- if (armed && gear && inRifle && !p.inRifle) [p.rifle, p.clip, p.nades] = [
6894
+ if (armed && gear && !own && inRifle && !p.inRifle) [p.rifle, p.clip, p.nades] = [
6884
6895
  kit.rifle,
6885
6896
  kit.clip,
6886
6897
  3
@@ -6974,7 +6985,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6974
6985
  return STRIKE.NONE;
6975
6986
  }
6976
6987
  if (bare || p.wield && !top || p.railed || p.rifled || busy || p.reload || !p.wield && !p.mag) p.charge = 0;
6977
- const pistol = hand == 0 && !busy && !p.reload && !p.charge && !!p.mag;
6988
+ const pistol = hand == 0 && !kit.hunter && !busy && !p.reload && !p.charge && !!p.mag;
6978
6989
  p.burst = pistol ? p.burst ?? 0 : 0;
6979
6990
  if (pistol && !p.cool && (p.burst || i.keys & KEY.SPECIAL)) {
6980
6991
  p.burst = (p.burst || 3) - 1;
@@ -6985,7 +6996,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6985
6996
  p.cool = p.burst ? Math.ceil(kit.cool / 2) : Math.min(15, kit.cool * 2);
6986
6997
  return STRIKE.SHOT;
6987
6998
  }
6988
- if (p.railed && i.keys & KEY.SPECIAL && !busy && !p.reload && !p.hot && p.cap >= RING_COST) {
6999
+ if (p.railed && !own && i.keys & KEY.SPECIAL && !busy && !p.reload && !p.hot && p.cap >= RING_COST) {
6989
7000
  p.rail -= RING_COST;
6990
7001
  p.cap -= RING_COST;
6991
7002
  [p.heat, p.hot] = [120, true];
@@ -7004,7 +7015,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
7004
7015
  return STRIKE.DISK;
7005
7016
  }
7006
7017
  if (p.wield && i.keys & KEY.SPECIAL && !busy && !p.swing) {
7007
- p.cut = i.keys & KEY.FIRE ? cutOf(i.keys) + 4 : (i.keys & (KEY.LEFT | KEY.RIGHT)) === KEY.LEFT ? CUT.ARC_L : CUT.ARC_R;
7018
+ p.cut = i.keys & KEY.FIRE ? cutOf(i.keys, !kit.hunter) + 4 : (i.keys & (KEY.LEFT | KEY.RIGHT)) === KEY.LEFT ? CUT.ARC_L : CUT.ARC_R;
7008
7019
  [p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
7009
7020
  launch(p);
7010
7021
  return STRIKE.NONE;
@@ -7019,7 +7030,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
7019
7030
  p.swing = PUNCHES[p.cut].ticks;
7020
7031
  }
7021
7032
  } else if (p.wield && !p.swing) {
7022
- p.cut = cutOf(i.keys);
7033
+ p.cut = cutOf(i.keys, !kit.hunter);
7023
7034
  [p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
7024
7035
  launch(p);
7025
7036
  } else if (p.rifled) {
@@ -7030,7 +7041,8 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
7030
7041
  p.shots = p.shots + 1 & 255;
7031
7042
  return STRIKE.LASER;
7032
7043
  }
7033
- } else if (p.railed) {
7044
+ } else if (p.railed && own) return STRIKE.RAIL;
7045
+ else if (p.railed) {
7034
7046
  if (p.cap && !p.reload && !p.hot) {
7035
7047
  p.heat = (p.heat ?? 0) + 1;
7036
7048
  p.hot = p.heat >= 120;
@@ -104,6 +104,19 @@ type Ring = [c: Vec3, x: Vec3, y: Vec3];
104
104
  /** The curl the xenomorph's fingers close to at most. */
105
105
  export declare const RAKE = 0.35;
106
106
  export declare const HUNTER_HAND: Vec3;
107
+ /** Where the back of the Hunter's right wrist faces, in the view, with the blades out: up and well over to the right. */
108
+ export declare const CLAW_ROLL: Vec3;
109
+ /** The Hunter's left hand in its guard while the blades are out (view space, mirrored): low left, ahead. */
110
+ export declare const GUARD: Vec3;
111
+ /** The guard hand thrown out ahead through a cut's wind-up, and pulled in to the belly on its strike. */
112
+ export declare const LUNGE_L: Vec3;
113
+ export declare const TUCK: Vec3;
114
+ /**
115
+ * How far the Hunter's left hand is out ahead (LUNGE_L) and in at the belly (TUCK), 0 to 1 each, at
116
+ * `prog` of his cut (-1: none): out through the wind-up to the strike, then in within a tenth of
117
+ * the cut, held, and back to the guard over its last quarter.
118
+ */
119
+ export declare const counter: (p: Pick<PlayerState, "cut">, prog: number) => [number, number];
107
120
  type Claws = boolean | 'short';
108
121
  /** The ring of a finger from which on it is bare: the glove's fingers end 60 % along the middle phalanx. */
109
122
  export declare const BARE = 8;
@@ -80,8 +80,11 @@ export interface Hud {
80
80
  marks(list: Mark[]): void;
81
81
  /** The orbital station's mission line (mission.ts), `hot` when urgent; none hides it. */
82
82
  mission(text?: string, hot?: boolean): void;
83
- /** The Hunter's current local vision mode. */
84
- hunterVision(text?: string, scoped?: boolean): void;
83
+ /**
84
+ * The Hunter's current local vision mode, `text` empty for the plain view; with `hint`, the V key
85
+ * is shown with it, blinking in the plain view.
86
+ */
87
+ hunterVision(text?: string, scoped?: boolean, hint?: boolean): void;
85
88
  /** The Predator-style shoulder-laser sight, at a screen point and progressing to a lock. */
86
89
  hunterAim(at?: [number, number], progress?: number): void;
87
90
  /** The dark rim of a space helmet's visor around the screen: on while the own player wears one, off otherwise. */
@@ -1,4 +1,5 @@
1
1
  import type { Vec3 } from './mesh';
2
+ import type { PlayerState } from '../shared/types';
2
3
  import type { Out } from './verts';
3
4
  import type { Pieces } from './store';
4
5
  export declare function hunter(lod: 0 | 1 | 2): Record<string, number[]>;
@@ -10,14 +11,49 @@ export declare const hunterWristEnds: () => Vec3[];
10
11
  * brushed metal lies on their rest place; the bolt, shortened as it folds, stays in `out`.
11
12
  */
12
13
  export declare const drawHarpoon: (out: Out, lod: 0 | 1 | 2, at: Vec3, axes: Vec3[], scale: number, open: number, loaded?: boolean,
13
- /** 0 just after a shot to 1: the next bolt slides forward from the stock into its seat. */
14
- feed?: number, pieces?: Pieces) => void;
14
+ /** 0 as the reload starts to 1: the next bolt slides forward from behind the stock into its seat. */
15
+ feed?: number, pieces?: Pieces,
16
+ /** How far (m, unscaled) the bolt just fired has flown out of the muzzle; drawn under HARPOON_GONE. */
17
+ fired?: number) => void;
18
+ /** Metres a fired bolt is drawn leaving the muzzle; past this the flying ball alone shows it. */
19
+ export declare const HARPOON_GONE = 1.2;
20
+ /** Metres behind its seat the next bolt starts as it feeds in. */
21
+ export declare const HARPOON_BACK = 0.9;
22
+ /** The share of the harpoon's reload (swapOf()) at which the next bolt starts in, and its sound. */
23
+ export declare const HARPOON_RACK = 0.35;
24
+ /** Seconds the fired bolt takes to leave the drawn tube (HARPOON_GONE). */
25
+ export declare const HARPOON_OUT = 0.09;
26
+ /**
27
+ * The next bolt's slide into its seat at `swap` of the harpoon's reload (swapOf(), 0 to 1; -1 none):
28
+ * absent for the first 35 % (the tube empty after the shot), then eased in by 85 %, seated after.
29
+ */
30
+ export declare const harpoonFeed: (swap: number) => number;
15
31
  export declare const hunterHarpoon: (lod: 0 | 1 | 2) => number[];
16
32
  /**
17
33
  * The Hunter's own rest skeleton in model space: the rig's joints on his 1.2 m stature, the arms
18
34
  * where the sculpted sleeves hang (wider than the rig's) and the neck under the lowered mask.
19
35
  * Rest rotations are the identity, so a joint's rest frame is this point alone.
20
36
  */
37
+ /**
38
+ * The top of the shoulder cannon's post, in the rest model: the hinge it folds about. The model
39
+ * draws it deployed, along the look; stowed it lies back along the top of the shoulder.
40
+ */
41
+ export declare const CANNON_HINGE: Vec3;
42
+ /** Radians the stowed cannon is turned about its hinge's right axis from the deployed one: muzzle back. */
43
+ export declare const CANNON_FOLD = 2.9;
44
+ /** The cannon's muzzle, from its hinge, deployed (the stepped muzzle's face). */
45
+ export declare const CANNON_MUZZLE: Vec3;
46
+ /** Seconds the cannon takes to fold out, or back. */
47
+ export declare const CANNON_SWING = 0.35;
48
+ /** The shoulder cannon's fold `k`, moved toward out (`out`) or stowed by `dt` seconds. */
49
+ export declare const unfold: (k: number, out: boolean, dt: number) => number;
50
+ /**
51
+ * The Hunter as his arms are posed: with the shoulder cannon in use his hands hold nothing, so he
52
+ * is drawn as with no weapon in hand (not the rail gun's hold, nor the harpoon's).
53
+ */
54
+ export declare const handsFree: <P extends Pick<PlayerState, "railed" | "ammo" | "zapping">>(p: P) => P;
55
+ /** How far along its swing a cannon folded out by `k` is: a smooth start and stop. */
56
+ export declare const folded: (k: number) => number;
21
57
  export declare const HUNTER_REST: Vec3[];
22
58
  /** A rigid Hunter piece: the vertices that follow `joint`, in that joint's rest frame. */
23
59
  export interface HunterPiece {
@@ -26,6 +62,8 @@ export interface HunterPiece {
26
62
  thin: boolean;
27
63
  /** The harpoon on his back, left out while it is in his hand. */
28
64
  harpoon: boolean;
65
+ /** The shoulder cannon, from its hinge (CANNON_HINGE) rather than the joint: it folds about it. */
66
+ cannon: boolean;
29
67
  vertices: number[];
30
68
  }
31
69
  /**
@@ -19,8 +19,14 @@ export declare const WEAPON: {
19
19
  readonly RIFLE: 3;
20
20
  readonly FISTS: 4;
21
21
  };
22
- /** The choice after a key: 1 the gun, 2 the katana, 3 the rail gun, 4 the laser rifle, any other key keeps it. */
23
- export declare const picked: (weapon: number, code: string) => number;
22
+ /**
23
+ * The weapon in a slot (1 to 5 less one), and the slot of a weapon: WEAPON's order, but for the
24
+ * Hunter, whose wrist blades are slot 1 and harpoon slot 2 (the user, 2026-11-23). The swap is its
25
+ * own inverse.
26
+ */
27
+ export declare const slotted: (slot: number, hunter?: boolean) => number;
28
+ /** The choice after a key: 1 the gun, 2 the katana, 3 the rail gun, 4 the laser rifle (the Hunter's slots by slotted()), any other key keeps it. */
29
+ export declare const picked: (weapon: number, code: string, hunter?: boolean) => number;
24
30
  /** Which of the gun, the katana, the rail gun and the laser rifle a player has; all of them when there is no state yet. */
25
31
  export declare const owned: (p?: PlayerState) => boolean[];
26
32
  /**
@@ -29,8 +35,8 @@ export declare const owned: (p?: PlayerState) => boolean[];
29
35
  export declare const chosen: (weapon: number, was?: PlayerState, now?: PlayerState) => number;
30
36
  /** The keys of a step with KEY.BLADE set while the katana is the choice, KEY.RAIL while the rail gun is, KEY.RIFLE while the rifle is. */
31
37
  export declare const withWeapon: (keys: number, weapon: number) => number;
32
- /** The choice the wheel turns to, `dir` 1 or -1: the next weapon he has, including fists. */
33
- export declare const turned: (weapon: number, dir: number, have: boolean[]) => number;
38
+ /** The choice the wheel turns to, `dir` 1 or -1: the next weapon he has in slot order, including fists. */
39
+ export declare const turned: (weapon: number, dir: number, have: boolean[], hunter?: boolean) => number;
34
40
  /** Live look angles and held keys; the loop reads them once per step and per frame. */
35
41
  export interface Controls {
36
42
  /** Radians, [0, 2π). Mouse right turns right, which lowers yaw. */
@@ -164,6 +164,15 @@ export declare const SOUND: {
164
164
  /** A rising three-step target lock and a heavy shoulder-mounted laser discharge. */
165
165
  readonly HUNTER_LOCK: 85;
166
166
  readonly HUNTER_LASER: 86;
167
+ /** The harpoon's next bolt racked in from behind: a servo's whine, the slide, the lock home. */
168
+ readonly HARPOON_RELOAD: 87;
169
+ /**
170
+ * The Hunter's views (the user, 2026-11-23): the flash of a view switched with V, then, while a
171
+ * special one is on, a heart beating and a radio that barely holds its station, both looped.
172
+ */
173
+ readonly HUNTER_FLASH: 88;
174
+ readonly HEARTBEAT: 89;
175
+ readonly STATIC: 90;
167
176
  };
168
177
  /**
169
178
  * The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
@@ -211,6 +220,15 @@ export type Cry = {
211
220
  };
212
221
  /** Renders a Cry as mono samples at RATE, peaking at its `vol`. */
213
222
  export declare const scream: (c?: Cry) => Float32Array;
223
+ /**
224
+ * A radio that barely holds its station, under the Hunter's special views (the user, 2026-11-23:
225
+ * close to the film's, subtle, and no high tone over and over but a deep, unsettling and slightly
226
+ * distorted one coming back slowly, then rarer and slower still): once a loop a low growl swells in
227
+ * and sinks away, overdriven,
228
+ * over a faint hiss that fades and drops out, a crackle now and then and a slow tuning whistle.
229
+ * 6.1 s, for a 6 s loop (seam): the swell's envelope repeats every 6 s, so the seam joins it.
230
+ */
231
+ export declare const radio: () => Float32Array;
214
232
  /**
215
233
  * A sound made loopable: the last `x` samples are cross-faded into the first, the length drops by
216
234
  * `x`, and the end joins the start. For a stationary sound (a loop's voice is held at full
@@ -34,6 +34,8 @@ export interface Runner {
34
34
  parry: number;
35
35
  trail: Trail;
36
36
  t: number;
37
+ /** How far the Hunter's shoulder cannon is folded out, 0 stowed to 1 along his look. */
38
+ cannon: number;
37
39
  /** The limb a katana's cut took off, while he is down (see limbs.ts). */
38
40
  cut?: Piece;
39
41
  /** Seconds left of the grimace a hit puts on his face, and of the grin of a capture or of a foe put down. */
@@ -199,6 +201,12 @@ export declare const stance: (r: Runner) => {
199
201
  yaw: number;
200
202
  carry: [Vec3, Vec3[]] | undefined;
201
203
  };
204
+ /**
205
+ * The shoulder cannon's hinge and turn on a Hunter whose chest is at `chest` turned by `q`: stowed
206
+ * (k 0) it lies back along the shoulder, CANNON_FOLD about the hinge from the chest's frame; out
207
+ * (k 1) it points along his look.
208
+ */
209
+ export declare const cannonOf: (chest: Vec3, q: Quat, p: Pick<PlayerState, "yaw" | "pitch">, k: number) => [Vec3, Quat];
202
210
  /** Build and index the Hunter models before they can be drawn during a match. */
203
211
  export declare const warmHunter: () => void;
204
212
  /** Draws the runner and gives back its solved skeleton, or nothing once a bolt has burnt it away. */
@@ -15,8 +15,9 @@ export declare const roll: (...n: number[]) => number;
15
15
  /**
16
16
  * The cut the keys held when FIRE starts a swing give: LEFT or RIGHT, one of them, cuts across from
17
17
  * that side; else FORWARD thrusts; else (back or no key) it slashes. Both sides held are neither.
18
+ * The Hunter's wrist blades do not thrust (`thrust` false, the user 2026-11-23): FORWARD slashes.
18
19
  */
19
- export declare const cutOf: (keys: number) => number;
20
+ export declare const cutOf: (keys: number, thrust?: boolean) => number;
20
21
  /**
21
22
  * The swing `p` is in, its numbers as CUTS has them (`table`; the xenomorph's is TAILS): the cut's
22
23
  * own, or, for a heavy release (`heavy`), the rest of it from the top of its wind-up, HEAVY times as
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.205.1",
5
+ "version": "0.207.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"