@korial29/tiny-fps 1.9.0 → 1.10.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.
@@ -2317,6 +2317,10 @@ var Ctf = class {
2317
2317
  this.clock = this.rules.timeLimit * 60;
2318
2318
  for (const m of this.mates.values()) m.caps = m.returns = m.frags = 0;
2319
2319
  }
2320
+ /** Ticks the match has run (it counts down from the time limit). */
2321
+ elapsed() {
2322
+ return this.rules.timeLimit * 60 - this.clock;
2323
+ }
2320
2324
  /** The part of a snapshot that is the match's. */
2321
2325
  wire() {
2322
2326
  return {
@@ -6113,7 +6117,7 @@ var hull$1 = () => SHIP$1.flatMap(({ cut, floor, holes, tears, fair, crates }, n
6113
6117
  ][deck + 1], 125.75, WOOD));
6114
6118
  })];
6115
6119
  });
6116
- var BACK$2 = HULL.axis.map((c) => c + HULL.r);
6120
+ var BACK$3 = HULL.axis.map((c) => c + HULL.r);
6117
6121
  /**
6118
6122
  * A heap of wreckage across each gap, from one broken end to the other, on the line: nobody walks
6119
6123
  * through a gap (the user, 2026-11-26). Its top is 1.875 m over the highest sand under it (no
@@ -6517,7 +6521,7 @@ var BEACH = {
6517
6521
  ]),
6518
6522
  vests: both([on(ENGINE)], [
6519
6523
  63,
6520
- BACK$2[1],
6524
+ BACK$3[1],
6521
6525
  MID$1
6522
6526
  ]),
6523
6527
  floor: DEPTH,
@@ -6944,7 +6948,7 @@ var end = (l) => [
6944
6948
  l.y,
6945
6949
  l.to[1]
6946
6950
  ];
6947
- var flat$2 = (ax, az, bx, bz) => Math.sqrt((bx - ax) ** 2 + (bz - az) ** 2);
6951
+ var flat$3 = (ax, az, bx, bz) => Math.sqrt((bx - ax) ** 2 + (bz - az) ** 2);
6948
6952
  /** The rectangle r less h: up to four rectangles. */
