@korial29/tiny-fps 1.4.5 → 1.5.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/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  **▶ Play it now: https://korial29.github.io/tiny-fps/**
12
12
 
13
- A tiny multiplayer first-person game for the browser, written in TypeScript with raw WebGL2, no game library and no runtime dependency. It is becoming an open-air capture-the-flag between two teams of players on rooftops, inspired by Mirror's Edge: parkour movement and no CPU enemies. Today two teams play capture the flag on Highline, a symmetric rooftop map, or on Tranquility, a moon base in a crater, with the parkour moves, a tackle, a plasma gun, an electric katana, a rail gun and a laser rifle ([`docs/PLAN.md`](docs/PLAN.md), [`docs/WEAPON.md`](docs/WEAPON.md)). Everything is generated in code: geometry, textures, lights. There are no images, fonts or assets to serve.
13
+ A tiny multiplayer first-person game for the browser, written in TypeScript with raw WebGL2, no game library and no runtime dependency. It is becoming an open-air capture-the-flag between two teams of players on rooftops, inspired by Mirror's Edge: parkour movement and no CPU enemies. Today two teams play capture the flag on Highline, a symmetric rooftop map, on Tranquility, a moon base in a crater, or on Landfall, a Caribbean beach with a crashed ship across it, with the parkour moves, a tackle, a plasma gun, an electric katana, a rail gun and a laser rifle, and five classes to play: the marine, the ninja, the astronaut, the xenomorph and the Hunter ([`docs/PLAN.md`](docs/PLAN.md), [`docs/WEAPON.md`](docs/WEAPON.md), [`docs/CHARACTERS.md`](docs/CHARACTERS.md), [`docs/HUNTER.md`](docs/HUNTER.md)). Everything is generated in code: geometry, textures, lights. There are no images, fonts or assets to serve.
14
14
 
15
15
  It started as a co-op shooter inspired by carlini's [Yet Another Doom Clone](https://github.com/carlini/js13k2019-yet-another-doom-clone) (js13k 2019). Only the ideas were reused, not the code. The renderer, the netcode and the sound come from that first game.
16
16
 
@@ -30,12 +30,12 @@ It started as a co-op shooter inspired by carlini's [Yet Another Doom Clone](htt
30
30
 
31
31
  | Entry | What it is | Size (gzip) |
32
32
  | --------------------------- | ---------------------------------------------------------------------- | ----------- |
33
- | `@korial29/tiny-fps` | The game client: rendering, lights and shadows, input, prediction, HUD | ~80 KB |
34
- | `@korial29/tiny-fps/local` | Same-browser multiplayer, no server: the host runs in a tab | ~15.5 KB |
33
+ | `@korial29/tiny-fps` | The game client: rendering, lights and shadows, input, prediction, HUD | ~275 KB |
34
+ | `@korial29/tiny-fps/local` | Same-browser multiplayer, no server: the host runs in a tab | ~58 KB |
35
35
  | `@korial29/tiny-fps/server` | Node WebSocket server (needs `ws`) | Node only |
36
36
  | `@korial29/tiny-fps/room` | The authoritative `Room` alone, no `ws`: bring your own transport | Node only |
37
37
 
38
- CI checks the budgets (164 KB and 40 KB) on every pull request.
38
+ The numbers are the budget of each entry, plus chunks loaded on demand (maps, voices). CI checks them on every pull request (`npm run size`, limits in [`scripts/size.mjs`](scripts/size.mjs)).
39
39
 
40
40
  ## Live demo
41
41
 
@@ -102,7 +102,7 @@ Each URL path is its own room: `/my-room` and `/other` are two separate games. A
102
102
  PORT=8787 npx tiny-fps-server
103
103
  ```
104
104
 
105
- `MAP=tranquility` starts a new room on the moon map (the default is `highline`). In local mode the tab that hosts the room starts it on its client's `map` option, which the demo's Map menu sets.
105
+ `MAP=tranquility` or `MAP=landfall` starts a new room on the moon map or the beach (the default is `highline`). In local mode the tab that hosts the room starts it on its client's `map` option, which the demo's Map menu sets.
106
106
 
107
107
  `BOTS=8` fills each room with bots up to 8 players while at least one person plays: the bots even out the teams, and each one leaves when a person joins. In local mode it is the `bots` rule of `localSocket()`, which the demo's Bots menu sets. `BOT_SKILL` (0 to 7, 4 when unset) sets how well they aim, react and dodge, as UT2004's bot skill does: the `botSkill` rule, which the demo's Bot level menu sets in local mode (Novice to Godlike). A bot takes the gun at its rack, runs the routes of Highline (jumps, dashes and wall-runs included) or the lanes of the Moon, takes the flag, chases the one who has its own and shoots the enemies it sees.
108
108
 
@@ -210,18 +210,22 @@ The subset of `WebSocket` the client uses: `binaryType`, `onopen`, `onclose`, `o
210
210
 
211
211
  ## Controls
212
212
 
213
- | Action | Keys |
214
- | ------ | ----------------------------------------------------------------------------------- |
215
- | Look | Mouse (click the game to lock the pointer, Esc to release it) |
216
- | Move | WASD, or the arrow keys |
217
- | Sprint | Shift, with forward: the top speed builds over about a second |
218
- | Jump | Space. Press it again in the air for a second jump |
219
- | Dash | A move key pressed twice quickly: a short burst that way, once a second |
220
- | Crouch | C. At sprint speed it is a slide, low enough to go under a 1.2 m slot |
221
- | Fire | Left button: click to fire the gun, hold to charge it; click to cut with the katana |
222
- | Weapon | 1 the gun, 2 the katana, 3 the rail gun, 4 the laser rifle, or the wheel |
223
- | Reload | R: a new battery in the gun or the rifle, a new capsule on the rail gun (also dry) |
224
- | Mute | M (remembered) |
213
+ | Action | Keys |
214
+ | ------- | ------------------------------------------------------------------------------------- |
215
+ | Look | Mouse (click the game to lock the pointer, Esc to release it) |
216
+ | Move | WASD, or the arrow keys |
217
+ | Sprint | Shift, with forward: the top speed builds over about a second |
218
+ | Jump | Space. Press it again in the air for a second jump |
219
+ | Dash | A move key pressed twice quickly, or Q (A on AZERTY): a short burst, once a second |
220
+ | Crouch | C. At sprint speed it is a slide, low enough to go under a 1.2 m slot |
221
+ | Fire | Left button: click to fire the gun, hold to charge it; click to cut with the katana |
222
+ | Weapon | 1 the fists, 2 the katana, 3 the gun, 4 the laser rifle, 5 the rail gun, or the wheel |
223
+ | Reload | R: a new battery in the gun or the rifle, a new capsule on the rail gun (also dry) |
224
+ | Use | E: get in and out of a rover or a ship |
225
+ | Grenade | G: the laser rifle's grenade (the xenomorph's tail special) |
226
+ | Vision | V: the Hunter's thermal and xenomorph-detecting visions |
227
+ | Swim | In the sea on Landfall: forward and back dive and climb where you look |
228
+ | Mute | M (remembered) |
225
229
 
226
230
  Facing a ledge between 1.2 and 2.4 m above your feet in the air, you take hold of it: forward or Space climbs, back or C lets go, and Space looking away jumps off it. Jumping while running next to a wall, up to half a metre away and not more than about 50 degrees off it, starts a wall-run along its side (about a second, hold forward, Space kicks off). Ctrl is not used, since Ctrl+W closes the tab.
227
231
 
@@ -239,6 +243,8 @@ The game is the movement and a capture the flag on top of it, with a tackle, a g
239
243
  - **Capture the flag**: touch the enemy flag, at its base or where it was dropped, to take it, and carry it to your own base while your own flag is there: that is a capture, and the flag goes home. Touch your own dropped flag to send it home at once; left alone it goes home after 10 seconds. A carrier who falls off the roofs or leaves drops it where he last stood. A tackled carrier drops it too, and it lies there for 2 seconds: nobody can send it home, and the carrier's teammates can grab it. There is a ring of light on each base, a marker toward each flag (and toward your base while you carry), a banner for each event and a sound for a take, a drop, a return and a capture.
240
244
  - **A match** ends at 3 captures or after 8 minutes, then everyone sees the result and each player's captures and returns for 10 seconds, and a new match starts with everyone back at their spawn, on the map the host picked.
241
245
  - **The map**: Highline, 94 by 240 m under an open sky, the same for both teams (the blue half is the mirror of the red one). Each team holds a 26 m tower with its flag and eight spawns. Three routes lead to the other tower, and they meet at the plaza in the middle. The **Spine** (west, 26 m) is the fast one, about 25 s by sprint: an 11 m gap that takes a dash or a double jump, a 17 m viaduct along a wall that takes a wall-run and a dash, a beam over the plaza. **Midtown** (centre, 19 to 21 m) is roofs, short gaps and ledges to grab, about 36 s. The **Lowline** (east, 14.5 m) is stairs, short gaps and a sign to slide under, about 39 s, and needs no special move. A miss costs time: roofs under the gaps and ladders of ledges lead back up, and only a fall into the street puts you back at your tower.
246
+ - **Landfall**, the beach map: 110 by 250 m of pale sand between a turquoise lagoon and a forest of palms, with granite headlands at each end. A ship has crashed across the middle, its hollow hull, broken wings, fallen engine and fires cutting the sand between the two camps: its debris is the parkour, with ways along the sand, the decks, the wing rails and the lagoon. The sea can be swum, with a breaststroke, a dive and a view under the water, splashes and wash; Full gravity and no vehicle, as on Highline ([`docs/BEACH.md`](docs/BEACH.md)).
247
+ - **Classes**: the marine, the ninja (faster, with a parry, a katana that runs down quickly), the astronaut (moon maps), the xenomorph (a creature on all fours that fights with its tail and walks on walls) and the Hunter (wrist blades, a harpoon, a shoulder cannon, a returning disc and a thermal vision). Each is picked on the title screen and changes the kit the host and the predictor share ([`docs/CHARACTERS.md`](docs/CHARACTERS.md), [`docs/HUNTER.md`](docs/HUNTER.md)).
242
248
  - **Tranquility**, the moon map: an arena of 160 by 280 m in the middle of a crater 600 by 720 m across, under a black sky with the Earth and the stars, in a hard low sun. Gravity is half the Earth's, so a jump floats twice as high and twice as long, and everyone wears a space helmet with a glowing visor. Each team has a round dome with its flag in front, a landing pad with its shuttle, two modules joined by tubes, light masts and rovers. A rille cuts the middle: a bridge, a long jump on the west side, stepping stones on the east. Outside the arena the regolith rolls away in hills and craters to a wall nobody climbs past, with three ranges of mountains on the horizon all round behind it: the Bowl with a wrecked lander at its bottom, a long ridge to the east, an antenna array on a hill, a field of pebbles, and seven jump ramps marked by orange lamps. No ground is level for long: hummocks and shallow pans up to half a metre cover the floor outside the bases and the measured jumps. The arena's field is no longer flat: mounds up to 2.6 m roll between the bases and the rille and each half has a hollow 2 m deep. The rille wanders, its lips following a meander with bights up to 6.5 m under a rim of broken rock, its walls dropping in strata to a dark bottom; two mounds on each side ramp up to its lip, so a rover with a long run-up flies the 16 m gap. A few rounded boulders stand in the field and outside, cover you are stopped by where they are drawn; pebbles of three sizes lie strewn on the floor, thickest in clusters and round each boulder, and nothing collides with them. Thirty-one craters pit the crater floor, their rims outlined by a drawn band; three hold a pit 18 m deep, where a rover that drives in stays and its crew climbs out by the steps on the east wall. The regolith's texture does not repeat: the shader fetches its tile twice at offsets drawn from a noise and blends them, and darkens the slopes. Its tone varies by noise computed in the shader and, with distance, the tile fades to its mean colour, so far hills carry shading and no pattern. The ground is one lattice of heights for the physics and the drawing (`relief.ts`), so what you see is what you stand on. The bases are dressed from outside like a ship's hull: twelve dark spines up each dome to a collar round its aerial, traces of light up every other one, angled panel cuts between them, hatches and vents, round portholes, a dish and whip aerials on the module roofs, sensors and lamps over the airlocks, strips of light round each dome's foot and door, and lights in the ground leading to the doors. The dome's door and the modules' airlocks have automatic doors: two panels slide into the wall when a player or a driven rover comes near and shut a second after the last one leaves; a shut door stops shots and sight but never a body. Each base can be walked into: the dome holds a hall 40 m across under a 10.5 m roof, entered by a door facing the flag, with a mezzanine 3.5 m up along its walls (a health pack on its north balcony), stairs facing the door and crates for cover; two tubes run from the hall to the modules, each with an airlock to the outside, and the tube tops and module roofs are still walked on. Two rovers are parked at each base: E gets you in (the wheel first, else the seat beside it) and out. The rover goes where its driver looks, from a camera behind it: W and S are the throttle and the brake, Space the handbrake that swings the tail round, and above a jog the tyres let go and it drifts. It rides on four long, soft springs, flies close to two seconds off a ramp in the half gravity and levels out to land on its wheels. The driver's own weapons are put away and he cannot touch a flag, but the rover carries a laser on each side: holding the left button fires green bolts from both, seven salvos a second, that cross 50 m ahead where he looks and graze like the laser rifle's; the rider keeps his weapons and may carry one; a rover at speed runs enemies over. It is an open two-seat buggy of white panels and gold foil on a bare tube frame, with fenders in its team's colour, headlights and a trail of dust. A player on foot walks into a rover's body and can stand on it, and a rover stops on another. A rover or a ship has 10 hit points: every weapon but the fists takes some from an enemy one, and at 0 it blows up, its crew goes down, and its wreck lies 5 s before a fresh one is parked in its place. A combat ship waits on each landing pad, armed with lasers and missiles: E boards it, and it climbs out of the crater into orbit, where the ships fight over the globe of the moon ([`docs/MOON.md`](docs/MOON.md)).
243
249
  - **Weapons**: each team's armoury is a plinth 1.5 m high past its flag, in sight of the spawns, with a gun rack, a katana rack, a rail gun rack and a laser rifle rack: run and jump up to take them. You spawn with none and carry each once taken. The first time a weapon comes to hand you switch it on, each its own way: the right thumb presses the plasma gun's button and the katana's, the left index the laser rifle's, the left hand turns the rail gun's capsule; it lights up with its sound. Drawn again, or after a swap, it lights up at once.
244
250
  - The **plasma gun** holds 60 shots, 15 at a time in a battery in its grip: an empty one, or R, swaps it in 1.3 s, the gun dark until the new one is in: the spent battery falls to the floor, the left hand takes a new one out of a pouch on the hip and puts it in, a pause, a slap of the palm, a jolt and the gun back in aim. A click fires a plasma ball at 40 m/s that bursts on the first wall or enemy it touches, and the view kicks up with each one. Held, the button charges the next ball, with a rising whine and the gun shaking, shown by a gauge under the ammo counter, and letting go fires it: up to 5 shots' worth in one second, which takes 5 health and puts any enemy down.
@@ -260,7 +266,10 @@ The game is the movement and a capture the flag on top of it, with a tackle, a g
260
266
  - [x] A brush world under an open sky: roofs at any height, gaps, floating platforms and overhangs, steps, falls back to a spawn; eight procedural materials (brick, tile, lava, stone, metal, wood, moss, grating) with bump mapping and per-material highlights; a sky with a blooming sun, a sun shadow that follows you, daylight from the sky
261
267
  - [x] Highline, the capture-the-flag map: two towers, three routes at three heights, a plaza, wall-run and dash gaps, ledge ladders and stairs, ways back up after a miss; ROOFTOPS, a parkour course, stays as the test course of the moves
262
268
  - [x] Tranquility, a moon base in a crater: half gravity, space helmets, domes, a rille to cross, the Earth in a black sky
263
- - [x] Tranquility's crater of 600 by 720 m with relief, a base to walk into, and rovers to drive
269
+ - [x] Tranquility's crater of 600 by 720 m with relief, a base to walk into, rovers to drive and ships that fight in orbit over the moon
270
+ - [x] Landfall, a beach with a crashed ship, dunes, granite headlands, a forest and a sea to swim
271
+ - [x] Five classes: marine, ninja, astronaut, xenomorph and Hunter, each with its own body, kit and weapons
272
+ - [x] Bots that fill a room, run the routes, carry the flag and fight (`BOTS`, `BOT_SKILL`)
264
273
  - [x] Client-side prediction, exact to the bit, and the other players interpolated
265
274
  - [x] A per-tick history of the players on the host, for lag compensation
266
275
  - [x] Daylight: a sky with a blooming sun, a sun shadow that follows you, a light colour per box, haze toward the horizon
@@ -268,7 +277,7 @@ The game is the movement and a capture the flag on top of it, with a tackle, a g
268
277
  - [x] Parkour moves, predicted exactly: momentum, sprint, dash, double jump, ledge grab and climb, wall-run, slide, coyote time and jump buffer
