@korial29/tiny-fps 0.179.0 → 0.180.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
@@ -1568,7 +1568,7 @@ var holdAt = (p, w, side) => {
1568
1568
  * 2026-11-16: running into a wall, not walking): in the air within WALL_REACH, on a floor touching
1569
1569
  * it, a wall from the knees to the head (wallGap). Not the side it just kicked off.
1570
1570
  */
1571
- var clingTo = (p, w, c) => {
1571
+ var clingTo = (p, w, c, speed) => {
1572
1572
  if (!c.kit.xeno || !c.fwd || !(c.keys & KEY.SPRINT) || c.stumble) return false;
1573
1573
  const reach = p.mode === MODE.AIR ? WALL_REACH : .05;
1574
1574
  for (let side = 1; side <= 4; side++) {
@@ -1577,7 +1577,12 @@ var clingTo = (p, w, c) => {
1577
1577
  if (side !== p.wall && c.fx * nx + c.fz * nz >= .6 && gap !== void 0 && gap <= reach) {
1578
1578
  enter(p, MODE.CLING);
1579
1579
  p.wall = side;
1580
- p.vx = p.vy = p.vz = 0;
1580
+ const [tx, tz] = [-nz, nx];
1581
+ const k = Math.min(1, c.kit.sprint * c.pace / Math.max(speed[0], EPS));
1582
+ const a = (speed[1] * tx + speed[2] * tz) * k;
1583
+ p.vx = tx * a;
1584
+ p.vz = tz * a;
1585
+ p.vy = Math.sqrt(Math.max(0, (speed[0] * k) ** 2 - a * a));
1581
1586
  p.jumps = 1;
1582
1587
  p.coyote = 0;
1583
1588
  p.ev |= EV.GRAB;
@@ -1621,7 +1626,11 @@ var cling = (p, w, c) => {
1621
1626
  const [hu, ha] = [c.fx * nx + c.fz * nz, c.fx * tx + c.fz * tz];
1622
1627
  const [wu, wa] = [fw * hu - s * ha, fw * ha + s * hu];
1623
1628
  const n = Math.sqrt(wu * wu + wa * wa);
1624
- const v = n > 1 ? 8 / n : 8;
1629
+ const was = Math.sqrt(p.vx * p.vx + p.vy * p.vy + p.vz * p.vz);
1630
+ const run = c.kit.run * c.pace;
1631
+ const top = c.keys & KEY.SPRINT ? c.kit.sprint * c.pace : run;
1632
+ const sp = was > top ? Math.max(top, was - 12 * DT$2) : Math.min(top, Math.max(run, was + 3 * c.kit.accel * DT$2));
1633
+ const v = n > 1 ? sp / n : sp;
1625
1634
  const up = wu > .05 ? 1 : wu < -.05 ? -1 : 0;
1626
1635
  const k = wa * v;
1627
1636
  const { a, sign } = along(p, p.wall);
@@ -1689,6 +1698,11 @@ var free$1 = (p, w, c) => {
1689
1698
  if (p.mode === MODE.AIR) air(p, w, c, burst);
1690
1699
  const g = burst && p.vy <= 0 ? 0 : p.mode === MODE.WALLRUN ? WALLRUN_GRAVITY : 1;
1691
1700
  const was = p.mode;
1701
+ const speed = [
1702
+ len$1(p.vx, p.vz),
1703
+ p.vx,
1704
+ p.vz
1705
+ ];
1692
1706
  const hit = fly$1(p, w, heightOf(p), g, onFloor(was), c.bodies);
1693
1707
  if (hit >= 0) {
1694
1708
  if (!onFloor(p.mode)) {
@@ -1708,7 +1722,7 @@ var free$1 = (p, w, c) => {
1708
1722
  p.ev |= p.mode === MODE.SLIDE ? EV.SLIDE_END : 0;
1709
1723
  enter(p, MODE.AIR);
1710
1724
  }
1711
- if ((p.mode === MODE.AIR || p.mode === MODE.GROUND) && clingTo(p, w, c)) return;
1725
+ if ((p.mode === MODE.AIR || p.mode === MODE.GROUND) && clingTo(p, w, c, speed)) return;
1712
1726
  if (p.mode === MODE.AIR) {
1713
1727
  const ledge = ledgeAt(p, w);
1714
1728
  if (ledge) grab(p, ledge, c.kit.dashes);
@@ -20,8 +20,8 @@ export declare const TAIL: {
20
20
  * A pose of the tail, as bonesOf() takes it: its arch over the back (0 behind, 1 over the head and
21
21
  * forward down into the view), its turn about the pelvis' up (radians, to its left: through its
22
22
  * right side, a tail pointing back turns forward), its lean to the right, its reach (as a share of
23
- * its length, a whip stretched), how much of the hook at its tip it keeps, and how far its root
24
- * rises (radians, less toward the tip).
23
+ * its length, a whip stretched), how much of the hook at its tip it keeps, how far its root
24
+ * rises (radians, less toward the tip), and how far it is coiled in an S to the side (0 to 1, a charge).
25
25
  */
26
26
  export type Lash = readonly [
27
27
  sting: number,
@@ -29,15 +29,17 @@ export type Lash = readonly [
29
29
  lean: number,
30
30
  reach: number,
31
31
  hook: number,
32
- rise: number
32
+ rise: number,
33
+ coil?: number
33
34
  ];
34
35
  /** At rest: behind, hooked. */
35
36
  export declare const HOOKED: Lash;
36
37
  /**
37
38
  * Where its tail is through a strike (TAILS, by the cut): it goes from HOOKED to the strike's poise
38
- * by the top of the wind-up (or most of the way to the strike for a special), is driven to its end
39
- * at the strike, eased in, then comes back. A charge holds the poise and trembles with the clock
40
- * `t`. The SPIN turns the tail low once round the body.
39
+ * in the first third of the wind-up (or most of the way to the strike for a special), so it answers
40
+ * the click at once (the user, 2026-11-16), is driven to its end at the strike, eased in, then
41
+ * comes back. A charge holds the poise drawn in, coils it in an S to the side as it grows (the
42
+ * user, 2026-11-16) and trembles with the clock `t`. The SPIN turns the tail low once round the body.
41
43
  */
42
44
  export declare const lashOf: (p: Pick<PlayerState, "cut" | "swing" | "heavy" | "charge" | "down">, t?: number) => Lash;
43
45
  /** A solved skeleton (solve() in rig.ts): each joint's place and turn in the world. */
@@ -259,15 +259,14 @@ export declare const PUNCH_HITS: number, PUNCH_STUN: number, PUNCH_MEMORY: numbe
259
259
  /**
260
260
  * The xenomorph (the user, 2026-11-15; kit.ts). XENO_HP health. It clings to a wall it faces with
261
261
  * forward and the sprint held (MODE.CLING, physics.ts; the sprint since the user, 2026-11-16):
262
- * CLING_SPEED m/s up, down or along it (faster than a man runs, the user 2026-11-16: it was slow)
263
- * while the wall rises CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP
262
+ * up, down or along it as fast as on a floor, its run and its sprint with the key held (the user,
263
+ * 2026-11-16) while the wall rises CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP
264
264
  * m/s. It dashes as a man does, XENO_DASH times as fast so as far, three in a row (kit.ts; the
265
265
  * user, 2026-11-16: no more charged pounce); an enemy its dash's burst reaches is pinned (room.ts):
266
266
  * POUNCE_HP health, his flag dropped, a stumble of POUNCE_STUN ticks, once per TACKLE_COOLDOWN. An
267
267
  * enemy whose katana or fists hit it loses ACID_HP.
268
268
  */
269
269
  export declare const XENO_HP = 12;
270
- export declare const CLING_SPEED = 8;
271
270
  export declare const CLING_FACING = 0.6;
272
271
  export declare const CLING_HOLD = 0.4;
273
272
  export declare const CLING_LEAP = 10;
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.179.0",
5
+ "version": "0.180.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"