@korial29/tiny-fps 1.22.1 → 1.24.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.
@@ -488,8 +488,11 @@ var raise = (def) => {
488
488
  h[i + j * nx] = at(x0 + i * cell, z0 + j * cell);
489
489
  top = Math.max(top, h[i + j * nx]);
490
490
  }
491
- const pitted = new Uint8Array(nx * nz);
492
- for (const [px0, pz0, px1, pz1] of pits) for (let j = Math.floor((pz0 - z0) / cell) - 1; j <= Math.floor((pz1 - z0) / cell) + 1; j++) for (let i = Math.floor((px0 - x0) / cell) - 1; i <= Math.floor((px1 - x0) / cell) + 1; i++) if (i >= 0 && j >= 0 && i < nx && j < nz) pitted[i + j * nx] = 1;
491
+ const pitted = [];
492
+ for (const q of pits) {
493
+ const [px0, pz0, px1, pz1] = q;
494
+ for (let j = Math.floor((pz0 - z0) / cell) - 1; j <= Math.floor((pz1 - z0) / cell) + 1; j++) for (let i = Math.floor((px0 - x0) / cell) - 1; i <= Math.floor((px1 - x0) / cell) + 1; i++) if (i >= 0 && j >= 0 && i < nx && j < nz) (pitted[i + j * nx] ??= []).push(q);
495
+ }
493
496
  const r = {
494
497
  x0,
495
498
  z0,
@@ -518,7 +521,7 @@ var ground = (w, x, z) => {
518
521
  const v = Math.min(Math.max((z - r.z0) / r.cell, 0), r.nz - 1);
519
522
  const i = Math.min(Math.floor(u), r.nx - 2);
520
523
  const j = Math.min(Math.floor(v), r.nz - 2);
521
- if (r.pitted[i + j * r.nx] && r.pits.some((q) => x >= q[0] && x <= q[2] && z >= q[1] && z <= q[3])) return -Infinity;
524
+ if (r.pitted[i + j * r.nx]?.some((q) => x >= q[0] && x <= q[2] && z >= q[1] && z <= q[3])) return -Infinity;
522
525
  const [fu, fv] = [u - i, v - j];
523
526
  const n = i + j * r.nx;
524
527
  const [a, b, c, d] = [
@@ -1151,7 +1154,7 @@ var speedOf$1 = (p) => len$1(p.vx, p.vz);
1151
1154
  /** Whether the brush stops a body of height h whose feet are at y when it walks sideways into it. */
1152
1155
  var blocks = (b, y, h) => b.max[1] > y + .5 + SKIN && b.min[1] < y + h - SKIN;
1153
1156
  /** The closest point of the brush footprint to (x, z), as the offset from it to (x, z). */
1154
- var gap = (b, x, z) => [x - clamp$3(x, b.min[0], b.max[0]), z - clamp$3(z, b.min[2], b.max[2])];
1157
+ var gap$1 = (b, x, z) => [x - clamp$3(x, b.min[0], b.max[0]), z - clamp$3(z, b.min[2], b.max[2])];
1155
1158
  /**
1156
1159
  * Pushes the player out of every brush that blocks it and that the circle overlaps, deepest first
1157
1160
  * (up to 4 passes: two walls in a corner settle in two). The push is along the vector from the
@@ -1182,7 +1185,7 @@ var shove = (p, w, h, r) => {
1182
1185
  for (const i of ids) {
1183
1186
  const b = brushes[i];
1184
1187
  if (!blocks(b, p.y, h)) continue;
1185
- const [dx, dz] = gap(b, p.x, p.z);
1188
+ const [dx, dz] = gap$1(b, p.x, p.z);
1186
1189
  const d2 = dx * dx + dz * dz;
1187
1190
  if (d2 >= reach) continue;
1188
1191
  if (d2) {
@@ -1283,7 +1286,7 @@ var span = (p, w, h, bodies = []) => {
1283
1286
  let ceil = Infinity;
1284
1287
  for (const i of near(w, p.x, p.z, PLAYER_R)) {
1285
1288
  const b = brushes[i];
1286
- const [dx, dz] = gap(b, p.x, p.z);
1289
+ const [dx, dz] = gap$1(b, p.x, p.z);
1287
1290
  if (dx * dx + dz * dz >= reach) continue;
1288
1291
  if (b.max[1] <= p.y + .5 + SKIN) floor = Math.max(floor, b.max[1]);
1289
1292
  else if (b.min[1] >= p.y + h - SKIN) ceil = Math.min(ceil, b.min[1]);
@@ -1314,7 +1317,7 @@ var canStand = (p, w) => {
1314
1317
  const reach = (PLAYER_R - EPS) ** 2;
1315
1318
  return near(w, p.x, p.z, PLAYER_R).every((i) => {
1316
1319
  const b = w.def.brushes[i];
1317
- const [dx, dz] = gap(b, p.x, p.z);
1320
+ const [dx, dz] = gap$1(b, p.x, p.z);
1318
1321
  return dx * dx + dz * dz >= reach || !blocks(b, p.y, 1.8);
1319
1322
  });
1320
1323
  };
@@ -1323,7 +1326,7 @@ var clear = (w, x, z, y0, y1) => {
1323
1326
  const reach = (PLAYER_R - EPS) ** 2;
1324
1327
  return near(w, x, z, PLAYER_R).every((i) => {
1325
1328
  const b = w.def.brushes[i];
1326
- const [dx, dz] = gap(b, x, z);
1329
+ const [dx, dz] = gap$1(b, x, z);
1327
1330
  return dx * dx + dz * dz >= reach || b.max[1] <= y0 || b.min[1] >= y1;
1328
1331
  });
1329
1332
  };
@@ -1461,7 +1464,7 @@ var unwalled = (p, w, c, h) => {
1461
1464
  let [x, z] = [c.wx, c.wz];
1462
1465
  for (const i of near(w, p.x, p.z, PLAYER_R + TOUCH$1)) {
1463
1466
  const b = w.def.brushes[i];
1464
- const [dx, dz] = gap(b, p.x, p.z);
1467
+ const [dx, dz] = gap$1(b, p.x, p.z);
1465
1468
  const d = len$1(dx, dz);
1466
1469
  if (d > 0 && d <= .4 + TOUCH$1 && blocks(b, p.y, h)) {
1467
1470
  const into = (-x * dx - z * dz) / d;
@@ -3733,97 +3736,897 @@ var KIT = [
3733
3736
  3
3734
3737
  ],
3735
3738
  [
3736
- PLANTS,
3737
- 115,
3738
- 222.4,
3739
- 121,
3740
- 223.2,
3741
- 0,
3742
- 2,
3743
- 1
3739
+ PLANTS,
3740
+ 115,
3741
+ 222.4,
3742
+ 121,
3743
+ 223.2,
3744
+ 0,
3745
+ 2,
3746
+ 1
3747
+ ],
3748
+ [
3749
+ PLANTS,
3750
+ 123.8,
3751
+ 226.4,
3752
+ 124.6,
3753
+ 229.6,
3754
+ 0,
3755
+ 2,
3756
+ 2
3757
+ ],
3758
+ [
3759
+ LOCKERS,
3760
+ 96.4,
3761
+ 200.4,
3762
+ 97,
3763
+ 203.6,
3764
+ 0,
3765
+ 2.1,
3766
+ 0
3767
+ ],
3768
+ [
3769
+ SUIT,
3770
+ 108.6,
3771
+ 197.4,
3772
+ 109.6,
3773
+ 198.4,
3774
+ 0,
3775
+ 2,
3776
+ 2
3777
+ ]
3778
+ ];
3779
+ /**
3780
+ * A wall along the axis k from a to b, between p and q across, up to y: a doorway H high in each
3781
+ * gap (from, to). A gap of no width only cuts the wall in two: vision.ts stripes a wall of 8 m.
3782
+ */
3783
+ var wall = (k, a, b, p, q, y, gaps = []) => {
3784
+ const piece = (s, t, y0) => k ? box$2(p, y0, s, q, y, t, CONCRETE$1) : box$2(s, y0, p, t, y, q, CONCRETE$1);
3785
+ return [...gaps, [b, b]].flatMap(([s, t], i, l) => [piece(i ? l[i - 1][1] : a, s, 0), ...t > s ? [piece(s, t, H)] : []]);
3786
+ };
3787
+ /** A module: a roof slab on four walls, with the gaps of the walls at its low z, high z, low x and high x. */
3788
+ var room = ({ min: [x0, , z0], max: [x1, y, z1] }, gaps, crate) => [
3789
+ box$2(x0, 4, z0, x1, y, z1, HULL$2, CONCRETE$1),
3790
+ ...wall(0, x0, x1, z0, z0 + T, 4, gaps[0]),
3791
+ ...wall(0, x0, x1, z1 - T, z1, 4, gaps[1]),
3792
+ ...wall(2, z0 + T, z1 - T, x0, x0 + T, 4, gaps[2]),
3793
+ ...wall(2, z0 + T, z1 - T, x1 - T, x1, 4),
3794
+ crate
3795
+ ];
3796
+ var ORANGE$1 = [
3797
+ 1,
3798
+ .42,
3799
+ .08
3800
+ ];
3801
+ /** Red's half of the base. */
3802
+ var BASE = [
3803
+ ...BANDS.slice(2).flatMap((y1, i) => around(shell(BANDS[i + 1]) + .2).map(([a, b]) => ghost$1([
3804
+ -a,
3805
+ -b,
3806
+ a,
3807
+ b
3808
+ ], BANDS[i + 1], y1))),
3809
+ ...turns(SLICES).flatMap((p) => flush(p).map(([r, y]) => ghost$1(r, y, BANDS[1]))),
3810
+ ...FIT$1,
3811
+ ...KIT.map(([, x0, z0, x1, z1, y0, y1]) => ({
3812
+ ...box$2(x0, y0, z0, x1, y1, z1, STEEL$3),
3813
+ ghost: true
3814
+ })),
3815
+ ...room(MODULES[0], [
3816
+ [[118, 118]],
3817
+ [[116.8, 119.2]],
3818
+ [[TZ0 + T, TZ1 - T]]
3819
+ ], box$2(121.5, 0, 223.5, 123.5, 1.2, 225.5, PAINT$3, PAINT$3, ORANGE$1)),
3820
+ ...room(MODULES[1], [[[101.8, 104.2]], [[UX0 + T, UX1 - T], [105.8, 105.8]]], box$2(106, 0, 200.6, 108, 1.2, 202.6, PAINT$3, PAINT$3, ORANGE$1)),
3821
+ box$2(TX0, H, TZ0, TX1, TY, TZ1, STEEL$3, HULL$2),
3822
+ box$2(UX0, H, UZ0, UX1, TY, TZ1, STEEL$3, HULL$2),
3823
+ box$2(UX0, 0, TZ1 - T, TX1, H, TZ1, HULL$2),
3824
+ box$2(UX1 - T, 0, TZ0, TX1, H, TZ0 + T, HULL$2),
3825
+ box$2(UX0, 0, UZ0, UX0 + T, H, TZ0, HULL$2),
3826
+ box$2(UX1 - T, 0, UZ0, UX1, H, TZ0, HULL$2),
3827
+ ...stairs(2, 214, TZ0, 105, 109, 0, 3.5),
3828
+ ...stairs(0, 108, UX1, 206, 210, 0, 3.5)
3829
+ ];
3830
+ // src/shared/moon/rift.ts
3831
+ /** Where the lip stays straight, x0 to x1: the west jump's spurs, a mound and its flanks, the bridge, the east stones and the other mound. */
3832
+ var STRAIGHT = [
3833
+ [12, 24],
3834
+ [36, 60],
3835
+ [72, 88],
3836
+ [124, 156]
3837
+ ];
3838
+ /**
3839
+ * The rille's lip on red's side, a number for each metre of x from 0: how far it is behind z 148,
3840
+ * in half metres. A meander from two octaves of noise, 0 on STRAIGHT, never more than half a
3841
+ * metre from one metre to the next between the ends, at most 6.5 m. Under 0, a spur into the
3842
+ * rille: only over the last 8 m of each end, where it closes (a narrower rille is a new jump).
3843
+ * Blue's lip is the mirror.
3844
+ */
3845
+ var LIP = (() => {
3846
+ const d = Array.from({ length: 160 }, (_, x) => STRAIGHT.some(([a, b]) => x >= a - 1 && x <= b) ? 0 : Math.min(Math.round(Math.max(26 * noise(x / 17, 0, 33) + 8 * noise(x / 5, 0, 35) - 11, 0)) / 2, 6.5));
3847
+ for (const k of [1, -1]) for (let x = k > 0 ? 1 : 158; x >= 0 && x < 160; x += k) d[x] = Math.min(d[x], d[x - k] + .5);
3848
+ return d.map((v, x) => {
3849
+ const e = Math.min(x, 159 - x);
3850
+ return e < 4 ? -6 : e < 8 ? -3 : v;
3851
+ });
3852
+ })();
3853
+ /** A hollow in red's field, its middle x, z and how deep: the slab is lowered under it (HOLLOW's square, 3 m), the relief is the floor there. */
3854
+ var HOLLOW = [
3855
+ 114,
3856
+ 176,
3857
+ 2
3858
+ ];
3859
+ /**
3860
+ * The cracks, red's: each a line of points x, z from the centre line and half its width there.
3861
+ * The width swells and narrows with a noise along it (0.8 to 1.2 times) and its edge is broken by
3862
+ * a finer one (half a metre). They join (the user, 2026-11-27: from island to island): the
3863
+ * front one runs across the field from wall to wall in front of the base, and the long ones,
3864
+ * the side ones and the sinkholes cut what is between it and the rille into islands, each
3865
+ * reached by a jump (CROSSINGS). The two long ones still run on almost to the dome's door and
3866
+ * the module's airlock. Kept whole: the west jump's run-up and take-off, the bridge's landing,
3867
+ * the east stones' approach, and each mound with the rover's run-up behind it.
3868
+ */
3869
+ var CRACKS = [
3870
+ [
3871
+ [
3872
+ 66,
3873
+ 6,
3874
+ 2.4
3875
+ ],
3876
+ [
3877
+ 65.5,
3878
+ 14,
3879
+ 2.8
3880
+ ],
3881
+ [
3882
+ 63.5,
3883
+ 22,
3884
+ 4
3885
+ ],
3886
+ [
3887
+ 63,
3888
+ 30,
3889
+ 5
3890
+ ],
3891
+ [
3892
+ 66,
3893
+ 38,
3894
+ 4.6
3895
+ ],
3896
+ [
3897
+ 71,
3898
+ 46,
3899
+ 3.8
3900
+ ],
3901
+ [
3902
+ 75,
3903
+ 54,
3904
+ 3
3905
+ ],
3906
+ [
3907
+ 78,
3908
+ 62,
3909
+ 2.2
3910
+ ],
3911
+ [
3912
+ 79.5,
3913
+ 67,
3914
+ .9
3915
+ ]
3916
+ ],
3917
+ [
3918
+ [
3919
+ 96,
3920
+ 6,
3921
+ 2.4
3922
+ ],
3923
+ [
3924
+ 94,
3925
+ 14,
3926
+ 3.2
3927
+ ],
3928
+ [
3929
+ 89.5,
3930
+ 22,
3931
+ 4.2
3932
+ ],
3933
+ [
3934
+ 88,
3935
+ 30,
3936
+ 4.4
3937
+ ],
3938
+ [
3939
+ 88.5,
3940
+ 38,
3941
+ 4
3942
+ ],
3943
+ [
3944
+ 92,
3945
+ 45,
3946
+ 3.2
3947
+ ],
3948
+ [
3949
+ 96,
3950
+ 49,
3951
+ 2.2
3952
+ ],
3953
+ [
3954
+ 99,
3955
+ 51,
3956
+ 1.1
3957
+ ]
3958
+ ],
3959
+ [
3960
+ [
3961
+ 34.5,
3962
+ 36,
3963
+ 2.4
3964
+ ],
3965
+ [
3966
+ 37,
3967
+ 45,
3968
+ 3
3969
+ ],
3970
+ [
3971
+ 36.5,
3972
+ 53,
3973
+ 2.4
3974
+ ],
3975
+ [
3976
+ 35,
3977
+ 58,
3978
+ 1.8
3979
+ ],
3980
+ [
3981
+ 34.5,
3982
+ 61,
3983
+ 1.8
3984
+ ]
3985
+ ],
3986
+ [
3987
+ [
3988
+ 28.5,
3989
+ 6,
3990
+ 1.6
3991
+ ],
3992
+ [
3993
+ 29,
3994
+ 14,
3995
+ 1.6
3996
+ ],
3997
+ [
3998
+ 29.5,
3999
+ 21,
4000
+ 1.8
4001
+ ],
4002
+ [
4003
+ 31,
4004
+ 27,
4005
+ 2
4006
+ ]
4007
+ ],
4008
+ [
4009
+ [
4010
+ -1,
4011
+ 60,
4012
+ 2.2
4013
+ ],
4014
+ [
4015
+ 12,
4016
+ 61,
4017
+ 2.3
4018
+ ],
4019
+ [
4020
+ 26,
4021
+ 60,
4022
+ 2.5
4023
+ ],
4024
+ [
4025
+ 40,
4026
+ 61,
4027
+ 2.4
4028
+ ],
4029
+ [
4030
+ 48,
4031
+ 61.5,
4032
+ 2.4
4033
+ ],
4034
+ [
4035
+ 56,
4036
+ 62,
4037
+ 2.4
4038
+ ],
4039
+ [
4040
+ 64,
4041
+ 61,
4042
+ 2.4
4043
+ ],
4044
+ [
4045
+ 70,
4046
+ 59,
4047
+ 2.4
4048
+ ],
4049
+ [
4050
+ 76.5,
4051
+ 58,
4052
+ 2.4
4053
+ ],
4054
+ [
4055
+ 82,
4056
+ 57,
4057
+ 2.3
4058
+ ],
4059
+ [
4060
+ 88,
4061
+ 55.5,
4062
+ 2.3
4063
+ ],
4064
+ [
4065
+ 94,
4066
+ 51.5,
4067
+ 2.1
4068
+ ],
4069
+ [
4070
+ 98.5,
4071
+ 50.5,
4072
+ 2
4073
+ ],
4074
+ [
4075
+ 106,
4076
+ 50.5,
4077
+ 2
4078
+ ],
4079
+ [
4080
+ 114,
4081
+ 50.8,
4082
+ 2
4083
+ ],
4084
+ [
4085
+ 122,
4086
+ 50.8,
4087
+ 2
4088
+ ],
4089
+ [
4090
+ 128,
4091
+ 52,
4092
+ 2
4093
+ ],
4094
+ [
4095
+ 132,
4096
+ 54.5,
4097
+ 2.2
4098
+ ],
4099
+ [
4100
+ 136,
4101
+ 58,
4102
+ 2.4
4103
+ ],
4104
+ [
4105
+ 148,
4106
+ 62,
4107
+ 2.4
4108
+ ],
4109
+ [
4110
+ 161,
4111
+ 63,
4112
+ 2.2
4113
+ ]
4114
+ ],
4115
+ [
4116
+ [
4117
+ -1,
4118
+ 36,
4119
+ 2.2
4120
+ ],
4121
+ [
4122
+ 10,
4123
+ 35,
4124
+ 2.5
4125
+ ],
4126
+ [
4127
+ 22,
4128
+ 34,
4129
+ 2.3
4130
+ ],
4131
+ [
4132
+ 29,
4133
+ 31.5,
4134
+ 2
4135
+ ]
4136
+ ],
4137
+ [
4138
+ [
4139
+ 64.5,
4140
+ 35,
4141
+ 2.2
4142
+ ],
4143
+ [
4144
+ 70,
4145
+ 36,
4146
+ 2.3
4147
+ ],
4148
+ [
4149
+ 77,
4150
+ 35.5,
4151
+ 2.2
4152
+ ],
4153
+ [
4154
+ 83,
4155
+ 34.5,
4156
+ 2.2
4157
+ ],
4158
+ [
4159
+ 88,
4160
+ 33,
4161
+ 2
4162
+ ]
4163
+ ],
4164
+ [
4165
+ [
4166
+ 89.5,
4167
+ 22,
4168
+ 2
4169
+ ],
4170
+ [
4171
+ 94,
4172
+ 21,
4173
+ 2.2
4174
+ ],
4175
+ [
4176
+ 100,
4177
+ 20,
4178
+ 2.3
4179
+ ],
4180
+ [
4181
+ 107,
4182
+ 18.5,
4183
+ 2.1
4184
+ ],
4185
+ [
4186
+ 115,
4187
+ 17.5,
4188
+ 2
4189
+ ],
4190
+ [
4191
+ 122,
4192
+ 21.5,
4193
+ 2.1
4194
+ ],
4195
+ [
4196
+ 128,
4197
+ 24.5,
4198
+ 2
4199
+ ],
4200
+ [
4201
+ 132,
4202
+ 27,
4203
+ 2
4204
+ ]
4205
+ ],
4206
+ [
4207
+ [
4208
+ 132,
4209
+ 27,
4210
+ 1.6
4211
+ ],
4212
+ [
4213
+ 134,
4214
+ 33,
4215
+ 1.4
4216
+ ],
4217
+ [
4218
+ 136,
4219
+ 42,
4220
+ 1.4
4221
+ ],
4222
+ [
4223
+ 136,
4224
+ 52,
4225
+ 1.4
4226
+ ],
4227
+ [
4228
+ 136,
4229
+ 58,
4230
+ 1.6
4231
+ ]
4232
+ ],
4233
+ [[
4234
+ 31.5,
4235
+ 6,
4236
+ 1.6
4237
+ ], [
4238
+ 31,
4239
+ 10,
4240
+ .9
4241
+ ]]
4242
+ ];
4243
+ /**
4244
+ * The jumps between the islands, red's: a point in a crack and the way across it (x, z from the
4245
+ * centre line, a unit vector). A body takes off a metre short of the edge and lands 1.5 m past
4246
+ * the far one (hops()): the bots' links, flown both ways in moon.test.ts.
4247
+ */
4248
+ var CROSSINGS$1 = [
4249
+ [
4250
+ 18,
4251
+ 60.6,
4252
+ 0,
4253
+ 1
4254
+ ],
4255
+ [
4256
+ 44,
4257
+ 61.2,
4258
+ 0,
4259
+ 1
4260
+ ],
4261
+ [
4262
+ 85,
4263
+ 56.3,
4264
+ 0,
4265
+ 1
4266
+ ],
4267
+ [
4268
+ 118,
4269
+ 50.8,
4270
+ 0,
4271
+ 1
4272
+ ],
4273
+ [
4274
+ 141,
4275
+ 59.7,
4276
+ 0,
4277
+ 1
4278
+ ],
4279
+ [
4280
+ 6,
4281
+ 35.5,
4282
+ 0,
4283
+ 1
4284
+ ],
4285
+ [
4286
+ 29,
4287
+ 12,
4288
+ 1,
4289
+ 0
4290
+ ],
4291
+ [
4292
+ 65.7,
4293
+ 10,
4294
+ 1,
4295
+ 0
4296
+ ],
4297
+ [
4298
+ 93,
4299
+ 16,
4300
+ 1,
4301
+ 0
4302
+ ],
4303
+ [
4304
+ 78,
4305
+ 35.3,
4306
+ 0,
4307
+ 1
4308
+ ],
4309
+ [
4310
+ 103,
4311
+ 19.6,
4312
+ 0,
4313
+ 1
4314
+ ],
4315
+ [
4316
+ 136,
4317
+ 45,
4318
+ 1,
4319
+ 0
4320
+ ]
4321
+ ];
4322
+ /**
4323
+ * The rovers' ramps, red's (the user, 2026-11-27: discreet, marked by an orange band at the top as
4324
+ * the west long jump's spur is): a point in a crack's middle, the way a rover jumps it (a unit
4325
+ * vector). The relief rises KICK_H m over 7 m to 2 m short of the point, level 4 m across and 2.5 m
4326
+ * of flank each side (moon.ts at()); a rover at speed flies the crack off it. One on each branch
4327
+ * of the cracks between two islands where there is room for one, and both ways over the front
4328
+ * crack facing the rovers parked before the base.
4329
+ */
4330
+ var KICKERS = [
4331
+ [
4332
+ 62,
4333
+ 61.25,
4334
+ 0,
4335
+ -1
4336
+ ],
4337
+ [
4338
+ 62,
4339
+ 61.25,
4340
+ 0,
4341
+ 1
4342
+ ],
4343
+ [
4344
+ 154,
4345
+ 62.5,
4346
+ 0,
4347
+ -1
4348
+ ],
4349
+ [
4350
+ 154,
4351
+ 62.5,
4352
+ 0,
4353
+ 1
4354
+ ],
4355
+ [
4356
+ 18,
4357
+ 60.6,
4358
+ 0,
4359
+ 1
4360
+ ],
4361
+ [
4362
+ 90,
4363
+ 54.7,
4364
+ 0,
4365
+ -1
4366
+ ],
4367
+ [
4368
+ 117,
4369
+ 50.8,
4370
+ 0,
4371
+ 1
4372
+ ],
4373
+ [
4374
+ 35.8,
4375
+ 55,
4376
+ 1,
4377
+ 0
4378
+ ],
4379
+ [
4380
+ 14,
4381
+ 34.8,
4382
+ 0,
4383
+ -1
4384
+ ],
4385
+ [
4386
+ 65,
4387
+ 17,
4388
+ 1,
4389
+ 0
4390
+ ],
4391
+ [
4392
+ 74,
4393
+ 52.5,
4394
+ 1,
4395
+ 0
4396
+ ],
4397
+ [
4398
+ 78,
4399
+ 35.5,
4400
+ 0,
4401
+ -1
4402
+ ],
4403
+ [
4404
+ 91.7,
4405
+ 44,
4406
+ 1,
4407
+ 0
4408
+ ]
4409
+ ];
4410
+ var KICK_H = 1.2;
4411
+ /** Round each ramp, x0, z0, x1, z1 from the centre line: its slope and flanks, the field level under it. */
4412
+ var KICKER_RECTS = KICKERS.map(([rx, rz, ux, uz]) => {
4413
+ const [xs, zs] = [[rx - 9 * ux, rx + ux], [rz - 9 * uz, rz + uz]];
4414
+ const [ex, ez] = [4.5 * Math.abs(uz), 4.5 * Math.abs(ux)];
4415
+ return [
4416
+ Math.min(...xs) - ex,
4417
+ Math.min(...zs) - ez,
4418
+ Math.max(...xs) + ex,
4419
+ Math.max(...zs) + ez
4420
+ ];
4421
+ });
4422
+ /** The ramps' relief at (x, z from the centre line): 0 off them. */
4423
+ var ramped = (x, z) => {
4424
+ let h = 0;
4425
+ for (const [rx, rz, ux, uz] of KICKERS) {
4426
+ const [a, b] = [(x - rx) * ux + (z - rz) * uz, (z - rz) * ux - (x - rx) * uz];
4427
+ h = Math.max(h, KICK_H * c1$1((a + 9) / 7) * c1$1((1.5 - a) / 3) * c1$1((4.5 - Math.abs(b)) / 2.5));
4428
+ }
4429
+ return h;
4430
+ };
4431
+ /** The sinkholes, red's: x, z from the centre line, radius (0.85 to 1.15 of it with the bearing). */
4432
+ var SINKS = [[
4433
+ 33,
4434
+ 30.5,
4435
+ 5.5
4436
+ ], [
4437
+ 132,
4438
+ 27,
4439
+ 5.5
4440
+ ]];
4441
+ /** The pylons to hop on, red's: x, z from the centre line, half side, top. In the sinkholes and the cracks' wide parts. */
4442
+ var PYLONS = [
4443
+ [
4444
+ 31,
4445
+ 30.5,
4446
+ .8,
4447
+ .3
4448
+ ],
4449
+ [
4450
+ 33.8,
4451
+ 31.8,
4452
+ .8,
4453
+ 1.1
4454
+ ],
4455
+ [
4456
+ 36.4,
4457
+ 30,
4458
+ .8,
4459
+ .4
4460
+ ],
4461
+ [
4462
+ 130,
4463
+ 25,
4464
+ .8,
4465
+ .8
4466
+ ],
4467
+ [
4468
+ 131,
4469
+ 28.5,
4470
+ .8,
4471
+ 0
4472
+ ],
4473
+ [
4474
+ 61,
4475
+ 30,
4476
+ .9,
4477
+ .6
3744
4478
  ],
3745
4479
  [
3746
- PLANTS,
3747
- 123.8,
3748
- 226.4,
3749
- 124.6,
3750
- 229.6,
3751
- 0,
3752
- 2,
3753
- 2
4480
+ 64,
4481
+ 33.5,
4482
+ .8,
4483
+ -.4
3754
4484
  ],
3755
4485
  [
3756
- LOCKERS,
3757
- 96.4,
3758
- 200.4,
3759
- 97,
3760
- 203.6,
3761
- 0,
3762
- 2.1,
3763
- 0
4486
+ 88,
4487
+ 26,
4488
+ .8,
4489
+ .9
3764
4490
  ],
3765
4491
  [
3766
- SUIT,
3767
- 108.6,
3768
- 197.4,
3769
- 109.6,
3770
- 198.4,
3771
- 0,
3772
- 2,
3773
- 2
4492
+ 88.5,
4493
+ 34,
4494
+ .8,
4495
+ .2
3774
4496
  ]
3775
4497
  ];
4498
+ var far$2 = (a, b) => Math.sqrt(a * a + b * b);
4499
+ /** t clamped to [0, 1]. */
4500
+ var c1$1 = (t) => Math.min(Math.max(t, 0), 1);
4501
+ /** How far (x, z from the centre line) is inside a crack or a sinkhole: over 0 open. */
4502
+ var open = (x, z) => {
4503
+ let o = -Infinity;
4504
+ const jag = .5 * (noise(x / 1.3, z / 1.3, 93) - .5);
4505
+ CRACKS.forEach((l, k) => {
4506
+ let along = 0;
4507
+ for (let i = 0; i < l.length - 1; i++) {
4508
+ const [[ax, az, aw], [bx, bz, bw]] = [l[i], l[i + 1]];
4509
+ const [dx, dz] = [bx - ax, bz - az];
4510
+ const n = far$2(dx, dz);
4511
+ const t = Math.min(Math.max(((x - ax) * dx + (z - az) * dz) / (n * n), 0), 1);
4512
+ const w = (aw + (bw - aw) * t) * (.8 + .4 * noise((along + t * n) / 5, k + .5, 91));
4513
+ o = Math.max(o, w + jag - far$2(x - ax - t * dx, z - az - t * dz));
4514
+ along += n;
4515
+ }
4516
+ });
4517
+ for (const [k, [cx, cz, r]] of SINKS.entries()) {
4518
+ const d = far$2(x - cx, z - cz);
4519
+ const [ux, uz] = d ? [(x - cx) / d, (z - cz) / d] : [1, 0];
4520
+ o = Math.max(o, r * (.85 + .3 * noise(2.5 * ux + 7 * k, 2.5 * uz, 95)) + jag - d);
4521
+ }
4522
+ return o;
4523
+ };
4524
+ /** The grid: cells of S m, NX across x 0 to 160 and NZ from the centre line out. */
4525
+ var [S, NX, NZ] = [
4526
+ .5,
4527
+ 320,
4528
+ 152
4529
+ ];
4530
+ /** The cell (i, j) in the rille or a notch of its lip, by its column of x (a metre, two cells). Past the centre line its mirror. */
4531
+ var lipped = (i, j) => i >= 0 && i < NX && ((j < 0 ? -1 - j : j) + 1) * S <= 8 + LIP[Math.floor(i * S)];
4532
+ /** The cracks' and the sinkholes' corners, 1 open: (i, j) at x = i S, z = j S from the centre line. */
4533
+ var CRACKED = (() => {
4534
+ const c = new Uint8Array((NX + 1) * (NZ + 1));
4535
+ for (let j = 0; j <= NZ; j++) for (let i = 0; i <= NX; i++) c[i + j * (NX + 1)] = +(open(i * S, j * S) > 0);
4536
+ return c;
4537
+ })();
4538
+ var cracked = (i, j) => i < 0 || i > NX || j > NZ ? 0 : CRACKED[i + Math.abs(j) * (NX + 1)];
4539
+ /** Three of a cell's corners open in a crack or more. */
4540
+ var loose = (i, j) => cracked(i, j) + cracked(i + 1, j) + cracked(i + 1, j + 1) + cracked(i, j + 1) >= 3;
4541
+ /**
4542
+ * The cells open, from the centre line out: the rille and its notches, cell for cell as LIP
4543
+ * says; and in the cracks the loose ones in a square of four loose or lipped ones, so no slot is
4544
+ * under a metre wide, which a body could fall into and not climb out of.
4545
+ */
4546
+ var GAPS$1 = (() => {
4547
+ const g = new Uint8Array(NX * NZ);
4548
+ const either = (i, j) => lipped(i, j) || loose(i, j);
4549
+ for (let j = 0; j < NZ; j++) for (let i = 0; i < NX; i++) g[i + j * NX] = +(lipped(i, j) || loose(i, j) && [-1, 0].some((a) => [-1, 0].some((b) => either(i + a, j + b) && either(i + a + 1, j + b) && either(i + a, j + b + 1) && either(i + a + 1, j + b + 1))));
4550
+ return g;
4551
+ })();
4552
+ /** A cell open: no floor, the scenery draws none or a chamfer's triangle. Past the grid's sides closed, past the centre line its mirror. */
4553
+ var gap = (i, j) => i < 0 || i >= NX || j >= NZ ? 0 : GAPS$1[i + (j < 0 ? -1 - j : j) * NX];
3776
4554
  /**
3777
- * A wall along the axis k from a to b, between p and q across, up to y: a doorway H high in each
3778
- * gap (from, to). A gap of no width only cuts the wall in two: vision.ts stripes a wall of 8 m.
4555
+ * The cells as rectangles, rows merged where a run of one kind goes on unchanged: x0, z0, x1, z1
4556
+ * (z from the centre line) and the kind (`kind(i, j)`, -1 left out), in columns of 8 m. Few where
4557
+ * the edges are straight, a row each where they wander.
3779
4558
  */
3780
- var wall = (k, a, b, p, q, y, gaps = []) => {
3781
- const piece = (s, t, y0) => k ? box$2(p, y0, s, q, y, t, CONCRETE$1) : box$2(s, y0, p, t, y, q, CONCRETE$1);
3782
- return [...gaps, [b, b]].flatMap(([s, t], i, l) => [piece(i ? l[i - 1][1] : a, s, 0), ...t > s ? [piece(s, t, H)] : []]);
4559
+ var rects = (kind) => {
4560
+ const out = [];
4561
+ let live = /* @__PURE__ */ new Map();
4562
+ for (let j = 0; j <= NZ; j++) {
4563
+ const next = /* @__PURE__ */ new Map();
4564
+ for (let i = 0; j < NZ && i < NX;) {
4565
+ const k = kind(i, j);
4566
+ let e = i + 1;
4567
+ while (e < NX && e % 16 && kind(e, j) === k) e++;
4568
+ if (k >= 0) {
4569
+ const key = `${i},${e},${k}`;
4570
+ const r = live.get(key) ?? [
4571
+ i * S,
4572
+ j * S,
4573
+ e * S,
4574
+ j * S,
4575
+ k
4576
+ ];
4577
+ live.delete(key);
4578
+ r[3] = (j + 1) * S;
4579
+ next.set(key, r);
4580
+ }
4581
+ i = e;
4582
+ }
4583
+ out.push(...live.values());
4584
+ live = next;
4585
+ }
4586
+ return out;
3783
4587
  };
3784
- /** A module: a roof slab on four walls, with the gaps of the walls at its low z, high z, low x and high x. */
3785
- var room = ({ min: [x0, , z0], max: [x1, y, z1] }, gaps, crate) => [
3786
- box$2(x0, 4, z0, x1, y, z1, HULL$2, CONCRETE$1),
3787
- ...wall(0, x0, x1, z0, z0 + T, 4, gaps[0]),
3788
- ...wall(0, x0, x1, z1 - T, z1, 4, gaps[1]),
3789
- ...wall(2, z0 + T, z1 - T, x0, x0 + T, 4, gaps[2]),
3790
- ...wall(2, z0 + T, z1 - T, x1 - T, x1, 4),
3791
- crate
3792
- ];
3793
- var ORANGE$1 = [
3794
- 1,
3795
- .42,
3796
- .08
3797
- ];
3798
- /** Red's half of the base. */
3799
- var BASE = [
3800
- ...BANDS.slice(2).flatMap((y1, i) => around(shell(BANDS[i + 1]) + .2).map(([a, b]) => ghost$1([
3801
- -a,
3802
- -b,
3803
- a,
3804
- b
3805
- ], BANDS[i + 1], y1))),
3806
- ...turns(SLICES).flatMap((p) => flush(p).map(([r, y]) => ghost$1(r, y, BANDS[1]))),
3807
- ...FIT$1,
3808
- ...KIT.map(([, x0, z0, x1, z1, y0, y1]) => ({
3809
- ...box$2(x0, y0, z0, x1, y1, z1, STEEL$3),
3810
- ghost: true
3811
- })),
3812
- ...room(MODULES[0], [
3813
- [[118, 118]],
3814
- [[116.8, 119.2]],
3815
- [[TZ0 + T, TZ1 - T]]
3816
- ], box$2(121.5, 0, 223.5, 123.5, 1.2, 225.5, PAINT$3, PAINT$3, ORANGE$1)),
3817
- ...room(MODULES[1], [[[101.8, 104.2]], [[UX0 + T, UX1 - T], [105.8, 105.8]]], box$2(106, 0, 200.6, 108, 1.2, 202.6, PAINT$3, PAINT$3, ORANGE$1)),
3818
- box$2(TX0, H, TZ0, TX1, TY, TZ1, STEEL$3, HULL$2),
3819
- box$2(UX0, H, UZ0, UX1, TY, TZ1, STEEL$3, HULL$2),
3820
- box$2(UX0, 0, TZ1 - T, TX1, H, TZ1, HULL$2),
3821
- box$2(UX1 - T, 0, TZ0, TX1, H, TZ0 + T, HULL$2),
3822
- box$2(UX0, 0, UZ0, UX0 + T, H, TZ0, HULL$2),
3823
- box$2(UX1 - T, 0, UZ0, UX1, H, TZ0, HULL$2),
3824
- ...stairs(2, 214, TZ0, 105, 109, 0, 3.5),
3825
- ...stairs(0, 108, UX1, 206, 210, 0, 3.5)
3826
- ];
4588
+ /** In the hollow's square: its slab is 3 m down. */
4589
+ var hollowed = (x, z) => Math.abs(x - HOLLOW[0]) < 12 && Math.abs(z + 140 - HOLLOW[1]) < 12;
4590
+ /** Red's floor over the grid, ghosts the scenery draws over: a box for each rectangle of closed cells, 3 m down in the hollow. */
4591
+ var floor = () => rects((i, j) => gap(i, j) ? -1 : hollowed((i + .5) * S, (j + .5) * S) ? 1 : 0).map(([x0, z0, x1, z1, k]) => ({
4592
+ ...box$2(x0, -30, 140 + z0, x1, k ? -3 : 0, 140 + z1, TEX.STONE),
4593
+ ghost: true
4594
+ }));
4595
+ /** The pylons, red's, ghosts the scenery draws as rock pillars. */
4596
+ var pylons = () => PYLONS.map(([x, z, h, y]) => ({
4597
+ ...box$2(x - h, -30, 140 + z - h, x + h, y, 140 + z + h, TEX.STONE),
4598
+ ghost: true
4599
+ }));
4600
+ /** The relief's voids past the rille, both sides: x0, z0, x1, z1. */
4601
+ var voids = () => rects((i, j) => j >= 8 / S && gap(i, j) ? 0 : -1).flatMap(([x0, z0, x1, z1]) => [[
4602
+ x0,
4603
+ 140 + z0,
4604
+ x1,
4605
+ 140 + z1
4606
+ ], [
4607
+ x0,
4608
+ 140 - z1,
4609
+ x1,
4610
+ 140 - z0
4611
+ ]]);
4612
+ /**
4613
+ * The jumps as the bots fly them, red's: take-off and landing, x and z from the centre line, and
4614
+ * whether it needs a sprint (over 5 m of void). Found along each of CROSSINGS from its point:
4615
+ * the first closed cell each way.
4616
+ */
4617
+ var hops = () => CROSSINGS$1.map(([x, z, dx, dz]) => {
4618
+ const edge = (k) => {
4619
+ let d = 0;
4620
+ while (gap(Math.floor((x + k * d * dx) / S), Math.floor((z + k * d * dz) / S)) && d < 20) d += .1;
4621
+ return d;
4622
+ };
4623
+ const [a, b] = [edge(-1), edge(1)];
4624
+ return {
4625
+ from: [x - (a + 1) * dx, z - (a + 1) * dz],
4626
+ to: [x + (b + 1.5) * dx, z + (b + 1.5) * dz],
4627
+ sprint: a + b > 5
4628
+ };
4629
+ });
3827
4630
  // src/shared/station.ts
3828
4631
  /** Where the mission stands. */
3829
4632
  var PHASE = {
@@ -4130,30 +4933,25 @@ var PADS = [[
4130
4933
  var MASTS = [[106.2, 230.4], [103.2, 212.4]];
4131
4934
  /** Red's flag: in the hall, 2 m from the dome's centre toward the door. */
4132
4935
  var FLAG = DOME[1] - 2;
4133
- var c1$1 = (t) => Math.min(Math.max(t, 0), 1);
4134
4936
  var sm$1 = (t) => c1$1(t) * c1$1(t) * (3 - 2 * c1$1(t));
4135
4937
  var far$1 = (a, b) => Math.sqrt(a * a + b * b);
4136
4938
  /**
4137
4939
  * Craters, x, z, radius and how deep as a share of the radius: a bowl under a rim, both wandering
4138
4940
  * with the bearing (the rim is 0.03 to 0.075 of the radius high and up to 10 % nearer or further),
4139
- * flat for 4 m. With a fifth number, a pit's crater: a level terrace out to that share of the
4140
- * radius (22 m and more), then one wall up to the rim; the pit is cut in the terrace (PITS). The
4141
- * first is the Bowl; the small ones by a big one's rim are its secondaries.
4941
+ * flat for 4 m. The first is the Bowl; the small ones by a big one's rim are its secondaries.
4142
4942
  */
4143
4943
  var BOWLS = [
4144
4944
  [
4145
4945
  -100,
4146
4946
  0,
4147
4947
  46,
4148
- .13,
4149
- .52
4948
+ .13
4150
4949
  ],
4151
4950
  [
4152
4951
  -4,
4153
4952
  224,
4154
4953
  36,
4155
- .12,
4156
- .67
4954
+ .12
4157
4955
  ],
4158
4956
  [
4159
4957
  110,
@@ -4255,45 +5053,6 @@ var RAMPS = [
4255
5053
  ];
4256
5054
  /** The ridge east of the arena (x, the z its crest ends at) and the antennas' hill south-east (x, z). */
4257
5055
  var [RIDGE, HILL] = [[248, 64], [180, 200]];
4258
- /** Where the lip stays straight, x0 to x1: the west jump's spurs, a mound and its flanks, the bridge, the east stones and the other mound. */
4259
- var STRAIGHT = [
4260
- [12, 24],
4261
- [36, 60],
4262
- [72, 88],
4263
- [124, 156]
4264
- ];
4265
- /**
4266
- * The rille's lip on red's side, a number for each metre of x from 0: how far it is behind z 148,
4267
- * in half metres. A meander from two octaves of noise, 0 on STRAIGHT, never more than half a
4268
- * metre from one metre to the next between the ends (so the rim the scenery draws through it is never more than
4269
- * that from a brush), at most 6.5 m. Under 0, a spur into the rille: only over the last 8 m of
4270
- * each end, where it closes (a narrower rille is a new jump). Blue's lip is the mirror.
4271
- */
4272
- var LIP = (() => {
4273
- const d = Array.from({ length: 160 }, (_, x) => STRAIGHT.some(([a, b]) => x >= a - 1 && x <= b) ? 0 : Math.min(Math.round(Math.max(26 * noise(x / 17, 0, 33) + 8 * noise(x / 5, 0, 35) - 11, 0)) / 2, 6.5));
4274
- for (const k of [1, -1]) for (let x = k > 0 ? 1 : 158; x >= 0 && x < 160; x += k) d[x] = Math.min(d[x], d[x - k] + .5);
4275
- return d.map((v, x) => {
4276
- const e = Math.min(x, 159 - x);
4277
- return e < 4 ? -6 : e < 8 ? -3 : v;
4278
- });
4279
- })();
4280
- /** Runs of a list of numbers a metre of x apart: first x, metres, value. */
4281
- var runs = (l) => l.reduce((r, n, x) => {
4282
- if (r.at(-1)?.[2] === n) r.at(-1)[1]++;
4283
- else r.push([
4284
- x,
4285
- 1,
4286
- n
4287
- ]);
4288
- return r;
4289
- }, []);
4290
- var RUNS = runs(LIP);
4291
- /** A hollow in red's field, its middle x, z and how deep: the slab is lowered under it (HOLLOW's square), the relief is the floor there. */
4292
- var HOLLOW = [
4293
- 114,
4294
- 176,
4295
- 2
4296
- ];
4297
5056
  /**
4298
5057
  * The mounds by the rille, their middle x: a ramp up to the lip, RISE m long and MOUND m high (21
4299
5058
  * degrees), 8 m wide with 8 m of flank each side. A rover at speed flies the 16 m to the twin
@@ -4333,6 +5092,12 @@ var FLATS$1 = [
4333
5092
  125,
4334
5093
  90
4335
5094
  ],
5095
+ [
5096
+ 88,
5097
+ 66,
5098
+ 92,
5099
+ 70
5100
+ ],
4336
5101
  [
4337
5102
  98,
4338
5103
  36,
@@ -4340,10 +5105,16 @@ var FLATS$1 = [
4340
5105
  40
4341
5106
  ],
4342
5107
  [
4343
- 28,
4344
- 113,
4345
- 32,
4346
- 117
5108
+ 55,
5109
+ 77,
5110
+ 59,
5111
+ 81
5112
+ ],
5113
+ [
5114
+ 152,
5115
+ 76,
5116
+ 156,
5117
+ 80
4347
5118
  ],
4348
5119
  [
4349
5120
  30,
@@ -4352,10 +5123,10 @@ var FLATS$1 = [
4352
5123
  45
4353
5124
  ],
4354
5125
  [
4355
- 135,
4356
- 50,
4357
- 135,
4358
- 50
5126
+ 131,
5127
+ 48,
5128
+ 131,
5129
+ 48
4359
5130
  ],
4360
5131
  [
4361
5132
  50,
@@ -4370,16 +5141,16 @@ var FLATS$1 = [
4370
5141
  104
4371
5142
  ],
4372
5143
  [
4373
- 115,
4374
- 22,
4375
- 115,
4376
- 22
5144
+ 103,
5145
+ 24.5,
5146
+ 103,
5147
+ 24.5
4377
5148
  ],
4378
5149
  [
4379
5150
  45,
4380
5151
  20,
4381
5152
  51,
4382
- 62
5153
+ 54
4383
5154
  ],
4384
5155
  [
4385
5156
  114,
@@ -4391,7 +5162,7 @@ var FLATS$1 = [
4391
5162
  141,
4392
5163
  20,
4393
5164
  147,
4394
- 66
5165
+ 54
4395
5166
  ]
4396
5167
  ];
4397
5168
  /** The boulder field south-west: x, z, radius. */
@@ -4480,23 +5251,23 @@ var WRECK = [BOWLS[0][0] - 4.5, 140];
4480
5251
  /** Where the boulders stood, red's (x, z, radius): the field's six stones, those along the three walls of the half, and the boulder field's. No rock there now, no box: the scenery scatters pebbles thickest round each. */
4481
5252
  var SITES = [
4482
5253
  [
4483
- 6,
4484
- 174,
5254
+ 8,
5255
+ 184,
4485
5256
  2.5
4486
5257
  ],
4487
5258
  [
4488
- 32.5,
5259
+ 36,
4489
5260
  156.5,
4490
5261
  3.1
4491
5262
  ],
4492
5263
  [
4493
- 67.5,
5264
+ 72,
4494
5265
  159.5,
4495
5266
  1.9
4496
5267
  ],
4497
5268
  [
4498
- 97.5,
4499
- 166,
5269
+ 100,
5270
+ 167,
4500
5271
  2.8
4501
5272
  ],
4502
5273
  [
@@ -4505,9 +5276,9 @@ var SITES = [
4505
5276
  3.4
4506
5277
  ],
4507
5278
  [
4508
- 94,
4509
- 188,
4510
- 2.5
5279
+ 14,
5280
+ 164,
5281
+ 2.2
4511
5282
  ],
4512
5283
  ...Array.from({ length: 36 }, (_, i) => {
4513
5284
  const h = (k) => hash(i, k, 41);
@@ -4521,20 +5292,18 @@ var SITES = [
4521
5292
  }),
4522
5293
  ...FIELD
4523
5294
  ];
4524
- /** What the craters dig and raise at (x, z from the centre line), and how far in a pit's crater it is (1 on its terrace, 0 well clear): the hills fade out there. */
5295
+ /** What the craters dig and raise at (x, z from the centre line). */
4525
5296
  var bowls = (x, z) => {
4526
- let [h, m] = [0, 0];
4527
- for (const [cx, cz, r, k = .17, flat = 0] of BOWLS) {
5297
+ let h = 0;
5298
+ for (const [cx, cz, r, k = .17] of BOWLS) {
4528
5299
  const d = far$1(x - cx, z - cz);
4529
5300
  const [ux, uz] = d ? [(x - cx) / d, (z - cz) / d] : [1, 0];
4530
5301
  const q = d / r * (.9 + .2 * noise(2.5 * ux + .37 * cx, 2.5 * uz + .21 * cz, 9));
4531
5302
  const rim = .03 + .045 * noise(4 * ux - .1 * cz, 4 * uz + .1 * cx, 10);
4532
5303
  const s = 1 - c1$1((q - 1 - 4 / r) / .6);
4533
- const wall = flat ? (k + rim) * c1$1((q - flat) / (1 - flat)) - k : (k + rim) * q * q - k;
4534
- h += r * (q < 1 ? wall : rim * s * s);
4535
- m = Math.max(m, flat ? c1$1((1.6 - q) / (1.5 - flat)) : 0);
5304
+ h += r * (q < 1 ? (k + rim) * q * q - k : rim * s * s);
4536
5305
  }
4537
- return [h, m];
5306
+ return h;
4538
5307
  };
4539
5308
  /**
4540
5309
  * How much of a mound's height there is at x, across it: all of it for 4 m each side of its
@@ -4631,13 +5400,15 @@ var at$3 = (x, z) => {
4631
5400
  if (out < 0) {
4632
5401
  let m = sm$1((z - 16 - 10 * noise(x / 19, .5, 37)) / 8) * sm$1(-out / 10);
4633
5402
  for (const [x0, z0, x1, z1] of FLATS$1) m *= sm$1((far$1(Math.max(x0 - x, x - x1, 0), Math.max(z0 - z, z - z1, 0)) - (x0 < x1 ? 6 : 7.5)) / 6);
5403
+ for (const [x0, z0, x1, z1] of KICKER_RECTS) m *= sm$1(far$1(Math.max(x0 - x, x - x1, 0), Math.max(z0 - z, z - z1, 0)) / 6);
4634
5404
  h = m * Math.min(Math.max(4.8 * noise(x / 15, z / 15, 21) - .9, 0) + Math.max(3 * noise(x / 31, z / 31, 23) - .6, 0), 2.6);
4635
5405
  const s = sm$1((10 - far$1(x - HOLLOW[0], z - (HOLLOW[1] - 140))) / 8);
4636
5406
  h = h * (1 - s) - HOLLOW[2] * s;
4637
5407
  for (const cx of MOUNDS) h += MOUND * c1$1((8 + RISE$1 - z) / RISE$1) * across(cx, x);
5408
+ h += ramped(x, z);
4638
5409
  h = z < 8 ? 0 : h;
4639
5410
  }
4640
- h = (out < 0 ? h : h * (1 - dug[1])) + dug[0] + rough(x, z, out) * (1 - dug[1]) * (1 - sm$1(t));
5411
+ h += dug + rough(x, z, out) * (1 - sm$1(t));
4641
5412
  for (const [rx, rz, ax, az] of RAMPS) {
4642
5413
  const [p, q] = [x - rx, z - rz];
4643
5414
  const a = p * ax + q * az;
@@ -4906,22 +5677,22 @@ var crag = (x, z, R, H, s) => {
4906
5677
  /** Red's boulders, each with the boxes it collides with; blue's are their mirrors. */
4907
5678
  var CRAGS$1 = [
4908
5679
  [
4909
- 32.5,
5680
+ 36,
4910
5681
  156.5,
4911
5682
  3.1,
4912
5683
  3.45,
4913
5684
  62
4914
5685
  ],
4915
5686
  [
4916
- 67.5,
5687
+ 72,
4917
5688
  159.5,
4918
5689
  1.86,
4919
5690
  1.84,
4920
5691
  63
4921
5692
  ],
4922
5693
  [
4923
- 97.5,
4924
- 166,
5694
+ 100,
5695
+ 167,
4925
5696
  2.79,
4926
5697
  2.99,
4927
5698
  64
@@ -4966,65 +5737,6 @@ var ghosts = (l) => l.flatMap((c) => c.parts).map(([x0, y0, z0, x1, y1, z1]) =>
4966
5737
  ...box$2(x0, y0, z0, x1, y1, z1, STONE$1),
4967
5738
  ghost: true
4968
5739
  }));
4969
- /** A pit: PIT_R in radius, cut in a square of half side PIT_S of its crater's terrace, its floor at PIT_FLOOR, 7 m over the kill floor; a flight of PIT_STEPS steps up its east wall. */
4970
- var [PIT_R, PIT_S, PIT_FLOOR, PIT_STEPS] = [
4971
- 9,
4972
- 12,
4973
- -19,
4974
- 7
4975
- ];
4976
- /**
4977
- * The pits of red's side and of the centre line (the Bowl's): the middle, the terrace's level and
4978
- * the rows, a metre of z each: z0, z1 and how far the void goes west and east of the middle. A
4979
- * circle that wanders by 12 % with z, the same north and south of the middle, rounded up to half
4980
- * a metre: the void is never narrower than the outline the scenery draws.
4981
- */
4982
- var PITS = BOWLS.filter((b) => b[4]).map(([x, zf], n) => {
4983
- const z = 140 + zf;
4984
- const rows = Array.from({ length: 2 * PIT_R }, (_, i) => {
4985
- const dz = Math.abs(i + .5 - PIT_R);
4986
- const half = Math.sqrt(PIT_R * PIT_R - dz * dz);
4987
- const w = (side) => Math.ceil(2 * half * (.88 + .24 * noise(dz / 4, side + .5, 60 + n))) / 2;
4988
- return [
4989
- z - PIT_R + i,
4990
- z - PIT_R + i + 1,
4991
- w(0),
4992
- w(1)
4993
- ];
4994
- });
4995
- return {
4996
- x,
4997
- z,
4998
- level: at$3(x, z),
4999
- rows
5000
- };
5001
- });
5002
- /** What a pit collides with: its square of terrace in pieces round the void (two caps and, for each run of rows of one width, a box each side), its floor, and the steps: each as high again as a body jumps at half gravity, 1.3 m deep, up to the terrace at the east wall. */
5003
- var pit = ({ x, z, level, rows }) => {
5004
- const runs = rows.reduce((l, [z0, z1, a, b]) => {
5005
- const last = l.at(-1);
5006
- if (last && last[2] === a && last[3] === b) last[1] = z1;
5007
- else l.push([
5008
- z0,
5009
- z1,
5010
- a,
5011
- b
5012
- ]);
5013
- return l;
5014
- }, []);
5015
- const east = rows[PIT_R][3];
5016
- const rise = (level - PIT_FLOOR) / PIT_STEPS;
5017
- return [
5018
- box$2(x - PIT_S, -30, z - PIT_S, x + PIT_S, level, z - PIT_R, STONE$1),
5019
- box$2(x - PIT_S, -30, z + PIT_R, x + PIT_S, level, z + PIT_S, STONE$1),
5020
- ...runs.flatMap(([z0, z1, a, b]) => [box$2(x - PIT_S, -30, z0, x - a, level, z1, STONE$1), box$2(x + b, -30, z0, x + PIT_S, level, z1, STONE$1)]),
5021
- box$2(x - PIT_R - 1.5, -30, z - PIT_R, x + PIT_R + 1.5, PIT_FLOOR, z + PIT_R, STONE$1),
5022
- ...Array.from({ length: PIT_STEPS - 1 }, (_, k) => box$2(x + east - 1.3 * (PIT_STEPS - 1 - k), PIT_FLOOR, z - 1, x + east - 1.3 * (PIT_STEPS - 2 - k), PIT_FLOOR + rise * (k + 1), z + 1, STONE$1))
5023
- ].map((b) => ({
5024
- ...b,
5025
- ghost: true
5026
- }));
5027
- };
5028
5740
  /** The ghost under a drawn rock or mast: a box of half side s from under the ground to h above it. */
5029
5741
  var lump = (x, z, s, h) => ({
5030
5742
  ...box$2(x - s, at$3(x, z) - 6, z - s, x + s, at$3(x, z) + h, z + s, STONE$1),
@@ -5040,17 +5752,6 @@ var LAYOUT$1 = {
5040
5752
  m * az + 0
5041
5753
  ])),
5042
5754
  wreck: WRECK,
5043
- /** The pits, both sides: the middle, the terrace's level and the rows (z0, z1, the void's reach west and east). */
5044
- pits: PITS.flatMap((p) => p.z === 140 ? [p] : [p, {
5045
- ...p,
5046
- z: 280 - p.z,
5047
- rows: p.rows.map(([z0, z1, a, b]) => [
5048
- 280 - z1,
5049
- 280 - z0,
5050
- a,
5051
- b
5052
- ]).reverse()
5053
- }]),
5054
5755
  /** The craters of the relief, both sides: x, z, radius, depth as a share of it. */
5055
5756
  bowls: BOWLS.flatMap(([x, z, r, k = .17]) => (z ? [1, -1] : [1]).map((m) => [
5056
5757
  x,
@@ -5101,30 +5802,23 @@ var both$1 = (l, ...mid) => [
5101
5802
  ];
5102
5803
  /** Red's half: z from 140 to 280. */
5103
5804
  var half$1 = [
5104
- ...[
5105
- box$2(0, -30, 160, 160, 0, HOLLOW[1] - 12, STONE$1),
5106
- box$2(0, -30, HOLLOW[1] - 12, HOLLOW[0] - 12, 0, HOLLOW[1] + 12, STONE$1),
5107
- box$2(HOLLOW[0] + 12, -30, HOLLOW[1] - 12, 160, 0, HOLLOW[1] + 12, STONE$1),
5108
- box$2(0, -30, HOLLOW[1] + 12, 160, 0, 280, STONE$1),
5109
- box$2(HOLLOW[0] - 12, -30, HOLLOW[1] - 12, HOLLOW[0] + 12, -3, HOLLOW[1] + 12, STONE$1),
5110
- ...RUNS.filter((r) => r[2] < 0).map(([x, w, n]) => box$2(x, -30, 148 + n, x + w, 0, 160, STONE$1)),
5111
- ...Array.from({ length: 14 }, (_, k) => runs(LIP.map((n) => n < 0 ? 2 : n > k / 2 ? 1 : 0)).filter((r) => !r[2]).map(([x, w]) => box$2(x, -30, 148 + k / 2, x + w, 0, k < 13 ? 148.5 + k / 2 : 160, STONE$1))).flat(),
5112
- ...MOUNDS.flatMap((x) => [
5113
- -12,
5114
- -10,
5115
- -8,
5116
- -6,
5117
- -4,
5118
- 4,
5119
- 6,
5120
- 8,
5121
- 10
5122
- ].map((a) => [a, a + (a === -4 ? 8 : 2)]).map(([a, b]) => [
5123
- x + a,
5124
- x + b,
5125
- MOUND * Math.min(across(x, x + a), across(x, x + b)) * (1 - .5 / RISE$1) - .12
5126
- ]).filter((r) => r[2] > .3).map(([a, b, y]) => box$2(a, 0, 148, b, y, 148.5, STONE$1)))
5127
- ].map((b) => ({
5805
+ ...floor(),
5806
+ ...pylons(),
5807
+ ...[box$2(0, -30, 216, 160, 0, 280, STONE$1), ...MOUNDS.flatMap((x) => [
5808
+ -12,
5809
+ -10,
5810
+ -8,
5811
+ -6,
5812
+ -4,
5813
+ 4,
5814
+ 6,
5815
+ 8,
5816
+ 10
5817
+ ].map((a) => [a, a + (a === -4 ? 8 : 2)]).map(([a, b]) => [
5818
+ x + a,
5819
+ x + b,
5820
+ MOUND * Math.min(across(x, x + a), across(x, x + b)) * (1 - .5 / RISE$1) - .12
5821
+ ]).filter((r) => r[2] > .3).map(([a, b, y]) => box$2(a, 0, 148, b, y, 148.5, STONE$1)))].map((b) => ({
5128
5822
  ...b,
5129
5823
  ghost: true
5130
5824
  })),
@@ -5144,7 +5838,6 @@ var half$1 = [
5144
5838
  .42,
5145
5839
  .08
5146
5840
  ]),
5147
- ...PITS.filter((p) => p.z !== 140).flatMap(pit),
5148
5841
  ...ghosts(CRAGS$1),
5149
5842
  ...DISHES.map(([x, z]) => lump(x, z, .4, 6))
5150
5843
  ];
@@ -5166,10 +5859,9 @@ var centre$1 = [
5166
5859
  ghost: true
5167
5860
  },
5168
5861
  {
5169
- ...box$2(WRECK[0] - 3.6, -30, WRECK[1] - 3.6, WRECK[0] + 3.6, PIT_FLOOR + 3.5, WRECK[1] + 3.6, STONE$1),
5862
+ ...box$2(WRECK[0] - 3.6, -30, WRECK[1] - 3.6, WRECK[0] + 3.6, at$3(WRECK[0], WRECK[1]) + 3.5, WRECK[1] + 3.6, STONE$1),
5170
5863
  ghost: true
5171
5864
  },
5172
- ...PITS.filter((p) => p.z === 140).flatMap(pit),
5173
5865
  ...LAYOUT$1.ramps.flatMap(([x, z, ax, az]) => [-8, 8].map((c) => lump(x + c * az, z - c * ax, .2, 2.2)))
5174
5866
  ];
5175
5867
  /** Red's spawns behind the dome facing blue (yaw 0 looks toward -z): five in a row, three in front. */
@@ -5285,18 +5977,18 @@ var MOON = {
5285
5977
  200
5286
5978
  ],
5287
5979
  [
5288
- 135,
5980
+ 131,
5289
5981
  0,
5290
- 190
5982
+ 188
5291
5983
  ]
5292
5984
  ], [
5293
- 115,
5985
+ 103,
5294
5986
  0,
5295
- 162
5987
+ 164.5
5296
5988
  ], [
5297
- 115,
5989
+ 103,
5298
5990
  0,
5299
- 118
5991
+ 115.5
5300
5992
  ]),
5301
5993
  cells: both$1([[
5302
5994
  106.5,
@@ -5328,22 +6020,7 @@ var MOON = {
5328
6020
  160,
5329
6021
  148
5330
6022
  ],
5331
- pits: [...RUNS.flatMap(([x, w, n]) => n > 0 ? [[
5332
- x,
5333
- 148,
5334
- x + w,
5335
- 148 + n
5336
- ], [
5337
- x,
5338
- 132 - n,
5339
- x + w,
5340
- 132
5341
- ]] : []), ...LAYOUT$1.pits.flatMap(({ x, rows }) => rows.map(([z0, z1, a, b]) => [
5342
- x - a,
5343
- z0,
5344
- x + b,
5345
- z1
5346
- ]))],
6023
+ pits: voids(),
5347
6024
  bound: [
5348
6025
  80,
5349
6026
  140,
@@ -5377,27 +6054,39 @@ var MOON = {
5377
6054
  gravity: .5,
5378
6055
  rovers: [
5379
6056
  [
5380
- 100,
6057
+ 90,
5381
6058
  0,
5382
- 178,
6059
+ 208,
5383
6060
  0
5384
6061
  ],
5385
6062
  [
5386
- 30,
6063
+ 57,
6064
+ 0,
6065
+ 219,
6066
+ -.33
6067
+ ],
6068
+ [
6069
+ 154,
5387
6070
  0,
5388
- 255,
6071
+ 218,
5389
6072
  0
5390
6073
  ],
5391
6074
  [
5392
- 100,
6075
+ 90,
5393
6076
  0,
5394
- 102,
6077
+ 72,
5395
6078
  Math.PI
5396
6079
  ],
5397
6080
  [
5398
- 30,
6081
+ 57,
5399
6082
  0,
5400
- 25,
6083
+ 61,
6084
+ Math.PI + .33
6085
+ ],
6086
+ [
6087
+ 154,
6088
+ 0,
6089
+ 62,
5401
6090
  Math.PI
5402
6091
  ]
5403
6092
  ],
@@ -7040,7 +7729,7 @@ var CROSSINGS = [[
7040
7729
  [
7041
7730
  18,
7042
7731
  0,
7043
- 190
7732
+ 169
7044
7733
  ],
7045
7734
  [leap([18, 147], [18, 125], 0, { dash: 20 })]
7046
7735
  ], [
@@ -7151,7 +7840,7 @@ var heightAt = (w, p, x, z) => p.r ? ground(w, x, z) : p.y;
7151
7840
  var lowlands = (w) => {
7152
7841
  const r = w.relief;
7153
7842
  if (!r) return [];
7154
- const { x0, z0, cell, nx, nz, hole, pits, pitted, bound } = r;
7843
+ const { x0, z0, cell, nx, nz, hole, pitted, bound } = r;
7155
7844
  const dry = w.def.floor + WADE;
7156
7845
  const [cx, cz, ea, eb] = bound;
7157
7846
  const [mx, mz] = [nx - 1, nz - 1];
@@ -7171,7 +7860,7 @@ var lowlands = (w) => {
7171
7860
  [q[0], q[3]],
7172
7861
  [q[2], q[3]]
7173
7862
  ]) inside &&= ((x - cx) / ea) ** 2 + ((z - cz) / eb) ** 2 <= 1 && ground(w, x, z) >= dry;
7174
- free[i + j * mx] = +(inside && !over(q, hole) && !(pitted[i + j * nx] && pits.some((p) => over(q, p))));
7863
+ free[i + j * mx] = +(inside && !over(q, hole) && !pitted[i + j * nx]?.some((p) => over(q, p)));
7175
7864
  }
7176
7865
  const out = [];
7177
7866
  for (let j = 0; j < mz; j++) for (let i = 0; i < mx; i++) {
@@ -7488,6 +8177,22 @@ var build = (w) => {
7488
8177
  const a = ACROSS.find(([x0, x1]) => q[0] < x1 && q[2] > x0 && q[1] < 140 && q[3] > 140);
7489
8178
  if (a) route[i] = a[2];
7490
8179
  });
8180
+ for (const { from, to, sprint } of hops()) for (const [a, b] of [[from, to], [to, from]]) for (const side of [1, -1]) {
8181
+ const [ax, az, bx, bz] = [
8182
+ a[0],
8183
+ 140 + side * a[1],
8184
+ b[0],
8185
+ 140 + side * b[1]
8186
+ ];
8187
+ const l = Math.hypot(bx - ax, bz - az);
8188
+ const [sx, sz] = [ax - 6 * (bx - ax) / l, az - 6 * (bz - az) / l];
8189
+ const y = Math.max(ground(w, bx, bz), 0);
8190
+ links(nav, w, [
8191
+ sx,
8192
+ Math.max(ground(w, sx, sz), 0),
8193
+ sz
8194
+ ], [leap([ax, az], [bx, bz], y, { sprint })]);
8195
+ }
7491
8196
  for (const [k, [x, y, z], legs] of CROSSINGS) {
7492
8197
  links(nav, w, [
7493
8198
  x,