@korial29/tiny-fps 0.191.1 → 0.192.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
@@ -213,11 +213,12 @@ var [GLORY_HP, GLORY_REACH, GLORY_ARC, GLORY_TICKS] = [
213
213
  /**
214
214
  * The katana's glory kill, an execution (room.ts feast(), the user 2026-11-17: 1.5 s, not at once):
215
215
  * E locks the two for EXEC.TICKS (`exec` KILLER and VICTIM); the swordsman dashes in front of him,
216
- * to EXEC.REACH metres, over GLORY_DASH ticks, cuts down (CUT.SLASH) at EXEC.CUTS[0] and drops him
217
- * to his knees, then spins into a cut across (CUT.RIGHT) at EXEC.CUTS[1], whose strike is the
218
- * lock's last tick: his head goes (LIMB.HEAD) and the body, still on its knee, tips over where it
216
+ * to EXEC.REACH metres, over GLORY_DASH ticks, runs him through (CUT.THRUST, the user 2026-11-19) at EXEC.CUTS[0] and drops him
217
+ * to his knees, then raises the blade over his head and cuts down (CUT.SLASH, the user
218
+ * 2026-11-19: a samurai's execution, no spin) at EXEC.CUTS[1], whose strike is the lock's last
219
+ * tick: his head goes (LIMB.HEAD) and the body, still on its knee, tips over where it
219
220
  * is (feast.ts topple()). Without the katana in hand it is the fists' (the user, 2026-11-17): the
220
- * same lock, dashing to EXEC.FIST metres, a punch in the belly on the cut down's strike drops him on
221
+ * same lock, dashing to EXEC.FIST metres, a punch in the belly on the thrust's strike drops him on
221
222
  * his knee the same, and a punch down on his head on the lock's last tick bursts it (LIMB.BURST).
222
223
  * The fists strike nothing on the host: their blows are drawn (feast.ts pummel()).
223
224
  */
@@ -225,7 +226,7 @@ var EXEC = {
225
226
  TICKS: 88,
226
227
  REACH: 1.3,
227
228
  FIST: .7,
228
- CUTS: [20, 74],
229
+ CUTS: [26, 71],
229
230
  KILLER: 1,
230
231
  VICTIM: 2
231
232
  };
@@ -594,9 +595,9 @@ var KEY = {
594
595
  */
595
596
  BLADE: 512,
596
597
  /**
597
- * Set with FIRE by a double click (the client's choice): the katana's special cut, the special
598
- * of the cut the keys give (see CUT). Set alone by G with the laser rifle in hand: a grenade from
599
- * its launcher. Ignored with the other guns.
598
+ * Set for one step by G or the right button (the client's choice): with the katana in hand, the
599
+ * special of the cut the keys give (see CUT); with the laser rifle in hand, a grenade from its
600
+ * launcher. Ignored with the other guns.
600
601
  */
601
602
  SPECIAL: 1024,
602
603
  /**
@@ -614,7 +615,7 @@ var KEY = {
614
615
  /**
615
616
  * The katana's cuts (PlayerState.cut, constants CUTS), chosen by the keys held when FIRE starts
616
617
  * one: LEFT or RIGHT (one of them) cuts across from that side, else FORWARD thrusts, else (back or
617
- * no key) it slashes down from above. With SPECIAL (a double click) each has its special, the cut
618
+ * no key) it slashes down from above. With SPECIAL (G or the right button) each has its special, the cut
618
619
  * plus SPECIAL_CUT: the thrust a LUNGE (a dash forward on the point), a cut across an ARC (a heavy
619
620
  * cut down across the body that throws an arc of energy ahead, see wave(), plasma.ts), the slash a
620
621
  * LEAP (a jump and a blow down on landing).
@@ -6419,8 +6420,8 @@ var STRIKE = {
6419
6420
  * letting it go fires a ball as strong as the charge (powerOf()), spending as many shots; or it
6420
6421
  * starts the katana's swing (`cut` from the keys), unless the hands are busy (a hang, a climb).
6421
6422
  * The katana in hand, busy hands or no shot left drop the charge.
6422
- * With SPECIAL (a double click) the swing is the cut's special; its press within SPECIAL_LATE
6423
- * ticks of a cut's start turns that cut into it. The cut strikes `CUTS[cut].strike` ticks into
6423
+ * SPECIAL (G or the right button) with the katana in hand and no swing starts the special of
6424
+ * that cut instead, FIRE or not. The cut strikes `CUTS[cut].strike` ticks into
6424
6425
  * its swing. The look is the input's, so both go where the player sees.
6425
6426
  * `armed` is false while the match is over: no weapon, no rack. `bodies` are move()'s.
6426
6427
  */
@@ -6557,9 +6558,13 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6557
6558
  p.shots = p.shots + 1 & 255;
6558
6559
  return STRIKE.NADE;
6559
6560
  }
6561
+ if (p.wield && i.keys & KEY.SPECIAL && !busy && !p.swing) {
6562
+ p.cut = cutOf(i.keys) + 4;
6563
+ [p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
6564
+ launch(p);
6565
+ return STRIKE.NONE;
6566
+ }
6560
6567
  if (i.keys & KEY.FIRE && !busy) {
6561
- const late = CUTS[p.cut ?? 0].ticks - (p.swing ?? 0);
6562
- const special = !!(i.keys & KEY.SPECIAL) && (!p.swing || !p.heavy && (p.cut ?? 0) < 4 && late <= 18);
6563
6568
  if (bare) {
6564
6569
  if (!p.swing) {
6565
6570
  p.cut = tackling(p) || p.mode === MODE.GROUND && !!(i.keys & KEY.SPRINT) && p.vx * p.vx + p.vz * p.vz > kit.run * kit.run ? BLOW.LUNGE : BLOW.JAB;
@@ -6568,8 +6573,8 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6568
6573
  p.cut++;
6569
6574
  p.swing = PUNCHES[p.cut].ticks;
6570
6575
  }
6571
- } else if (p.wield && (!p.swing || special)) {
6572
- p.cut = cutOf(i.keys) + (special ? 4 : 0);
6576
+ } else if (p.wield && !p.swing) {
6577
+ p.cut = cutOf(i.keys);
6573
6578
  [p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
6574
6579
  launch(p);
6575
6580
  } else if (p.rifled) {
@@ -6657,7 +6662,7 @@ var duel = (p, i) => {
6657
6662
  /**
6658
6663
  * A step of a glory kill's execution (EXEC), whatever the keys: with the katana in hand at its start
6659
6664
  * (`wield`, kept through it) the swordsman's two cuts start on their ticks of the lock (EXEC.CUTS: a
6660
- * cut down, then one across whose strike is the lock's last tick), and strike no one; the fists'
6665
+ * thrust, then a cut down whose strike is the lock's last tick), and strike no one; the fists'
6661
6666
  * start no swing (their blows are drawn). His victim holds no weapon up. Predicted, as a cut is.
6662
6667
  */
6663
6668
  var execute = (p) => {
@@ -6666,7 +6671,7 @@ var execute = (p) => {
6666
6671
  const e = EXEC.TICKS - p.lock;
6667
6672
  const at = EXEC.CUTS.indexOf(e);
6668
6673
  const blade = p.exec === EXEC.KILLER && !!p.wield;
6669
- p.cut = blade && at >= 0 ? [CUT.SLASH, CUT.RIGHT][at] : p.cut;
6674
+ p.cut = blade && at >= 0 ? [CUT.THRUST, CUT.SLASH][at] : p.cut;
6670
6675
  p.swing = blade && at >= 0 ? CUTS[p.cut].ticks : Math.max(0, (p.swing ?? 0) - 1);
6671
6676
  [p.wield, p.charge, p.heavy] = [
6672
6677
  blade,
@@ -87,12 +87,14 @@ export declare const eating: (lock: number, mount: number) => number;
87
87
  export declare const chew: (pose: Pose, a: number, t: number) => Pose;
88
88
  /**
89
89
  * The katana's execution as drawn (EXEC, the user 2026-11-17): its victim turns to the swordsman as
90
- * he dashes in (TURN ticks), drops on the strike of the cut down (KNEEL: from that tick, over so
90
+ * he dashes in (TURN ticks), drops on the strike of the thrust (KNEEL: from that tick, over so
91
91
  * many) onto one knee, the right, the left foot ahead (STEP, metres), his hips LOW metres lower,
92
92
  * bent over in pain (BOW, radians: spine, chest, neck) with his hands on his belly (BELLY: across,
93
93
  * ahead and over his pelvis), panting (PANT: radians of the chest's heave, beats a second) and his
94
- * head shaking no (NO: radians each way, shakes a second); the swordsman spins a whole turn into the
95
- * cut across, ending on its strike (SPIN); on the cut down a spurt of WOUND drops of blood, and when
94
+ * head shaking no (NO: radians each way, shakes a second); the swordsman runs him through, draws
95
+ * the blade out, raises it over his head in both hands (RAISE: from that tick, over so many),
96
+ * holds it there and brings it down on the bowed neck (the user, 2026-11-19: a samurai's
97
+ * execution, a thrust first, no turn on himself); on the thrust a spurt of WOUND drops of blood, and when
96
98
  * his head goes NECK drops, then BLEED a second from the neck for BLEEDING seconds.
97
99
  */
98
100
  export declare const EXECUTE: {
@@ -106,7 +108,7 @@ export declare const EXECUTE: {
106
108
  readonly BELLY: readonly [0.08, 0.2, 0.1];
107
109
  readonly PANT: readonly [0.07, 2.6];
108
110
  readonly NO: readonly [0.4, 1.4];
109
- readonly SPIN: readonly [74, number];
111
+ readonly RAISE: readonly [number, 14];
110
112
  /** The beheaded body, still on its knee, tips over onto its right side about it: in so many seconds, so far (radians). */
111
113
  readonly FALL: readonly [0.7, 1.45];
112
114
  /** Its bounce on the floor: a share of the fall, how fast it dies out, its rate (rad/s); and the seconds it takes to go limp. */
@@ -119,8 +121,13 @@ export declare const EXECUTE: {
119
121
  };
120
122
  /** How far down on his knees its victim is with `lock` ticks left, 0 to 1. */
121
123
  export declare const kneeling: (lock: number) => number;
122
- /** How far the swordsman has spun into his cut across with `lock` ticks left, radians (a whole turn at its strike). */
123
- export declare const spun: (lock: number) => number;
124
+ /**
125
+ * Where in the cut down's swing (katana.ts stroke()) the swordsman's blade is drawn with `lock`
126
+ * ticks left and his own swing at `prog`: his thrust first (-1: his own cut, as it is), then, the
127
+ * blade drawn out of him and back in the guard, up to the top of the cut down's wind-up (`top`),
128
+ * held there until that cut comes down from it.
129
+ */
130
+ export declare const raised: (lock: number, prog: number, top: number) => number;
124
131
  /**
125
132
  * The victim's `pose` before the swordsman whose feet are at `killer`, with `lock` ticks of the
126
133
  * execution left, at `t` seconds: turned to him, then down on his right knee, his left foot ahead,
@@ -158,7 +165,7 @@ export declare const crouch: (pose: Pose, w: number) => Pose;
158
165
  * The fists' execution as drawn (EXEC, the user 2026-11-17: a glory kill for everyone, the victim's
159
166
  * kneel the katana's, the killer's blows his own), in ticks of the lock: turned to his victim over
160
167
  * TURN, the right fist drawn back low by the hip (GUT: cocked, still cocked), driven up into his
161
- * belly on the strike of the katana's cut down, so the victim kneels on it (home), buried there as he
168
+ * belly on the strike of the katana's thrust, so the victim kneels on it (home), buried there as he
162
169
  * folds (held), back to the guard (back); the left hand on the back of his bowed head, holding it
163
170
  * (GRAB: from, on); the right fist raised high over the shoulder (SMASH: from, raised), held there a
164
171
  * beat, brought down onto his head on the lock's last tick, as it bursts. Past the lock, the punch
@@ -223,6 +230,9 @@ export interface Prey {
223
230
  belly?: Vec3;
224
231
  head?: Vec3;
225
232
  }
233
+ export declare const LUNGE: number[][];
234
+ /** The swordsman's `pose` `e` ticks into the katana's execution (past EXEC.TICKS after the kill): his hips and his right foot on LUNGE, the left where it stands. */
235
+ export declare const lunge: (pose: Pose, e: number) => Pose;
226
236
  /**
227
237
  * The killer's `pose` in the fists' execution `e` ticks into its lock (past EXEC.TICKS after the
228
238
  * kill, a fraction between ticks), on `prey`: turned to him, the blows of PUMMEL, his feet where
@@ -17,7 +17,7 @@ export type Cue = [
17
17
  ];
18
18
  /** The xenomorph's, over GLORY_TICKS: on him at 18, its head back from 46, the bite home at 114. */
19
19
  export declare const FEAST_CUES: Cue[];
20
- /** The katana's, over EXEC.TICKS: the cut down bites at 36, he is on his knee at 46. */
20
+ /** The katana's, over EXEC.TICKS: the thrust goes in at 36, he is on his knee at 46. */
21
21
  export declare const EXEC_CUES: Cue[];
22
22
  /**
23
23
  * The fists', over EXEC.TICKS (feast.ts PUMMEL): the push off at 2 and 3, down on the left foot at 19
@@ -7,7 +7,7 @@ export declare const DOUBLE_TAP_MS = 250;
7
7
  export declare const dashKeys: (keys: number, dir: number) => number;
8
8
  /** The KEY bit of a KeyboardEvent.code, 0 for a key the game ignores. */
9
9
  export declare const keyBit: (code: string) => number;
10
- /** A second left press within this of the first (ms) is a double click: the katana's special cut. */
10
+ /** A second right press (or G) within this of the first (ms) is a double click: the xenomorph's tail special. */
11
11
  export declare const DOUBLE_CLICK_MS = 300;
12
12
  /** The wheel swaps the weapon at most this often (ms): a trackpad's flick is a hundred events, one swap. */
13
13
  export declare const WHEEL_MS = 250;
@@ -42,7 +42,7 @@ export interface Controls {
42
42
  keys: number;
43
43
  /** The chosen weapon (WEAPON: 1, 2, 3 and the wheel). */
44
44
  weapon: number;
45
- /** At a ship's stick (the client sets it): a press of G is a missile whatever the weapon, a double click nothing more than a click. */
45
+ /** At a ship's stick (the client sets it): a press of G or of the right button is a missile whatever the weapon. */
46
46
  pilot: boolean;
47
47
  /**
48
48
  * Playing the xenomorph (the client sets it): the right button strikes with the tail as FIRE cuts
@@ -54,8 +54,9 @@ export interface Controls {
54
54
  * The KEY bits of the next step, read once per step. Same as `keys`, plus BLADE while the katana
55
55
  * is chosen and RAIL while the rail gun is, except for the step right after a double tap: it carries DASH and only the tapped
56
56
  * direction, so the dash goes that way whatever else is held, and nothing else is on the wire.
57
- * The step after a double click carries FIRE and SPECIAL, however short the click was, but with
58
- * the rifle chosen; the step after a press of G carries SPECIAL with the rifle chosen: a grenade.
57
+ * The step after a press of G or of the right button carries SPECIAL: the katana's special cut
58
+ * with it in hand, a grenade with the rifle, a missile at a ship's stick (step() ignores it with
59
+ * the other guns).
59
60
  */
60
61
  take(): number;
61
62
  /** One live step of the own player, its state before and after: a katana or a rail gun picked up is chosen, losing every weapon chooses the gun. */
@@ -68,8 +69,8 @@ export interface Controls {
68
69
  /**
69
70
  * Click the canvas to lock the pointer; while locked the mouse looks, the keys move (WASD, Shift
70
71
  * sprints, Space jumps, Q dashes, C crouches, E gets in and out of a rover, a direction key pressed twice within DOUBLE_TAP_MS dashes that
71
- * way, the left button fires or cuts and a double click cuts the special, G launches a grenade with the
72
- * rifle, 1, 2 and 3 or the wheel pick
72
+ * way, the left button fires or cuts, G or the right button cuts the katana's special or launches a
73
+ * grenade with the rifle, 1, 2 and 3 or the wheel pick
73
74
  * the gun, the katana or the rail gun) and M calls `onMute`.
74
75
  */
75
76
  export declare const createInput: (canvas: HTMLCanvasElement, onMute?: () => void) => Controls;
@@ -73,6 +73,8 @@ export declare const PARRY_IN: number, PARRY_OUT: number;
73
73
  export declare const parrying: (s: number) => number;
74
74
  /** The grip and blade `k` (as stroke() gives them) taken `e` of the way to the parry `to`, the blade a unit again: a new array. */
75
75
  export declare const deflect: (k: number[], e: number, to?: number[]) => number[];
76
+ /** The share of the cut down's swing at the top of its wind-up, the blade over the head. */
77
+ export declare const SLASH_TOP = 0.28;
76
78
  /** The grip and the blade direction (x, y, z each) of cut `cut` at `p` of the swing: one array, rewritten by each call. */
77
79
  export declare const stroke: (cut: number, p: number) => number[];
78
80
  /** The trunk's [twist, bend, lean] (radians, see TRUNK) of cut `cut` at `p` of its swing: one array, rewritten by each call. */
@@ -99,6 +99,8 @@ export interface Runner {
99
99
  */
100
100
  pum?: number;
101
101
  prey?: Prey;
102
+ /** The katana's execution (feast.ts lunge()): its swordsman's ticks into the lock, smoothed as `pum`, running on past it for his recovery. */
103
+ exe?: number;
102
104
  fist?: boolean;
103
105
  /** The skeleton as last drawn: a limb cut off leaves from it (limbs.ts track()). */
104
106
  s?: ReturnType<typeof solve>;
@@ -303,11 +303,12 @@ export declare const XENO_FEED = 1;
303
303
  /**
304
304
  * The katana's glory kill, an execution (room.ts feast(), the user 2026-11-17: 1.5 s, not at once):
305
305
  * E locks the two for EXEC.TICKS (`exec` KILLER and VICTIM); the swordsman dashes in front of him,
306
- * to EXEC.REACH metres, over GLORY_DASH ticks, cuts down (CUT.SLASH) at EXEC.CUTS[0] and drops him
307
- * to his knees, then spins into a cut across (CUT.RIGHT) at EXEC.CUTS[1], whose strike is the
308
- * lock's last tick: his head goes (LIMB.HEAD) and the body, still on its knee, tips over where it
306
+ * to EXEC.REACH metres, over GLORY_DASH ticks, runs him through (CUT.THRUST, the user 2026-11-19) at EXEC.CUTS[0] and drops him
307
+ * to his knees, then raises the blade over his head and cuts down (CUT.SLASH, the user
308
+ * 2026-11-19: a samurai's execution, no spin) at EXEC.CUTS[1], whose strike is the lock's last
309
+ * tick: his head goes (LIMB.HEAD) and the body, still on its knee, tips over where it
309
310
  * is (feast.ts topple()). Without the katana in hand it is the fists' (the user, 2026-11-17): the
310
- * same lock, dashing to EXEC.FIST metres, a punch in the belly on the cut down's strike drops him on
311
+ * same lock, dashing to EXEC.FIST metres, a punch in the belly on the thrust's strike drops him on
311
312
  * his knee the same, and a punch down on his head on the lock's last tick bursts it (LIMB.BURST).
312
313
  * The fists strike nothing on the host: their blows are drawn (feast.ts pummel()).
313
314
  */
@@ -315,7 +316,7 @@ export declare const EXEC: {
315
316
  readonly TICKS: 88;
316
317
  readonly REACH: 1.3;
317
318
  readonly FIST: 0.7;
318
- readonly CUTS: readonly [20, 74];
319
+ readonly CUTS: readonly [26, 71];
319
320
  readonly KILLER: 1;
320
321
  readonly VICTIM: 2;
321
322
  };
@@ -42,8 +42,8 @@ export type Strike = (typeof STRIKE)[keyof typeof STRIKE];
42
42
  * letting it go fires a ball as strong as the charge (powerOf()), spending as many shots; or it
43
43
  * starts the katana's swing (`cut` from the keys), unless the hands are busy (a hang, a climb).
44
44
  * The katana in hand, busy hands or no shot left drop the charge.
45
- * With SPECIAL (a double click) the swing is the cut's special; its press within SPECIAL_LATE
46
- * ticks of a cut's start turns that cut into it. The cut strikes `CUTS[cut].strike` ticks into
45
+ * SPECIAL (G or the right button) with the katana in hand and no swing starts the special of
46
+ * that cut instead, FIRE or not. The cut strikes `CUTS[cut].strike` ticks into
47
47
  * its swing. The look is the input's, so both go where the player sees.
48
48
  * `armed` is false while the match is over: no weapon, no rack. `bodies` are move()'s.
49
49
  */
@@ -58,9 +58,9 @@ export declare const KEY: {
58
58
  */
59
59
  readonly BLADE: 512;
60
60
  /**
61
- * Set with FIRE by a double click (the client's choice): the katana's special cut, the special
62
- * of the cut the keys give (see CUT). Set alone by G with the laser rifle in hand: a grenade from
63
- * its launcher. Ignored with the other guns.
61
+ * Set for one step by G or the right button (the client's choice): with the katana in hand, the
62
+ * special of the cut the keys give (see CUT); with the laser rifle in hand, a grenade from its
63
+ * launcher. Ignored with the other guns.
64
64
  */
65
65
  readonly SPECIAL: 1024;
66
66
  /**
@@ -78,7 +78,7 @@ export declare const KEY: {
78
78
  /**
79
79
  * The katana's cuts (PlayerState.cut, constants CUTS), chosen by the keys held when FIRE starts
80
80
  * one: LEFT or RIGHT (one of them) cuts across from that side, else FORWARD thrusts, else (back or
81
- * no key) it slashes down from above. With SPECIAL (a double click) each has its special, the cut
81
+ * no key) it slashes down from above. With SPECIAL (G or the right button) each has its special, the cut
82
82
  * plus SPECIAL_CUT: the thrust a LUNGE (a dash forward on the point), a cut across an ARC (a heavy
83
83
  * cut down across the body that throws an arc of energy ahead, see wave(), plasma.ts), the slash a
84
84
  * LEAP (a jump and a blow down on landing).
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.191.1",
5
+ "version": "0.192.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"