@korial29/tiny-fps 0.91.2 → 0.92.1

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
@@ -168,7 +168,8 @@ var RIFLE_DRIFT = .012;
168
168
  var RULES = {
169
169
  maxPlayers: 16,
170
170
  scoreLimit: 3,
171
- timeLimit: 480
171
+ timeLimit: 480,
172
+ map: "highline"
172
173
  };
173
174
  // src/shared/types.ts
174
175
  /** Where a team's flag is: at its base, on a carrier's back, or on the ground where it was dropped. */
@@ -722,12 +723,14 @@ var over = (p, w) => {
722
723
  return f32(b.max[1]) === p.edge && co >= b.min[o] && co <= b.max[o] && depth >= .2;
723
724
  });
724
725
  };
726
+ /** The world's gravity: GRAVITY times the map's share (the moon's half gravity, the user, 2026-11-09). */
727
+ var pull = (w) => 20 * (w.def.gravity ?? 1);
725
728
  /** Whether the player will be back on a floor within the jump buffer: a press now is kept for it. */
726
729
  var landingSoon = (p, w) => {
727
730
  if (p.vy >= 0) return false;
728
731
  const [floor] = span(p, w, PLAYER_H);
729
732
  const t = 6 * DT;
730
- return p.y - floor <= -p.vy * t + 10 * t * t;
733
+ return p.y - floor <= -p.vy * t + .5 * pull(w) * t * t;
731
734
  };
732
735
  /** Changes the mode, and starts counting the time in it. */
733
736
  var enter = (p, mode) => {
@@ -813,7 +816,7 @@ var steer = (p, wish, top) => {
813
816
  };
814
817
  /**
815
818
  * Moves the cylinder by its speed for one step: sideways (sliding along the boxes, which takes the
816
- * speed into them away), then up or down by g times GRAVITY (a ceiling stops a rise, a floor a
819
+ * speed into them away), then up or down by g times the world's gravity (a ceiling stops a rise, a floor a
817
820
  * fall). Returns the speed it came down on a floor at, or -1 when it is not on one. With `snap`
818
821
  * a drop of at most STEP_H stays on the ground (a stair going down is not a fall).
819
822
  */
@@ -831,7 +834,7 @@ var fly$1 = (p, w, h, g, snap) => {
831
834
  }
832
835
  }
833
836
  const [floor, ceil] = span(p, w, h);
834
- const vy = p.vy - g * 20 * DT;
837
+ const vy = p.vy - g * pull(w) * DT;
835
838
  p.y += (p.vy + vy) / 2 * DT;
836
839
  p.vy = vy;
