@korial29/tiny-fps 0.160.0 → 0.161.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
@@ -63,7 +63,21 @@ var BLOW = {
63
63
  JAB: 0,
64
64
  CROSS: 1,
65
65
  HOOK: 2,
66
- LUNGE: 3
66
+ LUNGE: 3,
67
+ /** The xenomorph's (kit.ts): a swipe of the left claws, then of the right, while FIRE goes on. */
68
+ CLAW_L: 4,
69
+ CLAW_R: 5,
70
+ /** Its tail's sting, on SPECIAL: slow, far, and it throws whoever it stings. */
71
+ TAIL: 6
72
+ };
73
+ var CLAW = {
74
+ ticks: 16,
75
+ strike: 5,
76
+ reach: 1.8,
77
+ arc: .7,
78
+ hp: 1,
79
+ hold: -1,
80
+ knock: 0
67
81
  };
68
82
  var PUNCHES = [
69
83
  PUNCH,
@@ -85,6 +99,17 @@ var PUNCHES = [
85
99
  hp: 1,
86
100
  hold: -1,
87
101
  knock: 1.2
102
+ },
103
+ CLAW,
104
+ CLAW,
105
+ {
106
+ ticks: 40,
107
+ strike: 18,
108
+ reach: 3.2,
109
+ arc: .3,
110
+ hp: 3,
111
+ hold: -1,
112
+ knock: 1.2
88
113
  }
89
114
  ];
90
115
  var [PUNCH_HITS, PUNCH_STUN, PUNCH_MEMORY] = [
@@ -92,6 +117,14 @@ var [PUNCH_HITS, PUNCH_STUN, PUNCH_MEMORY] = [
92
117
  3,
93
118
  180
94
119
  ];
120
+ var CLING_SPEED = 4.5;
121
+ var [POUNCE_MIN, POUNCE_MAX, POUNCE_PITCH] = [
122
+ 9,
123
+ 17,
124
+ .3
125
+ ];
126
+ var [POUNCE_COOL, POUNCE_FLY] = [48, 40];
127
+ var [POUNCE_HP, POUNCE_STUN] = [2, 60];
95
128
  var PLASMA_R = .12;
96
129
  /**
97
130
  * The cuts, by CUT. A swing lasts `ticks`, during which no other starts, and strikes once, `strike`
@@ -516,7 +549,9 @@ var MODE = {
516
549
  /** Walking low. */
517
550
  CROUCH: 6,
518
551
  /** Seated in a rover (rover.ts): the body follows the seat, move() leaves it there. */
519
- RIDE: 7
552
+ RIDE: 7,
553
+ /** The xenomorph on a wall (`wall` the side): it climbs, goes down and along it with no gravity. */
554
+ CLING: 8
520
555
  };
521
556
  /**
522
557
  * Which side of the player a wall or a ledge is on (PlayerState.wall). In the air it is the side
@@ -576,7 +611,8 @@ var TEX = {
576
611
  var ROLE = {
577
612
  MARINE: 0,
578
613
  NINJA: 1,
579
- ASTRONAUT: 2
614
+ ASTRONAUT: 2,
615
+ XENO: 3
580
616
  };
581
617
  var MARINE = {
582
618
  run: 6,
@@ -595,7 +631,10 @@ var MARINE = {
595
631
  cap: 80,
596
632
  clip: 60,
597
633
  damage: 1,
598
- slow: 1
634
+ slow: 1,
635
+ hp: 8,
636
+ gear: true,
637
+ xeno: false
599
638
  };
600
639
  /** By ROLE. The astronaut moves and fights as the marine: the moon's gravity is the map's. */
601
640
  var KITS = [
@@ -617,12 +656,38 @@ var KITS = [
617
656
  cap: 40,
618
657
  clip: 30,
619
658
  damage: .5,
620
- slow: .55
659
+ slow: .55,
660
+ hp: 8,
661
+ gear: true,
662
+ xeno: false
621
663
  },
622
- MARINE
664
+ MARINE,
665
+ {
666
+ ...MARINE,
667
+ run: 6 * 1.1,
668
+ sprint: 9.9,
669
+ jump: 7 * 1.15,
670
+ double: 6 * 1.15,
671
+ ammo: 0,
672
+ rail: 0,
673
+ rifle: 0,
674
+ mag: 0,
675
+ cap: 0,
676
+ clip: 0,
677
+ hp: 12,
678
+ gear: false,
679
+ xeno: true
680
+ }
681
+ ];
682
+ /**
683
+ * The classes a map offers, the first one the default: on a map with space helmets the astronaut
684
+ * and the xenomorph, who breathes none.
685
+ */
686
+ var rolesOf = (def) => def.helmets ? [ROLE.ASTRONAUT, ROLE.XENO] : [
687
+ ROLE.MARINE,
688
+ ROLE.NINJA,
689
+ ROLE.XENO
623
690
  ];
624
- /** The classes a map offers, the first one the default: the astronaut alone on a map with space helmets. */
625
- var rolesOf = (def) => def.helmets ? [ROLE.ASTRONAUT] : [ROLE.MARINE, ROLE.NINJA];
626
691
  /** The class a player plays on the map: his `role` when the map offers it, else the map's default. */
