@korial29/tiny-fps 0.192.3 → 0.193.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
@@ -3668,11 +3668,16 @@ var { STONE, CONCRETE, METAL, STEEL, PAINT } = TEX;
3668
3668
  /** The twin of a box across the centre line. */
3669
3669
  var mirror$1 = ({ min, max }) => bx(min[0], min[1], 280 - max[2], max[0], max[1], 280 - min[2]);
3670
3670
  /** The domes' centres, the landing pads (x, z, radius), the modules, the tubes and the masts (centres), red's then blue's: what the scenery draws on. */
3671
- var PAD$1 = [
3671
+ /** Two a base (the user, 2026-11-20: a second ship a team), the second west of the first. */
3672
+ var PADS = [[
3672
3673
  40,
3673
3674
  220,
3674
3675
  13
3675
- ];
3676
+ ], [
3677
+ 13.5,
3678
+ 220,
3679
+ 13
3680
+ ]];
3676
3681
  /** By the tubes. The four at the pad's corners went (the user, 2026-11-14): a ship hit them for nothing. */
3677
3682
  var MASTS = [[106.2, 230.4], [103.2, 212.4]];
3678
3683
  /** Red's flag: in the hall, 2 m from the dome's centre toward the door. */
@@ -3862,6 +3867,12 @@ var FLATS = [
3862
3867
  53,
3863
3868
  93
3864
3869
  ],