269
278
  - [x] Your own body in first person, Mirror's Edge style: arms that pump with the stride, hands on the ledge, legs when you look down; a camera that kicks its field of view, dips on landings, leans into wall-runs; speed lines
270
279
  - [x] The other players as skinned runners: one continuous skin on a rig, a natural walk, run and sprint with planted feet, and every parkour move
271
- - [x] Four weapons taken at each team's armoury, a plasma gun, an electric katana, a rail gun and a laser rifle: plasma balls, charged shots, three cuts and their specials, a bolt of lightning, a saber lock, a shock, limb cuts, health and ammo packs, all predicted on the client and resolved by the host with lag compensation; magazines and reloads drawn by hand, each weapon switched on its own way
280
+ - [x] Weapons taken at each team's armoury (and the fists and the Hunter's own), a plasma gun, an electric katana, a rail gun and a laser rifle: plasma balls, charged shots, three cuts and their specials, a bolt of lightning, a saber lock, a shock, limb cuts, health and ammo packs, all predicted on the client and resolved by the host with lag compensation; magazines and reloads drawn by hand, each weapon switched on its own way
272
281
  - [x] A city around the roofs: a street far below with traffic and markings to the horizon, a height fog, parks of branched trees and a skyline
273
282
  - [x] Sound: a jsfxr-style synthesiser for steps, jumps, dashes, landings, grabs, climbs, slides and the wind of speed, placed in stereo; a looped music; M mutes
274
283
  - [x] A title screen with a menu (the character to play, the mode and the map; the controls), a muted mark, a player count and name tags
@@ -297,7 +306,8 @@ Node 24 (see `.nvmrc`).
297
306
  npm install
298
307
  npm start # demo with hot reload (Vite)
299
308
  npm run dev:server # WebSocket server on :8787
300
- npm test # Vitest
309
+ npm test # Vitest, with coverage
310
+ npm run test:ci # Vitest, without coverage
301
311
  npm run lint # Prettier, ESLint, tsc
302
312
  npm run build # dist/: client, local, server, types
303
313
  npm run size # gzip budgets