627
692
  var roleOf = (role, def) => {
628
693
  const all = rolesOf(def);
@@ -1155,7 +1220,7 @@ var stumble = (p, dx, dz, ticks = 48, knock = 6) => {
1155
1220
  p.coyote = 0;
1156
1221
  p.buffer = 0;
1157
1222
  if (p.mode === MODE.HANG || p.mode === MODE.CLIMB) p.vy = 0;
1158
- if (p.mode === MODE.HANG || p.mode === MODE.CLIMB || p.mode === MODE.WALLRUN || p.mode === MODE.RIDE) {
1223
+ if (p.mode === MODE.HANG || p.mode === MODE.CLIMB || p.mode === MODE.WALLRUN || p.mode === MODE.CLING || p.mode === MODE.RIDE) {
1159
1224
  enter(p, MODE.AIR);
1160
1225
  p.edge = 0;
1161
1226
  }
@@ -1378,6 +1443,130 @@ var startRun = (p, w, c) => {
1378
1443
  }
1379
1444
  }
1380
1445
  };
1446
+ /**
1447
+ * The wall on `side` the xenomorph can hold: faces within WALL_REACH that rise CLING_HOLD over its
1448
+ * feet and start under its head; undefined when there is none.
1449
+ */
1450
+ var holdAt = (p, w, side) => {
1451
+ const { a, sign } = along(p, side);
1452
+ let best;
1453
+ for (const i of near(w, p.x, p.z, PLAYER_R + WALL_REACH)) {
1454
+ const b = w.def.brushes[i];
1455
+ const d = faceDist(b, p, side, WALL_REACH);
1456
+ if (d !== void 0 && b.max[1] > p.y + .4 && b.min[1] < p.y + 1.8) {
1457
+ const gap = Math.max(0, d - PLAYER_R);
1458
+ best = {
1459
+ gap: Math.min(best?.gap ?? Infinity, gap),
1460
+ top: Math.max(best?.top ?? -Infinity, b.max[1]),
1461
+ face: sign > 0 ? b.min[a] : b.max[a]
1462
+ };
1463
+ }
1464
+ }
1465
+ return best;
1466
+ };
1467
+ /**
1468
+ * The xenomorph takes hold of a wall it faces with forward held: in the air within WALL_REACH, on
1469
+ * a floor touching it, a wall from the knees to the head (wallGap). Not the side it just kicked off.
1470
+ */
1471
+ var clingTo = (p, w, c) => {
1472
+ if (!c.kit.xeno || !c.fwd || c.stumble) return false;
1473
+ const reach = p.mode === MODE.AIR ? WALL_REACH : .05;
1474
+ for (let side = 1; side <= 4; side++) {
1475
+ const [nx, nz] = TOWARD[side];
1476
+ const gap = wallGap(p, w, side);
1477
+ if (side !== p.wall && c.fx * nx + c.fz * nz >= .6 && gap !== void 0 && gap <= reach) {
1478
+ enter(p, MODE.CLING);
1479
+ p.wall = side;
1480
+ p.vx = p.vy = p.vz = 0;
1481
+ p.jumps = 1;
1482
+ p.coyote = 0;
1483
+ p.ev |= EV.GRAB;
1484
+ return true;
1485
+ }
1486
+ }
1487
+ return false;
1488
+ };
1489
+ /**
1490
+ * On a wall: forward climbs and back goes down, the side keys go along it (as the look sees it);
1491
+ * crouch lets go; a jump kicks off it, straight back when looking at it, else along the look. At a
1492
+ * top under the head, climbing pulls it up onto the top (MODE.CLIMB); down on a floor, it stands.
1493
+ */
1494
+ var cling = (p, w, c) => {
1495
+ const [nx, nz] = TOWARD[p.wall];
1496
+ const hold = holdAt(p, w, p.wall);
1497
+ if (c.keys & KEY.CROUCH || !hold) {
1498
+ enter(p, MODE.AIR);
1499
+ p.coyote = 0;
1500
+ return;
1501
+ }
1502
+ if (c.jump) {
1503
+ enter(p, MODE.AIR);
1504
+ if (c.fx * nx + c.fz * nz > .3) {
1505
+ p.vx = -nx * WALL_KICK_SPEED;
1506
+ p.vz = -nz * WALL_KICK_SPEED;
1507
+ leap$1(p, WALL_KICK_UP);
1508
+ } else {
1509
+ const cp = Math.cos(p.pitch);
1510
+ p.vx = c.fx * cp * 10;
1511
+ p.vz = c.fz * cp * 10;
1512
+ leap$1(p, Math.max(Math.sin(p.pitch) * 10, WALL_KICK_UP / 2));
1513
+ }
1514
+ return;
1515
+ }
1516
+ const up = (c.keys & KEY.FORWARD ? 1 : 0) - (c.keys & KEY.BACK ? 1 : 0);
1517
+ const s = (c.keys & KEY.RIGHT ? 1 : 0) - (c.keys & KEY.LEFT ? 1 : 0);
1518
+ const [tx, tz] = [-nz, nx];
1519
+ const k = (tx * -c.fz + tz * c.fx >= 0 ? s : -s) * CLING_SPEED;
1520
+ const { a, sign } = along(p, p.wall);
1521
+ if (up > 0 && hold.top < p.y + 1.8) {
1522
+ const land = hold.face + sign * CLIMB_INSET;
1523
+ const [lx, lz] = a === 0 ? [land, p.z] : [p.x, land];
1524
+ if (clear(w, lx, lz, hold.top + SKIN, hold.top + 1.8)) {
1525
+ enter(p, MODE.CLIMB);
1526
+ p.edge = f32$2(hold.top);
1527
+ p.vx = p.vy = p.vz = 0;
1528
+ return;
1529
+ }
1530
+ }
1531
+ p.vx = tx * k;
1532
+ p.vz = tz * k;
1533
+ p.vy = up > 0 && hold.top - p.y <= .45 ? 0 : up * CLING_SPEED;
1534
+ const pull = Math.min(hold.gap, 4 * DT$2);
1535
+ p.x += nx * pull;
1536
+ p.z += nz * pull;
1537
+ if (fly$1(p, w, 1.8, 0, false, c.bodies) >= 0 && up < 0) {
1538
+ enter(p, MODE.GROUND);
1539
+ p.wall = SIDE$1.NONE;
1540
+ p.coyote = 6;
1541
+ p.ev |= EV.LAND;
1542
+ }
1543
+ };
1544
+ /**
1545
+ * The xenomorph's dash: DASH held on a floor or a wall, with the dash timer run out, charges a
1546
+ * pounce (`charge`); let go, it leaps along the look, at least POUNCE_PITCH up, faster the longer
1547
+ * the charge. Anywhere else, or stumbling, the charge is lost.
1548
+ */
1549
+ var pounce = (p, c) => {
1550
+ const ready = !c.stumble && p.dash === 0 && (onFloor(p.mode) || p.mode === MODE.CLING);
1551
+ if (ready && c.keys & KEY.DASH) {
1552
+ p.charge = Math.min((p.charge ?? 0) + 1, 36);
1553
+ return;
1554
+ }
1555
+ if (ready && p.charge) {
1556
+ const v = POUNCE_MIN + (POUNCE_MAX - POUNCE_MIN) * p.charge / 36;
1557
+ const pitch = Math.max(p.pitch, POUNCE_PITCH);
1558
+ const cp = Math.cos(pitch);
1559
+ if (p.mode !== MODE.CLING) p.wall = SIDE$1.NONE;
1560
+ p.ev |= p.mode === MODE.SLIDE ? EV.SLIDE_END : 0;
1561
+ enter(p, MODE.AIR);
1562
+ p.vx = c.fx * cp * v;
1563
+ p.vz = c.fz * cp * v;
1564
+ leap$1(p, Math.sin(pitch) * v);
1565
+ p.dash = POUNCE_COOL;
1566
+ p.ev |= EV.DASH;
1567
+ }
1568
+ p.charge = 0;
1569
+ };
1381
1570
  /** Takes hold of a ledge: hang there. */
1382
1571
  var grab = (p, l, dashes) => {
1383
1572
  enter(p, MODE.HANG);
@@ -1397,7 +1586,7 @@ var free$1 = (p, w, c) => {
1397
1586
  const ground = p.mode === MODE.GROUND;
1398
1587
  const chain = c.kit.dashes > 1;
1399
1588
  if (chain && ground && p.dash === 0) p.dashes = c.kit.dashes;
1400
- if (c.dash && (p.dash === 0 || chain && p.dashes > 0 && p.dash <= 44) && (ground ? !chain || p.dashes > 0 : (p.mode === MODE.AIR || p.mode === MODE.WALLRUN) && p.dashes > 0)) {
1589
+ if (!c.kit.xeno && c.dash && (p.dash === 0 || chain && p.dashes > 0 && p.dash <= 44) && (ground ? !chain || p.dashes > 0 : (p.mode === MODE.AIR || p.mode === MODE.WALLRUN) && p.dashes > 0)) {
1401
1590
  const [dx, dz] = c.wx || c.wz ? [c.wx, c.wz] : [c.fx, c.fz];
1402
1591
  p.dashes -= +(ground && chain);
1403
1592
  if (!ground) {
@@ -1438,6 +1627,7 @@ var free$1 = (p, w, c) => {
1438
1627
  p.ev |= p.mode === MODE.SLIDE ? EV.SLIDE_END : 0;
1439
1628
  enter(p, MODE.AIR);
1440
1629
  }
1630
+ if ((p.mode === MODE.AIR || p.mode === MODE.GROUND) && clingTo(p, w, c)) return;
1441
1631
  if (p.mode === MODE.AIR) {
1442
1632
  const ledge = ledgeAt(p, w);
1443
1633
  if (ledge) grab(p, ledge, c.kit.dashes);
@@ -1538,9 +1728,11 @@ var move = (p, i, w, team = 0, bodies = [], kit = KITS[0]) => {
1538
1728
  p.dash--;
1539
1729
  if (p.dash === 50) cap(p, 10);
1540
1730
  }
1731
+ if (kit.xeno && p.mode !== MODE.HANG && p.mode !== MODE.CLIMB && !riding) pounce(p, c);
1541
1732
  if (p.mode === MODE.HANG) hang(p, w, c);
1733
+ if (p.mode === MODE.CLING) cling(p, w, c);
1542
1734
  if (p.mode === MODE.CLIMB) climb(p, w);
1543
- else if (p.mode !== MODE.HANG && !riding) free$1(p, w, c);
1735
+ else if (p.mode !== MODE.HANG && p.mode !== MODE.CLING && !riding) free$1(p, w, c);
1544
1736
  if (p.slow) {
1545
1737
  p.slow--;
1546
1738
  cap(p, 3);
@@ -5965,6 +6157,11 @@ var reach$1 = (r, c) => {
5965
6157
  /** Whether the player's body is a weapon: in a slide, or in the burst of a dash. */
5966
6158
  var tackling = (p) => p.mode === MODE.SLIDE || p.dash > 50;
5967
6159
  /**
6160
+ * Whether a xenomorph is in the strike of its pounce: in the air, the first POUNCE_FLY ticks of the
6161
+ * dash timer it leapt with (POUNCE_COOL). Only for a xenomorph: another's dash runs through it too.
6162
+ */
6163
+ var pouncing = (p) => p.mode === MODE.AIR && p.dash > POUNCE_COOL - POUNCE_FLY && p.dash <= POUNCE_COOL;
6164
+ /**
5968
6165
  * Whether the cylinders of `a` and `b` overlap, with TACKLE_REACH of reach on top: closer than
5969
6166
  * two radii and the reach on the floor plane, and their heights (low in a slide) overlap.
5970
6167
  */
@@ -6040,12 +6237,16 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6040
6237
  ...i,
6041
6238
  keys: 0
6042
6239
  } : i, w, team, bodies, kit);
6240
+ p.hp = Math.min(p.ev & EV.RESPAWN ? kit.hp : p.hp, kit.hp);
6043
6241
  p.heat = Math.max(0, (p.heat ?? 0) - (p.zapping ? 0 : p.hot ? 1 : 2));
6044
6242
  p.hot = !!p.hot && p.heat > 0;
6045
6243
  p.zapping = false;
6046
6244
  p.zap = !!p.stun && !!p.zap;
6047
6245
  if (down) {
6048
- if (p.down > 0 && !--p.down) respawn(p, w, team);
6246
+ if (p.down > 0 && !--p.down) {
6247
+ respawn(p, w, team);
6248
+ p.hp = kit.hp;
6249
+ }
6049
6250
  return STRIKE.NONE;
6050
6251
  }
6051
6252
  if (locked) return duel(p, i);
@@ -6053,14 +6254,22 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6053
6254
  p.pressed = !!(i.keys & KEY.FIRE);
6054
6255
  const { rack, blade, rail, rifle } = w.def.teams[team];
6055
6256
  const inside = !!rack && within(p, rack, 1.2);
6056
- if (armed && inside && !p.rack) [p.ammo, p.mag] = [kit.ammo, kit.mag];
6257
+ const gear = kit.gear;
6258
+ if (!gear) [p.ammo, p.rail, p.rifle, p.blade, p.nades] = [
6259
+ -1,
6260
+ -1,
6261
+ -1,
6262
+ false,
6263
+ 0
6264
+ ];
6265
+ if (armed && gear && inside && !p.rack) [p.ammo, p.mag] = [kit.ammo, kit.mag];
6057
6266
  p.rack = inside;
6058
- p.blade = !!p.blade || armed && !!blade && within(p, blade, 1.2);
6267
+ p.blade = !!p.blade || armed && gear && !!blade && within(p, blade, 1.2);
6059
6268
  const inRail = !!rail && within(p, rail, 1.2);
6060
- if (armed && inRail && !p.inRail) [p.rail, p.cap] = [kit.rail, kit.cap];
6269
+ if (armed && gear && inRail && !p.inRail) [p.rail, p.cap] = [kit.rail, kit.cap];
6061
6270
  p.inRail = inRail;
6062
6271
  const inRifle = !!rifle && within(p, rifle, 1.2);
6063
- if (armed && inRifle && !p.inRifle) [p.rifle, p.clip, p.nades] = [
6272
+ if (armed && gear && inRifle && !p.inRifle) [p.rifle, p.clip, p.nades] = [
6064
6273
  kit.rifle,
6065
6274
  kit.clip,
6066
6275
  3
@@ -6078,7 +6287,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6078
6287
  p.lob = Math.max(0, (p.lob ?? 0) - 1);
6079
6288
  const busy = p.mode === MODE.HANG || p.mode === MODE.CLIMB;
6080
6289
  const { ticks, hold } = CUTS[p.cut ?? 0];
6081
- const top = !!p.swing && !p.heavy && ticks - (p.swing ?? 0) === hold;
6290
+ const top = !kit.xeno && !!p.swing && !p.heavy && ticks - (p.swing ?? 0) === hold;
6082
6291
  if (top && p.wield && armed && !busy && i.keys & KEY.FIRE) p.charge = Math.min((p.charge ?? 0) + 1, HEAVY_MAX);
6083
6292
  else if (top && armed && !busy && (p.charge ?? 0) >= HEAVY_TAP) {
6084
6293
  [p.heavy, p.charge] = [true, 0];
@@ -6109,7 +6318,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6109
6318
  ];
6110
6319
  if (p.swing && hand >= 0 && !p.blade) p.swing = 0;
6111
6320
  if (!armed) {
6112
- [p.charge, p.reload] = [0, 0];
6321
+ [p.charge, p.reload] = [kit.xeno ? p.charge : 0, 0];
6113
6322
  return STRIKE.NONE;
6114
6323
  }
6115
6324
  const [key, size, carried, ticks2] = hand == 3 ? [
@@ -6135,6 +6344,10 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6135
6344
  const bare = hand < 0;
6136
6345
  const c = bare ? PUNCHES[p.cut ?? 0] ?? PUNCHES[0] : swingOf(p);
6137
6346
  if (p.swing && c.ticks - p.swing === c.strike) return STRIKE.CUT;
6347
+ if (kit.xeno) {
6348
+ claws(p, i, fresh, busy);
6349
+ return STRIKE.NONE;
6350
+ }
6138
6351
  if (p.wield && !top || p.railed || p.rifled || busy || p.reload || !p.wield && !p.mag) p.charge = 0;
6139
6352
  if (p.rifled && i.keys & KEY.SPECIAL && !busy && p.nades && !p.lob) {
6140
6353
  p.nades--;
@@ -6190,6 +6403,20 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6190
6403
  return STRIKE.NONE;
6191
6404
  };
6192
6405
  /**
6406
+ * The xenomorph's blows (BLOW): FIRE swipes the left claws, then the right while it goes on, a
6407
+ * fresh press after a swipe's strike throwing the next at once; SPECIAL alone stings with the tail.
6408
+ * Not with the hands busy (a hang, a climb); on a wall they are free.
6409
+ */
6410
+ var claws = (p, i, fresh, busy) => {
6411
+ if (busy) return;
6412
+ const c = PUNCHES[p.cut ?? 0];
6413
+ const other = p.cut === BLOW.CLAW_L ? BLOW.CLAW_R : BLOW.CLAW_L;
6414
+ if (!p.swing && i.keys & KEY.SPECIAL && !(i.keys & KEY.FIRE)) p.cut = BLOW.TAIL;
6415
+ else if (i.keys & KEY.FIRE && (!p.swing || fresh && p.cut !== BLOW.TAIL && c.ticks - p.swing > c.strike)) p.cut = other;
6416
+ else return;
6417
+ [p.heavy, p.swing] = [false, PUNCHES[p.cut].ticks];
6418
+ };
6419
+ /**
6193
6420
  * A step in a saber lock: the blade stays in hand and no cut starts. Each FIRE press (FIRE held
6194
6421
  * now, not at the last step) pushes; a side or back key held counts `away`, up to LOCK_BREAK. The
6195
6422
  * lock runs down to 1, where it waits for the host, who parts the two (room.ts).
@@ -7946,13 +8173,15 @@ var mapOf = (key) => key !== void 0 && MAPS[key] || HIGHLINE;
7946
8173
  var mapKey = (key) => key !== void 0 && Object.hasOwn(MAPS, key) ? key : "highline";
7947
8174
  // src/shared/protocol.ts
7948
8175
  /** What put a player down, in a frag message. */
8176
+ /** CLAW is all the xenomorph's: claws, tail, pounce, and its acid. */
7949
8177
  var FRAG = {
7950
8178
  GUN: 0,
7951
8179
  BLADE: 1,
7952
8180
  FIST: 2,
7953
8181
  RAIL: 3,
7954
8182
  NADE: 4,
7955
- VEHICLE: 5
8183
+ VEHICLE: 5,
8184
+ CLAW: 6
7956
8185
  };
7957
8186
  /** A rover's floats, in wire order. */
7958
8187
  var ROVER_F = [...[
@@ -8055,7 +8284,7 @@ var encodeSnapshot = (s) => {
8055
8284
  v.setUint8(o + 46, (p.lost ?? 0) & 7 | ((p.cut ?? 0) & 4) << 1 | (p.fried ? 16 : 0) | (p.heavy ? 32 : 0) | (p.armor ?? 0) << 6);
8056
8285
  v.setUint8(o + 47, p.down ? p.fell ?? 0 : p.charge ?? 0);
8057
8286
  v.setUint8(o + 48, p.lock ?? 0);
8058
- v.setUint8(o + 49, (p.foe ?? 0) & 15 | (p.dashes & 2) << 3 | (p.hp & 8) << 2 | (p.pressed ? 128 : 0));
8287
+ v.setUint8(o + 49, (p.foe ?? 0) & 15 | (p.dashes & 2) << 3 | (p.hp & 8) << 2 | (p.mode & 8) << 3 | (p.pressed ? 128 : 0));
8059
8288
  v.setUint8(o + 50, p.pushes ?? 0);
8060
8289
  v.setUint8(o + 51, p.away ?? 0);
8061
8290
  v.setUint8(o + 52, (p.rail ?? -1) + 1);
@@ -8192,7 +8421,7 @@ var chosen = (m) => {
8192
8421
  const [tone, hair, role] = [
8193
8422
  index(m.tone, 6),
8194
8423
  index(m.hair, HAIRS_N[body ?? 0]),
8195
- index(m.role, 3)
8424
+ index(m.role, KITS.length)
8196
8425
  ];
8197
8426
  return {
8198
8427
  ...body !== void 0 ? { body } : {},
@@ -8637,6 +8866,10 @@ var Room = class {
8637
8866
  */
8638
8867
  tackle(p, view) {
8639
8868
  const me = p.state;
8869
+ if (!me.down && pouncing(me) && this.kit(p).xeno) {
8870
+ this.pin(p, view);
8871
+ return;
8872
+ }
8640
8873
  if (me.down || !tackling(me) || this.ticks - p.tackled < 30) return;
8641
8874
  const foes = this.players().filter((q) => q.info.team !== p.info.team);
8642
8875
  const hit = this.rewind(p.info.id, view).find((seen) => reaches(me, seen) && foes.some((q) => q.info.id === seen.id && this.ctf.carrying(q.info.id) >= 0));
@@ -8650,6 +8883,38 @@ var Room = class {
8650
8883
  p.tackled = this.ticks;
8651
8884
  }
8652
8885
  /**
8886
+ * A xenomorph's pounce `p` meets an enemy who is up, where `p` drew him: he is pinned, POUNCE_HP
8887
+ * of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it leapt. The pounce
8888
+ * ends on him: it stops, its dash timer past the strike.
8889
+ */
8890
+ pin(p, view) {
8891
+ const me = p.state;
8892
+ const seen = this.enemies(p, view).find((s) => reaches(me, s));
8893
+ const foe = this.players().find((q) => q.info.id === seen?.id);
8894
+ if (!foe) return;
8895
+ const v = speedOf$1(me);
8896
+ const [dx, dz] = v > .001 ? [me.vx / v, me.vz / v] : forward(me.yaw);
8897
+ me.dash = Math.min(me.dash, POUNCE_COOL - POUNCE_FLY);
8898
+ [me.vx, me.vz] = [me.vx * .2, me.vz * .2];
8899
+ me.hits = me.hits + 1 & 255;
8900
+ if (this.harm(foe, POUNCE_HP, p, FRAG.CLAW, felled(FALL$1.STRUCK, dx, dz))) return;
8901
+ this.drop(foe.info.id);
8902
+ stumble(foe.state, dx, dz, POUNCE_STUN);
8903
+ foe.state.zap = false;
8904
+ foe.by = p.info.id;
8905
+ }
8906
+ /** The class `p` plays on this map (kit.ts). */
8907
+ kit(p) {
8908
+ return kitOf(p.info.role, this.world.def);
8909
+ }
8910
+ /**
8911
+ * An enemy's katana or fists struck the xenomorph `foe`: its acid takes ACID_HP from `by`, unless
8912
+ * he is one too or already down.
8913
+ */
8914
+ acid(foe, by) {
8915
+ if (this.kit(foe).xeno && !this.kit(by).xeno && !by.state.down) this.harm(by, 1, foe, FRAG.CLAW, felled(FALL$1.STRUCK, ...forward(foe.state.yaw)));
8916
+ }
8917
+ /**
8653
8918
  * The enemies of `p` as `p` drew them at the view tick `view` (lag compensation), without one who
8654
8919
  * lies down now or did then.
8655
8920
  */
@@ -8856,6 +9121,7 @@ var Room = class {
8856
9121
  p.state.hits = p.state.hits + 1 & 255;
8857
9122
  for (const [, k] of cars) this.hurt(this.rovers[k], swingOf(p.state).hp, p.info.id, p.info.team);
8858
9123
  for (const foe of foes) {
9124
+ this.acid(foe, p);
8859
9125
  const drawn = seen.find((s) => s.id === foe.info.id);
8860
9126
  if (this.harm(foe, swingOf(p.state).hp, p, FRAG.BLADE, felled(FALL$1.STRUCK, ...knock(p.state)))) foe.state.lost = limbOf(p.state, drawn);
8861
9127
  else {
@@ -8880,12 +9146,15 @@ var Room = class {
8880
9146
  const foes = this.players().filter((q) => seen.some((s) => s.id === q.info.id));
8881
9147
  if (!foes.length) return;
8882
9148
  p.state.hits = p.state.hits + 1 & 255;
9149
+ const xeno = (p.state.cut ?? 0) >= BLOW.CLAW_L;
8883
9150
  for (const foe of foes) {
8884
- foe.blows = (this.ticks - (foe.punched ?? -Infinity) <= PUNCH_MEMORY ? foe.blows ?? 0 : 0) + 1;
9151
+ this.acid(foe, p);
9152
+ const fresh = this.ticks - (foe.punched ?? -Infinity) <= PUNCH_MEMORY;
9153
+ foe.blows = xeno ? 0 : (fresh ? foe.blows ?? 0 : 0) + 1;
8885
9154
  foe.punched = this.ticks;
8886
9155
  if (!blow.hp) foe.bruise = ((foe.bruise ?? 0) + 1) % PUNCH_HITS;
8887
9156
  const fell = felled(FALL$1.STRUCK, ...forward(p.state.yaw));
8888
- if ((blow.hp || !foe.bruise) && this.harm(foe, 1, p, FRAG.FIST, fell)) continue;
9157
+ if ((blow.hp || !foe.bruise) && this.harm(foe, blow.hp || 1, p, xeno ? FRAG.CLAW : FRAG.FIST, fell)) continue;
8889
9158
  if (blow.knock || foe.blows >= PUNCH_STUN) {
8890
9159
  foe.blows = 0;
8891
9160
  this.drop(foe.info.id);
@@ -8997,17 +9266,17 @@ var Room = class {
8997
9266
  const wants = ({ state: q, info }) => {
8998
9267
  const kit = kitOf(info.role, this.world.def);
8999
9268
  return [
9000
- q.hp < 8,
9269
+ q.hp < kit.hp,
9001
9270
  q.ammo >= 0 && q.ammo < kit.ammo || (q.rifle ?? -1) >= 0 && q.rifle < kit.rifle,
9002
9271
  (q.rail ?? -1) >= 0 && q.rail < kit.rail,
9003
- (q.armor ?? 0) < 3
9272
+ kit.gear && (q.armor ?? 0) < 3
9004
9273
  ][kind];
9005
9274
  };
9006
9275
  const p = players.find((o) => !o.state.down && wants(o) && within(o.state, at, .9));
9007
9276
  if (p) {
9008
9277
  const q = p.state;
9009
9278
  const kit = kitOf(p.info.role, this.world.def);
9010
- if (kind == 0) q.hp = Math.min(8, q.hp + 2);
9279
+ if (kind == 0) q.hp = Math.min(kit.hp, q.hp + 2);
9011
9280
  else if (kind == 1) {
9012
9281
  q.ammo = q.ammo < 0 ? -1 : Math.min(kit.ammo, q.ammo + 20);
9013
9282
  q.rifle = (q.rifle ?? -1) < 0 ? -1 : Math.min(kit.rifle, q.rifle + 60);
@@ -9138,6 +9407,7 @@ var Room = class {
9138
9407
  sink(r) {
9139
9408
  for (const p of this.players()) if (this.seatOf(p)[0] === r) {
9140
9409
  respawn(p.state, this.world, p.info.team);
9410
+ p.state.hp = this.kit(p).hp;
9141
9411
  this.ctf.moved(p.state);
9142
9412
  }
9143
9413
  this.renew(this.rovers.indexOf(r));
@@ -9351,7 +9621,8 @@ var Room = class {
9351
9621
  p.state = {
9352
9622
  ...this.place(p.info.id, p.info.team, put),
9353
9623
  shots,
9354
- hits
9624
+ hits,
9625
+ hp: this.kit(p).hp
9355
9626
  };
9356
9627
  put.push(p.state);
9357
9628
  this.ctf.place(p.info.id, p.state);
@@ -9501,7 +9772,10 @@ var Room = class {
9501
9772
  ...chosen(picked),
9502
9773
  ...bot ? { bot } : {}
9503
9774
  },
9504
- state: this.place(id, team, players.map((p) => p.state)),
9775
+ state: {
9776
+ ...this.place(id, team, players.map((p) => p.state)),
9777
+ hp: kitOf(chosen(picked).role, this.world.def).hp
9778
+ },
9505
9779
  since: this.joins++,
9506
9780
  bank: 10,
9507
9781
  ack: 65535,
@@ -4,7 +4,7 @@ import type { Beat } from './beats';
4
4
  /** Seconds between two frags for them to count as a double kill, a multi kill and on. */
5
5
  export declare const MULTI = 4;
6
6
  /** The lines of the 2nd, 3rd, 4th, 5th frag in quick succession; the last for every one after. */
7
- export declare const QUICK: (16 | 14 | 15 | 18 | 17)[];
7
+ export declare const QUICK: (16 | 14 | 18 | 17 | 15)[];
8
8
  /** Frags without going down between two lines of a run; the last line for every SPREE after. */
9
9
  export declare const SPREE = 5;
10
10
  export declare const RUNS: (20 | 21 | 22 | 23 | 19)[];
@@ -27,7 +27,7 @@ export interface Body {
27
27
  /** Appends the body's vertices (see STRIDE) in the jacket `color`; nothing when pose() has none. */
28
28
  draw(out: Out, eye: Vec3, yaw: number, pitch: number, roll?: number, color?: number[]): void;
29
29
  /** The own player's character (BUILD in rig.ts, PlayerInfo.body): the woman's arms are slimmer and her hands smaller, on the same grips; `tone` the skin he picked (the default's when absent). */
30
- wear(build: number, tone?: number[], ninja?: boolean): void;
30
+ wear(build: number, tone?: number[], ninja?: boolean, xeno?: boolean): void;
31
31
  }
32
32
  export declare const inv: ([x, y, z, w]: Quat) => Quat;
33
33
  /**
@@ -111,6 +111,8 @@ export declare const TONES: number[][];
111
111
  /** A skin tone for the runner `id`, the same for everyone who sees him. */
112
112
  export declare const toneOf: (id: number) => number[];
113
113
  /** The skin tone the player picked (`c.tone`, an index of TONES), else his id's. */
114
+ /** The xenomorph's skin on the human runner it is drawn as until it has a body of its own: dark chitin. */
115
+ export declare const CHITIN: number[];
114
116
  export declare const toneFor: (id: number, c?: {
115
117
  tone?: number;
116
118
  }) => number[];
@@ -91,6 +91,8 @@ export interface Hud {
91
91
  * as gold pips after the health's, only the ones he has.
92
92
  */
93
93
  vitals(hp: number, ammo: number, blade?: boolean, wield?: boolean, rail?: number, railed?: boolean, loaded?: number, swapping?: boolean, rifle?: number, rifled?: boolean, nades?: number, armor?: number): void;
94
+ /** The health the own player's class has at most (Kit.hp): as many pips. */
95
+ life(max: number): void;
94
96
  /** A hit marker on the crosshair for a moment: a ball or a cut of the own player hit. */
95
97
  hit(): void;
96
98
  /** The face over the health, frame `n` of face.ts (-1 hides it). */
@@ -44,6 +44,8 @@ export interface Controls {
44
44
  weapon: number;
45
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. */
46
46
  pilot: boolean;
47
+ /** Playing the xenomorph (the client sets it): the right button or G stings with the tail (SPECIAL alone). */
48
+ beast: boolean;
47
49
  /**
48
50
  * The KEY bits of the next step, read once per step. Same as `keys`, plus BLADE while the katana
49
51
  * 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
@@ -144,6 +144,8 @@ export interface Renderer {
144
144
  muzzle(id: number): Vec3 | undefined;
145
145
  /** The runners of the players `ids` grin for a moment: their team has captured. */
146
146
  cheer(ids: number[]): void;
147
+ /** The xenomorph's vision (the own player is one): a grey-blue world, the enemies in sight glowing. */
148
+ vision(on: boolean): void;
147
149
  /** The body of each player (PlayerInfo.body, BODY), from the roster: the man's for one not in it; and the skin and haircut he picked, his id's for one not in `looks`. */
148
150
  wear(builds: ReadonlyMap<number, number>, looks?: ReadonlyMap<number, Choice>): void;
149
151
  /**
@@ -212,6 +212,11 @@ export declare const BLOW: {
212
212
  readonly CROSS: 1;
213
213
  readonly HOOK: 2;
214
214
  readonly LUNGE: 3;
215
+ /** The xenomorph's (kit.ts): a swipe of the left claws, then of the right, while FIRE goes on. */
216
+ readonly CLAW_L: 4;
217
+ readonly CLAW_R: 5;
218
+ /** Its tail's sting, on SPECIAL: slow, far, and it throws whoever it stings. */
219
+ readonly TAIL: 6;
215
220
  };
216
221
  export declare const PUNCHES: {
217
222
  ticks: number;
@@ -223,6 +228,26 @@ export declare const PUNCHES: {
223
228
  knock: number;
224
229
  }[];
225
230
  export declare const PUNCH_HITS: number, PUNCH_STUN: number, PUNCH_MEMORY: number;
231
+ /**
232
+ * The xenomorph (the user, 2026-11-15; kit.ts). XENO_HP health. It clings to a wall it faces with
233
+ * forward held (MODE.CLING, physics.ts): CLING_SPEED m/s up, down or along it while the wall rises
234
+ * CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP m/s. DASH held on a
235
+ * floor or a wall charges a pounce for up to POUNCE_HOLD ticks (PlayerState.charge); let go, it
236
+ * leaps POUNCE_MIN to POUNCE_MAX m/s along the look, at least POUNCE_PITCH up, and the dash timer
237
+ * runs from POUNCE_COOL: the first POUNCE_FLY ticks of it in the air, an enemy it reaches is
238
+ * pinned (room.ts): POUNCE_HP health, his flag dropped, a stumble of POUNCE_STUN ticks. An enemy
239
+ * whose katana or fists hit it loses ACID_HP.
240
+ */
241
+ export declare const XENO_HP = 12;
242
+ export declare const CLING_SPEED = 4.5;
243
+ export declare const CLING_FACING = 0.6;
244
+ export declare const CLING_HOLD = 0.4;
245
+ export declare const CLING_LEAP = 10;
246
+ export declare const POUNCE_HOLD = 36;
247
+ export declare const POUNCE_MIN: number, POUNCE_MAX: number, POUNCE_PITCH: number;
248
+ export declare const POUNCE_COOL: number, POUNCE_FLY: number;
249
+ export declare const POUNCE_HP: number, POUNCE_STUN: number;
250
+ export declare const ACID_HP = 1;
226
251
  /** Shots the rack loads. */
227
252
  export declare const AMMO_MAX = 60;
228
253
  /**