837
840
  if (p.y + h > ceil) {
@@ -1696,7 +1699,7 @@ var roof = (x0, z0, x1, z1, top, side = TEX.CONCRETE) => ({
1696
1699
  side
1697
1700
  });
1698
1701
  /** Any box, corners (x0, y0, z0) and (x1, y1, z1). */
1699
- var box = ([x0, y0, z0], [x1, y1, z1], top, side = top, tint) => ({
1702
+ var box$1 = ([x0, y0, z0], [x1, y1, z1], top, side = top, tint) => ({
1700
1703
  min: [
1701
1704
  x0,
1702
1705
  y0,
@@ -1719,7 +1722,7 @@ var stair = (z, y) => [
1719
1722
  4,
1720
1723
  5,
1721
1724
  6
1722
- ].map((k) => box([
1725
+ ].map((k) => box$1([
1723
1726
  12,
1724
1727
  y,
1725
1728
  z - k
@@ -1735,7 +1738,7 @@ var stair = (z, y) => [
1735
1738
  roof(4, -5, 24, 7, 12.4, TEX.GLASS),
1736
1739
  roof(27, 20, 47, 50, 8),
1737
1740
  roof(27, 60, 47, 76, 8, TEX.BRICK),
1738
- box([
1741
+ box$1([
1739
1742
  9,
1740
1743
  12.2,
1741
1744
  39
@@ -1745,7 +1748,7 @@ var stair = (z, y) => [
1745
1748
  47
1746
1749
  ], TEX.STEEL),
1747
1750
  ...stair(53, 10),
1748
- box([
1751
+ box$1([
1749
1752
  5,
1750
1753
  10,
1751
1754
  42
@@ -1754,7 +1757,7 @@ var stair = (z, y) => [
1754
1757
  14,
1755
1758
  42.5
1756
1759
  ], TEX.STEEL),
1757
- box([
1760
+ box$1([
1758
1761
  5,
1759
1762
  10,
1760
1763
  50
@@ -1763,7 +1766,7 @@ var stair = (z, y) => [
1763
1766
  14,
1764
1767
  50.5
1765
1768
  ], TEX.STEEL),
1766
- box([
1769
+ box$1([
1767
1770
  8,
1768
1771
  12.4,
1769
1772
  24
@@ -1772,7 +1775,7 @@ var stair = (z, y) => [
1772
1775
  12.85,
1773
1776
  24.45
1774
1777
  ], TEX.STEEL),
1775
- box([
1778
+ box$1([
1776
1779
  36,
1777
1780
  8,
1778
1781
  22
@@ -1785,7 +1788,7 @@ var stair = (z, y) => [
1785
1788
  .72,
1786
1789
  .62
1787
1790
  ]),
1788
- box([
1791
+ box$1([
1789
1792
  30,
1790
1793
  8,
1791
1794
  28
@@ -1794,7 +1797,7 @@ var stair = (z, y) => [
1794
1797
  10,
1795
1798
  32
1796
1799
  ], TEX.CONCRETE),
1797
- box([
1800
+ box$1([
1798
1801
  40,
1799
1802
  8,
1800
1803
  30
@@ -1807,7 +1810,7 @@ var stair = (z, y) => [
1807
1810
  .3,
1808
1811
  .06
1809
1812
  ]),
1810
- box([
1813
+ box$1([
1811
1814
  28,
1812
1815
  9.2,
1813
1816
  44
@@ -1820,7 +1823,7 @@ var stair = (z, y) => [
1820
1823
  .42,
1821
1824
  1
1822
1825
  ]),
1823
- box([
1826
+ box$1([
1824
1827
  41.5,
1825
1828
  7.6,
1826
1829
  50
@@ -1829,7 +1832,7 @@ var stair = (z, y) => [
1829
1832
  8,
1830
1833
  60
1831
1834
  ], TEX.STEEL),
1832
- box([
1835
+ box$1([
1833
1836
  30,
1834
1837
  8,
1835
1838
  64
@@ -1844,18 +1847,20 @@ var stair = (z, y) => [
1844
1847
  ])
1845
1848
  ];
1846
1849
  /** The map is 240 m long: a point at z has its twin at ZED - z. */
1847
- var ZED = 240;
1850
+ var ZED$1 = 240;
1848
1851
  /** Team colours as brush tints: the flip swaps one for the other, so a red accent has a blue twin. */
1849
- var RED = [
1852
+ var RED$1 = [
1850
1853
  1,
1851
1854
  .22,
1852
1855
  .26
1853
1856
  ];
1854
- var BLUE = [
1857
+ var BLUE$1 = [
1855
1858
  .2,
1856
1859
  .46,
1857
1860
  1
1858
1861
  ];
1862
+ /** The two team tints, red then blue. */
1863
+ var TEAM_TINT = [RED$1, BLUE$1];
1859
1864
  var ORANGE = [
1860
1865
  1,
1861
1866
  .42,
@@ -1867,7 +1872,7 @@ var TEAL = [
1867
1872
  .62
1868
1873
  ];
1869
1874
  /** An accent: a slab of tinted paint, corners (x0, y0, z0) and (x1, y1, z1). */
1870
- var pad = (x0, y0, z0, x1, y1, z1, tint) => box([
1875
+ var pad = (x0, y0, z0, x1, y1, z1, tint) => box$1([
1871
1876
  x0,
1872
1877
  y0,
1873
1878
  z0
@@ -1880,12 +1885,12 @@ var pad = (x0, y0, z0, x1, y1, z1, tint) => box([
1880
1885
  * A column of stairs: from `a` to `b` along `axis` (0 for x, 2 for z), across `w0` to `w1` on the
1881
1886
  * other one, rising from `y` to `top` in steps of at most 0.46 m, each step a solid from `low`.
1882
1887
  */
1883
- var stairs = (axis, a, b, w0, w1, y, top, low = BASE) => {
1888
+ var stairs$1 = (axis, a, b, w0, w1, y, top, low = BASE) => {
1884
1889
  const n = Math.ceil((top - y) / .46);
1885
1890
  return Array.from({ length: n }, (_, i) => {
1886
1891
  const [s0, s1] = [a + (b - a) * i / n, a + (b - a) * (i + 1) / n].sort((p, q) => p - q);
1887
1892
  const up = y + (top - y) * (i + 1) / n;
1888
- return axis === 0 ? box([
1893
+ return axis === 0 ? box$1([
1889
1894
  s0,
1890
1895
  low,
1891
1896
  w0
@@ -1893,7 +1898,7 @@ var stairs = (axis, a, b, w0, w1, y, top, low = BASE) => {
1893
1898
  s1,
1894
1899
  up,
1895
1900
  w1
1896
- ], TEX.CONCRETE) : box([
1901
+ ], TEX.CONCRETE) : box$1([
1897
1902
  w0,
1898
1903
  low,
1899
1904
  s0
@@ -1908,7 +1913,7 @@ var stairs = (axis, a, b, w0, w1, y, top, low = BASE) => {
1908
1913
  * A ledge ladder: one platform 4 m wide and `d` deep per top in `tops`, the first at (x, z), each
1909
1914
  * next one (dx, dz) further, over the roof at `low`. The hands catch the face of each from the one before.
1910
1915
  */
1911
- var ladder = (x, z, dx, dz, d, low, tops) => tops.map((top, k) => box([
1916
+ var ladder = (x, z, dx, dz, d, low, tops) => tops.map((top, k) => box$1([
1912
1917
  x + k * dx,
1913
1918
  low,
1914
1919
  z + k * dz
@@ -1918,15 +1923,15 @@ var ladder = (x, z, dx, dz, d, low, tops) => tops.map((top, k) => box([
1918
1923
  z + k * dz + d
1919
1924
  ], TEX.STEEL, TEX.CONCRETE));
1920
1925
  /** Red's half: z from 120 to 240, then flipped. */
1921
- var half = [
1926
+ var half$1 = [
1922
1927
  roof(12, 212, 52, 240, 26, TEX.GLASS),
1923
- pad(12, 26, 212, 52, 26.12, 212.5, RED),
1924
- pad(12, 26, 239.5, 52, 26.12, 240, RED),
1925
- pad(12, 26, 212.5, 12.5, 26.12, 239.5, RED),
1926
- pad(51.5, 26, 212.5, 52, 26.12, 239.5, RED),
1927
- pad(11.6, 12, 222, 12, 25.8, 232, RED),
1928
- pad(28, 12, 211.4, 31, 25.5, 212, RED),
1929
- box([
1928
+ pad(12, 26, 212, 52, 26.12, 212.5, RED$1),
1929
+ pad(12, 26, 239.5, 52, 26.12, 240, RED$1),
1930
+ pad(12, 26, 212.5, 12.5, 26.12, 239.5, RED$1),
1931
+ pad(51.5, 26, 212.5, 52, 26.12, 239.5, RED$1),
1932
+ pad(11.6, 12, 222, 12, 25.8, 232, RED$1),
1933
+ pad(28, 12, 211.4, 31, 25.5, 212, RED$1),
1934
+ box$1([
1930
1935
  19,
1931
1936
  26,
1932
1937
  222
@@ -1935,7 +1940,7 @@ var half = [
1935
1940
  27.4,
1936
1941
  225
1937
1942
  ], TEX.STEEL),
1938
- box([
1943
+ box$1([
1939
1944
  42,
1940
1945
  26,
1941
1946
  222
@@ -1944,7 +1949,7 @@ var half = [
1944
1949
  27.4,
1945
1950
  225
1946
1951
  ], TEX.STEEL),
1947
- box([
1952
+ box$1([
1948
1953
  29,
1949
1954
  26,
1950
1955
  229
@@ -1953,7 +1958,7 @@ var half = [
1953
1958
  27.1,
1954
1959
  229.6
1955
1960
  ], TEX.CONCRETE),
1956
- box([
1961
+ box$1([
1957
1962
  24.5,
1958
1963
  26,
1959
1964
  215
@@ -1961,12 +1966,12 @@ var half = [
1961
1966
  35,
1962
1967
  27.5,
1963
1968
  219
1964
- ], TEX.STEEL, TEX.PAINT, RED),
1969
+ ], TEX.STEEL, TEX.PAINT, RED$1),
1965
1970
  roof(6, 164, 26, 201, 26, TEX.GLASS),
1966
1971
  roof(6, 134, 26, 147, 26, TEX.GLASS),
1967
1972
  roof(6, 201, 26, 212, 19),
1968
1973
  roof(15, 147, 26, 164, 19),
1969
- box([
1974
+ box$1([
1970
1975
  14,
1971
1976
  26,
1972
1977
  164
@@ -1975,7 +1980,7 @@ var half = [
1975
1980
  32,
1976
1981
  196
1977
1982
  ], TEX.PAINT, TEX.PAINT, TEAL),
1978
- box([
1983
+ box$1([
1979
1984
  14,
1980
1985
  18,
1981
1986
  147
@@ -1984,7 +1989,7 @@ var half = [
1984
1989
  32,
1985
1990
  164
1986
1991
  ], TEX.PAINT, TEX.PAINT, TEAL),
1987
- box([
1992
+ box$1([
1988
1993
  14,
1989
1994
  26,
1990
1995
  134
@@ -2020,7 +2025,7 @@ var half = [
2020
2025
  164,
2021
2026
  25
2022
2027
  ]
2023
- ].map(([x0, z0, x1, z1, top]) => box([
2028
+ ].map(([x0, z0, x1, z1, top]) => box$1([
2024
2029
  x0,
2025
2030
  19,
2026
2031
  z0
@@ -2029,7 +2034,7 @@ var half = [
2029
2034
  top,
2030
2035
  z1
2031
2036
  ], TEX.STEEL, TEX.CONCRETE)),
2032
- box([
2037
+ box$1([
2033
2038
  20,
2034
2039
  26,
2035
2040
  178
@@ -2038,7 +2043,7 @@ var half = [
2038
2043
  27.3,
2039
2044
  181
2040
2045
  ], TEX.STEEL),
2041
- box([
2046
+ box$1([
2042
2047
  8,
2043
2048
  26,
2044
2049
  176
@@ -2047,7 +2052,7 @@ var half = [
2047
2052
  27.2,
2048
2053
  179
2049
2054
  ], TEX.STEEL),
2050
- box([
2055
+ box$1([
2051
2056
  8,
2052
2057
  26,
2053
2058
  190
@@ -2056,7 +2061,7 @@ var half = [
2056
2061
  27.3,
2057
2062
  193
2058
2063
  ], TEX.STEEL),
2059
- box([
2064
+ box$1([
2060
2065
  20,
2061
2066
  26,
2062
2067
  140
@@ -2066,7 +2071,7 @@ var half = [
2066
2071
  143
2067
2072
  ], TEX.STEEL),
2068
2073
  roof(32, 186, 76, 209, 19),
2069
- pad(32, 19, 207.5, 76, 19.1, 209, RED),
2074
+ pad(32, 19, 207.5, 76, 19.1, 209, RED$1),
2070
2075
  ...ladder(33, 209, 7, 0, 3, 19, [
2071
2076
  21.2,
2072
2077
  23.4,
@@ -2094,7 +2099,7 @@ var half = [
2094
2099
  188,
2095
2100
  25
2096
2101
  ]
2097
- ].map(([x0, z0, x1, z1, top]) => box([
2102
+ ].map(([x0, z0, x1, z1, top]) => box$1([
2098
2103
  x0,
2099
2104
  BASE,
2100
2105
  z0
@@ -2105,7 +2110,7 @@ var half = [
2105
2110
  ], TEX.STEEL, TEX.CONCRETE)),
2106
2111
  roof(32, 166, 64, 182, 21.2, TEX.GLASS),
2107
2112
  roof(32, 140, 64, 161, 19),
2108
- box([
2113
+ box$1([
2109
2114
  40,
2110
2115
  21.2,
2111
2116
  172
@@ -2114,7 +2119,7 @@ var half = [
2114
2119
  22.6,
2115
2120
  176
2116
2121
  ], TEX.STEEL),
2117
- box([
2122
+ box$1([
2118
2123
  52,
2119
2124
  19,
2120
2125
  148
@@ -2123,7 +2128,7 @@ var half = [
2123
2128
  20.3,
2124
2129
  151
2125
2130
  ], TEX.STEEL),
2126
- box([
2131
+ box$1([
2127
2132
  38,
2128
2133
  19,
2129
2134
  196
@@ -2132,7 +2137,7 @@ var half = [
2132
2137
  20.4,
2133
2138
  199
2134
2139
  ], TEX.STEEL),
2135
- box([
2140
+ box$1([
2136
2141
  60,
2137
2142
  19,
2138
2143
  200
@@ -2141,7 +2146,7 @@ var half = [
2141
2146
  20.4,
2142
2147
  203
2143
2148
  ], TEX.STEEL),
2144
- box([
2149
+ box$1([
2145
2150
  52,
2146
2151
  19,
2147
2152
  190
@@ -2150,7 +2155,7 @@ var half = [
2150
2155
  20.6,
2151
2156
  194
2152
2157
  ], TEX.STEEL),
2153
- box([
2158
+ box$1([
2154
2159
  66,
2155
2160
  19,
2156
2161
  204
@@ -2159,7 +2164,7 @@ var half = [
2159
2164
  20.2,
2160
2165
  207
2161
2166
  ], TEX.STEEL),
2162
- box([
2167
+ box$1([
2163
2168
  56,
2164
2169
  21.2,
2165
2170
  170
@@ -2168,7 +2173,7 @@ var half = [
2168
2173
  22.4,
2169
2174
  174
2170
2175
  ], TEX.STEEL),
2171
- box([
2176
+ box$1([
2172
2177
  34,
2173
2178
  19,
2174
2179
  152
@@ -2185,10 +2190,10 @@ var half = [
2185
2190
  23.8
2186
2191
  ]),
2187
2192
  roof(76, 213, 100, 240, 14.5, TEX.STEEL),
2188
- pad(76, 14.5, 238.5, 100, 14.6, 240, RED),
2193
+ pad(76, 14.5, 238.5, 100, 14.6, 240, RED$1),
2189
2194
  roof(76, 185, 100, 209, 14.5),
2190
2195
  roof(76, 138, 100, 181, 14.5, TEX.GLASS),
2191
- box([
2196
+ box$1([
2192
2197
  80,
2193
2198
  15.7,
2194
2199
  158
@@ -2197,7 +2202,7 @@ var half = [
2197
2202
  17.7,
2198
2203
  162
2199
2204
  ], TEX.STEEL, TEX.PAINT, ORANGE),
2200
- box([
2205
+ box$1([
2201
2206
  82,
2202
2207
  14.5,
2203
2208
  234
@@ -2206,7 +2211,7 @@ var half = [
2206
2211
  15.9,
2207
2212
  237
2208
2213
  ], TEX.STEEL),
2209
- box([
2214
+ box$1([
2210
2215
  91,
2211
2216
  14.5,
2212
2217
  190
@@ -2215,7 +2220,7 @@ var half = [
2215
2220
  15.9,
2216
2221
  193
2217
2222
  ], TEX.STEEL),
2218
- box([
2223
+ box$1([
2219
2224
  80,
2220
2225
  14.5,
2221
2226
  204
@@ -2224,7 +2229,7 @@ var half = [
2224
2229
  15.6,
2225
2230
  207
2226
2231
  ], TEX.STEEL),
2227
- box([
2232
+ box$1([
2228
2233
  78,
2229
2234
  14.5,
2230
2235
  170
@@ -2233,7 +2238,7 @@ var half = [
2233
2238
  15.9,
2234
2239
  173
2235
2240
  ], TEX.STEEL),
2236
- box([
2241
+ box$1([
2237
2242
  92,
2238
2243
  14.5,
2239
2244
  146
@@ -2242,7 +2247,7 @@ var half = [
2242
2247
  15.7,
2243
2248
  149
2244
2249
  ], TEX.STEEL),
2245
- box([
2250
+ box$1([
2246
2251
  92,
2247
2252
  14.5,
2248
2253
  222
@@ -2251,14 +2256,14 @@ var half = [
2251
2256
  15.8,
2252
2257
  226
2253
2258
  ], TEX.STEEL),
2254
- ...stairs(0, 76, 52, 226, 232, 14.5, 26),
2255
- ...stairs(0, 85, 76, 196, 202, 14.5, 19, 14.5)
2259
+ ...stairs$1(0, 76, 52, 226, 232, 14.5, 26),
2260
+ ...stairs$1(0, 85, 76, 196, 202, 14.5, 19, 14.5)
2256
2261
  ];
2257
2262
  /** What stands on the centre line, symmetric as written: the plaza, its dais and canopy, the beam. */
2258
- var centre = [
2263
+ var centre$1 = [
2259
2264
  roof(6, 106, 62, 134, 15),
2260
2265
  roof(62, 106, 100, 134, 14.5),
2261
- box([
2266
+ box$1([
2262
2267
  34,
2263
2268
  15,
2264
2269
  112
@@ -2273,7 +2278,7 @@ var centre = [
2273
2278
  [35, 126.2],
2274
2279
  [51, 113],
2275
2280
  [51, 126.2]
2276
- ].map(([x, z]) => box([
2281
+ ].map(([x, z]) => box$1([
2277
2282
  x,
2278
2283
  17.2,
2279
2284
  z
@@ -2282,7 +2287,7 @@ var centre = [
2282
2287
  21.5,
2283
2288
  z + .8
2284
2289
  ], TEX.STEEL)),
2285
- box([
2290
+ box$1([
2286
2291
  34.6,
2287
2292
  21.5,
2288
2293
  112.6
@@ -2291,7 +2296,7 @@ var centre = [
2291
2296
  21.9,
2292
2297
  127.4
2293
2298
  ], TEX.GLASS),
2294
- box([
2299
+ box$1([
2295
2300
  14,
2296
2301
  15,
2297
2302
  114
@@ -2300,7 +2305,7 @@ var centre = [
2300
2305
  16.5,
2301
2306
  117
2302
2307
  ], TEX.STEEL),
2303
- box([
2308
+ box$1([
2304
2309
  14,
2305
2310
  15,
2306
2311
  123
@@ -2309,7 +2314,7 @@ var centre = [
2309
2314
  16.5,
2310
2315
  126
2311
2316
  ], TEX.STEEL),
2312
- box([
2317
+ box$1([
2313
2318
  56,
2314
2319
  15,
2315
2320
  114
@@ -2318,7 +2323,7 @@ var centre = [
2318
2323
  16.5,
2319
2324
  117
2320
2325
  ], TEX.STEEL),
2321
- box([
2326
+ box$1([
2322
2327
  56,
2323
2328
  15,
2324
2329
  123
@@ -2327,7 +2332,7 @@ var centre = [
2327
2332
  16.5,
2328
2333
  126
2329
2334
  ], TEX.STEEL),
2330
- box([
2335
+ box$1([
2331
2336
  15.35,
2332
2337
  25.5,
2333
2338
  106
@@ -2336,7 +2341,7 @@ var centre = [
2336
2341
  26,
2337
2342
  134
2338
2343
  ], TEX.STEEL),
2339
- box([
2344
+ box$1([
2340
2345
  70,
2341
2346
  14.5,
2342
2347
  108
@@ -2345,7 +2350,7 @@ var centre = [
2345
2350
  38,
2346
2351
  108.8
2347
2352
  ], TEX.STEEL),
2348
- box([
2353
+ box$1([
2349
2354
  70,
2350
2355
  14.5,
2351
2356
  131.2
@@ -2354,7 +2359,7 @@ var centre = [
2354
2359
  38,
2355
2360
  132
2356
2361
  ], TEX.STEEL),
2357
- box([
2362
+ box$1([
2358
2363
  66,
2359
2364
  14.5,
2360
2365
  110
@@ -2363,7 +2368,7 @@ var centre = [
2363
2368
  15.9,
2364
2369
  113
2365
2370
  ], TEX.STEEL),
2366
- box([
2371
+ box$1([
2367
2372
  66,
2368
2373
  14.5,
2369
2374
  127
@@ -2374,19 +2379,19 @@ var centre = [
2374
2379
  ], TEX.STEEL)
2375
2380
  ];
2376
2381
  /** The twin of a brush across the centre line. */
2377
- var flip = (b) => ({
2382
+ var flip$1 = (b) => ({
2378
2383
  ...b,
2379
2384
  min: [
2380
2385
  b.min[0],
2381
2386
  b.min[1],
2382
- ZED - b.max[2]
2387
+ ZED$1 - b.max[2]
2383
2388
  ],
2384
2389
  max: [
2385
2390
  b.max[0],
2386
2391
  b.max[1],
2387
- ZED - b.min[2]
2392
+ ZED$1 - b.min[2]
2388
2393
  ],
2389
- tint: b.tint === RED ? BLUE : b.tint
2394
+ tint: b.tint === RED$1 ? BLUE$1 : b.tint
2390
2395
  });
2391
2396
  /** Where a team starts: two rows facing the other end. */
2392
2397
  var row = (yaw, z, z2) => [...[
@@ -2519,9 +2524,9 @@ var CELLS = [
2519
2524
  var HIGHLINE = {
2520
2525
  name: "Highline",
2521
2526
  brushes: [
2522
- ...half,
2523
- ...half.map(flip),
2524
- ...centre
2527
+ ...half$1,
2528
+ ...half$1.map(flip$1),
2529
+ ...centre$1
2525
2530
  ],
2526
2531
  teams: [{
2527
2532
  base: [
@@ -2583,7 +2588,7 @@ var HIGHLINE = {
2583
2588
  ...PACKS.map(([x, y, z]) => [
2584
2589
  x,
2585
2590
  y,
2586
- ZED - z
2591
+ ZED$1 - z
2587
2592
  ]),
2588
2593
  [
2589
2594
  24,
@@ -2601,7 +2606,7 @@ var HIGHLINE = {
2601
2606
  ...AMMO.map(([x, y, z]) => [
2602
2607
  x,
2603
2608
  y,
2604
- ZED - z
2609
+ ZED$1 - z
2605
2610
  ]),
2606
2611
  [
2607
2612
  12,
@@ -2619,12 +2624,12 @@ var HIGHLINE = {
2619
2624
  ...CELLS.map(([x, y, z]) => [
2620
2625
  x,
2621
2626
  y,
2622
- ZED - z
2627
+ ZED$1 - z
2623
2628
  ]),
2624
2629
  [
2625
2630
  28,
2626
2631
  15,
2627
- ZED / 2
2632
+ ZED$1 / 2
2628
2633
  ]
2629
2634
  ],
2630
2635
  floor: -25,
@@ -2656,6 +2661,369 @@ var HIGHLINE = {
2656
2661
  .0035
2657
2662
  ]
2658
2663
  };
2664
+ var [RED, BLUE] = TEAM_TINT;
2665
+ var { STONE, CONCRETE, METAL, STEEL, PAINT } = TEX;
2666
+ /** A box, corners (x0, y0, z0) and (x1, y1, z1), tops and sides, a tint. */
2667
+ var box = (x0, y0, z0, x1, y1, z1, top, side = top, tint) => ({
2668
+ min: [
2669
+ x0,
2670
+ y0,
2671
+ z0
2672
+ ],
2673
+ max: [
2674
+ x1,
2675
+ y1,
2676
+ z1
2677
+ ],
2678
+ top,
2679
+ side,
2680
+ tint
2681
+ });
2682
+ var fromBx = ({ min, max }, top, side = top) => ({
2683
+ min,
2684
+ max,
2685
+ top,
2686
+ side
2687
+ });
2688
+ var bx = (x0, y0, z0, x1, y1, z1) => ({
2689
+ min: [
2690
+ x0,
2691
+ y0,
2692
+ z0
2693
+ ],
2694
+ max: [
2695
+ x1,
2696
+ y1,
2697
+ z1
2698
+ ]
2699
+ });
2700
+ /** The twin of a box across the centre line. */
2701
+ var mirror = ({ min, max }) => bx(min[0], min[1], 280 - max[2], max[0], max[1], 280 - min[2]);
2702
+ /** The drawn dome (moonscape.ts): a drum of radius R up to y 5, then a shell to the apex at y 17. */
2703
+ var R = 22.4;
2704
+ var shell = (y) => y < 5 ? R : R * Math.sqrt(1 - ((y - 5) / 12) ** 2);
2705
+ var q = (v) => Math.round(v * 10) / 10;
2706
+ /** Height bands of the ghost collision over the dome: the first is above a double jump from a module top. */
2707
+ var BANDS = [
2708
+ 0,
2709
+ 10.5,
2710
+ 13.5,
2711
+ 15.5,
2712
+ 17
2713
+ ];
2714
+ /**
2715
+ * The half sides (x, z) of the boxes that cover the circle of radius r, centred: four, stepped,
2716
+ * the first two crossed with the last two (a union of axis-aligned boxes: its corners stick out of
2717
+ * the circle by up to 17 %, the ghosts are not drawn).
2718
+ */
2719
+ var around = (r) => [
2720
+ [1, .39],
2721
+ [.93, .71],
2722
+ [.71, .93],
2723
+ [.39, 1]
2724
+ ].map(([a, b]) => [q(a * r), q(b * r)]);
2725
+ var first = around(22.599999999999998);
2726
+ /** The domes' centres, the landing pads (x, z, radius), the shuttles, the modules, the tubes and the masts (centres), red's then blue's: what the scenery draws on. */
2727
+ var DOME = [80, 236];
2728
+ var PAD = [
2729
+ 40,
2730
+ 220,
2731
+ 13
2732
+ ];
2733
+ var SHUTTLE = bx(33, .25, 218, 47, 3.25, 222);
2734
+ var MODULES = [bx(111, 0, 222, 125, 5, 230), bx(96, 0, 196, 110, 5, 204)];
2735
+ var TUBES = [bx(DOME[0] + first[1][0], 0, DOME[1] - first[0][1] - 4, 111, 3.5, DOME[1] - first[0][1]), bx(98, 0, 204, 102, 3.5, DOME[1] - first[1][1])];
2736
+ var MASTS = [
2737
+ [27.3, 207.3],
2738
+ [52.7, 207.3],
2739
+ [27.3, 232.7],
2740
+ [52.7, 232.7],
2741
+ [106.2, 230.4],
2742
+ [103.2, 212.4]
2743
+ ];
2744
+ DOME[0], 280 - DOME[1], PAD[0], 280 - PAD[1], PAD[2], mirror(SHUTTLE), [...MODULES, ...MODULES.map(mirror)], [...TUBES, ...TUBES.map(mirror)], [...MASTS, ...MASTS.map(([x, z]) => [x, 280 - z])];
2745
+ /**
2746
+ * Stairs from `a` to `b` along z (axis 2) or x (0), across `w0` to `w1`, rising from `y` to `top`
2747
+ * in steps of at most 0.46 m, each a solid from `y`.
2748
+ */
2749
+ var stairs = (axis, a, b, w0, w1, y, top) => {
2750
+ const n = Math.ceil((top - y) / .46);
2751
+ return Array.from({ length: n }, (_, i) => {
2752
+ const [s, t] = [a + (b - a) * i / n, a + (b - a) * (i + 1) / n].sort((p, q) => p - q);
2753
+ const up = y + (top - y) * (i + 1) / n;
2754
+ return axis ? box(w0, y, s, w1, up, t, CONCRETE) : box(s, y, w0, t, up, w1, CONCRETE);
2755
+ });
2756
+ };
2757
+ /** The twin of a brush, a point or a spawn across the centre line. */
2758
+ var flip = (b) => ({
2759
+ ...b,
2760
+ min: [
2761
+ b.min[0],
2762
+ b.min[1],
2763
+ 280 - b.max[2]
2764
+ ],
2765
+ max: [
2766
+ b.max[0],
2767
+ b.max[1],
2768
+ 280 - b.min[2]
2769
+ ],
2770
+ tint: b.tint === RED ? BLUE : b.tint
2771
+ });
2772
+ var flipPoint = ([x, y, z]) => [
2773
+ x,
2774
+ y,
2775
+ 280 - z
2776
+ ];
2777
+ /** The list and its twins, then the pieces by the rille. */
2778
+ var both = (l, ...mid) => [
2779
+ ...l,
2780
+ ...l.map(flipPoint),
2781
+ ...mid
2782
+ ];
2783
+ /** Red's half: z from 140 to 280. */
2784
+ var half = [
2785
+ box(0, -30, 148, 160, 0, 280, STONE),
2786
+ ...BANDS.slice(1).flatMap((y1, i) => around(shell(BANDS[i]) + .2).map(([a, b]) => ({
2787
+ ...box(DOME[0] - a, BANDS[i], DOME[1] - b, DOME[0] + a, y1, DOME[1] + b, CONCRETE),
2788
+ ghost: true
2789
+ }))),
2790
+ box(74, 0, 199, 86, .5, 211, PAINT, CONCRETE, RED),
2791
+ box(76, .5, 201, 84, 1, 209, PAINT, CONCRETE, RED),
2792
+ box(60, 0, 259, 70, 1.5, 265, STEEL, PAINT, RED),
2793
+ box(27, 0, 207, 53, .25, 233, METAL),
2794
+ {
2795
+ ...fromBx(SHUTTLE, PAINT),
2796
+ tint: [
2797
+ .82,
2798
+ .84,
2799
+ .88
2800
+ ]
2801
+ },
2802
+ ...MODULES.map((m) => fromBx(m, METAL, CONCRETE)),
2803
+ ...TUBES.map((t) => fromBx(t, STEEL, METAL)),
2804
+ ...stairs(2, 214, TUBES[0].min[2], 105, 109, 0, 3.5),
2805
+ ...stairs(0, 108, 102, 206, 210, 0, 3.5),
2806
+ ...MASTS.map(([x, z]) => box(x - .2, x < 60 ? .25 : 0, z - .2, x + .2, x < 60 ? 10.25 : 10, z + .2, STEEL)),
2807
+ box(12, -30, 148 - 2.5 / 2, 24, 0, 148, PAINT, STONE, [
2808
+ 1,
2809
+ .42,
2810
+ .08
2811
+ ]),
2812
+ ...[
2813
+ [
2814
+ 4,
2815
+ 172,
2816
+ 4,
2817
+ 4,
2818
+ 2.2
2819
+ ],
2820
+ [
2821
+ 30,
2822
+ 154,
2823
+ 5,
2824
+ 5,
2825
+ 3
2826
+ ],
2827
+ [
2828
+ 66,
2829
+ 158,
2830
+ 3,
2831
+ 3,
2832
+ 1.6
2833
+ ],
2834
+ [
2835
+ 95,
2836
+ 164,
2837
+ 5,
2838
+ 4,
2839
+ 2.6
2840
+ ],
2841
+ [
2842
+ 125,
2843
+ 175,
2844
+ 6,
2845
+ 5,
2846
+ 3.2
2847
+ ],
2848
+ [
2849
+ 92,
2850
+ 186,
2851
+ 4,
2852
+ 4,
2853
+ 2.4
2854
+ ]
2855
+ ].map(([x, z, w, d, h]) => box(x, 0, z, x + w, h, z + d, STONE))
2856
+ ];
2857
+ /** What stands on the centre line, symmetric as written: the bridge, the stones and the rim. */
2858
+ var centre = [
2859
+ box(74, -1.5, 132, 86, 0, 148, METAL, STEEL),
2860
+ box(74, 0, 132, 74.4, 1.1, 148, CONCRETE),
2861
+ box(85.6, 0, 132, 86, 1.1, 148, CONCRETE),
2862
+ box(126, -30, 143, 131, 1.2, 147, STONE),
2863
+ box(130, -30, 138.5, 135, 2.4, 141.5, STONE),
2864
+ box(126, -30, 133, 131, 1.2, 137, STONE),
2865
+ ...[
2866
+ box(-10, -30, -10, 0, 14, 290, STONE),
2867
+ box(160, -30, -10, 170, 14, 290, STONE),
2868
+ box(0, -30, -10, 160, 14, 0, STONE),
2869
+ box(0, -30, 280, 160, 14, 290, STONE)
2870
+ ].map((b) => ({
2871
+ ...b,
2872
+ ghost: true
2873
+ }))
2874
+ ];
2875
+ /** Red's spawns behind the dome facing blue (yaw 0 looks toward -z): five in a row, three in front. */
2876
+ var SPAWNS = [...[
2877
+ 56,
2878
+ 68,
2879
+ 80,
2880
+ 92,
2881
+ 104
2882
+ ].map((x) => [
2883
+ x,
2884
+ 0,
2885
+ 271,
2886
+ 0
2887
+ ]), ...[
2888
+ 62,
2889
+ 80,
2890
+ 98
2891
+ ].map((x) => [
2892
+ x,
2893
+ 0,
2894
+ 267,
2895
+ 0
2896
+ ])];
2897
+ /** The racks on the plinth, 2.5 m apart: rifle, rail, gun, katana. */
2898
+ var racks = (z) => Object.fromEntries([
2899
+ "rifle",
2900
+ "rail",
2901
+ "rack",
2902
+ "blade"
2903
+ ].map((k, i) => [k, [
2904
+ 61.25 + 2.5 * i,
2905
+ 1.5,
2906
+ z
2907
+ ]]));
2908
+ var team = (z, s) => ({
2909
+ base: [
2910
+ 80,
2911
+ 1,
2912
+ z
2913
+ ],
2914
+ spawns: s,
2915
+ ...racks(z + (z > 140 ? 57 : -57))
2916
+ });
2917
+ // src/shared/maps.ts
2918
+ var MAPS = {
2919
+ highline: HIGHLINE,
2920
+ tranquility: {
2921
+ name: "Tranquility",
2922
+ brushes: [
2923
+ ...half,
2924
+ ...half.map(flip),
2925
+ ...centre
2926
+ ],
2927
+ teams: [team(205, SPAWNS), team(75, SPAWNS.map(([x, y, z]) => [
2928
+ x,
2929
+ y,
2930
+ 280 - z,
2931
+ Math.PI
2932
+ ]))],
2933
+ packs: both([
2934
+ [
2935
+ 90,
2936
+ 0,
2937
+ 210
2938
+ ],
2939
+ [
2940
+ 118,
2941
+ 5,
2942
+ 226
2943
+ ],
2944
+ [
2945
+ 30,
2946
+ 0,
2947
+ 185
2948
+ ]
2949
+ ], [
2950
+ 45,
2951
+ 0,
2952
+ 152
2953
+ ], [
2954
+ 45,
2955
+ 0,
2956
+ 128
2957
+ ]),
2958
+ ammo: both([
2959
+ [
2960
+ 50,
2961
+ 0,
2962
+ 246
2963
+ ],
2964
+ [
2965
+ 103,
2966
+ 5,
2967
+ 200
2968
+ ],
2969
+ [
2970
+ 135,
2971
+ 0,
2972
+ 190
2973
+ ]
2974
+ ], [
2975
+ 115,
2976
+ 0,
2977
+ 152
2978
+ ], [
2979
+ 115,
2980
+ 0,
2981
+ 128
2982
+ ]),
2983
+ cells: both([[
2984
+ 106.5,
2985
+ 3.5,
2986
+ 226
2987
+ ], [
2988
+ 35,
2989
+ 0,
2990
+ 244
2991
+ ]], [
2992
+ 80,
2993
+ 0,
2994
+ 140
2995
+ ]),
2996
+ floor: -20,
2997
+ sun: {
2998
+ dir: [
2999
+ .87996,
3000
+ .40998,
3001
+ .23999
3002
+ ],
3003
+ color: [
3004
+ 3,
3005
+ 2.95,
3006
+ 2.85
3007
+ ]
3008
+ },
3009
+ sky: [[
3010
+ .002,
3011
+ .002,
3012
+ .006
3013
+ ], [
3014
+ .02,
3015
+ .02,
3016
+ .035
3017
+ ]],
3018
+ gravity: .5,
3019
+ scenery: "moon",
3020
+ helmets: true
3021
+ }
3022
+ };
3023
+ /** The map of a key; an unknown or missing one is HIGHLINE. */
3024
+ var mapOf = (key) => key !== void 0 && MAPS[key] || HIGHLINE;
3025
+ /** The key of a known map, else 'highline'. */
3026
+ var mapKey = (key) => key !== void 0 && Object.hasOwn(MAPS, key) ? key : "highline";
2659
3027
  // src/shared/plasma.ts
2660
3028
  /** Metres a ball flies in a tick, and an arc. */
2661
3029
  var PLASMA_STEP = 40 / 60;
@@ -2985,12 +3353,16 @@ var Room = class {
2985
3353
  gone;
2986
3354
  /** The plasma balls in flight, and the ones that burst since the last snapshot, which sends them once more. */
2987
3355
  balls = [];
2988
- /** Missing rules fall back to RULES. */
2989
- constructor(rules = {}, map = HIGHLINE) {
3356
+ /** The key of the map being played, which the roster tells the clients. */
3357
+ mapName;
3358
+ /** Missing rules fall back to RULES. The map is the rules' one, unless a definition is given. */
3359
+ constructor(rules = {}, def) {
2990
3360
  this.rules = {
2991
3361
  ...RULES,
2992
3362
  ...rules
2993
3363
  };
3364
+ this.mapName = mapKey(this.rules.map);
3365
+ const map = def ?? mapOf(this.mapName);
2994
3366
  this.world = build(map);
2995
3367
  this.ctf = new Ctf(this.world, this.rules);
2996
3368
  this.gone = [
@@ -3481,7 +3853,8 @@ var Room = class {
3481
3853
  players.forEach((p) => p.conn.send(JSON.stringify({
3482
3854
  t: "roster",
3483
3855
  you: p.info.id,
3484
- players: list
3856
+ players: list,
3857
+ map: this.mapName
3485
3858
  })));
3486
3859
  }
3487
3860
  };