@@ -1079,6 +1079,9 @@ var STILL = {
1079
1079
  blade: false,
1080
1080
  wield: false,
1081
1081
  fists: false,
1082
+ side: -1,
1083
+ sideMag: 0,
1084
+ sided: false,
1082
1085
  swing: 0,
1083
1086
  cut: 0,
1084
1087
  zap: false,
@@ -1114,13 +1117,6 @@ var spawn = (id, w, n, team = 0, kit = KITS[0]) => {
1114
1117
  ground: true,
1115
1118
  ...STILL,
1116
1119
  hp: kit.hp,
1117
- ...kit.hunter && {
1118
- ammo: kit.ammo,
1119
- mag: kit.mag,
1120
- rail: 0,
1121
- cap: kit.cap,
1122
- charge: 0
1123
- },
1124
1120
  blade: !!kit.katana,
1125
1121
  wield: !!kit.katana
1126
1122
  };
@@ -8495,6 +8491,30 @@ var STRIKE = {
8495
8491
  * `armed` is false while the match is over: no weapon, no rack. `bodies` are move()'s.
8496
8492
  */
8497
8493
  var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
8494
+ swapped = false;
8495
+ const s = act(p, i, w, team, armed, bodies, kit);
8496
+ if (swapped) sideSwap(p);
8497
+ return s;
8498
+ };
8499
+ /**
8500
+ * Whether act() put the Hunter's pistol in the gun's fields this step (sideSwap()): step() puts
8501
+ * them back once it returns.
8502
+ */
8503
+ var swapped = false;
8504
+ /**
8505
+ * Swaps the Hunter's pistol (`side`, `sideMag`) with his harpoon (`ammo`, `mag`): while the pistol
8506
+ * is in hand, the step fires, charges, bursts and reloads it as the gun, with the gun's code.
8507
+ */
8508
+ var sideSwap = (p) => {
8509
+ [p.ammo, p.side, p.mag, p.sideMag] = [
8510
+ p.side ?? -1,
8511
+ p.ammo,
8512
+ p.sideMag ?? 0,
8513
+ p.mag ?? 0
8514
+ ];
8515
+ };
8516
+ /** step() but for putting the Hunter's pistol back in its own fields. */
8517
+ var act = (p, i, w, team, armed, bodies, kit) => {
8498
8518
  const down = p.down > 0;
8499
8519
  const locked = !down && (p.lock ?? 0) > 0;
8500
8520
  const all = p.exec ? EXEC.TICKS : GLORY_TICKS;
@@ -8521,7 +8541,6 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
8521
8541
  const fresh = !!(i.keys & KEY.FIRE) && !p.pressed;
8522
8542
  p.pressed = !!(i.keys & KEY.FIRE);
8523
8543
  const near = (key) => w.def.teams.some((t) => !!t[key] && within(p, t[key], 1.2));
8524
- const inside = near("rack");
8525
8544
  const gear = kit.gear;
8526
8545
  if (!gear) [p.ammo, p.rail, p.rifle, p.blade, p.nades] = [
8527
8546
  -1,
@@ -8531,38 +8550,44 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
8531
8550
  0
8532
8551
  ];
8533
8552
  const own = kit.hunter;
8553
+ const inside = near("rack") || !!own && near("blade");
8534
8554
  if (own) {
8535
- [p.rifle, p.nades] = [0, 0];
8555
+ p.nades = 0;
8536
8556
  p.clip = Math.max(0, (p.clip ?? 0) - 1);
8537
- if (p.ammo < 0 && !p.down) [p.ammo, p.mag, p.cap, p.rail] = [
8538
- kit.ammo,
8539
- kit.mag,
8540
- kit.cap,
8541
- 0
8542
- ];
8543
- p.cap = Math.min(p.cap ?? kit.cap, kit.cap);
8544
- p.rail = Math.min(Math.max(p.rail ?? 0, 0), 90);
8545
- if (p.cap >= kit.cap) p.rail = 0;
8546
- else if (p.rail > 1) p.rail--;
8547
- else {
8548
- p.cap++;
8549
- p.rail = p.cap < kit.cap ? 90 : 0;
8557
+ p.rifle = (p.rifle ?? -1) >= 0 ? 0 : -1;
8558
+ if ((p.rail ?? -1) >= 0) {
8559
+ p.cap = Math.min(p.cap ?? kit.cap, kit.cap);
8560
+ p.rail = Math.min(p.rail, 90);
8561
+ if (p.cap >= kit.cap) p.rail = 0;
8562
+ else if (p.rail > 1) p.rail--;
8563
+ else {
8564
+ p.cap++;
8565
+ p.rail = p.cap < kit.cap ? 90 : 0;
8566
+ }
8550
8567
  }
8551
8568
  }
8552
- if (armed && gear && inside && !p.rack) [p.ammo, p.mag] = [kit.ammo, kit.mag];
8569
+ if (armed && gear && inside && !p.rack) {
8570
+ if (!own || !near("rack")) [p.ammo, p.mag] = [kit.ammo, kit.mag];
8571
+ else [p.side, p.sideMag] = [60, 15];
8572
+ }
8553
8573
  p.rack = inside;
8554
8574
  p.blade = !!kit.katana || !!p.blade || armed && gear && near("blade");
8555
8575
  const inRail = near("rail");
8556
- if (armed && gear && !own && inRail && !p.inRail) [p.rail, p.cap] = [kit.rail, kit.cap];
8576
+ if (armed && gear && inRail && !p.inRail) [p.rail, p.cap] = [own ? 0 : kit.rail, kit.cap];
8557
8577
  p.inRail = inRail;
8558
8578
  const inRifle = near("rifle");
8559
- if (armed && gear && !own && inRifle && !p.inRifle) [p.rifle, p.clip, p.nades] = [
8560
- kit.rifle,
8561
- kit.clip,
8562
- 3
8563
- ];
8579
+ if (armed && gear && inRifle && !p.inRifle) {
8580
+ if (own) [p.rifle, p.clip] = p.rifle < 0 ? [0, 0] : [p.rifle, p.clip];
8581
+ else [p.rifle, p.clip, p.nades] = [
8582
+ kit.rifle,
8583
+ kit.clip,
8584
+ 3
8585
+ ];
8586
+ }
8564
8587
  p.inRifle = inRifle;
8565
8588
  p.ammo = Math.min(p.ammo, kit.ammo);
8589
+ p.side = own ? Math.min(p.side ?? -1, 60) : -1;
8590
+ p.sideMag = Math.min(p.sideMag ?? 0, Math.max(p.side, 0), 15);
8566
8591
  p.rail = p.rail === void 0 ? p.rail : Math.min(p.rail, kit.rail);
8567
8592
  p.rifle = p.rifle === void 0 ? p.rifle : Math.min(p.rifle, kit.rifle);
8568
8593
  [p.mag, p.cap, p.clip] = [
@@ -8605,20 +8630,27 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
8605
8630
  p.ammo >= 0,
8606
8631
  !!p.blade,
8607
8632
  (p.rail ?? -1) >= 0,
8608
- (p.rifle ?? -1) >= 0
8633
+ (p.rifle ?? -1) >= 0,
8634
+ p.side >= 0
8609
8635
  ];
8610
- const want = i.keys & KEY.BLADE ? 1 : i.keys & KEY.RAIL ? 2 : i.keys & KEY.RIFLE ? 3 : 0;
8636
+ const want = own && i.keys & KEY.FISTS ? 4 : i.keys & KEY.BLADE ? 1 : i.keys & KEY.RAIL ? 2 : i.keys & KEY.RIFLE ? 3 : 0;
8611
8637
  const fists = gear && !own && !!(i.keys & KEY.FISTS) && !(p.swing && p.wield);
8612
8638
  const first = own && has[1] ? 1 : has.indexOf(true);
8613
8639
  const hand = p.swing && p.wield ? 1 : fists ? -1 : has[want] ? want : first;
8614
- if (hand != (p.fists ? -1 : p.rifled ? 3 : p.railed ? 2 : +!!p.wield)) p.reload = 0;
8640
+ if (hand != (p.fists ? -1 : p.sided ? 4 : p.rifled ? 3 : p.railed ? 2 : +!!p.wield)) p.reload = 0;
8615
8641
  if (p.swing && hand >= 0 && !p.wield) p.swing = 0;
8616
- [p.wield, p.railed, p.rifled, p.fists] = [
8642
+ [p.wield, p.railed, p.rifled, p.fists, p.sided] = [
8617
8643
  hand == 1,
8618
8644
  hand == 2,
8619
8645
  hand == 3,
8620
- fists
8646
+ fists,
8647
+ hand == 4
8621
8648
  ];
8649
+ if (hand == 4) {
8650
+ sideSwap(p);
8651
+ swapped = true;
8652
+ }
8653
+ const harpoon = own && hand == 0;
8622
8654
  if (!armed) {
8623
8655
  [p.charge, p.reload] = [kit.xeno ? p.charge : 0, 0];
8624
8656
  return STRIKE.NONE;
@@ -8635,7 +8667,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
8635
8667
  90
8636
8668
  ] : [
8637
8669
  "mag",
8638
- kit.mag,
8670
+ hand == 4 ? 15 : kit.mag,
8639
8671
  p.ammo,
8640
8672
  78
8641
8673
  ];
@@ -8651,7 +8683,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
8651
8683
  return STRIKE.NONE;
8652
8684
  }
8653
8685
  if (bare || p.wield && !top || p.railed || p.rifled || busy || p.reload || !p.wield && !p.mag) p.charge = 0;
8654
- const pistol = hand == 0 && !kit.hunter && !busy && !p.reload && !p.charge && !!p.mag;
8686
+ const pistol = (hand == 0 || hand == 4) && !harpoon && !busy && !p.reload && !p.charge && !!p.mag;
8655
8687
  p.burst = pistol ? p.burst ?? 0 : 0;
8656
8688
  if (pistol && !p.cool && (p.burst || i.keys & KEY.SPECIAL)) {
8657
8689
  p.burst = (p.burst || 3) - 1;
@@ -8729,7 +8761,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
8729
8761
  return STRIKE.RAIL;
8730
8762
  }
8731
8763
  } else if (!p.wield && !p.cool && p.mag && !p.reload) {
8732
- if (kit.hunter) {
8764
+ if (harpoon) {
8733
8765
  p.power = 1;
8734
8766
  p.ammo--;
8735
8767
  p.mag--;
@@ -10226,8 +10258,25 @@ var Bot = class {
10226
10258
  this.why = "gun rack";
10227
10259
  return home.rack;
10228
10260
  }
10229
- if (gear && !s.kit?.katana && role === "attack") {
10230
- const choices = [
10261
+ const own = !!s.kit?.hunter;
10262
+ if (gear && (!s.kit?.katana || own) && role === "attack") {
10263
+ const choices = own ? [
10264
+ [
10265
+ home.blade,
10266
+ p.ammo < 0,
10267
+ "harpoon rack"
10268
+ ],
10269
+ [
10270
+ home.rail,
10271
+ (p.rail ?? -1) < 0,
10272
+ "cannon rack"
10273
+ ],
10274
+ [
10275
+ home.rifle,
10276
+ (p.rifle ?? -1) < 0,
10277
+ "disc rack"
10278
+ ]
10279
+ ] : [
10231
10280
  [
10232
10281
  home.rail,
10233
10282
  (p.rail ?? -1) < 0,
@@ -10814,7 +10863,7 @@ var decodeInput = (buf) => {
10814
10863
  var flagBytes = (state) => state === FLAG$1.CARRIED ? 2 : state === FLAG$1.DROPPED ? 8 : 1;
10815
10864
  function encodeSnapshot(s, meta) {
10816
10865
  const rovers = (s.rovers ?? []).slice(0, 15);
10817
- const mid = 5 + 62 * s.players.length;
10866
+ const mid = 5 + 64 * s.players.length;
10818
10867
  const end = mid + 57 * rovers.length;
10819
10868
  const balls = s.balls ?? [];
10820
10869
  const tail = end + 10 + s.flags.reduce((n, f) => n + flagBytes(f.state), 0);
@@ -10827,7 +10876,7 @@ function encodeSnapshot(s, meta) {
10827
10876
  v.setUint8(3, s.players.length);
10828
10877
  v.setUint8(4, rovers.length);
10829
10878
  s.players.forEach((p, i) => {
10830
- const o = 5 + i * 62;
10879
+ const o = 5 + i * 64;
10831
10880
  const ack = meta ? meta[i].ack : p.ack;
10832
10881
  const by = meta ? p.stun ? meta[i].by : 0 : p.by;
10833
10882
  v.setUint8(o, p.id);
@@ -10868,6 +10917,8 @@ function encodeSnapshot(s, meta) {
10868
10917
  v.setUint8(o + 59, p.clip ?? 0);
10869
10918
  v.setUint8(o + 60, p.heat ?? 0);
10870
10919
  v.setUint8(o + 61, (p.nades ?? 0) << 6 | (p.lob ?? 0));
10920
+ v.setUint8(o + 62, (p.side ?? -1) + 1 | +!!p.sided << 7);
10921
+ v.setUint8(o + 63, p.sideMag ?? 0);
10871
10922
  });
10872
10923
  rovers.forEach((r, i) => {
10873
10924
  const o = mid + i * 57;
@@ -11610,6 +11661,9 @@ var Room = class {
11610
11661
  blade: false,
11611
11662
  wield: false,
11612
11663
  fists: false,
11664
+ side: -1,
11665
+ sideMag: 0,
11666
+ sided: false,
11613
11667
  swing: 0,
11614
11668
  lost: LIMB.NONE,
11615
11669
  fell,
@@ -11645,7 +11699,7 @@ var Room = class {
11645
11699
  * grenade (lob()) is flown on the same way, a tick of its arc at a time.
11646
11700
  */
11647
11701
  shoot(p, view = 0, b) {
11648
- b ??= launch$1(p.state, p.info.team, this.kit(p).hunter);
11702
+ b ??= launch$1(p.state, p.info.team, this.kit(p).hunter && !p.state.sided);
11649
11703
  const lag = (this.ticks - view + 65536) % 65536;
11650
11704
  this.balls.push(b);
11651
11705
  const ticks = Math.min(lag < 32768 ? lag : 0, 12);
@@ -12196,10 +12250,11 @@ var Room = class {
12196
12250
  const kind = +(k >= packs.length) + +(k >= packs.length + ammo.length) + +(k >= packs.length + ammo.length + cells.length);
12197
12251
  const wants = ({ state: q, info }) => {
12198
12252
  const kit = kitOf(info.role, this.world.def);
12253
+ const own = !!kit.hunter;
12199
12254
  return [
12200
12255
  q.hp < kit.hp,
12201
- q.ammo >= 0 && q.ammo < kit.ammo || (q.rifle ?? -1) >= 0 && q.rifle < kit.rifle,
12202
- (q.rail ?? -1) >= 0 && q.rail < kit.rail,
12256
+ q.ammo >= 0 && q.ammo < kit.ammo || !own && (q.rifle ?? -1) >= 0 && q.rifle < kit.rifle,
12257
+ !own && (q.rail ?? -1) >= 0 && q.rail < kit.rail,
12203
12258
  kit.gear && (q.armor ?? 0) < 3
12204
12259
  ][kind];
12205
12260
  };
@@ -12210,7 +12265,7 @@ var Room = class {
12210
12265
  if (kind == 0) q.hp = Math.min(kit.hp, q.hp + 2);
12211
12266
  else if (kind == 1) {
12212
12267
  q.ammo = q.ammo < 0 ? -1 : Math.min(kit.ammo, q.ammo + 20);
12213
- q.rifle = (q.rifle ?? -1) < 0 ? -1 : Math.min(kit.rifle, q.rifle + 60);
12268
+ q.rifle = (q.rifle ?? -1) < 0 ? -1 : kit.hunter ? q.rifle : Math.min(kit.rifle, q.rifle + 60);
12214
12269
  } else if (kind == 2) q.rail = Math.min(kit.rail, q.rail + 80);
12215
12270
  else q.armor = 3;
12216
12271
  this.gone[k] = [
@@ -0,0 +1 @@
1
+ var e,t=.4,n=1.8,r=1.6,i=1.55,a=.5,o=2.4,s=.03,c=[`Red`,`Blue`],l=[`#ff3d4f`,`#2f80ff`],u={ticks:20,strike:6,reach:1.4,arc:.6,hp:0,hold:-1,knock:0},d={JAB:0,CROSS:1,HOOK:2,LUNGE:3,CLAW_L:4,CLAW_R:5},f={ticks:16,strike:5,reach:1.8,arc:.7,hp:2,hold:-1,knock:0},p=[u,u,{ticks:28,strike:9,reach:1.5,arc:.9,hp:1,hold:-1,knock:1.4},{ticks:26,strike:7,reach:2.2,arc:.5,hp:1,hold:-1,knock:1.2},f,f],m=[2,6],h={STAB:0,SWEEP_L:1,SWEEP_R:2,LASH:3,SPIN:6,LEAP:7},g=[{ticks:52,strike:26,reach:3.4,arc:.25,hp:m[0],hold:18,knock:0},{ticks:50,strike:26,reach:2.8,arc:1.1,hp:m[0],hold:16,knock:0},{ticks:50,strike:26,reach:2.8,arc:1.1,hp:m[0],hold:16,knock:0},{ticks:54,strike:28,reach:3.1,arc:.4,hp:m[0],hold:20,knock:0},f,f,{ticks:60,strike:30,reach:2.6,arc:Math.PI,hp:3,hold:18,knock:0},{ticks:63,strike:52,reach:2.8,arc:.6,hp:5,hold:32,knock:0}],[_,v]=[.75,1],[y,b,x,ee]=[3,2.5,1,120],te={TICKS:88,REACH:1.3,FIST:.85,CUTS:[26,71],KILLER:1,VICTIM:2},ne=.12,S=.08,re=.16,ie=.5,ae=.012,oe=1.2,se=[{ticks:28,strike:10,reach:2.65,arc:.3,hp:2,hold:8},{ticks:34,strike:13,reach:2.15,arc:1.2,hp:2,hold:4},{ticks:34,strike:13,reach:2.15,arc:1.2,hp:2,hold:4},{ticks:40,strike:16,reach:2.15,arc:.45,hp:3,hold:11},{ticks:36,strike:12,reach:3.2,arc:.3,hp:3,hold:-1},{ticks:46,strike:20,reach:2.15,arc:.6,hp:3,hold:-1},{ticks:46,strike:20,reach:2.15,arc:.6,hp:3,hold:-1},{ticks:58,strike:40,reach:2.4,arc:.6,hp:4,hold:-1}],[ce,le,ue]=[1.8,15,60],[de,fe,pe]=[2,.5,1.4],[me,he,ge]=[24,15,.6],_e=7.5,ve=.7,ye=.3,[be,xe,Se]=[20,4,2.5],Ce=.012,we={maxPlayers:16,scoreLimit:3,timeLimit:480,map:`highline`},Te={HP:10,WRECK:300,FADE:60,GRAZE:4,SKID:.92},Ee={SEAM:300,TOP:960,ALT:25e4},De=(e,t,n)=>{let r=Math.imul(e,374761393)+Math.imul(t,668265263)+Math.imul(n,144665)|0;return r=Math.imul(r^r>>>13,1274126177),((r^r>>>16)>>>0)/4294967296},C=(e,t,n)=>{let[r,i]=[Math.floor(e),Math.floor(t)],[a,o]=[e-r,t-i].map(e=>e*e*(3-2*e)),s=(e,t)=>De(r+e,i+t,n);return(s(0,0)*(1-a)+s(1,0)*a)*(1-o)+(s(0,1)*(1-a)+s(1,1)*a)*o},Oe=/* @__PURE__ */ new WeakMap,ke=e=>{let t=Oe.get(e);if(t)return t;let{hole:n,bound:r,cell:i,at:a,pits:o=[],origin:[s,c]=[0,0]}=e,l=o.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])],[1/0,1/0,-1/0,-1/0]),[u,d,f,p]=r,m=Math.floor((u-f-s)/i)*i+s,h=Math.floor((d-p-c)/i)*i+c,g=Math.ceil((u+f-m)/i)+1,_=Math.ceil((d+p-h)/i)+1,v=new Float32Array(g*_),y=-1/0;for(let e=0;e<_;e++)for(let t=0;t<g;t++)v[t+e*g]=a(m+t*i,h+e*i),y=Math.max(y,v[t+e*g]);let b=new Uint8Array(g*_);for(let[e,t,n,r]of o)for(let a=Math.floor((t-h)/i)-1;a<=Math.floor((r-h)/i)+1;a++)for(let t=Math.floor((e-m)/i)-1;t<=Math.floor((n-m)/i)+1;t++)t>=0&&a>=0&&t<g&&a<_&&(b[t+a*g]=1);let x={x0:m,z0:h,cell:i,nx:g,nz:_,h:v,hole:n,pits:o,pitted:b,box:l,bound:r,top:y};return Oe.set(e,x),x},Ae=(e,t,n)=>{let r=e.relief;if(!r||t>r.hole[0]&&t<r.hole[2]&&n>r.hole[1]&&n<r.hole[3])return-1/0;let i=Math.min(Math.max((t-r.x0)/r.cell,0),r.nx-1),a=Math.min(Math.max((n-r.z0)/r.cell,0),r.nz-1),o=Math.min(Math.floor(i),r.nx-2),s=Math.min(Math.floor(a),r.nz-2);if(r.pitted[o+s*r.nx]&&r.pits.some(e=>t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]))return-1/0;let[c,l]=[i-o,a-s],u=o+s*r.nx,[d,f,p,m]=[r.h[u],r.h[u+1],r.h[u+r.nx],r.h[u+r.nx+1]];return c>=l?d+(f-d)*c+(m-f)*l:d+(p-d)*l+(m-p)*c},je=(e,t)=>{if(!t.relief)return;let[n,r,i,a]=t.relief.bound,[o,s]=[(e.x-n)/i,(e.z-r)/a],c=o*o+s*s;if(c<=1)return;let l=1/Math.sqrt(c);e.x=n+o*l*i,e.z=r+s*l*a;let[u,d]=[o*l/i,s*l/a],f=(e.vx*u+e.vz*d)/(u*u+d*d);f>0&&(e.vx-=f*u,e.vz-=f*d)},Me={HOME:0,CARRIED:1,DROPPED:2},w={FORWARD:1,BACK:2,LEFT:4,RIGHT:8,JUMP:16,SPRINT:32,DASH:64,CROUCH:128,FIRE:256,BLADE:512,SPECIAL:1024,RAIL:2048,RELOAD:4096,RIFLE:8192,USE:16384,FISTS:32768},Ne={THRUST:0,LEFT:1,RIGHT:2,SLASH:3,LUNGE:4,ARC_L:5,ARC_R:6,LEAP:7},Pe={NONE:0,HEAD:1,ARM_L:2,ARM_R:3,LEG_L:4,LEG_R:5,EATEN:6,BURST:7},Fe={PLAIN:0,SHOT:1,STRUCK:2},T={GROUND:0,AIR:1,WALLRUN:2,HANG:3,CLIMB:4,SLIDE:5,CROUCH:6,RIDE:7,CLING:8,SWIM:9},E={JUMP:1,DOUBLE:2,DASH:4,LAND:8,GRAB:16,CLIMB:32,WALLRUN_START:64,WALLRUN_END:128,SLIDE_START:256,SLIDE_END:512,RESPAWN:1024},D={BRICK:0,TILE:1,LAVA:2,STONE:3,METAL:4,WOOD:5,MOSS:6,GRATE:7,CONCRETE:8,GLASS:9,STEEL:10,PAINT:11,ROCK:12},Ie={MARINE:0,NINJA:1,ASTRONAUT:2,XENO:3,HUNTER:4},Le={run:6,sprint:9,jump:7,double:6,wallrun:75,dashes:1,dash:16,haste:1,ammo:60,rail:240,rifle:240,cool:7,rifleCool:3,mag:15,cap:80,clip:60,damage:1,slow:1,accel:1,parry:0,hp:8,gear:!0,xeno:!1},Re=[Le,{run:6*1.2,sprint:9*1.2,jump:9.1,double:6*1.3,wallrun:150,dashes:3,dash:16,haste:2,ammo:30,rail:120,rifle:120,cool:14,rifleCool:6,mag:8,cap:40,clip:30,damage:.5,slow:.55,accel:1,parry:.7,katana:!0,hp:8,gear:!0,xeno:!1},Le,{...Le,run:7.5,sprint:11.25,jump:7*Math.SQRT2,double:6*Math.SQRT2,dashes:3,dash:22.4,accel:1.25,ammo:0,rail:0,rifle:0,mag:0,cap:0,clip:0,hp:12,gear:!1,xeno:!0,girth:.1},{...Le,katana:!0,hunter:!0,ammo:12,mag:1,cap:15,rail:90,girth:.25,size:1.2}],ze=e=>e.helmets?[Ie.ASTRONAUT,Ie.XENO,Ie.HUNTER]:[Ie.MARINE,Ie.NINJA,Ie.XENO,Ie.HUNTER],Be=(e,t)=>{let n=ze(t);return n.includes(e??-1)?e:n[0]},Ve=(e,t)=>Be(e.role,t)==Ie.XENO?0:e.body??0,He=(e,t)=>Re[Be(e,t)],Ue=1024,We=(e,t)=>2048*(e+Ue)+t+Ue,O=(e,t)=>Math.min(Math.max(Math.floor(e/t),-1024),1023),Ge=[],Ke=(e,t=4)=>{let n=/* @__PURE__ */ new Map;return e.brushes.forEach(({min:e,max:r},i)=>{for(let a=O(e[0],t);a<=O(r[0],t);a++)for(let o=O(e[2],t);o<=O(r[2],t);o++){let e=We(a,o),t=n.get(e);t?t.push(i):n.set(e,[i])}}),{def:e,cell:t,grid:n,...e.relief?{relief:ke(e.relief)}:{},...e.doors?{doors:e.doors.map(()=>({open:0,wait:0}))}:{}}},qe=/* @__PURE__ */ new Uint32Array,Je=0,k=(e,t,n,r)=>{let i=[];qe.length<e.def.brushes.length&&(qe=new Uint32Array(e.def.brushes.length)),Je=Je+1>>>0||(qe.fill(0),1);for(let a=O(t-r,e.cell);a<=O(t+r,e.cell);a++)for(let t=O(n-r,e.cell);t<=O(n+r,e.cell);t++)for(let n of e.grid.get(We(a,t))??[])qe[n]!==Je&&(qe[n]=Je,i.push(n));return i},Ye=(e,t,n,r,i=0)=>{let a=Xe(e,t,n,r,i);return e.doors?.forEach(({open:r},o)=>{if(r<.5){let{min:r,max:s}=e.def.doors[o],[c,l]=[0,a];for(let e=0;e<3;e++){let[a,o]=n[e]?[(r[e]-i-t[e])/n[e],(s[e]+i-t[e])/n[e]]:t[e]<r[e]-i||t[e]>s[e]+i?[1,-1]:[-1/0,1/0];c=Math.max(c,Math.min(a,o)),l=Math.min(l,Math.max(a,o))}c<=l&&l>0&&(a=c)}}),e.relief?((e,t,n,r,i=0)=>{let a=e.relief;if(!a||Math.min(t[1],t[1]+n[1]*r)-i>a.top)return r;let[o,s]=[0,r];for(let e of[0,1]){let[r,i,c,l]=[t[2*e],n[2*e],a.hole[e],a.hole[e+2]];if(i){let[e,t]=[(c-r)/i,(l-r)/i];o=Math.max(o,Math.min(e,t)),s=Math.min(s,Math.max(e,t))}else(r<=c||r>=l)&&(s=-1)}let c=r=>t[1]+n[1]*r-i-Ae(e,t[0]+n[0]*r,t[2]+n[2]*r);if(!n[0]&&!n[2]){let e=c(0);return e<0?0:n[1]<0?Math.min(r,e/-n[1]):r}for(let[e,t]of o<s?[[0,o],[s,r]]:[[0,r]]){if(e<t&&c(e)<0)return e;for(let n=e;n<t;n+=1){let e=Math.min(n+1,t);if(c(e)<0){let[t,r]=[n,e];for(let e=0;e<6;e++){let e=(t+r)/2;c(e)<0?r=e:t=e}return t}}}return r})(e,t,n,a,i):a},Xe=(e,t,n,r,i)=>{let{cell:a,def:o}=e,s=r,c=O(t[0],a),l=O(t[2],a),u=Math.sign(n[0]),d=Math.sign(n[2]),f=u?((c+ +(u>0))*a-t[0])/n[0]:1/0,p=d?((l+ +(d>0))*a-t[2])/n[2]:1/0,m=u?a/Math.abs(n[0]):1/0,h=d?a/Math.abs(n[2]):1/0;for(;;){for(let r of e.grid.get(We(c,l))??[]){let e=o.brushes[r],[a,c]=[0,s];for(let r=0;r<3&&a<=c;r++){if(!n[r]){(t[r]<e.min[r]-i||t[r]>e.max[r]+i)&&(c=-1);continue}let o=(e.min[r]-i-t[r])/n[r],s=(e.max[r]+i-t[r])/n[r];a=Math.max(a,Math.min(o,s)),c=Math.min(c,Math.max(o,s))}a<=c&&c>0&&a<s&&(s=a)}if(Math.min(f,p)>=s||Math.abs(c)>Ue||Math.abs(l)>Ue)return s;f<p?(c+=u,f+=m):(l+=d,p+=h)}},Ze=(e,t,n)=>{let[r,i,a]=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],o=Math.hypot(r,i,a);return o>0&&Ye(e,t,[r/o,i/o,a/o],o)<o-1e-4},A=1/60,Qe=2*Math.PI,$e=1e-6,j=.01,et=e=>(e%Qe+Qe)%Qe,tt=e=>[-Math.sin(e),-Math.cos(e)],M=Math.fround,nt=Math.sqrt,rt=(e,t,n)=>Math.min(Math.max(e,t),n),N=(e,t)=>nt(e*e+t*t),P=[[0,0],[1,0],[-1,0],[0,1],[0,-1]],it={vx:0,vz:0,mode:T.GROUND,t:0,wall:0,edge:0,jumps:1,dashes:1,dash:0,stun:0,coyote:6,buffer:0,held:0,hp:8,armor:0,ammo:-1,cool:0,mag:0,cap:0,reload:0,rack:!1,down:0,shots:0,hits:0,blade:!1,wield:!1,fists:!1,side:-1,sideMag:0,sided:!1,swing:0,cut:0,zap:!1,lost:Pe.NONE,rail:-1,railed:!1,rifle:-1,clip:0,rifled:!1,nades:0,lob:0,inRifle:!1,inRail:!1,zapping:!1,slow:0,fried:!1,heavy:!1,ev:0,fall:0},at=(e,t,n,r=0,i=Re[0])=>{let{spawns:a}=t.def.teams[r],[o,s,c,l]=a[(n%a.length+a.length)%a.length];return{id:e,x:M(o),y:M(s),z:M(c),vy:0,yaw:et(l),pitch:0,ground:!0,...it,hp:i.hp,blade:!!i.katana,wield:!!i.katana}},ot=(e,t,n,r=Re[0])=>{let{yaw:i,pitch:a,id:o,shots:s,hits:c}=e;Object.assign(e,at(o,t,o,n,r),{yaw:i,pitch:a,shots:s,hits:c,ev:e.ev|E.RESPAWN})},st=e=>e===T.GROUND||e===T.SLIDE||e===T.CROUCH,ct=e=>e.mode===T.SLIDE||e.mode===T.CROUCH?.9:n,lt=e=>e.mode===T.SWIM?1.35:e.mode===T.SLIDE||e.mode===T.CROUCH?.7:1.6,ut=e=>N(e.vx,e.vz),dt=e=>e.mode===T.GROUND&&N(e.vx,e.vz)>6.5,ft=(e,t,n)=>e.max[1]>t+.5+j&&e.min[1]<t+n-j,pt=(e,t,n)=>[t-rt(t,e.min[0],e.max[0]),n-rt(n,e.min[2],e.max[2])],mt=(e,n,r)=>ht(e,n,r,t),ht=(e,t,n,r)=>{let{brushes:i}=t.def,a=k(t,e.x,e.z,2*r),o=(r-$e)**2,[s,c]=[0,0];for(let t=0;t<4;t++){let t=0,l=0,u=0;for(let s of a){let a=i[s];if(!ft(a,e.y,n))continue;let[c,d]=pt(a,e.x,e.z),f=c*c+d*d;if(f>=o)continue;if(f){let e=nt(f);r-e>t&&(t=r-e,l=c/e*t,u=d/e*t);continue}let[p,m,h]=[[e.x-a.min[0],-1,0],[a.max[0]-e.x,1,0],[e.z-a.min[2],0,-1],[a.max[2]-e.z,0,1]].reduce((e,t)=>t[0]<e[0]?t:e);p+r>t&&(t=p+r,[l,u]=[m*t,h*t])}if(!t)break;e.x+=l,e.z+=u,s+=l,c+=u}return[s,c]},gt=(e,t,n)=>{let[[r,i,a],[o,s,c]]=[e.a,e.b],[l,u]=[o-r,c-a],d=l*l+u*u,f=d?rt(((t-r)*l+(n-a)*u)/d,0,1):0;return[t-r-f*l,n-a-f*u,i+f*(s-i)]},_t=(e,t,n,r)=>t>=Math.min(e.a[0],e.b[0])-r&&t<=Math.max(e.a[0],e.b[0])+r&&n>=Math.min(e.a[2],e.b[2])-r&&n<=Math.max(e.a[2],e.b[2])+r,vt=(e,n,r,i=[])=>{let{brushes:a}=n.def,o=(t-$e)**2,s=Ae(n,e.x,e.z),c=1/0;for(let i of k(n,e.x,e.z,t)){let t=a[i],[n,l]=pt(t,e.x,e.z);n*n+l*l>=o||(t.max[1]<=e.y+.5+j?s=Math.max(s,t.max[1]):t.min[1]>=e.y+r-j&&(c=Math.min(c,t.min[1])))}for(let t of i){if(!_t(t,e.x,e.z,t.r+.4))continue;let[n,i,a]=gt(t,e.x,e.z);n*n+i*i>=(t.r+.4-$e)**2||(a+t.h<=e.y+.5+j?s=Math.max(s,a+t.h):a>=e.y+r-j&&(c=Math.min(c,a)))}return[s,c]},yt=(e,t,n,r)=>{let i=Ae(e,t,n);for(let a of((e,t,n)=>e.grid.get(We(O(t,e.cell),O(n,e.cell)))??Ge)(e,t,n)){let{min:o,max:s}=e.def.brushes[a];t>=o[0]&&t<=s[0]&&n>=o[2]&&n<=s[2]&&s[1]<=r&&(i=Math.max(i,s[1]))}return i},bt=(e,n)=>{let r=(t-$e)**2;return k(n,e.x,e.z,t).every(t=>{let i=n.def.brushes[t],[a,o]=pt(i,e.x,e.z);return a*a+o*o>=r||!ft(i,e.y,1.8)})},xt=(e,n,r,i,a)=>{let o=(t-$e)**2;return k(e,n,r,t).every(t=>{let s=e.def.brushes[t],[c,l]=pt(s,n,r);return c*c+l*l>=o||s.max[1]<=i||s.min[1]>=a})},St=(e,t)=>{let[n,r]=P[t],i=n?0:2;return{a:i,o:2-i,sign:n||r,c:n?e.x:e.z,co:n?e.z:e.x}},Ct=(e,t,n,r)=>{let{a:i,o:a,sign:o,c:s,co:c}=St(t,n),l=((o>0?e.min[i]:e.max[i])-s)*o;return l>=.399&&l<=.4+r&&c>=e.min[a]&&c<=e.max[a]?l:void 0},wt=(e,n,r)=>{let i;for(let a of k(n,e.x,e.z,.9)){let o=n.def.brushes[a],s=Ct(o,e,r,.5);s!==void 0&&o.min[1]<e.y+.5&&o.max[1]>e.y+1.8&&(i=Math.min(i??1/0,Math.max(0,s-t)))}return i},Tt=e=>e>20?Math.ceil((e-20)/2):0,Et=e=>20*(e.def.gravity??1),F=(e,t)=>{e.mode=t,e.t=0},Dt=e=>!!e.zap&&e.stun>24,Ot=(e,t)=>{let n=N(e.vx,e.vz);n>t&&(e.vx*=t/n,e.vz*=t/n)},kt=(e,t,n,r)=>{let[i,a]=[n.wx,n.wz];for(let n of k(t,e.x,e.z,.401)){let o=t.def.brushes[n],[s,c]=pt(o,e.x,e.z),l=N(s,c);if(l>0&&l<=.401&&ft(o,e.y,r)){let e=(-i*s-a*c)/l;e>0&&(i+=e*s/l,a+=e*c/l)}}return[i,a]},At=(e,t,n,r=6,i=1)=>{let a=N(t[0],t[1]);if(a<$e){let t=N(e.vx,e.vz),n=t?Math.max(0,t-.75)/t:0;e.vx*=n,e.vz*=n;return}let[o,s]=[t[0]/a,t[1]/a],c=e.vx*o+e.vz*s,[l,u]=[e.vx-c*o,e.vz-c*s],d=N(l,u);if(d){let e=Math.max(0,d-.75)/d;[l,u]=[l*e,u*e]}c=c<(n*=a)?Math.min(n,c+(c>=r?3:50)*i*A):Math.max(n,c-.2),e.vx=l+c*o,e.vz=u+c*s},jt=(e,t,n)=>{Mt(e,t,ct(e),0,!1,n),[e.x,e.y,e.z]=[M(e.x),M(e.y),M(e.z)]},Mt=(e,n,r,i,a,o)=>{let s=e.y;e.x+=e.vx*A,e.z+=e.vz*A;let[c,l]=mt(e,n,r),[u,d]=((e,n,r)=>{let[i,a]=[0,0];for(let o of n){let n=o.r+t;if(!_t(o,e.x,e.z,n))continue;let[s,c,l]=gt(o,e.x,e.z),u=s*s+c*c;if(u>=(n-$e)**2||l+o.h<=e.y+.5+j||l>=e.y+r-j)continue;let d=nt(u),[f,p]=[o.b[0]-o.a[0],o.b[2]-o.a[2]],m=N(f,p),[h,g]=d?[s/d,c/d]:m?[p/m,-f/m]:[1,0];e.x+=h*(n-d),e.z+=g*(n-d),i+=h*(n-d),a+=g*(n-d)}return[i,a]})(e,o,r);if(u||d){let[t,i]=mt(e,n,r);c+=u+t,l+=d+i}let f=N(c,l);if(f){let t=(e.vx*c+e.vz*l)/f;t<0&&(e.vx-=t*c/f,e.vz-=t*l/f)}je(e,n);let[p,m]=vt(e,n,r,o),h=e.vy-i*Et(n)*A;if(e.y+=(e.vy+h)/2*A,e.vy=h,e.y+r>m&&(e.y=m-r,e.vy=Math.min(e.vy,0)),e.vy<=0?e.y<=p+j:e.y<p){if(e.y=p,e.vy<=0){let t=-e.vy;return e.vy=0,t}}else if(a&&e.vy<=0&&p>=s-.5)return e.y=p,e.vy=0,0;return-1},Nt=(e,t)=>{e.vy=t,e.coyote=0,e.buffer=0,e.ev|=E.JUMP},Pt=e=>(e.def.water??0)-1.1,Ft=(e,t,r,i)=>{let a=(r.keys&w.CROUCH)!==0;if(e.buffer>0&&(e.mode===T.GROUND||bt(e,t)))return e.ev|=e.mode===T.SLIDE?E.SLIDE_END:0,F(e,T.AIR),void Nt(e,r.kit.jump);let o=N(e.vx,e.vz);if(e.mode===T.GROUND&&a){let t=o>=7.5;F(e,t?T.SLIDE:T.CROUCH),e.ev|=t?E.SLIDE_START:0}else e.mode===T.SLIDE&&(e.t>=60||o<4.5||r.stumble)?(e.ev|=E.SLIDE_END,F(e,!a&&bt(e,t)?T.GROUND:T.CROUCH)):e.mode===T.SLIDE&&!a&&bt(e,t)?(e.ev|=E.SLIDE_END,F(e,T.GROUND)):e.mode===T.CROUCH&&!a&&bt(e,t)&&F(e,T.GROUND);if(!i){if(r.stumble){if(o>2.5){let t=Math.max(2.5,o-.2)/o;e.vx*=t,e.vz*=t}else At(e,kt(e,t,r,ct(e)),2.5)}else if(e.mode===T.SLIDE){let t=Math.max(0,o-4*A)/o;e.vx*=t,e.vz*=t}else if(e.mode===T.CROUCH)At(e,kt(e,t,r,.9),3);else{let i=(r.keys&w.SPRINT)!==0&&r.fwd,a=r.kit.run*r.pace;At(e,kt(e,t,r,n),i?r.kit.sprint*r.pace:a,a,r.kit.accel)}}},It=(e,t,r,i)=>{if(e.buffer>0&&(e.coyote>0?Nt(e,r.kit.jump):e.jumps>0&&!((e,t)=>{if(e.vy>=0)return!1;let[r]=vt(e,t,n);return e.y-r<=.1*-e.vy+.5*Et(t)*.1*.1})(e,t)&&(e.jumps--,Nt(e,r.kit.double),e.ev=e.ev&~E.JUMP|E.DOUBLE)),i||!r.wx&&!r.wz)return;let a=N(e.vx,e.vz);e.vx+=14*r.wx*A,e.vz+=14*r.wz*A,Ot(e,Math.max(a,6))},Lt=(e,r,i,a=0,o=[],s=Re[0])=>{e.yaw=et(r.yaw),e.pitch=Math.max(-1.55,Math.min(1.55,r.pitch));let c=(r.keys&w.FORWARD?1:0)-(r.keys&w.BACK?1:0),l=(r.keys&w.RIGHT?1:0)-(r.keys&w.LEFT?1:0),u=Dt(e)?1/0:N(c,l)||1,[d,f]=tt(e.yaw),p=t=>(r.keys&t)!==0&&(e.held&t)===0,m=e.stun>0,h=e.mode===T.RIDE,g={keys:r.keys,stumble:m,jump:!m&&!h&&p(w.JUMP),dash:!m&&!h&&p(w.DASH),fwd:c>0,wx:(d*c-f*l)/u,wz:(f*c+d*l)/u,fx:d,fz:f,bodies:o,kit:s,pace:e.fists||e.wield||!(e.ammo>=0||(e.rail??-1)>=0||(e.rifle??-1)>=0)?1:s.slow},_=e.mode;e.ev=0,e.fall=0,g.jump&&(e.buffer=7),m&&e.stun--,e.dash>0&&(e.dash--,e.dash===50&&Ot(e,10)),e.mode===T.HANG&&((e,t,r)=>{let[i,a]=P[e.wall],o=t=>{F(e,t),e.edge=0};if(r.keys&(w.BACK|w.CROUCH))o(T.AIR),e.coyote=0;else if(r.jump&&r.fx*i+r.fz*a<0)o(T.AIR),e.vx=4*-i,e.vz=4*-a,Nt(e,6);else if(r.jump||r.fwd&&e.t>=6)F(e,T.CLIMB);else if(e.t>=30)o(T.AIR),e.coyote=0;else{let r=Math.max(e.edge-2,vt(e,t,n)[0]);e.y+=rt(r-e.y,-8*A,8*A)}})(e,i,g),e.mode===T.CLING&&((e,n,r)=>{let[i,a]=P[e.wall],o=((e,n,r)=>{let{a:i,sign:a}=St(e,r),o;for(let s of k(n,e.x,e.z,.9)){let c=n.def.brushes[s],l=Ct(c,e,r,.5);if(l!==void 0&&c.max[1]>e.y+.4&&c.min[1]<e.y+1.8){let e=Math.max(0,l-t);o={gap:Math.min(o?.gap??1/0,e),top:Math.max(o?.top??-1/0,c.max[1]),face:a>0?c.min[i]:c.max[i]}}}return o})(e,n,e.wall);if(r.keys&w.CROUCH||!o)return F(e,T.AIR),void(e.coyote=0);if(r.jump){F(e,T.AIR);let[t,n]=[10*Math.cos(e.pitch),10*Math.sin(e.pitch)],[o,s]=[Math.max(n,3.25),(r.fz*i-r.fx*a)*t];e.vx=-i*o-a*s,e.vz=-a*o+i*s,Nt(e,(r.fx*i+r.fz*a)*t);return}let s=(r.keys&w.FORWARD?1:0)-(r.keys&w.BACK?1:0),c=(r.keys&w.RIGHT?1:0)-(r.keys&w.LEFT?1:0),[l,u]=[-a,i],[d,f]=[r.fx*i+r.fz*a,r.fx*l+r.fz*u],[p,m]=[s*d-c*f,s*f+c*d],h=Math.sqrt(p*p+m*m),g=Math.sqrt(e.vx*e.vx+e.vy*e.vy+e.vz*e.vz),_=r.keys&w.SPRINT,v=r.kit.run*r.pace*(_?1:.5),y=_?r.kit.sprint*r.pace:v,b=g>y?Math.max(y,g-.2):Math.min(y,Math.max(v,g+3*r.kit.accel*A)),x=h>1?b/h:b,ee=p>.05?1:p<-.05?-1:0,te=m*x,{a:ne,sign:S}=St(e,e.wall);if(ee>0&&o.top<e.y+1.8){let t=o.face+.2*S,[r,i]=ne===0?[t,e.z]:[e.x,t];if(xt(n,r,i,o.top+j,o.top+1.8))return F(e,T.CLIMB),e.edge=M(o.top),void(e.vx=e.vy=e.vz=0)}e.vx=l*te,e.vz=u*te,e.vy=ee>0&&o.top-e.y<=.45?0:p*x;let re=Math.min(o.gap,4*A);e.x+=i*re,e.z+=a*re,Mt(e,n,1.8,0,!1,r.bodies)>=0&&ee<0&&(F(e,T.GROUND),e.wall=0,e.coyote=6,e.ev|=E.LAND)})(e,i,g),e.mode===T.SWIM?((e,t,n)=>{let r=.1,i=Pt(t),a=(n.keys&w.FORWARD?1:0)-(n.keys&w.BACK?1:0),o=a!==0&&(e.pitch<0||e.y<i-j)?Math.cos(e.pitch):1;e.vx+=(4*n.wx*o-e.vx)*r,e.vz+=(4*n.wz*o-e.vz)*r,e.vy+=((a===0?1.5:a*Math.sin(e.pitch)*4)-e.vy)*r,Mt(e,t,ct(e),0,!1,n.bodies),vt(e,t,ct(e),n.bodies)[0]>=i-j?(e.y=Math.max(e.y,i),e.vy=0,e.jumps=1,e.dashes=n.kit.dashes,F(e,T.GROUND)):e.y>i&&(e.y=i,e.vy=Math.min(e.vy,0))})(e,i,g):e.mode===T.CLIMB?((e,t)=>{let[n,r]=P[e.wall];e.y<e.edge?e.y=Math.min(e.edge,e.y+8*A):(e.x+=5.5*n*A,e.z+=5.5*r*A),e.y>=e.edge&&((e,t)=>{let{a:n,o:r,sign:i,c:a,co:o}=St(e,e.wall);return k(t,e.x,e.z,0).some(s=>{let c=t.def.brushes[s],l=i>0?a-c.min[n]:c.max[n]-a;return M(c.max[1])===e.edge&&o>=c.min[r]&&o<=c.max[r]&&l>=.2})})(e,t)?(F(e,T.GROUND),e.vx=3*n,e.vz=3*r,e.vy=0,e.edge=0,e.wall=0,e.coyote=6,e.ev|=E.CLIMB):e.t>=40&&(F(e,e.y>=e.edge?T.GROUND:T.AIR),e.edge=0,e.wall=0)})(e,i):e.mode===T.HANG||e.mode===T.CLING||h||((e,n,r)=>{let i=e.mode===T.GROUND,a=r.kit.dashes>1;if(a&&i&&e.dash===0&&(e.dashes=r.kit.dashes),r.dash&&(e.dash===0||a&&e.dashes>0&&e.dash<=44)&&(i?!a||e.dashes>0:(e.mode===T.AIR||e.mode===T.WALLRUN)&&e.dashes>0)){let[t,n]=r.wx||r.wz?[r.wx,r.wz]:[r.fx,r.fz];e.dashes-=+(i&&a),i||(e.dashes--,e.vy=0,e.mode===T.WALLRUN&&(F(e,T.AIR),e.ev|=E.WALLRUN_END)),e.vx=t*r.kit.dash,e.vz=n*r.kit.dash,e.dash=60,e.ev|=E.DASH}let o=e.dash>50;e.mode===T.WALLRUN&&((e,t,n)=>{let[r,i]=P[e.wall],a=e.vx*r+e.vz*i,[o,s]=[e.vx-a*r,e.vz-a*i],c=N(o,s);if(n.jump){F(e,T.AIR);let t=c>0?1+2/c:1;e.vx=o*t-6.5*r,e.vz=s*t-6.5*i,Nt(e,7.5),e.jumps=1,e.dashes=n.kit.dashes,e.ev|=E.WALLRUN_END}else{let a=wt(e,t,e.wall);if(a===void 0||!n.fwd||c<3.5||e.t>=n.kit.wallrun)return F(e,T.AIR),void(e.ev|=E.WALLRUN_END);let l=Math.max(0,c-.025)/c;e.vx=o*l,e.vz=s*l;let u=Math.min(a,4*A);e.x+=r*u,e.z+=i*u}})(e,n,r),st(e.mode)&&Ft(e,n,r,o),e.mode===T.AIR&&It(e,n,r,o);let s=o&&e.vy<=0?0:e.mode===T.WALLRUN?.15:1,c=e.mode,l=[N(e.vx,e.vz),e.vx,e.vz],u=Mt(e,n,ct(e),s,st(c),r.bodies);if(u>=0){if(!st(e.mode)){if(e.ev|=E.LAND|(e.mode===T.WALLRUN?E.WALLRUN_END:0),e.fall=u,e.jumps=1,e.dashes=r.kit.dashes,e.wall=0,r.keys&w.CROUCH){let t=N(e.vx,e.vz)>=7.5;F(e,t?T.SLIDE:T.CROUCH),e.ev|=t?E.SLIDE_START:0}else F(e,T.GROUND)}e.coyote=6}else st(e.mode)&&(e.ev|=e.mode===T.SLIDE?E.SLIDE_END:0,F(e,T.AIR));if((e.mode!==T.AIR&&e.mode!==T.GROUND||!((e,t,n,r)=>{if(!n.kit.xeno||!n.fwd||!(n.keys&w.SPRINT)||n.stumble)return!1;let i=e.mode===T.AIR?.5:.05;for(let a=1;a<=4;a++){let[o,s]=P[a],c=wt(e,t,a);if(a!==e.wall&&n.fx*o+n.fz*s>=.6&&c!==void 0&&c<=i){F(e,T.CLING),e.wall=a;let[t,i]=[-s,o],c=Math.min(1,n.kit.sprint*n.pace/Math.max(r[0],$e)),l=(r[1]*t+r[2]*i)*c;return e.vx=t*l,e.vz=i*l,e.vy=Math.sqrt(Math.max(0,(r[0]*c)**2-l*l)),e.jumps=1,e.coyote=0,e.ev|=E.GRAB,!0}}return!1})(e,n,r,l))&&e.mode===T.AIR){let i=((e,n)=>{let[r,i]=tt(e.yaw),a;for(let o=1;o<=4;o++){let[s,c]=P[o];if(o===e.wall||r*s+i*c<.5)continue;let{a:l,sign:u}=St(e,o);for(let r of k(n,e.x,e.z,t+.2)){let i=n.def.brushes[r],s=i.max[1],c=s-e.y;if(Ct(i,e,o,.2)===void 0||c<1.2||c>2.4||i.min[1]>s-.25||a&&a.top>=s)continue;let d=u>0?i.min[l]:i.max[l],f=d-u*(t+.03),p=d+.2*u,[m,h]=l===0?[f,e.z]:[e.x,f],[g,_]=l===0?[p,e.z]:[e.x,p];xt(n,m,h,Math.min(e.y,s-2)+j,s+1.8)&&xt(n,g,_,s+j,s+1.8)&&(a={side:o,top:s,hang:f})}}return a})(e,n);i?((e,t,n)=>{F(e,T.HANG),e.wall=t.side,e.edge=M(t.top),t.side<=2?e.x=t.hang:e.z=t.hang,e.vx=e.vy=e.vz=0,e.jumps=1,e.dashes=n,e.coyote=0,e.buffer=0,e.ev|=E.GRAB})(e,i,r.kit.dashes):((e,t,n)=>{if(!n.fwd)return;let r=N(e.vx,e.vz);if(!(r<4.5))for(let i=1;i<=4;i++){let[a,o]=P[i],s=e.vx*a+e.vz*o,[c,l]=[e.vx-s*a,e.vz-s*o];if(i!==e.wall&&s<=.75*r&&s>=-.2*r&&wt(e,t,i)!==void 0){let t=N(c,l),a=Math.max(t,.9*r)/t;F(e,T.WALLRUN),e.wall=i,[e.vx,e.vz]=[c*a,l*a],e.vy=rt(e.vy,2,3),e.jumps=1,e.dashes=n.kit.dashes,e.coyote=0,e.ev|=E.WALLRUN_START;return}}})(e,n,r)}})(e,i,g),((e,t)=>{t.def.water===void 0||e.y>=Pt(t)-.02||e.mode!==T.GROUND&&e.mode!==T.AIR&&e.mode!==T.CROUCH&&e.mode!==T.SLIDE&&e.mode!==T.WALLRUN||(F(e,T.SWIM),e.y=Pt(t),e.vy=0,e.dash=0,e.wall=0)})(e,i),e.slow&&(e.slow--,Ot(e,3)),e.y<i.def.floor&&e.mode!==T.SWIM&&ot(e,i,a,s),e.t=e.mode===_?Math.min(255,e.t+1):e.t,e.buffer=Math.max(0,e.buffer-1),e.mode===T.AIR&&_===T.AIR&&(e.coyote=Math.max(0,e.coyote-1)),e.held=r.keys&(w.JUMP|w.DASH|w.USE),e.ground=st(e.mode),e.x=M(e.x),e.y=M(e.y),e.z=M(e.z),e.vx=M(e.vx),e.vy=M(e.vy),e.vz=M(e.vz),e.edge=M(e.edge)},Rt=class{a=/* @__PURE__ */ new Float64Array(65536);length=0;room(e){let t=this.length+e;if(t>this.a.length){let e=new Float64Array(Math.max(t,2*this.a.length));e.set(this.a),this.a=e}return this.a}push(...e){let t=this.room(e.length);for(let n=0;n<e.length;n++)t[this.length++]=e[n]}slice(e,t){return Array.from(this.a.subarray(e,t))}},zt=(e,t)=>Array.isArray(e)?e:e.room(t),Bt=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],Vt=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],Ht=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],Ut=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n],Wt=e=>{let t=Math.hypot(...e)||1;return[e[0]/t,e[1]/t,e[2]/t]},Gt=-1.25,Kt=-1.12,qt=-1.42,[Jt,Yt]=[-1.45,.04],[Xt,Zt]=[-1.36,1e-4],Qt=-1.06,$t=-1.17,en=-1.19,tn=-1.135,nn=-.94,rn=(e,t,n=0)=>{let[r,i,a,o,s,c]=[e,t,n].flatMap(e=>[Math.sin(e),Math.cos(e)]),l=[i,0,-r],u=[r*a,o,i*a];return[l.map((e,t)=>e*c-u[t]*s),u.map((e,t)=>e*c+l[t]*s),[-r*o,a,-i*o]]},an=(e,t,n=[0,0,0])=>{let r=[],i=e.filter((t,n)=>!n||Math.hypot(t[0]-e[n-1][0],t[1]-e[n-1][1])>1e-9),a=i.slice(1).map(([e,t],n)=>{let[r,a]=i[n],o=Math.hypot(e-r,t-a);return[(t-a)/o,-(e-r)/o]}),o=i.map(([e],t)=>{let[n,r]=[0,1].map(e=>(a[t-1]?.[e]??0)+(a[t]?.[e]??0)),i=Math.hypot(n,r);return e?[n/i,r/i]:[0,Math.sign(r)]}),s=(e,a)=>{let[s,c]=i[a],[l,u]=[Math.cos(e*Qe/t),Math.sin(e*Qe/t)];r.push(n[0]+s*l,n[1]+s*u,n[2]-c,o[a][0]*l,o[a][0]*u,-o[a][1])};for(let e=1;e<i.length;e++)for(let n=0;n<t;n++)[...i[e-1][0]?[[n,e-1],[n+1,e-1],[n+1,e]]:[],...i[e][0]?[[n,e-1],[n+1,e],[n,e]]:[]].forEach(([e,t])=>s(e,t));return r},on=(e,t,n,[r,i],a)=>{let o=(e,t,n,r)=>Array.from({length:t},(i,a)=>{let o=a*Qe/t/4;return[e*Math.sin(o),n-r*e*Math.cos(o)]});return an([...r?o(t[0],r,0,1):[[0,0]],...t.map((n,r)=>[n,e*r/(t.length-1)]),...i?o(t[t.length-1],i,e,-1).reverse():[[0,e]]],n,a)},sn=(e,[t,n,r])=>Array.from({length:e.length*(10/6)},(i,a)=>{let[o,s]=[Math.floor(a/10),a%10];return s<6?e[6*o+s]:[t,n,-1,r][s-6]}),cn=[[5,1],[7,2],[10,3]],ln=/* @__PURE__ */ new Map,un=(e,t,n,r=[1,1])=>{let[i,a]=cn[e];!e&&n.length>3&&(n=[n[0],n[n.length>>1],n[n.length-1]]);let o=`${e} ${t} ${n} ${r}`,s=ln.get(o);return s||(s=sn(on(t,n,i,r.map(e=>Math.ceil(a*e))),[1,1,1]),ln.set(o,s)),s},dn=(e,t,n,[r,i,a],o,s,c=[1,1,1])=>{let[l,u,d]=typeof s==`number`?[s,s,s]:s,f=l==u&&u==d,[p,m,h,g,_,v,y,b,x]=[...r,...i,...a],ee=n[0]+p*o[0]+g*o[1]+y*o[2],te=n[1]+m*o[0]+_*o[1]+b*o[2],ne=n[2]+h*o[0]+v*o[1]+x*o[2];for(let n=0;n<t.length;n+=10){let[r,i,a]=[t[n]*l,t[n+1]*u,t[n+2]*d],[o,s,S]=[t[n+3],t[n+4],t[n+5]];if(!f){[o,s,S]=[o/l,s/u,S/d];let e=Math.sqrt(o*o+s*s+S*S)||1;[o,s,S]=[o/e,s/e,S/e]}e.push(ee+p*r+g*i-y*a,te+m*r+_*i-b*a,ne+h*r+v*i-x*a,p*o+g*s-y*S,m*o+_*s-b*S,h*o+v*s-x*S,t[n+6]*c[0],t[n+7]*c[1],t[n+8],t[n+9]*c[2])}},fn=(e,t,n)=>{let r=zt(e,0);for(let i=t;n<1&&i<e.length;i+=10)r[i+8]==-2&&(r[i+6]*=n,r[i+7]*=n,r[i+9]*=n)},pn=(e,t)=>{let n=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],r=t.map((t,r)=>t-e[r]*n),i=Math.hypot(...r)||1,[a,o,s]=r.map(e=>e/i);return[[a,o,s],[o*e[2]-s*e[1],s*e[0]-a*e[2],a*e[1]-o*e[0]],e]},mn=(e,t,n,r,i,a,o=1,s)=>{let c=[r[0]-n[0],r[1]-n[1],r[2]-n[2]],l=Math.hypot(...c)||1,[u,d]=typeof o==`number`?[o,o]:o;dn(e,t,n,pn([c[0]/l,c[1]/l,c[2]/l],i),[0,0,0],[u,d,l/a],s)},I=(e,t,n,r,i,a=D.CONCRETE)=>({min:[e,-30,t],max:[n,i,r],top:D.CONCRETE,side:a}),L=([e,t,n],[r,i,a],o,s=o,c)=>({min:[e,t,n],max:[r,i,a],top:o,side:s,tint:c}),hn=(I(4,57.7,24,76,10),I(4,36,24,53.5,10,D.GLASS),I(4,20,24,36,12.4),I(4,-5,24,7,12.4,D.GLASS),I(27,20,47,50,8),I(27,60,47,76,8,D.BRICK),L([9,12.2,39],[19,12.6,47],D.STEEL),[1,2,3,4,5,6].map(e=>L([12,10,53-e],[14,10+.4*e,53-e+1],D.CONCRETE)),L([5,10,42],[5.5,14,42.5],D.STEEL),L([5,10,50],[5.5,14,50.5],D.STEEL),L([8,12.4,24],[20,12.85,24.45],D.STEEL),L([36,8,22],[37,14.5,48],D.PAINT,D.PAINT,[.15,.72,.62]),L([30,8,28],[34,10,32],D.CONCRETE),L([40,8,30],[44,10.2,34],D.PAINT,D.PAINT,[1,.3,.06]),L([28,9.2,44],[35,12,46],D.STEEL,D.PAINT,[.2,.42,1]),L([41.5,7.6,50],[42,8,60],D.STEEL),L([30,8,64],[34,9.6,68],D.PAINT,D.PAINT,[.2,.8,.3]),240),R=[1,.22,.26],gn=[.2,.46,1],_n=[R,gn],vn=[1,.42,.08],yn=[.12,.7,.62],bn=(e,t,n,r,i,a,o)=>L([e,t,n],[r,i,a],D.PAINT,D.PAINT,o),xn=(e,t,n,r,i,a,o,s=-30)=>{let c=Math.ceil((o-a)/.46);return Array.from({length:c},(l,u)=>{let[d,f]=[t+(n-t)*u/c,t+(n-t)*(u+1)/c].sort((e,t)=>e-t),p=a+(o-a)*(u+1)/c;return e===0?L([d,s,r],[f,p,i],D.CONCRETE):L([r,s,d],[i,p,f],D.CONCRETE)})},Sn=(e,t,n,r,i,a,o)=>o.map((o,s)=>L([e+s*n,a,t+s*r],[e+s*n+4,o,t+s*r+i],D.STEEL,D.CONCRETE)),Cn=[I(12,212,52,240,26,D.GLASS),bn(12,26,212,52,26.12,212.5,R),bn(12,26,239.5,52,26.12,240,R),bn(12,26,212.5,12.5,26.12,239.5,R),bn(51.5,26,212.5,52,26.12,239.5,R),bn(11.6,12,222,12,25.8,232,R),bn(28,12,211.4,31,25.5,212,R),L([19,26,222],[22,27.4,225],D.STEEL),L([42,26,222],[45,27.4,225],D.STEEL),L([29,26,229],[35,27.1,229.6],D.CONCRETE),I(6,164,26,201,26,D.GLASS),I(6,134,26,147,26,D.GLASS),I(6,201,26,212,19),I(15,147,26,164,19),L([14,26,164],[15,32,196],D.PAINT,D.PAINT,yn),L([14,18,147],[15,32,164],D.PAINT,D.PAINT,yn),L([14,26,134],[15,32,147],D.PAINT,D.PAINT,yn),...Sn(6,201,7,0,4,19,[21.2,23.4,25]),...[[18,152,22,156,21.2],[18,158,22,162,23.4],[23,160,26,164,25]].map(([e,t,n,r,i])=>L([e,19,t],[n,i,r],D.STEEL,D.CONCRETE)),L([20,26,178],[23,27.3,181],D.STEEL),L([8,26,176],[11,27.2,179],D.STEEL),L([8,26,190],[11,27.3,193],D.STEEL),L([20,26,140],[23,27.3,143],D.STEEL),I(32,186,76,209,19),bn(32,19,207.5,76,19.1,209,R),...Sn(33,209,7,0,3,19,[21.2,23.4,25]),...[[28,196,32,200,21.2],[28,190,32,194,23.4],[26,184,30,188,25]].map(([e,t,n,r,i])=>L([e,-30,t],[n,i,r],D.STEEL,D.CONCRETE)),I(32,166,64,182,21.2,D.GLASS),I(32,140,64,161,19),L([40,21.2,172],[44,22.6,176],D.STEEL),L([52,19,148],[57,20.3,151],D.STEEL),L([38,19,196],[41,20.4,199],D.STEEL),L([60,19,200],[63,20.4,203],D.STEEL),L([52,19,190],[58,20.6,194],D.STEEL),L([66,19,204],[72,20.2,207],D.STEEL),L([56,21.2,170],[60,22.4,174],D.STEEL),L([34,19,152],[37,20.3,156],D.STEEL),...Sn(36,135,18,0,3,15,[17.2,17.2]),...Sn(6.5,129,6,0,4,15,[17.2,19.4,21.6,23.8]),I(76,213,100,240,14.5,D.STEEL),bn(76,14.5,238.5,100,14.6,240,R),I(76,185,100,209,14.5),I(76,138,100,181,14.5,D.GLASS),L([80,15.7,158],[96,17.7,162],D.STEEL,D.PAINT,vn),L([82,14.5,234],[85,15.9,237],D.STEEL),L([91,14.5,190],[94,15.9,193],D.STEEL),L([80,14.5,204],[83,15.6,207],D.STEEL),L([78,14.5,170],[81,15.9,173],D.STEEL),L([92,14.5,146],[95,15.7,149],D.STEEL),L([92,14.5,222],[96,15.8,226],D.STEEL),...xn(0,76,52,226,232,14.5,26),...xn(0,85,76,196,202,14.5,19,14.5)],wn=[I(6,106,62,134,15),I(62,106,100,134,14.5),L([34,15,112],[54,17.2,128],D.CONCRETE),bn(38,17.2,116,50,17.3,124,vn),...[[35,113],[35,126.2],[51,113],[51,126.2]].map(([e,t])=>L([e,17.2,t],[e+.8,21.5,t+.8],D.STEEL)),L([34.6,21.5,112.6],[52.2,21.9,127.4],D.GLASS),L([14,15,114],[17,16.5,117],D.STEEL),L([14,15,123],[17,16.5,126],D.STEEL),L([56,15,114],[59,16.5,117],D.STEEL),L([56,15,123],[59,16.5,126],D.STEEL),L([15.35,25.5,106],[15.85,26,134],D.STEEL),L([70,14.5,108],[70.8,38,108.8],D.STEEL),L([70,14.5,131.2],[70.8,38,132],D.STEEL),L([66,14.5,110],[69,15.9,113],D.STEEL),L([66,14.5,127],[69,15.9,130],D.STEEL)],Tn=(e,t,n)=>[...[16,22,28,34,40].map(n=>[n,26,t,e]),...[19,31,43].map(t=>[t,26,n,e])],En=[[20,26,190],[48,21.2,172],[48,19,200],[88,14.5,198]],Dn=[[21,26,168],[16,26,140],[46,19,144],[36,21.2,178],[58,19,156],[64,19,196],[88,14.5,216],[88,14.5,172],[90,14.5,150]],On=[[19.5,26,179],[46,19,152],[39.5,21.2,172],[88,14.5,186],[88,14.5,207]],kn={armor:!0,name:`Highline`,tag:`Rooftops · 94 × 240 m`,lore:`The towers of an old business district, closed for years, far above streets that still have traffic. Two crews of runners have taken the roofs. Three routes cross between them, and a fall takes you back to your tower.`,brushes:[...Cn,...Cn.map(e=>({...e,min:[e.min[0],e.min[1],hn-e.max[2]],max:[e.max[0],e.max[1],hn-e.min[2]],tint:e.tint===R?gn:e.tint})),...wn],teams:[{base:[32,26,224],spawns:Tn(0,236,231),rack:[30.75,26,217],blade:[38,26,217],rail:[18,26,137],rifle:[48,19,156]},{base:[32,26,16],spawns:Tn(Math.PI,4,9),rack:[30.75,26,23],blade:[38,26,23],rail:[18,26,103],rifle:[48,19,84]}],packs:[...En,...En.map(([e,t,n])=>[e,t,hn-n]),[24,15,112],[24,15,128]],ammo:[...Dn,...Dn.map(([e,t,n])=>[e,t,hn-n]),[12,15,116],[12,15,124]],cells:[...On,...On.map(([e,t,n])=>[e,t,hn-n]),[28,15,120]],vests:[[36,17.2,120],[23,26,136],[23,26,104]],floor:-25,sun:{dir:[.8,.6,0],color:[2.6,2.3,1.8]},sky:[[.04,.2,.72],[.72,.86,.98]],fog:[.72,.86,.98,.0035]},{CONCRETE:An,METAL:jn,STEEL:z,PAINT:Mn}=D,B=(e,t,n,r,i,a,o,s=o,c)=>({min:[e,t,n],max:[r,i,a],top:o,side:s,tint:c}),Nn=(e,t,n,r,i,a)=>({min:[e,t,n],max:[r,i,a]}),Pn=e=>Math.round(10*e)/10,Fn=[0,10.5,13.5,15.5,17],In=e=>[[1,.39],[.93,.71],[.71,.93],[.39,1]].map(([t,n])=>[Pn(t*e),Pn(n*e)]),[[Ln,Rn],[zn,Bn]]=In(22.599999999999998),Vn=.4,Hn=2.48,[V,Un]=[.4,2.48],H=[80,236],Wn=[Nn(111,0,222,125,5,230),Nn(96,0,196,110,5,204)],Gn=[Nn(102,0,223.2,111,3.5,227.2),Nn(98,0,204,102,3.5,227.2)],[[Kn,,qn],[Jn,Yn,Xn],[Zn,,Qn],[$n]]=Gn.flatMap(e=>[e.min,e.max]),er=[[19.8,6.7],[16,13.5]],[[tr,nr],[rr,ir]]=er,ar=[[0,-tr,2,3,2.8],[rr,-10.8,2,3.5,2]],or=[Nn(H[0]-ar[0][2],0,H[1]-tr-1.55,H[0]+ar[0][2],ar[0][3],H[1]-tr-1.25),Nn(116.8,0,Wn[0].max[2]-.3,119.2,Un,Wn[0].max[2]-.1),Nn(101.8,0,Wn[1].min[2]+.1,104.2,Un,Wn[1].min[2]+.3)],sr=e=>[...new Map(e.flatMap(([e,t,n,r])=>[1,-1].flatMap(i=>[1,-1].flatMap(a=>[[e,n,t,r],[t,r,e,n]].map(([e,t,n,r])=>[Math.min(i*e,i*t),Math.min(a*n,a*r),Math.max(i*e,i*t),Math.max(a*n,a*r)])))).map(e=>[`${e}`,e])).values()],U=([e,t,n,r],i,a,o=An,s=o)=>({...B(H[0]+e,i,H[1]+t,H[0]+n,a,H[1]+r,o,s),ghost:!0}),cr=(e,t,n,r,i,a,o)=>{let s=Math.ceil((o-a)/.46);return Array.from({length:s},(c,l)=>{let[u,d]=[t+(n-t)*l/s,t+(n-t)*(l+1)/s].sort((e,t)=>e-t),f=a+(o-a)*(l+1)/s;return e?B(r,a,u,i,f,d,An):B(u,a,r,d,f,i,An)})},lr=[...sr([[12,-ir,rr,ir],[rr,-nr,tr,nr]]).filter(e=>e[1]>-tr).map(e=>U(e,3.1,3.5,jn,z)),...cr(2,H[1]+5.6,H[1]+12,H[0]-1.5,H[0]+1.5,0,3.5).map(e=>({...e,ghost:!0})),U([-3,19,3,tr],3.5,4.6,z,jn),U([-9,12,-2.5,12.5],3.5,4.6,z,Mn),U([2.5,12,9,12.5],3.5,4.6,z,Mn),U([-9.5,-10,-7.5,-8],0,1.4,z),U([7.5,-10,9.5,-8],0,1.4,z),U([7.5,3,10,5.5],0,2.4,z)],ur={BENCH:0,SAMPLES:1,RACKS:2,SCOPE:3,ANALYSER:4,PLANTS:5,LOCKERS:6,SUIT:7},{BENCH:dr,SAMPLES:fr,RACKS:pr,SCOPE:mr,ANALYSER:hr,PLANTS:gr,LOCKERS:_r,SUIT:vr}=ur,yr=[[dr,60.2,230.5,61.2,241.5,0,.95,0],[fr,65,233.5,66.5,238.5,0,.9,0],[pr,98.8,229.3,99.8,234.3,0,3.1,2],[pr,98.8,237.7,99.8,242.7,0,3.1,2],[mr,68.9,250.8,70.1,252,3.5,4.5,3],[hr,89.4,250.8,91.4,252,3.5,4.8,3],[gr,115,222.4,121,223.2,0,2,1],[gr,123.8,226.4,124.6,229.6,0,2,2],[_r,96.4,200.4,97,203.6,0,2.1,0],[vr,108.6,197.4,109.6,198.4,0,2,2]],br=(e,t,n,r,i,a,o=[])=>{let s=(t,n,o)=>e?B(r,o,t,i,a,n,An):B(t,o,r,n,a,i,An);return[...o,[n,n]].flatMap(([e,n],r,i)=>[s(r?i[r-1][1]:t,e,0),...n>e?[s(e,n,Un)]:[]])},xr=({min:[e,,t],max:[n,r,i]},a,o)=>[B(e,4,t,n,r,i,jn,An),...br(0,e,n,t,t+V,4,a[0]),...br(0,e,n,i-V,i,4,a[1]),...br(2,t+V,i-V,e,e+V,4,a[2]),...br(2,t+V,i-V,n-V,n,4),o],Sr=[1,.42,.08],Cr=[...Fn.slice(2).flatMap((e,t)=>In((e=>e<5?22.4:22.4*Math.sqrt(1-((e-5)/12)**2))(Fn[t+1])+.2).map(([n,r])=>U([-n,-r,n,r],Fn[t+1],e))),...sr([[tr,-Rn,Ln,Rn],[rr,nr,zn,Bn],[ir,ir,rr,rr]]).map(e=>U(e,ar.find(([t,n])=>e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3])?.[3]??0,Fn[1])),...[[-Rn,-Ln,-ar[0][2],-tr],[ar[0][2],-Ln,Rn,-tr],[rr,Xn-H[1],zn,-nr],[rr,-Bn,Zn-H[0],qn-H[1]]].map(e=>U(e,0,Fn[1])),...lr,...yr.map(([,e,t,n,r,i,a])=>({...B(e,i,t,n,a,r,z),ghost:!0})),...xr(Wn[0],[[[118,118]],[[116.8,119.2]],[[qn+V,Xn-V]]],B(121.5,0,223.5,123.5,1.2,225.5,Mn,Mn,Sr)),...xr(Wn[1],[[[101.8,104.2]],[[Zn+V,$n-V],[105.8,105.8]]],B(106,0,200.6,108,1.2,202.6,Mn,Mn,Sr)),B(Kn,Un,qn,Jn,Yn,Xn,z,jn),B(Zn,Un,Qn,$n,Yn,Xn,z,jn),B(Zn,0,Xn-V,Jn,Un,Xn,jn),B($n-V,0,qn,Jn,Un,qn+V,jn),B(Zn,0,Qn,Zn+V,Un,qn,jn),B($n-V,0,Qn,$n,Un,qn,jn),...cr(2,214,qn,105,109,0,3.5),...cr(0,108,$n,206,210,0,3.5)],wr={READY:0,ARMED:1,STRUCK:2,COOL:3},Tr=({hall:[e,t]},n,r,i)=>n>e[0]&&n<t[0]&&r>e[1]&&r<t[1]&&i>e[2]&&i<t[2],Er=({hull:[e,,t],post:[[,n]]})=>[[[e-24,n,t-Mr.R],[e+24,n+14,t+Mr.R]],[[e+24,n,t-10],[e+40,n+4,t+10]]],Dr=({hull:[e,,t],post:[[,n]]})=>[t-Mr.R,t+Mr.R].map(t=>[[e-20,n,t],[e+20,n,t],[e+20,n+11,t],[e-20,n+11,t]]),{METAL:Or,STEEL:kr,PAINT:W,GLASS:Ar,GRATE:jr}=D,G=(e,t,n,r,i,a,o,s=o,c)=>({min:[e,t,n],max:[r,i,a],top:o,side:s,tint:c}),Mr={R:44,LOW:-40,TOP:130},K={BARREL:.68,GUN:44,BOOM:16,PANEL:44,SPAN:50,GAP:2,WING:.45,DOME:7,MAST:16},[Nr,Pr]=_n,{STONE:q,CONCRETE:Fr,METAL:Ir,STEEL:Lr,PAINT:Rr}=D,zr=({min:e,max:t})=>Nn(e[0],e[1],280-t[2],t[0],t[1],280-e[2]),Br=[[40,220,13],[13.5,220,13]],Vr=[[106.2,230.4],[103.2,212.4]],Hr=H[1]-2,J=e=>Math.min(Math.max(e,0),1),Y=e=>J(e)*J(e)*(3-2*J(e)),X=(e,t)=>Math.sqrt(e*e+t*t),Ur=[[-100,0,46,.13,.52],[-4,224,36,.12,.67],[110,236,16],[-112,108,14],[236,170,13],[-52,230,10],[80,184,14],[150,250,13],[-36,168,10],[200,152,12],[262,134,14],[240,150,9],[-140,60,12],[-66,60,9],[40,262,10],[118,200,11]],Wr=[[-20,0,-1,0],[192,124,0,-1],[64,236,1,0],[-60,100,0,1]],[Gr,Kr]=[[248,64],[180,200]],qr=[[12,24],[36,60],[72,88],[124,156]],Jr=(()=>{let e=Array.from({length:160},(e,t)=>qr.some(([e,n])=>t>=e-1&&t<=n)?0:Math.min(Math.round(Math.max(26*C(t/17,0,33)+8*C(t/5,0,35)-11,0))/2,6.5));for(let t of[1,-1])for(let n=t>0?1:158;n>=0&&n<160;n+=t)e[n]=Math.min(e[n],e[n-t]+.5);return e.map((e,t)=>{let n=Math.min(t,159-t);return n<4?-6:n<8?-3:e})})(),Yr=e=>e.reduce((e,t,n)=>(e.at(-1)?.[2]===t?e.at(-1)[1]++:e.push([n,1,t]),e),[]),Xr=Yr(Jr),Z=[114,176,2],Zr=[48,144],[Qr,$r]=[3,8],ei=[[27,67,53,93],[.5,67,26.5,93],[56,74,104,133],[96,56,125,90],[98,36,102,40],[28,113,32,117],[30,45,30,45],[135,50,135,50],[50,106,50,106],[35,104,35,104],[115,22,115,22],[45,20,51,62],[114,36,114,36],[141,20,147,66]],ti=[[0,0,4.5],[-14,6,3],[10,-12,3.5],[16,10,2.5],[-8,-16,2.2],[-20,-8,3.8],[6,18,3],[22,-4,2],[-12,20,2.4]].map(([e,t,n])=>[e-50,t+330,n]),ni=[[126,143,131,147,1.2],[130,138.5,135,141.5,2.4],[126,133,131,137,1.2]],ri=[[180,340],[173,346],[186,347]],ii=[Ur[0][0]-4.5,140],ai=[[6,174,2.5],[32.5,156.5,3.1],[67.5,159.5,1.9],[97.5,166,2.8],[128,177.5,3.4],[94,188,2.5],...Array.from({length:36},(e,t)=>{let n=e=>De(t,e,41),r=Math.floor(3*n(1)),[i,a]=r<2?[(r?151:0)+9*n(2),150+122*n(3)]:[5+150*n(2),273+7*n(3)];return[i,a+(r===0&&Math.abs(a-174)<8?16:0),.6+2.4*n(4)*n(4)]}),...ti],oi=(e,t)=>{let n=t=>J((12-Math.abs(t-e))/8)*J((152-t)/4),r=4*Math.floor(t/4);return n(r)+(n(r+4)-n(r))*(t-r)/4},si=[[8,0,28,16],[70,0,90,16],[122,0,139,16],[36,0,60,16],[132,0,156,16]],ci=(e,t)=>{t=Math.abs(t-140);let n=X((e-80)/300,t/360),r=Math.max((n-.78)/.22,0),i=((e,t)=>{let[n,r]=[0,0];for(let[i,a,o,s=.17,c=0]of Ur){let l=X(e-i,t-a),[u,d]=l?[(e-i)/l,(t-a)/l]:[1,0],f=l/o*(.9+.2*C(2.5*u+.37*i,2.5*d+.21*a,9)),p=.03+.045*C(4*u-.1*a,4*d+.1*i,10),m=1-J((f-1-4/o)/.6),h=c?(s+p)*J((f-c)/(1-c))-s:(s+p)*f*f-s;n+=o*(f<1?h:p*m*m),r=Math.max(r,c?J((1.6-f)/(1.5-c)):0)}return[n,r]})(e,t),a=Math.max(Math.abs(e-80)-80,t-140),o=Y((a-12)/48)*(1-.7*Y(r))*(16*C(e/96,t/96,1)+6*C(e/52,t/52,4)+5*C(e/36,t/36,2)+1.4*C(e/22,t/22,3)-14.2);if(a<0){let n=Y((t-16-10*C(e/19,.5,37))/8)*Y(-a/10);for(let[r,i,a,o]of ei)n*=Y((X(Math.max(r-e,e-a,0),Math.max(i-t,t-o,0))-(r<a?6:7.5))/6);o=n*Math.min(Math.max(4.8*C(e/15,t/15,21)-.9,0)+Math.max(3*C(e/31,t/31,23)-.6,0),2.6);let r=Y((10-X(e-Z[0],t-(Z[1]-140)))/8);o=o*(1-r)-Z[2]*r;for(let n of Zr)o+=Qr*J((8+$r-t)/$r)*oi(n,e);o=t<8?0:o}o=(a<0?o:o*(1-i[1]))+i[0]+((e,t,n)=>{let r=(n,r,i)=>n.reduce((n,[a,o,s,c])=>n*Y((X(Math.max(a-e,e-s,0),Math.max(o-t,t-c,0))-r)/i),1);if(n<0){let i=Math.min(Math.max(Math.floor(e),6),Jr.length-7),a=Math.max(...Jr.slice(i-6,i+7),0);return(.6*Math.max(C(e/5,t/5,61)-.42,0)+.25*Math.max(C(e/9,t/9,67)-.5,0))*Y(-n/4)*Y((t-14-a)/3)*r(ei.filter(e=>e[0]===e[2]),7.5,2)*r(ei.filter(e=>e[0]<e[2]),5.7,2)*r(si,5.7,2)}let i=Y(n/4)*(Math.abs(e-80)<96?Y((t-10)/6):1);for(let[n,r,a,o]of Wr){let[s,c]=[e-n,t-r],l=s*a+c*o;i*=Y((X(Math.max(-22-l,l-38,0),Math.max(Math.abs(s*o-c*a)-10,0))-2)/4)}for(let[n,r,a]of Ur)i*=Y((X(e-n,t-r)/a-1.3)/.25);return i*=Y((X(e-Kr[0],t-Kr[1])-40)/20),(.75*Math.max(C(e/5,t/5,61)-.42,0)-.8*Math.max(C(e/7,t/7,63)-.6,0)+.25*(C(e/11,t/11,65)-.5))*i})(e,t,a)*(1-i[1])*(1-Y(r));for(let[n,r,i,a]of Wr){let[s,c]=[e-n,t-r],l=s*i+c*a;o+=5.6*J(Math.min(l/16,(32-l)/12))*J((18-Math.abs(s*a-c*i))/12)}let s=J(X(e-Gr[0],Math.max(t-Gr[1],0))/36);o+=12*(1-s*s)*(1-s*s)+8*Y((36-X(e-Kr[0],t-Kr[1]))/24);let c=10*r*(1+r);if(n>1){let r=28+14*C(e/170,t/170,5)+6*C(e/70,t/70,7),i=10*Y((n-1)/.1);c=(c+r-Math.sqrt((c-r)*(c-r)+i*i))/2*(1-Y((n-1.3)/.35))}return o*=1-.55*Y((16-X(e-44,t-122))/10),Math.max(o,-14.5)+c},li=e=>Math.max(.3*e,Math.min(.5*e,.8)),ui=(e,t,n)=>{let r=t=>De(e,t,131),i=e=>{let[t,n]=[2*r(e)-1,2*r(e+1)-1],i=Math.sqrt(t*t+n*n)||1;return[t/i,n/i]},[a,o]=i(1),[s,c]=[t*(.9+.25*r(3)),t*(.68+.22*r(4))],l=.3*r(9)-.15,[u,d]=i(5),[f,p]=i(7),m=t=>{let n=.8+.28*C(1.1*t[0]+e,1.1*t[2]+.9*t[1],e)+.1*C(2.3*t[0]-e,2.3*t[2]+1.7*t[1],e+1),r=J((.8*(t[0]*u+t[2]*d)+.6*t[1]-.55)/.45),i=J((.954*(t[0]*f+t[2]*p)+.3*t[1]-.4)/.6);return n*(1-.14*r*r)*(1-.16*i*i)},h=(n-li(n))/m([0,1,0]),g=li(n)+.7*n,_=e=>{if(e[1]<0){let t=Math.sqrt(e[0]*e[0]+e[2]*e[2]);return t<1e-6?g:Math.min(_([e[0]/t,0,e[2]/t])/t,g/-e[1])}let t=(e[0]*a+e[2]*o-l*e[1])/s,n=(e[2]*a-e[0]*o-(.15-l)*e[1])/c,r=e[1]*e[1]/(h*h),[i,u]=[t*t+n*n+.65*r,.35*r*r],d=u<1e-12?1/i:(Math.sqrt(i*i+4*u)-i)/(2*u);return Math.sqrt(d)*m(e)};return{reach:_}},di=[.16,.3,.16,.3],fi=({reach:e},t,r,i,a)=>{let o=(n,r)=>{let i=new Float64Array(8*r),a=[0,0,0];for(let o=0;o<8*r;o++){let s=(o%(2*r)+.5)/r-1,c=Math.floor(o/(2*r)),l=Math.sqrt(1+s*s)*(c>1?-1:1),u=(c%2?-s:1)/l,d=(c%2?1:s)/l,f=0,p=1.6*t;for(let t=0;t<8;t++){let t=(f+p)/2,r=Math.sqrt(t*t+n*n);a[0]=t*u/r,a[1]=n/r,a[2]=t*d/r,r<=e(a)+.07?f=t:p=t}i[o]=f}return i},s=(e,t,n)=>{let r=e.length/8,i=Math.abs(t)>=Math.abs(n);if(Math.abs(t)+Math.abs(n)<1e-9)return!0;let a=(1+(i?n/t:-t/n))*r-.5+2*(i?t>0?0:2:n>0?1:3)*r,o=Math.floor(a),s=e[(o+8*r)%(8*r)]*(1-(a-o))+e[(o+1)%(8*r)]*(a-o);return t*t+n*n<=s*s},c=e([0,1,0])-.1,l=Math.max(.07,Math.min(.12,t/12)),u=[],d=i-n+.7,f=[r];for(let e=r;e<c-1e-9;){let t=e<i-1e-9?di[0]:di[1],n=o(e+.03,2),a=Math.min(e===r&&d<c-.3?d:e+.25,c);for(;a<c&&a-e<.9&&o(Math.min(a+.1,c),2).every((e,r)=>Math.abs(e-n[r])<=t);)a=Math.min(a+.1,c);e=c-a<.15?c:a,f.push(e)}let p=f.map((e,t)=>o(t?e:e+.03,8));for(let e=0;e+1<f.length;e++){let[t,n]=[f[e],f[e+1]],r=t<i-1e-9?di[2]:di[3],o=Math.ceil(Math.min(Math.max(...p[e]),Math.max(...p[e+1]))/l)+1,c=2*o+1,d=new Uint8Array(c*c);for(let t=0;t<c;t++)for(let n=0;n<c;n++){let[r,i]=[(t-o)*l,(n-o)*l];d[t+n*c]=s(p[e],r,i)&&s(p[e+1],r,i)?1:0}let m=Math.max(1,Math.round(r/l)),h=(e,t)=>e>=0&&e<c&&t>=0&&t<c&&d[e+t*c]>0,g=new Uint8Array(c*c);for(let e=0;e<c;e++)for(let t=0;t<c;t++)g[e+t*c]=!h(e,t)||h(e-1,t)&&h(e+1,t)&&h(e,t-1)&&h(e,t+1)?0:1;let _=[],v=new Uint8Array(c),y=c>48?2:1;for(let e=0;e<c;e+=y){v.fill(1);for(let t=e;t<c;t++){let n=!1;for(let r=0,i=0;r<=c;r++)v[r]=r<c&&v[r]&&d[t+r*c]?1:0,v[r]||(r-1-i>=2&&t-e>=2&&(t-e)%y===0&&_.push([e,i,t,r-1]),n||=r-1>i,i=r+1);if(!n)break}}let b=new Int32Array((c+1)*(c+1)),x=(e,t,n,r)=>{let[i,a,o,s]=[Math.max(e,0),Math.max(t,0),Math.min(n,c-1)+1,Math.min(r,c-1)+1];return b[o+s*(c+1)]-b[i+s*(c+1)]-b[o+a*(c+1)]+b[i+a*(c+1)]},ee=[];for(let r=0;r<40&&_.length;r++){for(let e=0;e<c;e++)for(let t=0;t<c;t++)b[t+1+(e+1)*(c+1)]=g[t+e*c]+b[t+(e+1)*(c+1)]+b[t+1+e*(c+1)]-b[t+e*(c+1)];let[i,s]=[-1,0];for(let e=0;e<_.length;e++){let t=_[e];if(r&&!ee.some(e=>t[0]<e[2]&&e[0]<t[2]&&t[1]<e[3]&&e[1]<t[3]))continue;let n=(t[2]-t[0])*(t[3]-t[1]),a=r?x(t[0]-m,t[1]-m,t[2]+m,t[3]+m):2,o=r?1e6*a+n:n;a>=2&&o>s&&([i,s]=[e,o])}if(i<0)break;let[d,f,p,h]=_[i];ee.push(_[i]);for(let e=Math.max(d-m,0);e<=Math.min(p+m,c-1);e++)for(let t=Math.max(f-m,0);t<=Math.min(h+m,c-1);t++)g[e+t*c]=0;u.push([(d-o)*l,e?t:a,(f-o)*l,(p-o)*l,n,(h-o)*l])}}return u},pi=(e,t)=>{let[n,r]=[Math.floor(e/4),Math.floor(t/4)],[i,a]=[e/4-n,t/4-r],o=(e,t)=>ci(4*(n+e),4*(r+t)),[s,c]=[o(0,0),o(1,1)];return i>=a?s+(o(1,0)-s)*i+(c-o(1,0))*a:s+(o(0,1)-s)*a+(c-o(0,1))*i},mi=[[32.5,156.5,3.1,3.45,62],[67.5,159.5,1.86,1.84,63],[97.5,166,2.79,2.99,64],[128,177.5,3.41,3.68,65],[-50,330,3.6,2.9,100],[-64,336,2.4,1.9,101],[-14,204,2.4,1.9,110],[176,212,2.8,2.3,111]].map(([e,t,r,i,a])=>((e,t,r,i,a)=>{let o=pi(e,t),s=o+li(i),c=[-3,-2,-1,0,1,2,3].map(e=>.4*r*e),l=c.map(n=>c.map(r=>pi(e+n,t+r))),u=Math.max(Math.min(...l.flat()),o-.55*i),d=Math.max(...l.flat())+n;return{at:[e,o,t],R:r,H:i,s:a,parts:fi(ui(a,r,i),r,u-s,d-s,u-.5-s).map(([n,r,i,a,o,c])=>[e+n,s+r,t+i,e+a,s+o,t+c])}})(e,t,r,i,a)),[Q,hi,gi,_i]=[9,12,-19,7],vi=Ur.filter(e=>e[4]).map(([e,t],n)=>{let r=140+t,i=Array.from({length:2*Q},(e,t)=>{let i=Math.abs(t+.5-Q),a=Math.sqrt(Q*Q-i*i),o=e=>Math.ceil(2*a*(.88+.24*C(i/4,e+.5,60+n)))/2;return[r-Q+t,r-Q+t+1,o(0),o(1)]});return{x:e,z:r,level:ci(e,r),rows:i}}),yi=({x:e,z:t,level:n,rows:r})=>{let i=r.reduce((e,[t,n,r,i])=>{let a=e.at(-1);return a&&a[2]===r&&a[3]===i?a[1]=n:e.push([t,n,r,i]),e},[]),a=r[Q][3],o=(n-gi)/_i;return[B(e-hi,-30,t-hi,e+hi,n,t-Q,q),B(e-hi,-30,t+Q,e+hi,n,t+hi,q),...i.flatMap(([t,r,i,a])=>[B(e-hi,-30,t,e-i,n,r,q),B(e+a,-30,t,e+hi,n,r,q)]),B(e-Q-1.5,-30,t-Q,e+Q+1.5,gi,t+Q,q),...Array.from({length:_i-1},(n,r)=>B(e+a-1.3*(_i-1-r),gi,t-1,e+a-1.3*(_i-2-r),gi+o*(r+1),t+1,q))].map(e=>({...e,ghost:!0}))},bi=(e,t,n,r)=>({...B(e-n,ci(e,t)-6,t-n,e+n,ci(e,t)+r,t+n,q),ghost:!0}),xi={dishes:[...ri,...ri.map(([e,t])=>[e,280-t])],ramps:Wr.flatMap(([e,t,n,r])=>(t?[1,-1]:[1]).map(i=>[e+16*n,140+i*(t+16*r),n,i*r+0])),wreck:ii,pits:vi.flatMap(e=>e.z===140?[e]:[e,{...e,z:280-e.z,rows:e.rows.map(([e,t,n,r])=>[280-t,280-e,n,r]).reverse()}]),bowls:Ur.flatMap(([e,t,n,r=.17])=>(t?[1,-1]:[1]).map(i=>[e,140+i*t,n,r])),crags:mi,sites:ai,pillars:ni,domes:[H,[H[0],280-H[1]]],pads:[...Br,...Br.map(([e,t,n])=>[e,280-t,n])],modules:[...Wn,...Wn.map(zr)],tubes:[...Gn,...Gn.map(zr)],masts:[...Vr,...Vr.map(([e,t])=>[e,280-t])]},Si=([e,t,n])=>[e,t,280-n],Ci=(e,...t)=>[...e,...e.map(Si),...t],wi=[...[B(0,-30,160,160,0,Z[1]-12,q),B(0,-30,Z[1]-12,Z[0]-12,0,Z[1]+12,q),B(Z[0]+12,-30,Z[1]-12,160,0,Z[1]+12,q),B(0,-30,Z[1]+12,160,0,280,q),B(Z[0]-12,-30,Z[1]-12,Z[0]+12,-3,Z[1]+12,q),...Xr.filter(e=>e[2]<0).map(([e,t,n])=>B(e,-30,148+n,e+t,0,160,q)),...Array.from({length:14},(e,t)=>Yr(Jr.map(e=>e<0?2:+(e>t/2))).filter(e=>!e[2]).map(([e,n])=>B(e,-30,148+t/2,e+n,0,t<13?148.5+t/2:160,q))).flat(),...Zr.flatMap(e=>[-12,-10,-8,-6,-4,4,6,8,10].map(e=>[e,e+(e===-4?8:2)]).map(([t,n])=>[e+t,e+n,Qr*Math.min(oi(e,e+t),oi(e,e+n))*(1-.5/$r)-.12]).filter(e=>e[2]>.3).map(([e,t,n])=>B(e,0,148,t,n,148.5,q)))].map(e=>({...e,ghost:!0})),...Cr,{...B(75.25,0,Hr-4.75,84.75,.5,Hr+4.75,Rr,Fr,Nr),ghost:!0},{...B(75.75,.5,Hr-4.25,84.25,1,Hr+4.25,Rr,Fr,Nr),ghost:!0},...Br.map(([e,t,n])=>B(e-n,0,t-n,e+n,.25,t+n,Ir)),...Vr.map(([e,t])=>B(e-.2,0,t-.2,e+.2,10,t+.2,Lr)),B(12,-30,146.75,24,0,148,Rr,q,[1,.42,.08]),...vi.filter(e=>e.z!==140).flatMap(yi),...(e=mi,e.flatMap(e=>e.parts).map(([e,t,n,r,i,a])=>({...B(e,t,n,r,i,a,q),ghost:!0}))),...ri.map(([e,t])=>bi(e,t,.4,6))],Ti=[B(74,-1.5,132,86,0,148,Ir,Lr),B(74,0,132,74.4,1.1,148,Fr),B(85.6,0,132,86,1.1,148,Fr),...ni.map(([e,t,n,r,i])=>({...B(e,-30,t,n,i,r,q),ghost:!0})),{...B(-10,-30,132,0,0,148,q),ghost:!0},{...B(160,-30,132,170,0,148,q),ghost:!0},{...B(ii[0]-3.6,-30,ii[1]-3.6,ii[0]+3.6,gi+3.5,ii[1]+3.6,q),ghost:!0},...vi.filter(e=>e.z===140).flatMap(yi),...xi.ramps.flatMap(([e,t,n,r])=>[-8,8].map(i=>bi(e+i*r,t-i*n,.2,2.2)))],Ei=[...[56,68,80,92,104].map(e=>[e,0,271,0]),...[62,80,98].map(e=>[e,0,267,0])],Di=(e,t)=>{let n=t=>e>140?t:Si(t);return{base:[80,1,e],spawns:t,rack:n([66,0,262]),blade:n([94,0,262]),rifle:n([145,0,191]),rail:n([43,0,158])}},[Oi,ki,Ai]=((e,t,n)=>{let{R:r,LOW:i,TOP:a}=Mr,[o,s,c,l]=[56,104,n-r,n+r],u=[.78,.8,.84],d=[.95,.55,.15],f=[[110.5,t,138.5],[112.5,601.1,141.5]],p=[];for(let u=e-r;u<e+r;u+=4){let d=Math.max(Math.abs(u-e),Math.abs(u+4-e)),f=Math.sqrt(r*r-d*d),m=(e,t,n,r)=>r>n&&p.push({...G(u,e,n,u+4,t,r,Or),ghost:!0});m(t+i,598,n-f,n+f),m(616,t+a,n-f,n+f);let[h,g]=u<s?u+4>o?[c,l]:[n,n]:u<120?[130,150]:[n,n];m(598,616,n-f,Math.min(h,n+f)),m(598,616,Math.max(g,n-f),n+f);let _=Math.sqrt(Math.max(0,(.75*r)**2-d*d));m(t+a,t+a+K.DOME-2,n-_,n+_);let v=K.BARREL*r+3,y=Math.sqrt(Math.max(0,v*v-d*d));m(t+i-K.GUN,t+i,n-y,n+y)}let m=t+i+(a-i)*K.WING,h=K.BOOM+4*(K.PANEL+K.GAP)+3;for(let t of[-1,1]){let[n,i]=[e+t*r,e+t*(r+h)];p.push({...G(Math.min(n,i),m-1.5,138.5,Math.max(n,i),m+1.5,141.5,Or),ghost:!0},{...G(Math.min(n,i),m-K.SPAN/2,139.6,Math.max(n,i),m+K.SPAN/2,140.4,Or),ghost:!0})}p.push({...G(55,t+a+3,133,73,t+a+K.MAST+6,147,Or),ghost:!0});let g=[[s-2.15,t,137],[s-1.85,603.2,143]];return[[G(o,598,c,s,t,l,jr,Or),G(o,614,c,s,616,l,Or),G(o,t,c,o+4,614,l,W,W,u),G(s-4,t,c,s,614,137,W,W,u),G(s-4,t,143,s,614,l,W,W,u),G(s-4,603.2,137,s,614,143,W,W,u),G(o+4,611,c,s-4,614,c+4,kr,kr,d),G(o+4,611,l-4,s-4,614,l,kr,kr,d),G(s,598,130,120,t,150,Or),G(s,604,130,120,605,150,Or),G(s,t,130,120,604,132,W,W,u),G(s,t,148,120,604,150,W,W,u),G(118,t,132,120,604,148,Ar),G(...f[0],...f[1],kr,kr,d),...p],{post:f,hall:[[o,599,c],[120,616,l]],hull:[e,t+i,n,t+a],gun:[e,t+i-K.GUN,n]},{min:g[0],max:g[1]}]})(80,600,140),ji={name:`Tranquility`,tag:`Moon · half gravity`,lore:`A mining base left in a lunar crater, its domes still lit. Two crews fight for it in space helmets, under the Earth and a black sky. Jumps float twice as high, and a rille cuts the base in two.`,brushes:[...wi,...wi.map(e=>({...e,min:[e.min[0],e.min[1],280-e.max[2]],max:[e.max[0],e.max[1],280-e.min[2]],tint:e.tint===Nr?Pr:e.tint})),...Ti,...Oi],teams:[Di(Hr,Ei),Di(280-Hr,Ei.map(([e,t,n])=>[e,t,280-n,Math.PI]))],packs:Ci([[90,0,210],[118,5,226],[30,0,185],[80,3.5,253.5]],[45,0,162],[45,0,118]),ammo:Ci([[50,0,246],[103,5,200],[135,0,190]],[115,0,162],[115,0,118]),cells:Ci([[106.5,3.5,226],[35,0,244]],[80,0,140]),vests:Ci([[107,5,200]],[132.5,2.4,140]),floor:-26,relief:{hole:[0,132,160,148],pits:[...Xr.flatMap(([e,t,n])=>n>0?[[e,148,e+t,148+n],[e,132-n,e+t,132]]:[]),...xi.pits.flatMap(({x:e,rows:t})=>t.map(([t,n,r,i])=>[e-r,t,e+i,n]))],bound:[80,140,300,360],cell:4,at:ci},sun:{dir:[.87996,.40998,.23999],color:[3,2.95,2.85]},sky:[[.002,.002,.006],[.02,.02,.035]],gravity:.5,rovers:[[100,0,178,0],[30,0,255,0],[100,0,102,Math.PI],[30,0,25,Math.PI]],ships:[...Br.map(([e,t])=>[e,.25,t,0]),...Br.map(([e,t])=>[e,.25,280-t,Math.PI])],doors:[...or,...or.map(zr),Ai],scenery:`moon`,helmets:!0,armor:!0,seam:Ee.SEAM,station:ki},Mi={PELVIS:0,SPINE:1,CHEST:2,NECK:3,HEAD:4,CLAVICLE_L:5,ARM_L:6,FOREARM_L:7,HAND_L:8,CLAVICLE_R:9,ARM_R:10,FOREARM_R:11,HAND_R:12,THIGH_L:13,SHIN_L:14,FOOT_L:15,TOE_L:16,THIGH_R:17,SHIN_R:18,FOOT_R:19,TOE_R:20},Ni=Object.keys(Mi).length,Pi=[-1,0,1,2,3,2,5,6,7,2,9,10,11,0,13,14,15,0,17,18,19],Fi=[[0,.98,0],[0,.12,0],[0,.2,0],[0,.22,0],[0,.1,0],[-.04,.17,0],[-.15,0,0],[-.03,-.29,0],[0,-.26,0],[.04,.17,0],[.15,0,0],[.03,-.29,0],[0,-.26,0],[-.1,-.05,0],[0,-.44,0],[0,-.43,0],[0,-.04,-.13],[.1,-.05,0],[0,-.44,0],[0,-.43,0],[0,-.04,-.13]],Ii={MALE:0,FEMALE:1},$=Fi.map(e=>[...e]);$[1]=[0,.115,0],$[2]=[0,.19,0],$[3]=[0,.21,0],$[4]=[0,.095,0],[-1,1].forEach((e,t)=>{$[5+4*t]=[.035*e,.16,0],$[6+4*t]=[.132*e,0,0],$[7+4*t]=[.026*e,-.275,0],$[8+4*t]=[0,-.25,0],$[13+4*t]=[.104*e,-.05,0]});var Li=[Fi,$],Ri=[0,0,0,1],zi=(e=[0,0,0],t=0,n=0)=>({at:e,yaw:t,hips:[0,0,0],rot:Array.from({length:Ni},()=>[...Ri]),...n?{rest:Li[n]}:{}}),Bi=([e,t,n,r],[i,a,o,s])=>[r*i+e*s+t*o-n*a,r*a-e*o+t*s+n*i,r*o+e*a-t*i+n*s,r*s-e*i-t*a-n*o],Vi=([e,t,n],r)=>{let i=Math.sin(r/2);return[e*i,t*i,n*i,Math.cos(r/2)]},Hi=(e,[t,n,r])=>{let[i,a,o,s]=e,[c,l,u]=[2*(a*r-o*n),2*(o*t-i*r),2*(i*n-a*t)];return[t+s*c+a*u-o*l,n+s*l+o*c-i*u,r+s*u+i*l-a*c]},Ui=(e,t,n)=>{let r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],i=r<0?-1:1;if(r*=i,r>.9995){let r=e.map((e,r)=>e+(i*t[r]-e)*n),a=Math.hypot(...r);return r.map(e=>e/a)}let a=Math.acos(r),[o,s]=[Math.sin((1-n)*a),Math.sin(n*a)*i],c=1/Math.sin(a);return e.map((e,n)=>(e*o+t[n]*s)*c)},Wi=e=>{let t=[],n=[],r=Vi([0,1,0],e.yaw),i=e.rest??Li[0];for(let a=0;a<Ni;a++){let o=Pi[a],s=o<0?r:n[o];n[a]=Bi(s,e.rot[a]);let c=Hi(s,a===0?i[0].map((t,n)=>t+e.hips[n]):i[a]),l=o<0?e.at:t[o];t[a]=[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}return{pos:t,rot:n}},Gi=[1,.62],Ki=2.2,qi=e=>{let t=parseInt(l[e].slice(1),16);return[t>>16,t>>8&255,255&t].map(e=>e/255)},Ji=(e,t,n)=>e.flatMap((e,r)=>{if(e.state===Me.DROPPED)return[{team:r,at:[e.x,e.y,e.z],dropped:!0}];if(e.state===Me.CARRIED){let t=n(e.by);return t?[{team:r,at:[t.x,t.y,t.z],by:{id:e.by,yaw:t.yaw,vx:t.vx,vz:t.vz}}]:[]}return[{team:r,at:t[r]}]}),Yi=[[1,0,0],[0,1,0],[0,0,1]],Xi=(e,t,n)=>{let r=zt(e,0);for(let i=t;i<e.length;i+=10)r[i+6]*=n,r[i+7]*=n,r[i+9]*=n,r[i+8]=-2},Zi=(e,t,n,r,[i,a,o])=>{let[s,c,l]=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],[u,d,f]=[r[0]-t[0],r[1]-t[1],r[2]-t[2]],p=[c*f-l*d,l*u-s*f,s*d-c*u],m=Math.hypot(...p)||1;if(Array.isArray(e))for(let s of[t,n,r])e.push(...s,p[0]/m,p[1]/m,p[2]/m,i,a,-1,o);else{let s=e.room(30),c=e.length,l=p[0]/m,u=p[1]/m,d=p[2]/m;for(let e of[t,n,r])s[c++]=e[0],s[c++]=e[1],s[c++]=e[2],s[c++]=l,s[c++]=u,s[c++]=d,s[c++]=i,s[c++]=a,s[c++]=-1,s[c++]=o;e.length=c}},Qi=(e,t,n,r,i)=>{for(let a=0;a<28;a++){let[o,s]=[a,a+1].map(e=>2*e*Math.PI/28),c=(e,n)=>[t[0]+e*Math.cos(n),t[1],t[2]+e*Math.sin(n)];Zi(e,c(n,o),c(r,s),c(r,o),i),Zi(e,c(n,o),c(n,s),c(r,s),i)}},$i=(e,t,n,r)=>{((e,t,n,r)=>{for(let i=0;i<28;i++){let[a,o]=[i,i+1].map(e=>2*e*Math.PI/28);Zi(e,t,[t[0]+n*Math.cos(o),t[1],t[2]+n*Math.sin(o)],[t[0]+n*Math.cos(a),t[1],t[2]+n*Math.sin(a)],r)}})(e,[t[0],t[1]+.04,t[2]],1.5,n.map(e=>.4*e));let i=e.length;Qi(e,[t[0],t[1]+.045,t[2]],1.34,1.5,n),Xi(e,i,Ki*(.75+.25*Math.sin(3*r)))},ea=(e,t,n,[r,i],a,o,s)=>{let c=[-n[2],0,n[0]],l=(e,s)=>{let l=a*e*Math.sin(7*o-5*e),u=i*s*(1-e);return[t[0]+n[0]*r*e+c[0]*l,t[1]-u+.12*r*e*Math.sin(5*o-4*e)*a,t[2]+n[2]*r*e+c[2]*l]};for(let t=0;t<8;t++){let[n,r]=[t/8,(t+1)/8],[i,a,o,c]=[l(n,0),l(r,0),l(r,1),l(n,1)],u=[(a[1]-i[1])*(c[2]-i[2])-(a[2]-i[2])*(c[1]-i[1]),(a[2]-i[2])*(c[0]-i[0])-(a[0]-i[0])*(c[2]-i[2]),(a[0]-i[0])*(c[1]-i[1])-(a[1]-i[1])*(c[0]-i[0])],d=Math.hypot(...u)||1,f=(e,t)=>[e[0]+u[0]/d*.004*t,e[1]+u[1]/d*.004*t,e[2]+u[2]/d*.004*t];for(let t of[1,-1]){let n=[i,a,o,c].map(e=>f(e,t)),[r,l,u,d]=t>0?n:[n[0],n[3],n[2],n[1]];Zi(e,r,l,u,s),Zi(e,r,u,d,s)}}},ta=(e,t,n,r)=>{mn(e,un(1,1,[1,1],[0,0]),t,n,[.6,0,.8],1,.045,[.82,.84,.9]);let i=e.length;dn(e,un(1,0,[1,1]),n,Yi,[0,0,0],.09,r),Xi(e,i,Ki)},na=(e,t,n,r,i)=>{let[a,o,s]=t.at,c=r+1.7*t.team;if(t.by){let{yaw:r,vx:l,vz:u}=t.by,d=-Math.sin(r),f=-Math.cos(r),p=Math.hypot(l,u),[m,h]=i??[[a,o+1.3,s],Vi([0,1,0],r)],g=e=>Hi(h,e).map((e,t)=>m[t]+e),_=g([0,-.4,.2]),v=g([0,1.5499999999999998,.42]),[y,b]=p>1?[-l/p,-u/p]:[-d,-f];ta(e,_,v,n);let x=Math.min(1,p/8);ea(e,v,[y,0,b],[Gi[0]*(.7+.5*x),Gi[1]],.1+.16*x,c,n);return}if(t.dropped){let t=12.9898*a+78.233*s,[i,l]=[Math.cos(t),Math.sin(t)],u=[a+2.3*i,o+.6,s+2.3*l];ta(e,[a,o+.06,s],u,n),ea(e,u,[i,0,l],[.8*Gi[0],.8*Gi[1]],.04,c,n);let d=e.length;Qi(e,[a,o+.045,s],1.4,1.5,n),Xi(e,d,Ki*(.5+.5*Math.abs(Math.sin(5*r))));return}let l=[a,o+2.4,s];ta(e,[a,o,s],l,n);let u=.6+t.team*Math.PI;ea(e,l,[Math.cos(u),0,Math.sin(u)],Gi,.18,c,n)},ra=[[1,0,0],[0,0,1],[0,1,0]],ia=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],aa=(e,t,n,r)=>{let i=ia(Bt(t[1],t[0]),Bt(t[2],t[0])),a=r&&Ht(i,Bt(t[0],r))<0?[...t].reverse():t;for(let t=1;t<a.length-1;t++)Zi(e,a[0],a[t],a[t+1],n)},oa=(e,t,n,r,i=0)=>{let a=t.map((e,t)=>(e+n[t])/2),o=e=>[1&e?n[0]:t[0],2&e?n[1]:t[1],4&e?n[2]:t[2]];for(let t of[[0,1,3,2],[4,5,7,6],[0,1,5,4],[2,3,7,6],[0,2,6,4],[1,3,7,5]].filter((e,t)=>!(i>>t&1)))aa(e,t.map(o),r,a)},sa=(e,t,n)=>{let r=e.length;n(),Xi(e,r,t)};export{Vn as $,be as $n,Ye as $t,gi as A,b as An,it as At,Tr as B,le as Bn,Et as Bt,Ui as C,se as Cn,mn as Ct,xi as D,r as Dn,Wt as Dt,ei as E,te as En,Bt as Et,li as F,ce as Fn,lt as Ft,lr as G,ye as Gn,ot as Gt,Er as H,i as Hn,Lt as Ht,ui as I,pe as In,yt as It,ur as J,t as Jn,ut as Jt,er as K,ne as Kn,ht as Kt,Mr as L,de as Ln,Dt as Lt,hi as M,s as Mn,P as Mt,_i as N,o as Nn,Tt as Nt,Jr as O,x as On,Rt as Ot,si as P,S as Pn,jt as Pt,Gn as Q,Ce as Qn,k as Qt,K as R,ue as Rn,tt as Rt,zi as S,d as Sn,dn as St,Hi as T,ie as Tn,un as Tt,Cr as U,Ee as Un,_t as Ut,Dr as V,_e as Vn,ct as Vt,H as W,ve as Wn,et as Wt,Wn as X,oe as Xn,Ke as Xt,yr as Y,p as Yn,dt as Yt,ar as Z,ae as Zn,Ze as Zt,Pi as _,C as _n,on as _t,sa as a,ze as an,v as ar,qt as at,Vi as b,he as bn,sn as bt,na as c,Fe as cn,c as cr,Yt as ct,Qi as d,Pe as dn,en as dt,Re as en,xe as er,kn as et,qi as f,T as fn,tn as ft,Ni as g,De as gn,rn as gt,Mi as h,Ae as hn,pn as ht,aa as i,Be as in,g as ir,$t as it,Q as j,ee as jn,Qe as jt,ji as k,y as kn,zt as kt,Ji as l,Me as ln,Te as lr,Gt as lt,Ii as m,je as mn,Vt as mt,oa as n,Ve as nn,a as nr,Xt as nt,Ki as o,Ne as on,_ as or,Kt as ot,Zi as p,D as pn,nn as pt,Hn as q,n as qn,at as qt,ia as r,He as rn,h as rr,Zt as rt,$i as s,E as sn,l as sr,Jt as st,ra as t,Ie as tn,we as tr,_n as tt,Xi as u,w as un,Qt as ut,Fi as v,ke as vn,fn as vt,Wi as w,re as wn,an as wt,Bi as x,me as xn,Ut as xt,Li as y,ge as yn,Ht as yt,wr as z,fe as zn,gt as zt};