3870
+ [
3871
+ .5,
3872
+ 67,
3873
+ 26.5,
3874
+ 93
3875
+ ],
3865
3876
  [
3866
3877
  56,
3867
3878
  74,
@@ -4604,11 +4615,11 @@ var LAYOUT = {
4604
4615
  sites: SITES,
4605
4616
  pillars: PILLARS,
4606
4617
  domes: [DOME, [DOME[0], 280 - DOME[1]]],
4607
- pads: [PAD$1, [
4608
- PAD$1[0],
4609
- 280 - PAD$1[1],
4610
- PAD$1[2]
4611
- ]],
4618
+ pads: [...PADS, ...PADS.map(([x, z, r]) => [
4619
+ x,
4620
+ 280 - z,
4621
+ r
4622
+ ])],
4612
4623
  modules: [...MODULES, ...MODULES.map(mirror$1)],
4613
4624
  tubes: [...TUBES, ...TUBES.map(mirror$1)],
4614
4625
  masts: [...MASTS, ...MASTS.map(([x, z]) => [x, 280 - z])]
@@ -4678,7 +4689,7 @@ var half = [
4678
4689
  ghost: true
4679
4690
  },
4680
4691
  box$1(60, 0, 259, 70, 1.5, 265, STEEL, PAINT, RED),
4681
- box$1(27, 0, 207, 53, .25, 233, METAL),
4692
+ ...PADS.map(([x, z, r]) => box$1(x - r, 0, z - r, x + r, .25, z + r, METAL)),
4682
4693
  ...MASTS.map(([x, z]) => box$1(x - .2, 0, z - .2, x + .2, 10, z + .2, STEEL)),
4683
4694
  box$1(12, -30, 148 - 2.5 / 2, 24, 0, 148, PAINT, STONE, [
4684
4695
  1,
@@ -4931,17 +4942,17 @@ var MOON = {
4931
4942
  Math.PI
4932
4943
  ]
4933
4944
  ],
4934
- ships: [[
4935
- PAD$1[0],
4945
+ ships: [...PADS.map(([x, z]) => [
4946
+ x,
4936
4947
  .25,
4937
- PAD$1[1],
4948
+ z,
4938
4949
  0
4939
- ], [
4940
- PAD$1[0],
4950
+ ]), ...PADS.map(([x, z]) => [
4951
+ x,
4941
4952
  .25,
4942
- 280 - PAD$1[1],
4953
+ 280 - z,
4943
4954
  Math.PI
4944
- ]],
4955
+ ])],
4945
4956
  doors: [
4946
4957
  ...DOORS,
4947
4958
  ...DOORS.map(mirror$1),
@@ -6559,7 +6570,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6559
6570
  return STRIKE.NADE;
6560
6571
  }
6561
6572
  if (p.wield && i.keys & KEY.SPECIAL && !busy && !p.swing) {
6562
- p.cut = cutOf(i.keys) + 4;
6573
+ p.cut = i.keys & KEY.FIRE ? cutOf(i.keys) + 4 : (i.keys & (KEY.LEFT | KEY.RIGHT)) === KEY.LEFT ? CUT.ARC_L : CUT.ARC_R;
6563
6574
  [p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
6564
6575
  launch(p);
6565
6576
  return STRIKE.NONE;
@@ -8577,8 +8588,8 @@ var decodeInput = (buf) => {
8577
8588
  /** Bytes of a flag on the wire, by its state. */
8578
8589
  var flagBytes = (state) => state === FLAG$1.CARRIED ? 2 : state === FLAG$1.DROPPED ? 8 : 1;
8579
8590
  var encodeSnapshot = (s) => {
8580
- const rovers = (s.rovers ?? []).slice(0, 7);
8581
- const mid = 4 + 62 * s.players.length;
8591
+ const rovers = (s.rovers ?? []).slice(0, 15);
8592
+ const mid = 5 + 62 * s.players.length;
8582
8593
  const end = mid + 57 * rovers.length;
8583
8594
  const balls = s.balls ?? [];
8584
8595
  const tail = end + 10 + s.flags.reduce((n, f) => n + flagBytes(f.state), 0);
@@ -8588,9 +8599,10 @@ var encodeSnapshot = (s) => {
8588
8599
  const v = new DataView(new ArrayBuffer(tail + (balls.length || gate ? 1 + 11 * balls.length : 0) + gate + (st ? 2 : 0)));
8589
8600
  v.setUint8(0, 2);
8590
8601
  v.setUint16(1, s.tick & 65535);
8591
- v.setUint8(3, s.players.length | rovers.length << 5);
8602
+ v.setUint8(3, s.players.length);
8603
+ v.setUint8(4, rovers.length);
8592
8604
  s.players.forEach((p, i) => {
8593
- const o = 4 + i * 62;
8605
+ const o = 5 + i * 62;
8594
8606
  v.setUint8(o, p.id);
8595
8607
  v.setFloat32(o + 1, p.x);
8596
8608
  v.setFloat32(o + 5, p.y);
@@ -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 right press (or G) within this of the first (ms) is a double click: the xenomorph's tail special. */
10
+ /** A second press within this of the first (ms) is a double click: the katana's special of the cut (left), the xenomorph's tail special (right or G). */
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;
@@ -83,12 +83,12 @@ export type ServerText =
83
83
  export declare const MSG_INPUT = 1;
84
84
  export declare const MSG_SNAPSHOT = 2;
85
85
  export declare const INPUT_BYTES = 12;
86
- export declare const SNAP_HEAD = 4;
86
+ export declare const SNAP_HEAD = 5;
87
87
  export declare const SNAP_PLAYER = 62;
88
88
  /** Bytes of a rover: thirteen float32, the two seats, then the kind and health, the wreck's time and a ship's missiles. */
89
89
  export declare const SNAP_ROVER = 57;
90
- /** The rover count has three bits of the head's count byte, the players the other five. */
91
- export declare const MAX_ROVERS = 7;
90
+ /** The most rovers and ships a snapshot carries (Tranquility has eight: four rovers, four ships). */
91
+ export declare const MAX_ROVERS = 15;
92
92
  /** The match block after the players and the rovers: the captures, the clock, the packs; the flags follow (2 to 16 bytes). */
93
93
  export declare const SNAP_MATCH = 10;
94
94
  /** Bytes of a plasma ball. */
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.192.3",
5
+ "version": "0.193.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"