6949
6953
  var cut$1 = (r, h) => {
6950
6954
  if (h[0] >= r[2] || h[2] <= r[0] || h[1] >= r[3] || h[3] <= r[1]) return [r];
@@ -7245,7 +7249,7 @@ var locate = (nav, w, v, above = ABOVE, near = NEAR$1) => {
7245
7249
  if (seen.has(j)) continue;
7246
7250
  seen.add(j);
7247
7251
  const o = onto(w, nav.polys[j], v[0], v[2]);
7248
- const d = flat$2(v[0], v[2], o[0], o[2]) + Math.abs(o[1] - v[1]);
7252
+ const d = flat$3(v[0], v[2], o[0], o[2]) + Math.abs(o[1] - v[1]);
7249
7253
  if (d < least && o[1] - v[1] <= above && v[1] - o[1] <= BELOW) [best, least, pt] = [
7250
7254
  j,
7251
7255
  d,
@@ -7285,7 +7289,7 @@ var links = (nav, w, start, legs, route = -1, toll = false) => {
7285
7289
  end(l)
7286
7290
  ] : [from, end(l)];
7287
7291
  let len = 0;
7288
- for (let n = 1; n < pts.length; n++) len += flat$2(pts[n - 1][0], pts[n - 1][2], pts[n][0], pts[n][2]);
7292
+ for (let n = 1; n < pts.length; n++) len += flat$3(pts[n - 1][0], pts[n - 1][2], pts[n][0], pts[n][2]);
7289
7293
  nav.out[i].push({
7290
7294
  to: j,
7291
7295
  from,
@@ -7491,8 +7495,8 @@ var path = (nav, w, a, b, prefer = -1) => {
7491
7495
  const back = new Int32Array(n).fill(-1);
7492
7496
  const at = new Float64Array(2 * n);
7493
7497
  const done = new Uint8Array(n);
7494
- const h = (i) => flat$2(at[2 * i], at[2 * i + 1], b[0], b[2]) / PACE;
7495
- g[s] = flat$2(a[0], a[2], sp[0], sp[2]) / PACE;
7498
+ const h = (i) => flat$3(at[2 * i], at[2 * i + 1], b[0], b[2]) / PACE;
7499
+ g[s] = flat$3(a[0], a[2], sp[0], sp[2]) / PACE;
7496
7500
  [at[2 * s], at[2 * s + 1]] = [sp[0], sp[2]];
7497
7501
  f[s] = g[s] + h(s);
7498
7502
  const heap = [s];
@@ -7511,11 +7515,11 @@ var path = (nav, w, a, b, prefer = -1) => {
7511
7515
  if (e.legs) {
7512
7516
  const [fx, , fz] = e.from;
7513
7517
  const other = e.route < 0 || prefer < 0 ? 1 : e.route === prefer ? 1 / OTHER : OTHER;
7514
- c = flat$2(x, z, fx, fz) / PACE + e.cost * other * (1 + (e.fails ?? 0)) + (e.toll && other > 1 ? AREA : 0);
7518
+ c = flat$3(x, z, fx, fz) / PACE + e.cost * other * (1 + (e.fails ?? 0)) + (e.toll && other > 1 ? AREA : 0);
7515
7519
  p = [e.end[0], e.end[2]];
7516
7520
  } else {
7517
7521
  p = nearest(e.a, e.b, x, z);
7518
- c = flat$2(x, z, p[0], p[1]) / PACE + (e.pass === PASS.HOP ? HOP_COST : e.pass ? DOWN : 0);
7522
+ c = flat$3(x, z, p[0], p[1]) / PACE + (e.pass === PASS.HOP ? HOP_COST : e.pass ? DOWN : 0);
7519
7523
  }
7520
7524
  const r = nav.route[e.to];
7521
7525
  c += r >= 0 && prefer >= 0 && r !== prefer && nav.route[i] !== r ? AREA : 0;
@@ -7530,7 +7534,7 @@ var path = (nav, w, a, b, prefer = -1) => {
7530
7534
  }
7531
7535
  }
7532
7536
  const goal = t >= 0 && done[t] ? t : close;
7533
- const target = goal !== t ? onto(w, nav.polys[goal], b[0], b[2]) : flat$2(b[0], b[2], tp[0], tp[2]) < .5 ? b : tp;
7537
+ const target = goal !== t ? onto(w, nav.polys[goal], b[0], b[2]) : flat$3(b[0], b[2], tp[0], tp[2]) < .5 ? b : tp;
7534
7538
  const edges = [];
7535
7539
  for (let i = goal; i !== s && prev[i]; i = back[i]) edges.unshift(prev[i]);
7536
7540
  const steps = [];
@@ -7555,10 +7559,10 @@ var path = (nav, w, a, b, prefer = -1) => {
7555
7559
  for (const e of edges) {
7556
7560
  if (e.legs) {
7557
7561
  const [fx, , fz] = e.from;
7558
- if (ports.length || !steps.at(-1)?.leg || flat$2(from[0], from[2], fx, fz) > 1) {
7562
+ if (ports.length || !steps.at(-1)?.leg || flat$3(from[0], from[2], fx, fz) > 1) {
7559
7563
  const l = e.legs[0];
7560
7564
  if (l.k === "leap") {
7561
- const d = flat$2(l.at[0], l.at[1], l.to[0], l.to[1]) || 1;
7565
+ const d = flat$3(l.at[0], l.at[1], l.to[0], l.to[1]) || 1;
7562
7566
  const [rx, rz] = [fx - (l.to[0] - l.at[0]) / d * RUN_IN, fz - (l.to[1] - l.at[1]) / d * RUN_IN];
7563
7567
  let level = true;
7564
7568
  for (let u = 0; u <= 1 && level; u += .25) {
@@ -7592,7 +7596,7 @@ var path = (nav, w, a, b, prefer = -1) => {
7592
7596
  const [dx, dz] = [(q[0] + q[2] - p[0] - p[2]) / 2, (q[1] + q[3] - p[1] - p[3]) / 2];
7593
7597
  const c = (v, n) => e.pass === PASS.DROP ? Math.min(Math.max(v, q[n] + OVER), q[n + 2] - OVER) : v;
7594
7598
  const [ax, az, bx, bz] = [...e.a, ...e.b].map((v, n) => c(v, n % 2));
7595
- const len = flat$2(ax, az, bx, bz);
7599
+ const len = flat$3(ax, az, bx, bz);
7596
7600
  const k = Math.min(EDGE, len * .4) / (len || 1);
7597
7601
  const ea = [ax + (bx - ax) * k, az + (bz - az) * k];
7598
7602
  const eb = [bx - (bx - ax) * k, bz - (bz - az) * k];
@@ -9430,7 +9434,7 @@ var muzzle = (r, [side, up, ahead]) => {
9430
9434
  ];
9431
9435
  };
9432
9436
  /** From `o` toward the aim, unit. */
9433
- var toward$2 = (o, aim) => {
9437
+ var toward$3 = (o, aim) => {
9434
9438
  const d = aim.map((v, a) => v - o[a]);
9435
9439
  const l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
9436
9440
  return d.map((v) => v / l);
@@ -9444,7 +9448,7 @@ var bolts = (r, by, team, yaw, pitch, id, sight) => {
9444
9448
  const aim = aimOf(r, yaw, pitch, sight);
9445
9449
  return (r.ship ? SHIP_GUNS : GUNS).map((m, k) => {
9446
9450
  const o = muzzle(r, m);
9447
- const d = toward$2(o, aim);
9451
+ const d = toward$3(o, aim);
9448
9452
  return {
9449
9453
  id: id + k & 255,
9450
9454
  by,
@@ -9468,7 +9472,7 @@ var bolts = (r, by, team, yaw, pitch, id, sight) => {
9468
9472
  */
9469
9473
  var missile = (r, by, team, yaw, pitch, id, k, sight) => {
9470
9474
  const o = muzzle(r, PODS[k]);
9471
- const d = toward$2(o, aimOf(r, yaw, pitch, sight));
9475
+ const d = toward$3(o, aimOf(r, yaw, pitch, sight));
9472
9476
  const own = r.vx * d[0] + r.vy * d[1] + r.vz * d[2];
9473
9477
  return {
9474
9478
  id: id & 255,
@@ -9488,7 +9492,7 @@ var missile = (r, by, team, yaw, pitch, id, k, sight) => {
9488
9492
  };
9489
9493
  };
9490
9494
  // src/shared/sortie.ts
9491
- var { FORWARD: FORWARD$1, BACK: BACK$1, JUMP: JUMP$1, CROUCH: CROUCH$1, SPRINT: SPRINT$1, USE } = KEY;
9495
+ var { FORWARD: FORWARD$2, BACK: BACK$2, JUMP: JUMP$1, CROUCH: CROUCH$1, SPRINT: SPRINT$1, USE: USE$1 } = KEY;
9492
9496
  /**
9493
9497
  * The flight: metres out from the mouth where it lines up; how high over the deck it flies in, over a pad it starts down; the top speed it asks, the share of
9494
9498
  * the distance it slows to near a stop, the nose's error past which it does not thrust, the
@@ -9511,8 +9515,8 @@ var SORTIE = {
9511
9515
  };
9512
9516
  /** Metres before a ship's centre a bot walks to, to board it. */
9513
9517
  var NOSE = 4;
9514
- var flat$1 = (ax, az, bx, bz) => Math.sqrt((bx - ax) ** 2 + (bz - az) ** 2);
9515
- var toward$1 = (x0, z0, x1, z1) => norm(Math.atan2(-(x1 - x0), -(z1 - z0)));
9518
+ var flat$2 = (ax, az, bx, bz) => Math.sqrt((bx - ax) ** 2 + (bz - az) ** 2);
9519
+ var toward$2 = (x0, z0, x1, z1) => norm(Math.atan2(-(x1 - x0), -(z1 - z0)));
9516
9520
  var clamp = (v, a, b) => Math.min(b, Math.max(a, v));
9517
9521
  /** A team's way into the station: in front of its mouth (red's is the +z one), then down on the deck inside. */
9518
9522
  var approach = ({ hull: [cx, , cz], post }, team) => {
@@ -9544,14 +9548,14 @@ var steer = (r, to, stop) => {
9544
9548
  ];
9545
9549
  const h = Math.sqrt(dx * dx + dz * dz);
9546
9550
  const d = Math.sqrt(h * h + dy * dy) || 1e-6;
9547
- const yaw = h > 2 ? toward$1(r.x, r.z, to[0], to[2]) : r.yaw;
9551
+ const yaw = h > 2 ? toward$2(r.x, r.z, to[0], to[2]) : r.yaw;
9548
9552
  const pitch = clamp(Math.atan2(dy, Math.max(h, 1)), -1.1, 1.1);
9549
9553
  const v = (r.vx * dx + r.vy * dy + r.vz * dz) / d;
9550
9554
  const want = stop ? Math.min(SORTIE.FAST, d * SORTIE.EASE) : SORTIE.FAST;
9551
9555
  const aimed = Math.abs(norm(yaw - r.yaw + Math.PI) - Math.PI) < SORTIE.AIM || h < 2;
9552
9556
  let keys = 0;
9553
- if (v > want + 2) keys |= BACK$1;
9554
- else if (v < want && aimed && h > 2) keys |= FORWARD$1 | (d > 150 ? SPRINT$1 : 0);
9557
+ if (v > want + 2) keys |= BACK$2;
9558
+ else if (v < want && aimed && h > 2) keys |= FORWARD$2 | (d > 150 ? SPRINT$1 : 0);
9555
9559
  const vy = Math.sign(dy) * Math.min(SORTIE.CLIMB, Math.sqrt(2 * SORTIE.SETTLE * Math.abs(dy)));
9556
9560
  if (r.vy < vy - .7) keys |= JUMP$1;
9557
9561
  else if (r.vy > vy + .7) keys |= CROUCH$1;
@@ -9562,9 +9566,9 @@ var steer = (r, to, stop) => {
9562
9566
  };
9563
9567
  };
9564
9568
  /** A straight walk on a floor to (x, z): forward, turned to it; nothing within half a metre. */
9565
- var walk = (p, x, z) => flat$1(p.x, p.z, x, z) < .5 ? void 0 : {
9566
- keys: FORWARD$1 | (flat$1(p.x, p.z, x, z) > 3 ? SPRINT$1 : 0),
9567
- yaw: toward$1(p.x, p.z, x, z),
9569
+ var walk = (p, x, z) => flat$2(p.x, p.z, x, z) < .5 ? void 0 : {
9570
+ keys: FORWARD$2 | (flat$2(p.x, p.z, x, z) > 3 ? SPRINT$1 : 0),
9571
+ yaw: toward$2(p.x, p.z, x, z),
9568
9572
  pitch: 0
9569
9573
  };
9570
9574
  /** Where its feet press the button from: in front of the console's west side. */
@@ -9587,7 +9591,7 @@ var plan = (r, { def, home, go, team }) => {
9587
9591
  ];
9588
9592
  const out = [];
9589
9593
  if (inside(def, r.x, r.y, r.z)) out.push(a);
9590
- else if (r.y > low && flat$1(r.x, r.z, cx, cz) < HULL$1.R + SORTIE.OUT - 10) out.push([
9594
+ else if (r.y > low && flat$2(r.x, r.z, cx, cz) < HULL$1.R + SORTIE.OUT - 10) out.push([
9591
9595
  cx,
9592
9596
  r.y,
9593
9597
  cz + (r.z < cz ? -1 : 1) * (HULL$1.R + SORTIE.OUT)
@@ -9620,7 +9624,7 @@ var Sortie = class {
9620
9624
  */
9621
9625
  think(id, p, e, t) {
9622
9626
  const { def, ship, go } = e;
9623
- const press = t & 1 ? USE : 0;
9627
+ const press = t & 1 ? USE$1 : 0;
9624
9628
  this.board = void 0;
9625
9629
  if (p.mode === MODE.RIDE) return ship.driver === id ? this.fly(ship, e, press) : void 0;
9626
9630
  [this.stage, this.landed, this.route] = [
@@ -9634,7 +9638,7 @@ var Sortie = class {
9634
9638
  const east = def.hall[0][0] + 44;
9635
9639
  if (go) return (reaches$1(def, p) ? void 0 : p.x < east && Math.abs(p.z - cz) > 2 ? walk(p, east - 4, cz) : walk(p, px, pz)) ?? {
9636
9640
  keys: go === "press" ? press : 0,
9637
- yaw: toward$1(p.x, p.z, px + 1, pz),
9641
+ yaw: toward$2(p.x, p.z, px + 1, pz),
9638
9642
  pitch: 0
9639
9643
  };
9640
9644
  if (p.x > east) return walk(p, east - 4, cz);
@@ -9643,7 +9647,7 @@ var Sortie = class {
9643
9647
  const [nx, nz] = [ship.x + fx * 3, ship.z + fz * 3];
9644
9648
  if (nearby(ship, p)) return {
9645
9649
  keys: press,
9646
- yaw: toward$1(p.x, p.z, ship.x, ship.z),
9650
+ yaw: toward$2(p.x, p.z, ship.x, ship.z),
9647
9651
  pitch: 0
9648
9652
  };
9649
9653
  return Math.abs(p.z - nz) > 1 ? walk(p, ship.x + 8, nz) : walk(p, nx + 3.5, nz);
@@ -9653,7 +9657,7 @@ var Sortie = class {
9653
9657
  if (go === "press" && ship.driver === 255 && !ship.wreck) {
9654
9658
  if (nearby(ship, p)) return {
9655
9659
  keys: press,
9656
- yaw: toward$1(p.x, p.z, ship.x, ship.z),
9660
+ yaw: toward$2(p.x, p.z, ship.x, ship.z),
9657
9661
  pitch: 0
9658
9662
  };
9659
9663
  const [fx, fz] = forward(ship.yaw);
@@ -9689,6 +9693,125 @@ var Sortie = class {
9689
9693
  };
9690
9694
  }
9691
9695
  };
9696
+ // src/shared/valet.ts
9697
+ var { FORWARD: FORWARD$1, BACK: BACK$1, USE } = KEY;
9698
+ /** The ride's numbers: metres. */
9699
+ var RIDE = {
9700
+ /** The shortest way worth a car, and the farthest car it walks to. */
9701
+ LONG: 70,
9702
+ NEAR: 25,
9703
+ /** The point of its way it steers for is at least this far ahead; it gets out this close to the end of the way. */
9704
+ LOOK: 15,
9705
+ END: 8,
9706
+ /** Metres ahead it looks for a drop, and the fall that stops it. */
9707
+ AHEAD: 14,
9708
+ DROP: 2.5,
9709
+ /** Ticks it walks to a car before it gives up, drives at the longest, and stands still before it gets out. */
9710
+ WALK: 300,
9711
+ DRIVE: 900,
9712
+ STUCK: 40,
9713
+ /** Ticks before it thinks of a car again after it got out or gave up. */
9714
+ PAUSE: 600
9715
+ };
9716
+ var flat$1 = (ax, az, bx, bz) => Math.hypot(bx - ax, bz - az);
9717
+ var toward$1 = (x0, z0, x1, z1) => norm(Math.atan2(-(x1 - x0), -(z1 - z0)));
9718
+ /** The bot's memory of a ride. */
9719
+ var Valet = class {
9720
+ /** Where it walks to on the ground to board, for its own way finding; none when it is not boarding. */
9721
+ board;
9722
+ since = 0;
9723
+ idle = 0;
9724
+ index = 0;
9725
+ asleep = -RIDE.PAUSE;
9726
+ walked = 0;
9727
+ /**
9728
+ * Whether it wants this car now, on foot: it has a long way to go, the car is close and free, and
9729
+ * it is of a driving mind this once (`take` the share of the cars it takes, `rnd` its dice).
9730
+ * Decided once a PAUSE, then kept for the walk to the car.
9731
+ */
9732
+ wants(p, car, goal, t, take, rnd) {
9733
+ if (this.board) {
9734
+ if (car && t - this.walked < RIDE.WALK) return true;
9735
+ [this.board, this.asleep] = [void 0, t];
9736
+ return false;
9737
+ }
9738
+ if (!car || !p.ground || t - this.asleep < RIDE.PAUSE) return false;
9739
+ this.asleep = t;
9740
+ const far = flat$1(p.x, p.z, goal[0], goal[2]);
9741
+ const close = flat$1(p.x, p.z, car.x, car.z);
9742
+ if (far < RIDE.LONG || close > far * .5 || rnd() >= take) return false;
9743
+ this.walked = t;
9744
+ this.board = [
9745
+ car.x,
9746
+ car.y,
9747
+ car.z
9748
+ ];
9749
+ return true;
9750
+ }
9751
+ /** On foot toward the car `car`: walks to it, then presses USE beside it. */
9752
+ approach(p, car, t) {
9753
+ if (nearby(car, p)) return {
9754
+ keys: t & 1 ? USE : 0,
9755
+ yaw: toward$1(p.x, p.z, car.x, car.z),
9756
+ pitch: 0
9757
+ };
9758
+ this.board = [
9759
+ car.x,
9760
+ car.y,
9761
+ car.z
9762
+ ];
9763
+ }
9764
+ /** Called when it sits at the wheel: the ride begins. */
9765
+ start(t) {
9766
+ [this.since, this.idle, this.index, this.board] = [
9767
+ t,
9768
+ 0,
9769
+ 0,
9770
+ void 0
9771
+ ];
9772
+ }
9773
+ /**
9774
+ * One tick at the wheel of `car` on its `way` (the points of its path before the first leg; the
9775
+ * goal when none): the keys and look, or a press of USE to get out.
9776
+ */
9777
+ drive(car, way, w, t) {
9778
+ const out = () => {
9779
+ this.asleep = t;
9780
+ return {
9781
+ keys: t & 1 ? USE : 0,
9782
+ yaw: car.yaw,
9783
+ pitch: 0
9784
+ };
9785
+ };
9786
+ const speed = Math.hypot(car.vx, car.vz);
9787
+ this.idle = speed < 1.5 && t - this.since > RIDE.STUCK ? this.idle + 1 : 0;
9788
+ while (this.index < way.length - 1 && flat$1(car.x, car.z, way[this.index][0], way[this.index][2]) < RIDE.LOOK) this.index++;
9789
+ const end = way.at(-1);
9790
+ const to = way[this.index] ?? end;
9791
+ if (!to || !end || t - this.since > RIDE.DRIVE || this.idle > RIDE.STUCK || flat$1(car.x, car.z, end[0], end[2]) < RIDE.END) return out();
9792
+ const yaw = toward$1(car.x, car.z, to[0], to[2]);
9793
+ const err = Math.abs(norm(yaw - car.yaw + Math.PI) - Math.PI);
9794
+ const [fx, fz] = forward(car.yaw);
9795
+ if (floorAt(w, car.x + fx * RIDE.AHEAD, car.z + fz * RIDE.AHEAD, car.y) < car.y - RIDE.DROP) return speed < 3 ? out() : {
9796
+ keys: BACK$1,
9797
+ yaw,
9798
+ pitch: 0
9799
+ };
9800
+ const left = flat$1(car.x, car.z, end[0], end[2]) - RIDE.END;
9801
+ if (left < 40 && speed > 5 + left * .5) return {
9802
+ keys: BACK$1,
9803
+ yaw,
9804
+ pitch: 0
9805
+ };
9806
+ return {
9807
+ keys: err > .9 || err > .4 && speed > 14 ? speed > 8 ? BACK$1 : 0 : FORWARD$1,
9808
+ yaw,
9809
+ pitch: 0
9810
+ };
9811
+ }
9812
+ };
9813
+ /** Whether `p` is seated at the wheel of `car`. */
9814
+ var driver = (p, car, id) => p.mode === MODE.RIDE && !!car && car.driver === id;
9692
9815
  // src/shared/bot.ts
9693
9816
  var { FORWARD, BACK, LEFT, RIGHT, JUMP, SPRINT, DASH, CROUCH, FIRE, BLADE, SPECIAL } = KEY;
9694
9817
  /** How far a bot shoots, metres, and how far it sees an enemy to fight. */
@@ -9719,13 +9842,14 @@ var personaOf = (id, skill = 4) => {
9719
9842
  miss: (.3 - .22 * s) * (.75 + .5 * r(1)),
9720
9843
  react: Math.round((40 - 24 * s) * (.75 + .5 * r(2))),
9721
9844
  turn: .04 + .06 * s,
9722
- jumpy: .003 + .012 * r(3),
9845
+ jumpy: .001 + .004 * r(3),
9723
9846
  strafe: Math.round(25 + 45 * r(4)),
9724
9847
  duck: .1 + .6 * s,
9725
9848
  warn: Math.round(1 + 2 * (1 - s) + r(5)),
9726
9849
  shake: (.15 - .1 * s) * (.75 + .5 * r(6)),
9727
9850
  lead: .3 + .6 * s,
9728
- track: .03 + .09 * s
9851
+ track: .03 + .09 * s,
9852
+ ride: .25 + .4 * r(7)
9729
9853
  };
9730
9854
  };
9731
9855
  /** One jump in DASHY that a fighting bot makes is a dash aside instead; metres it wants open for it. */
@@ -9981,6 +10105,9 @@ var Bot = class {
9981
10105
  weighed = /* @__PURE__ */ new Set();
9982
10106
  /** Its errand to the orbital station, when it has one. */
9983
10107
  sortie = new Sortie();
10108
+ /** Its rides in a rover, and whether it was at the wheel last tick. */
10109
+ valet = new Valet();
10110
+ riding = false;
9984
10111
  /**
9985
10112
  * Whether it jumps unlike the marine the routes were flown with (the ninja, the xenomorph): it
9986
10113
  * steers every leap in the air to come down on its point, as the moon's (`land`).
@@ -10065,7 +10192,10 @@ var Bot = class {
10065
10192
  }
10066
10193
  } else this.sortie.board = void 0;
10067
10194
  this.gaze = void 0;
10068
- const goal = this.goalOf(s);
10195
+ const target = this.goalOf(s);
10196
+ const ride = this.ride(s, p, target, t);
10197
+ if (ride) return ride;
10198
+ const goal = this.valet.board ?? target;
10069
10199
  const afloat = p.mode === MODE.SWIM;
10070
10200
  if (!this.goal && !p.ground && !afloat) return {
10071
10201
  keys: FORWARD,
@@ -10368,6 +10498,30 @@ var Bot = class {
10368
10498
  }
10369
10499
  return this.posts[this.post].at;
10370
10500
  }
10501
+ /**
10502
+ * Its rides (valet.ts): to a free rover on a long way, at its wheel along its own way, out where
10503
+ * the way turns to a leg. None when it is on foot and goes its way.
10504
+ */
10505
+ ride(s, p, goal, t) {
10506
+ if (driver(p, s.car, this.id)) {
10507
+ if (!this.riding) {
10508
+ this.riding = true;
10509
+ this.plan(s.world, p, goal);
10510
+ this.valet.start(t);
10511
+ }
10512
+ const way = [];
10513
+ for (const st of this.steps.slice(this.step)) {
10514
+ if (st.leg) break;
10515
+ way.push(st.to);
10516
+ }
10517
+ const e = this.valet.drive(s.car, way.length ? way : [goal], s.world, t);
10518
+ this.look = this.aim = e.yaw;
10519
+ this.why = "car";
10520
+ return e;
10521
+ }
10522
+ if (this.riding) [this.riding, this.goal] = [false, void 0];
10523
+ if (p.mode !== MODE.RIDE && this.why !== "flag home" && this.foe < 0 && this.valet.wants(p, s.car, goal, t, this.persona.ride, () => this.rnd())) return s.car ? this.valet.approach(p, s.car, t) : void 0;
10524
+ }
10371
10525
  urgent(why = this.why) {
10372
10526
  return why === "flag home" || why === "chase carrier" || why === "return flag";
10373
10527
  }
@@ -11033,6 +11187,11 @@ var beam = (w, p, foes = [], range = 30, [dy, dp] = [0, 0]) => {
11033
11187
  var MAX_CATCH_UP = 20;
11034
11188
  /** A new player does not spawn within this many metres of another one. */
11035
11189
  var SPAWN_CLEAR = 2;
11190
+ /**
11191
+ * Ticks into a match before a bot is sent to the orbital station (the user, 2026-11-26: they flew
11192
+ * off at the start and left the flag): the flag comes first.
11193
+ */
11194
+ var SORTIE_AFTER = 9e3;
11036
11195
  /** Ticks before a rover can run the same player over again. */
11037
11196
  var SPLAT_COOLDOWN = 30;
11038
11197
  /** Ticks between two of a bot's views to the players who watch it. */
@@ -12662,6 +12821,7 @@ var Room = class {
12662
12821
  world: this.world,
12663
12822
  balls: this.balls,
12664
12823
  errand: errands.get(p.info.id),
12824
+ car: this.carOf(p),
12665
12825
  kit: this.kit(p),
12666
12826
  hunters,
12667
12827
  packs: health,
@@ -12719,7 +12879,7 @@ var Room = class {
12719
12879
  const [ship, home] = [this.rovers[k], this.world.def.ships?.[k - cars]];
12720
12880
  if (!ship || !home || !def) continue;
12721
12881
  const over = this.ctf.over;
12722
- const want = !over && (phase === PHASE.READY || phase === PHASE.ARMED && armed !== team);
12882
+ const want = !over && this.ctf.elapsed() > SORTIE_AFTER && (phase === PHASE.READY || phase === PHASE.ARMED && armed !== team);
12723
12883
  const guard = !over && phase === PHASE.ARMED && armed === team;
12724
12884
  const able = (p) => !!p.bot && p.info.team === team && !p.state.down && this.ctf.carrying(p.info.id) < 0;
12725
12885
  let pilot = players.find((p) => p.info.id === this.pilots[team] && able(p));
@@ -12744,6 +12904,15 @@ var Room = class {
12744
12904
  }
12745
12905
  return out;
12746
12906
  }
12907
+ /**
12908
+ * The rover a bot may drive: the one at whose wheel it sits, or the nearest empty one within its
12909
+ * walk (valet.ts), never a ship (the station's errand flies those).
12910
+ */
12911
+ carOf(p) {
12912
+ const [mine] = this.seatOf(p);
12913
+ if (mine) return mine.ship ? void 0 : mine;
12914
+ return this.rovers.filter((r) => !r.ship && !r.wreck && r.driver === 255 && r.rider === 255 && Math.abs(r.y - p.state.y) < 3 && gap2(r, p.state) < RIDE.NEAR ** 2).sort((a, b) => gap2(a, p.state) - gap2(b, p.state))[0];
12915
+ }
12747
12916
  /** The bots' map of the world, built when it loads rather than in the tick of a bot's first plan. */
12748
12917
  guide() {
12749
12918
  if (this.rules.bots) navOf(this.world);