@korial29/tiny-fps 0.106.1 → 0.108.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 +1 -1
- package/dist/index.js +15 -15
- package/dist/local.js +1 -1
- package/dist/server.js +259 -28
- package/dist/types/client/gun.d.ts +7 -3
- package/dist/types/client/input.d.ts +4 -2
- package/dist/types/shared/constants.d.ts +1 -1
- package/dist/types/shared/gun.d.ts +1 -1
- package/dist/types/shared/moon.d.ts +26 -0
- package/dist/types/shared/relief.d.ts +7 -2
- package/dist/types/shared/types.d.ts +2 -2
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -190,7 +190,18 @@ var made = /* @__PURE__ */ new WeakMap();
|
|
|
190
190
|
var raise = (def) => {
|
|
191
191
|
const old = made.get(def);
|
|
192
192
|
if (old) return old;
|
|
193
|
-
const { hole, bound, cell, at } = def;
|
|
193
|
+
const { hole, bound, cell, at, pits = [] } = def;
|
|
194
|
+
const box = pits.reduce((b, q) => [
|
|
195
|
+
Math.min(b[0], q[0]),
|
|
196
|
+
Math.min(b[1], q[1]),
|
|
197
|
+
Math.max(b[2], q[2]),
|
|
198
|
+
Math.max(b[3], q[3])
|
|
199
|
+
], [
|
|
200
|
+
Infinity,
|
|
201
|
+
Infinity,
|
|
202
|
+
-Infinity,
|
|
203
|
+
-Infinity
|
|
204
|
+
]);
|
|
194
205
|
const [cx, cz, a, b] = bound;
|
|
195
206
|
const x0 = Math.floor((cx - a) / cell) * cell;
|
|
196
207
|
const z0 = Math.floor((cz - b) / cell) * cell;
|
|
@@ -210,6 +221,8 @@ var raise = (def) => {
|
|
|
210
221
|
nz,
|
|
211
222
|
h,
|
|
212
223
|
hole,
|
|
224
|
+
pits,
|
|
225
|
+
box,
|
|
213
226
|
bound,
|
|
214
227
|
top
|
|
215
228
|
};
|
|
@@ -218,11 +231,12 @@ var raise = (def) => {
|
|
|
218
231
|
};
|
|
219
232
|
/**
|
|
220
233
|
* The height of the ground at (x, z), or -Infinity where there is none: a world without relief,
|
|
221
|
-
* and inside
|
|
234
|
+
* inside the hole and inside a pit. Each lattice square is two triangles split from node (i, j) to (i + 1, j + 1).
|
|
222
235
|
*/
|
|
223
236
|
var ground = (w, x, z) => {
|
|
224
237
|
const r = w.relief;
|
|
225
|
-
|
|
238
|
+
const pit = (q) => x >= q[0] && x <= q[2] && z >= q[1] && z <= q[3];
|
|
239
|
+
if (!r || x > r.hole[0] && x < r.hole[2] && z > r.hole[1] && z < r.hole[3] || pit(r.box) && r.pits.some(pit)) return -Infinity;
|
|
226
240
|
const u = Math.min(Math.max((x - r.x0) / r.cell, 0), r.nx - 1);
|
|
227
241
|
const v = Math.min(Math.max((z - r.z0) / r.cell, 0), r.nz - 1);
|
|
228
242
|
const i = Math.min(Math.floor(u), r.nx - 2);
|
|
@@ -331,8 +345,8 @@ var KEY = {
|
|
|
331
345
|
BLADE: 512,
|
|
332
346
|
/**
|
|
333
347
|
* Set with FIRE by a double click (the client's choice): the katana's special cut, the special
|
|
334
|
-
* of the cut the keys give (see CUT)
|
|
335
|
-
* Ignored with the other guns.
|
|
348
|
+
* of the cut the keys give (see CUT). Set alone by G with the laser rifle in hand: a grenade from
|
|
349
|
+
* its launcher. Ignored with the other guns.
|
|
336
350
|
*/
|
|
337
351
|
SPECIAL: 1024,
|
|
338
352
|
/**
|
|
@@ -1750,7 +1764,7 @@ var STRIKE = {
|
|
|
1750
1764
|
* unless it is `hot`: its `heat` rises while it fires and falls when it does not (HEAT_MAX).
|
|
1751
1765
|
* - The laser rifle (KEY.RIFLE, `rifled`), filled at its rack on arrival, fires a round from its
|
|
1752
1766
|
* cell (`clip`) each RIFLE_COOL ticks while FIRE is held (STRIKE.LASER). Its rack loads NADE_MAX
|
|
1753
|
-
* grenades too: SPECIAL (
|
|
1767
|
+
* grenades too: SPECIAL (G) launches one (STRIKE.NADE) when `lob` is 0, even during
|
|
1754
1768
|
* a swap of the cell, then `lob` runs NADE_COOL ticks and the rifle holds its fire NADE_HOLD.
|
|
1755
1769
|
* - The trigger: `cool` and `swing` run down, and at 0 a held FIRE charges the gun, with ammo, and
|
|
1756
1770
|
* letting it go fires a ball as strong as the charge (powerOf()), spending as many shots; or it
|
|
@@ -1848,6 +1862,12 @@ var step = (p, i, w, team, armed = true, bodies = []) => {
|
|
|
1848
1862
|
const c = swingOf(p);
|
|
1849
1863
|
if (p.swing && c.ticks - p.swing === c.strike) return STRIKE.CUT;
|
|
1850
1864
|
if (p.wield && !top || p.railed || p.rifled || busy || p.reload || !p.wield && !p.mag) p.charge = 0;
|
|
1865
|
+
if (p.rifled && i.keys & KEY.SPECIAL && !busy && p.nades && !p.lob) {
|
|
1866
|
+
p.nades--;
|
|
1867
|
+
[p.lob, p.cool] = [60, 7];
|
|
1868
|
+
p.shots = p.shots + 1 & 255;
|
|
1869
|
+
return STRIKE.NADE;
|
|
1870
|
+
}
|
|
1851
1871
|
if (i.keys & KEY.FIRE && !busy) {
|
|
1852
1872
|
const late = CUTS[p.cut ?? 0].ticks - (p.swing ?? 0);
|
|
1853
1873
|
const special = !!(i.keys & KEY.SPECIAL) && (!p.swing || !p.heavy && (p.cut ?? 0) < 4 && late <= 18);
|
|
@@ -1856,12 +1876,6 @@ var step = (p, i, w, team, armed = true, bodies = []) => {
|
|
|
1856
1876
|
[p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
|
|
1857
1877
|
launch$1(p);
|
|
1858
1878
|
} else if (p.rifled) {
|
|
1859
|
-
if (i.keys & KEY.SPECIAL && p.nades && !p.lob) {
|
|
1860
|
-
p.nades--;
|
|
1861
|
-
[p.lob, p.cool] = [60, 7];
|
|
1862
|
-
p.shots = p.shots + 1 & 255;
|
|
1863
|
-
return STRIKE.NADE;
|
|
1864
|
-
}
|
|
1865
1879
|
if (!p.cool && p.clip && !p.reload) {
|
|
1866
1880
|
p.rifle--;
|
|
1867
1881
|
p.clip--;
|
|
@@ -3370,6 +3384,139 @@ var RAMPS = [
|
|
|
3370
3384
|
];
|
|
3371
3385
|
/** The ridge east of the arena (x, the z its crest ends at) and the antennas' hill south-east (x, z). */
|
|
3372
3386
|
var [RIDGE, HILL] = [[248, 64], [180, 200]];
|
|
3387
|
+
/** 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. */
|
|
3388
|
+
var STRAIGHT = [
|
|
3389
|
+
[12, 24],
|
|
3390
|
+
[36, 60],
|
|
3391
|
+
[72, 88],
|
|
3392
|
+
[124, 156]
|
|
3393
|
+
];
|
|
3394
|
+
/**
|
|
3395
|
+
* The rille's lip on red's side, a number for each metre of x from 0: how far it is behind z 148,
|
|
3396
|
+
* in half metres. A meander from two octaves of noise, 0 on STRAIGHT, never more than half a
|
|
3397
|
+
* metre from one metre to the next between the ends (so the rim the scenery draws through it is never more than
|
|
3398
|
+
* that from a brush), at most 6.5 m. Under 0, a spur into the rille: only over the last 8 m of
|
|
3399
|
+
* each end, where it closes (a narrower rille is a new jump). Blue's lip is the mirror.
|
|
3400
|
+
*/
|
|
3401
|
+
var LIP = (() => {
|
|
3402
|
+
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));
|
|
3403
|
+
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);
|
|
3404
|
+
return d.map((v, x) => {
|
|
3405
|
+
const e = Math.min(x, 159 - x);
|
|
3406
|
+
return e < 4 ? -6 : e < 8 ? -3 : v;
|
|
3407
|
+
});
|
|
3408
|
+
})();
|
|
3409
|
+
/** Runs of a list of numbers a metre of x apart: first x, metres, value. */
|
|
3410
|
+
var runs = (l) => l.reduce((r, n, x) => {
|
|
3411
|
+
if (r.at(-1)?.[2] === n) r.at(-1)[1]++;
|
|
3412
|
+
else r.push([
|
|
3413
|
+
x,
|
|
3414
|
+
1,
|
|
3415
|
+
n
|
|
3416
|
+
]);
|
|
3417
|
+
return r;
|
|
3418
|
+
}, []);
|
|
3419
|
+
var RUNS = runs(LIP);
|
|
3420
|
+
/** 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. */
|
|
3421
|
+
var HOLLOW = [
|
|
3422
|
+
114,
|
|
3423
|
+
176,
|
|
3424
|
+
2
|
|
3425
|
+
];
|
|
3426
|
+
/**
|
|
3427
|
+
* The mounds by the rille, their middle x: a ramp up to the lip, RISE m long and MOUND m high (21
|
|
3428
|
+
* degrees), 8 m wide with 8 m of flank each side. A rover at speed flies the 16 m to the twin
|
|
3429
|
+
* across and lands on its back.
|
|
3430
|
+
*/
|
|
3431
|
+
var MOUNDS = [48, 144];
|
|
3432
|
+
var [MOUND, RISE] = [3, 8];
|
|
3433
|
+
/**
|
|
3434
|
+
* Where the field stays flat at y 0, x0, z0, x1, z1 with z from the centre line: the landing pad,
|
|
3435
|
+
* the dome with the armoury and the spawns, the modules and tubes, the two rovers, the packs on the
|
|
3436
|
+
* floor, the run-up to each mound. The relief is 0 for 6 m round each (so the lattice's
|
|
3437
|
+
* triangles are level over it) and back to itself 6 m further. The lips need none: the field
|
|
3438
|
+
* starts 12 m behind them.
|
|
3439
|
+
*/
|
|
3440
|
+
var FLATS = [
|
|
3441
|
+
[
|
|
3442
|
+
27,
|
|
3443
|
+
67,
|
|
3444
|
+
53,
|
|
3445
|
+
93
|
|
3446
|
+
],
|
|
3447
|
+
[
|
|
3448
|
+
56,
|
|
3449
|
+
74,
|
|
3450
|
+
104,
|
|
3451
|
+
133
|
|
3452
|
+
],
|
|
3453
|
+
[
|
|
3454
|
+
96,
|
|
3455
|
+
56,
|
|
3456
|
+
125,
|
|
3457
|
+
90
|
|
3458
|
+
],
|
|
3459
|
+
[
|
|
3460
|
+
98,
|
|
3461
|
+
36,
|
|
3462
|
+
102,
|
|
3463
|
+
40
|
|
3464
|
+
],
|
|
3465
|
+
[
|
|
3466
|
+
28,
|
|
3467
|
+
113,
|
|
3468
|
+
32,
|
|
3469
|
+
117
|
|
3470
|
+
],
|
|
3471
|
+
[
|
|
3472
|
+
30,
|
|
3473
|
+
45,
|
|
3474
|
+
30,
|
|
3475
|
+
45
|
|
3476
|
+
],
|
|
3477
|
+
[
|
|
3478
|
+
135,
|
|
3479
|
+
50,
|
|
3480
|
+
135,
|
|
3481
|
+
50
|
|
3482
|
+
],
|
|
3483
|
+
[
|
|
3484
|
+
50,
|
|
3485
|
+
106,
|
|
3486
|
+
50,
|
|
3487
|
+
106
|
|
3488
|
+
],
|
|
3489
|
+
[
|
|
3490
|
+
35,
|
|
3491
|
+
104,
|
|
3492
|
+
35,
|
|
3493
|
+
104
|
|
3494
|
+
],
|
|
3495
|
+
[
|
|
3496
|
+
115,
|
|
3497
|
+
22,
|
|
3498
|
+
115,
|
|
3499
|
+
22
|
|
3500
|
+
],
|
|
3501
|
+
[
|
|
3502
|
+
45,
|
|
3503
|
+
20,
|
|
3504
|
+
51,
|
|
3505
|
+
62
|
|
3506
|
+
],
|
|
3507
|
+
[
|
|
3508
|
+
114,
|
|
3509
|
+
36,
|
|
3510
|
+
114,
|
|
3511
|
+
36
|
|
3512
|
+
],
|
|
3513
|
+
[
|
|
3514
|
+
141,
|
|
3515
|
+
20,
|
|
3516
|
+
147,
|
|
3517
|
+
66
|
|
3518
|
+
]
|
|
3519
|
+
];
|
|
3373
3520
|
/** The boulder field south-west: x, z, radius. */
|
|
3374
3521
|
var FIELD = [
|
|
3375
3522
|
[
|
|
@@ -3422,6 +3569,30 @@ var FIELD = [
|
|
|
3422
3569
|
z + 330,
|
|
3423
3570
|
r
|
|
3424
3571
|
]);
|
|
3572
|
+
/** The east stepping stones in the rille, x0, z0, x1, z1 and the top. */
|
|
3573
|
+
var PILLARS = [
|
|
3574
|
+
[
|
|
3575
|
+
126,
|
|
3576
|
+
143,
|
|
3577
|
+
131,
|
|
3578
|
+
147,
|
|
3579
|
+
1.2
|
|
3580
|
+
],
|
|
3581
|
+
[
|
|
3582
|
+
130,
|
|
3583
|
+
138.5,
|
|
3584
|
+
135,
|
|
3585
|
+
141.5,
|
|
3586
|
+
2.4
|
|
3587
|
+
],
|
|
3588
|
+
[
|
|
3589
|
+
126,
|
|
3590
|
+
133,
|
|
3591
|
+
131,
|
|
3592
|
+
137,
|
|
3593
|
+
1.2
|
|
3594
|
+
]
|
|
3595
|
+
];
|
|
3425
3596
|
/** The three dishes on the hill and the lander wrecked in the Bowl. */
|
|
3426
3597
|
var DISHES = [
|
|
3427
3598
|
[180, 340],
|
|
@@ -3493,9 +3664,20 @@ var BOULDERS = Array.from({ length: 36 }, (_, i) => {
|
|
|
3493
3664
|
return gap > 0 && gap < 1;
|
|
3494
3665
|
}));
|
|
3495
3666
|
/**
|
|
3667
|
+
* How much of a mound's height there is at x, across it: all of it for 4 m each side of its
|
|
3668
|
+
* middle cx, none 8 m further, and none over the spurs that close the rille's east end. Straight
|
|
3669
|
+
* between the lattice's lines, so the ground between two nodes is what at() says.
|
|
3670
|
+
*/
|
|
3671
|
+
var across = (cx, x) => {
|
|
3672
|
+
const f = (u) => c1((12 - Math.abs(u - cx)) / 8) * c1((152 - u) / 4);
|
|
3673
|
+
const x0 = 4 * Math.floor(x / 4);
|
|
3674
|
+
return f(x0) + (f(x0 + 4) - f(x0)) * (x - x0) / 4;
|
|
3675
|
+
};
|
|
3676
|
+
/**
|
|
3496
3677
|
* The height of the crater floor round the arena. Only + - * /, Math.sqrt, Math.abs, min, max, floor
|
|
3497
|
-
* and the integer hash: every engine builds the same lattice.
|
|
3498
|
-
*
|
|
3678
|
+
* and the integer hash: every engine builds the same lattice. In the arena, the field (see FLATS)
|
|
3679
|
+
* and the mounds; exactly 0 for 12 m round it (a rectangle on lattice lines, so between the nodes
|
|
3680
|
+
* too); then rolling hills, the pieces above, then the crater wall: it starts 0.78 of the way to the bound,
|
|
3499
3681
|
* is 20 m high on it and, past it where nobody goes, climbs to a ragged crest of 60 to 95 m and
|
|
3500
3682
|
* falls to the plain at 1.65 of the bound.
|
|
3501
3683
|
*/
|
|
@@ -3503,7 +3685,17 @@ var at$1 = (x, z) => {
|
|
|
3503
3685
|
z = Math.abs(z - 140);
|
|
3504
3686
|
const k = far((x - 80) / 300, z / 360);
|
|
3505
3687
|
const t = Math.max((k - .78) / .22, 0);
|
|
3506
|
-
|
|
3688
|
+
const out = Math.max(Math.abs(x - 80) - 80, z - 140);
|
|
3689
|
+
let h = sm((out - 12) / 48) * (1 - .7 * sm(t)) * (16 * noise(x / 96, z / 96, 1) + 6 * noise(x / 52, z / 52, 4) + 5 * noise(x / 36, z / 36, 2) + 1.4 * noise(x / 22, z / 22, 3) - 14.2);
|
|
3690
|
+
if (out < 0) {
|
|
3691
|
+
let m = sm((z - 16 - 10 * noise(x / 19, .5, 37)) / 8) * sm(-out / 10);
|
|
3692
|
+
for (const [x0, z0, x1, z1] of FLATS) m *= sm((far(Math.max(x0 - x, x - x1, 0), Math.max(z0 - z, z - z1, 0)) - 6) / 6);
|
|
3693
|
+
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);
|
|
3694
|
+
const s = sm((10 - far(x - HOLLOW[0], z - (HOLLOW[1] - 140))) / 8);
|
|
3695
|
+
h = h * (1 - s) - HOLLOW[2] * s;
|
|
3696
|
+
for (const cx of MOUNDS) h += MOUND * c1((8 + RISE - z) / RISE) * across(cx, x);
|
|
3697
|
+
h = z < 8 ? 0 : h;
|
|
3698
|
+
}
|
|
3507
3699
|
for (const [cx, cz, r] of BOWLS) {
|
|
3508
3700
|
const q = far(x - cx, z - cz) / r;
|
|
3509
3701
|
const s = 1 - c1((q - 1 - 4 / r) / .6);
|
|
@@ -3518,7 +3710,7 @@ var at$1 = (x, z) => {
|
|
|
3518
3710
|
h += 12 * (1 - d * d) * (1 - d * d) + 8 * sm((36 - far(x - HILL[0], z - HILL[1])) / 24);
|
|
3519
3711
|
let w = 10 * t * (1 + t);
|
|
3520
3712
|
if (k > 1) w = (w + (k - 1) * 60 * (Math.abs(2 * noise(x / 45, z / 45, 5) - 1) - .5)) * (1 + (k - 1) * (1.2 * noise(x / 90, z / 90, 7) - .6)) * (1 - sm((k - 1.25) / .4));
|
|
3521
|
-
return h + w;
|
|
3713
|
+
return Math.max(h, -14.5) + w;
|
|
3522
3714
|
};
|
|
3523
3715
|
/** The ghost under a drawn rock or mast: a box of half side s from under the ground to h above it. */
|
|
3524
3716
|
var lump = (x, z, s, h) => ({
|
|
@@ -3543,6 +3735,7 @@ var LAYOUT = {
|
|
|
3543
3735
|
/** Red's boulders along its walls and the field's stones; blue's are their mirrors, drawn by the scenery's flip. */
|
|
3544
3736
|
boulders: BOULDERS,
|
|
3545
3737
|
stones: STONES,
|
|
3738
|
+
pillars: PILLARS,
|
|
3546
3739
|
domes: [DOME, [DOME[0], 280 - DOME[1]]],
|
|
3547
3740
|
pads: [PAD, [
|
|
3548
3741
|
PAD[0],
|
|
@@ -3582,7 +3775,33 @@ var both = (l, ...mid) => [
|
|
|
3582
3775
|
];
|
|
3583
3776
|
/** Red's half: z from 140 to 280. */
|
|
3584
3777
|
var half = [
|
|
3585
|
-
|
|
3778
|
+
...[
|
|
3779
|
+
box(0, -30, 160, 160, 0, HOLLOW[1] - 12, STONE),
|
|
3780
|
+
box(0, -30, HOLLOW[1] - 12, HOLLOW[0] - 12, 0, HOLLOW[1] + 12, STONE),
|
|
3781
|
+
box(HOLLOW[0] + 12, -30, HOLLOW[1] - 12, 160, 0, HOLLOW[1] + 12, STONE),
|
|
3782
|
+
box(0, -30, HOLLOW[1] + 12, 160, 0, 280, STONE),
|
|
3783
|
+
box(HOLLOW[0] - 12, -30, HOLLOW[1] - 12, HOLLOW[0] + 12, -3, HOLLOW[1] + 12, STONE),
|
|
3784
|
+
...RUNS.filter((r) => r[2] < 0).map(([x, w, n]) => box(x, -30, 148 + n, x + w, 0, 160, STONE)),
|
|
3785
|
+
...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(x, -30, 148 + k / 2, x + w, 0, k < 13 ? 148.5 + k / 2 : 160, STONE))).flat(),
|
|
3786
|
+
...MOUNDS.flatMap((x) => [
|
|
3787
|
+
-12,
|
|
3788
|
+
-10,
|
|
3789
|
+
-8,
|
|
3790
|
+
-6,
|
|
3791
|
+
-4,
|
|
3792
|
+
4,
|
|
3793
|
+
6,
|
|
3794
|
+
8,
|
|
3795
|
+
10
|
|
3796
|
+
].map((a) => [a, a + (a === -4 ? 8 : 2)]).map(([a, b]) => [
|
|
3797
|
+
x + a,
|
|
3798
|
+
x + b,
|
|
3799
|
+
MOUND * Math.min(across(x, x + a), across(x, x + b)) * (1 - .5 / RISE) - .12
|
|
3800
|
+
]).filter((r) => r[2] > .3).map(([a, b, y]) => box(a, 0, 148, b, y, 148.5, STONE)))
|
|
3801
|
+
].map((b) => ({
|
|
3802
|
+
...b,
|
|
3803
|
+
ghost: true
|
|
3804
|
+
})),
|
|
3586
3805
|
...BASE,
|
|
3587
3806
|
{
|
|
3588
3807
|
...box(75.25, 0, FLAG - 4.75, 84.75, .5, FLAG + 4.75, PAINT, CONCRETE, RED),
|
|
@@ -3621,11 +3840,11 @@ var half = [
|
|
|
3621
3840
|
.08
|
|
3622
3841
|
]),
|
|
3623
3842
|
...STONES.map(([x, z, w, d, h]) => ({
|
|
3624
|
-
...box(x, 0, z, x + w, h, z + d, STONE),
|
|
3843
|
+
...box(x, 0, z, x + w, at$1(x + w / 2, z + d / 2) + h, z + d, STONE),
|
|
3625
3844
|
ghost: true
|
|
3626
3845
|
})),
|
|
3627
3846
|
...BOULDERS.map(([x, z, r]) => ({
|
|
3628
|
-
...box(x - .6 * r, 0, z - .6 * r, x + .6 * r, .75 * r, z + .6 * r, STONE),
|
|
3847
|
+
...box(x - .6 * r, 0, z - .6 * r, x + .6 * r, at$1(x, z) + .75 * r, z + .6 * r, STONE),
|
|
3629
3848
|
ghost: true
|
|
3630
3849
|
})),
|
|
3631
3850
|
...FIELD.map(([x, z, r]) => lump(x, z, .6 * r, .6 * r)),
|
|
@@ -3636,9 +3855,10 @@ var centre = [
|
|
|
3636
3855
|
box(74, -1.5, 132, 86, 0, 148, METAL, STEEL),
|
|
3637
3856
|
box(74, 0, 132, 74.4, 1.1, 148, CONCRETE),
|
|
3638
3857
|
box(85.6, 0, 132, 86, 1.1, 148, CONCRETE),
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3858
|
+
...PILLARS.map(([x0, z0, x1, z1, y]) => ({
|
|
3859
|
+
...box(x0, -30, z0, x1, y, z1, STONE),
|
|
3860
|
+
ghost: true
|
|
3861
|
+
})),
|
|
3642
3862
|
{
|
|
3643
3863
|
...box(-10, -30, 132, 0, 0, 148, STONE),
|
|
3644
3864
|
ghost: true
|
|
@@ -3732,11 +3952,11 @@ var MAPS = {
|
|
|
3732
3952
|
], [
|
|
3733
3953
|
45,
|
|
3734
3954
|
0,
|
|
3735
|
-
|
|
3955
|
+
162
|
|
3736
3956
|
], [
|
|
3737
3957
|
45,
|
|
3738
3958
|
0,
|
|
3739
|
-
|
|
3959
|
+
118
|
|
3740
3960
|
]),
|
|
3741
3961
|
ammo: both([
|
|
3742
3962
|
[
|
|
@@ -3757,11 +3977,11 @@ var MAPS = {
|
|
|
3757
3977
|
], [
|
|
3758
3978
|
115,
|
|
3759
3979
|
0,
|
|
3760
|
-
|
|
3980
|
+
162
|
|
3761
3981
|
], [
|
|
3762
3982
|
115,
|
|
3763
3983
|
0,
|
|
3764
|
-
|
|
3984
|
+
118
|
|
3765
3985
|
]),
|
|
3766
3986
|
cells: both([[
|
|
3767
3987
|
106.5,
|
|
@@ -3780,10 +4000,21 @@ var MAPS = {
|
|
|
3780
4000
|
relief: {
|
|
3781
4001
|
hole: [
|
|
3782
4002
|
0,
|
|
3783
|
-
|
|
4003
|
+
132,
|
|
3784
4004
|
160,
|
|
3785
|
-
|
|
4005
|
+
148
|
|
3786
4006
|
],
|
|
4007
|
+
pits: RUNS.flatMap(([x, w, n]) => n > 0 ? [[
|
|
4008
|
+
x,
|
|
4009
|
+
148,
|
|
4010
|
+
x + w,
|
|
4011
|
+
148 + n
|
|
4012
|
+
], [
|
|
4013
|
+
x,
|
|
4014
|
+
132 - n,
|
|
4015
|
+
x + w,
|
|
4016
|
+
132
|
|
4017
|
+
]] : []),
|
|
3787
4018
|
bound: [
|
|
3788
4019
|
80,
|
|
3789
4020
|
140,
|
|
@@ -209,9 +209,11 @@ export declare const lcd: (ammo: number) => number[];
|
|
|
209
209
|
/**
|
|
210
210
|
* The laser rifle's counter (`n` rounds in its cell), in model space: a trapezoid screen, narrow at
|
|
211
211
|
* the top, set in the sloped back of the housing and turned to the eye, ringed in a line of the
|
|
212
|
-
* digits' colour (cyan, red at 7 or fewer), with the two digits once `shown
|
|
212
|
+
* digits' colour (cyan, red at 7 or fewer), with the two digits once `shown`; under them, when
|
|
213
|
+
* `nades` is given, NADE_MAX orange pips for the launcher's grenades, dim for the spent ones (the
|
|
214
|
+
* user, 2026-11-10). All glow but the dark screen.
|
|
213
215
|
*/
|
|
214
|
-
export declare const scope: (n: number, shown?: boolean) => number[];
|
|
216
|
+
export declare const scope: (n: number, shown?: boolean, nades?: number) => number[];
|
|
215
217
|
/**
|
|
216
218
|
* How a gun is drawn beyond its place: its glow from 0 (off) to 1, the swap under way (0 to 1, -1
|
|
217
219
|
* none), whether its battery or capsule holds any, how far the gun's counter has faded in (0 dark,
|
|
@@ -227,6 +229,8 @@ export interface Lit {
|
|
|
227
229
|
cells?: number[];
|
|
228
230
|
heat?: number;
|
|
229
231
|
hot?: boolean;
|
|
232
|
+
/** The laser rifle's grenades left, shown under its rounds; none shown when absent. */
|
|
233
|
+
nades?: number;
|
|
230
234
|
/** How far the thumb has its button in, 0 to 1. */
|
|
231
235
|
press?: number;
|
|
232
236
|
/** How far the rail gun's capsule is turned on (radians, tune()). */
|
|
@@ -249,7 +253,7 @@ export declare const cellsOf: (p: Pick<PlayerState, "rail" | "cap">) => number[]
|
|
|
249
253
|
* given, and the charge gauge at `level`; its battery (capsule) where the swap has it, its glow and
|
|
250
254
|
* its counter dimmed with `light`, and the spark only when it is all on.
|
|
251
255
|
*/
|
|
252
|
-
export declare const held: (out: number[], pos: Vec3, q: Quat, lod: number, k?: number, ammo?: number, level?: number, kind?: boolean | number, t?: number, { light, swap, empty, screen, digits, cells, heat, hot, press, tune, id, floor, vel, carry, }?: Lit) => void;
|
|
256
|
+
export declare const held: (out: number[], pos: Vec3, q: Quat, lod: number, k?: number, ammo?: number, level?: number, kind?: boolean | number, t?: number, { light, swap, empty, screen, digits, cells, heat, hot, press, tune, nades, id, floor, vel, carry, }?: Lit) => void;
|
|
253
257
|
/** The muzzle of a gun (the rail gun's or the rifle's by `kind`) whose grip is at `at` and whose axes are [right, up, forward]. */
|
|
254
258
|
export declare const tip: (at: Vec3, [, u, f]: Vec3[], kind?: boolean | number) => Vec3;
|
|
255
259
|
/**
|
|
@@ -44,7 +44,8 @@ export interface Controls {
|
|
|
44
44
|
* The KEY bits of the next step, read once per step. Same as `keys`, plus BLADE while the katana
|
|
45
45
|
* is chosen and RAIL while the rail gun is, except for the step right after a double tap: it carries DASH and only the tapped
|
|
46
46
|
* direction, so the dash goes that way whatever else is held, and nothing else is on the wire.
|
|
47
|
-
* The step after a double click carries FIRE and SPECIAL, however short the click was
|
|
47
|
+
* The step after a double click carries FIRE and SPECIAL, however short the click was, but with
|
|
48
|
+
* the rifle chosen; the step after a press of G carries SPECIAL with the rifle chosen: a grenade.
|
|
48
49
|
*/
|
|
49
50
|
take(): number;
|
|
50
51
|
/** One live step of the own player, its state before and after: a katana or a rail gun picked up is chosen, losing every weapon chooses the gun. */
|
|
@@ -57,7 +58,8 @@ export interface Controls {
|
|
|
57
58
|
/**
|
|
58
59
|
* Click the canvas to lock the pointer; while locked the mouse looks, the keys move (WASD, Shift
|
|
59
60
|
* sprints, Space jumps, C crouches, E gets in and out of a rover, a direction key pressed twice within DOUBLE_TAP_MS dashes that
|
|
60
|
-
* way, the left button fires or cuts and a double click cuts the special,
|
|
61
|
+
* way, the left button fires or cuts and a double click cuts the special, G launches a grenade with the
|
|
62
|
+
* rifle, 1, 2 and 3 or the wheel pick
|
|
61
63
|
* the gun, the katana or the rail gun) and M calls `onMute`.
|
|
62
64
|
*/
|
|
63
65
|
export declare const createInput: (canvas: HTMLCanvasElement, onMute?: () => void) => Controls;
|
|
@@ -330,7 +330,7 @@ export declare const RIFLE_HITS = 2;
|
|
|
330
330
|
/**
|
|
331
331
|
* The laser rifle's grenade launcher (the user, 2026-11-10: "a double click and it sends an
|
|
332
332
|
* explosive grenade at range, like on an M16"): the block under the barrel. The rifle's rack loads
|
|
333
|
-
* NADE_MAX grenades with the rounds.
|
|
333
|
+
* NADE_MAX grenades with the rounds. G (KEY.SPECIAL; a double click until the user, 2026-11-10) with the rifle in hand launches
|
|
334
334
|
* one from the eye along the look at NADE_SPEED m/s, NADE_COOL ticks after the last, and the rifle
|
|
335
335
|
* holds its fire NADE_HOLD ticks. It falls under the map's gravity and bursts on the first brush or
|
|
336
336
|
* enemy body, or after NADE_RANGE metres of flight. The burst takes NADE_HP at its centre, falling
|
|
@@ -33,7 +33,7 @@ export type Strike = (typeof STRIKE)[keyof typeof STRIKE];
|
|
|
33
33
|
* unless it is `hot`: its `heat` rises while it fires and falls when it does not (HEAT_MAX).
|
|
34
34
|
* - The laser rifle (KEY.RIFLE, `rifled`), filled at its rack on arrival, fires a round from its
|
|
35
35
|
* cell (`clip`) each RIFLE_COOL ticks while FIRE is held (STRIKE.LASER). Its rack loads NADE_MAX
|
|
36
|
-
* grenades too: SPECIAL (
|
|
36
|
+
* grenades too: SPECIAL (G) launches one (STRIKE.NADE) when `lob` is 0, even during
|
|
37
37
|
* a swap of the cell, then `lob` runs NADE_COOL ticks and the rifle holds its fire NADE_HOLD.
|
|
38
38
|
* - The trigger: `cool` and `swing` run down, and at 0 a held FIRE charges the gun, with ammo, and
|
|
39
39
|
* letting it go fires a ball as strong as the charge (powerOf()), spending as many shots; or it
|
|
@@ -8,6 +8,31 @@ export declare const ZED = 280;
|
|
|
8
8
|
* a sprint 12.6 m, a dash adds about 1.2 m and more. At full gravity those are 4.2 and 6.3 m.
|
|
9
9
|
*/
|
|
10
10
|
export declare const WEST_GAP = 13.5;
|
|
11
|
+
/**
|
|
12
|
+
* The rille's lip on red's side, a number for each metre of x from 0: how far it is behind z 148,
|
|
13
|
+
* in half metres. A meander from two octaves of noise, 0 on STRAIGHT, never more than half a
|
|
14
|
+
* metre from one metre to the next between the ends (so the rim the scenery draws through it is never more than
|
|
15
|
+
* that from a brush), at most 6.5 m. Under 0, a spur into the rille: only over the last 8 m of
|
|
16
|
+
* each end, where it closes (a narrower rille is a new jump). Blue's lip is the mirror.
|
|
17
|
+
*/
|
|
18
|
+
export declare const LIP: number[];
|
|
19
|
+
/** 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. */
|
|
20
|
+
export declare const HOLLOW: number[];
|
|
21
|
+
/**
|
|
22
|
+
* The mounds by the rille, their middle x: a ramp up to the lip, RISE m long and MOUND m high (21
|
|
23
|
+
* degrees), 8 m wide with 8 m of flank each side. A rover at speed flies the 16 m to the twin
|
|
24
|
+
* across and lands on its back.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MOUNDS: number[];
|
|
27
|
+
export declare const MOUND: number, RISE: number;
|
|
28
|
+
/**
|
|
29
|
+
* Where the field stays flat at y 0, x0, z0, x1, z1 with z from the centre line: the landing pad,
|
|
30
|
+
* the dome with the armoury and the spawns, the modules and tubes, the two rovers, the packs on the
|
|
31
|
+
* floor, the run-up to each mound. The relief is 0 for 6 m round each (so the lattice's
|
|
32
|
+
* triangles are level over it) and back to itself 6 m further. The lips need none: the field
|
|
33
|
+
* starts 12 m behind them.
|
|
34
|
+
*/
|
|
35
|
+
export declare const FLATS: number[][];
|
|
11
36
|
export declare const LAYOUT: {
|
|
12
37
|
/** Outside the arena: the boulders (x, z, radius), the dishes, the ramps (the middle of the lip and the unit way up it), the wreck. */
|
|
13
38
|
rocks: number[][];
|
|
@@ -17,6 +42,7 @@ export declare const LAYOUT: {
|
|
|
17
42
|
/** Red's boulders along its walls and the field's stones; blue's are their mirrors, drawn by the scenery's flip. */
|
|
18
43
|
boulders: number[][];
|
|
19
44
|
stones: number[][];
|
|
45
|
+
pillars: number[][];
|
|
20
46
|
domes: number[][];
|
|
21
47
|
pads: number[][];
|
|
22
48
|
shuttles: Bx[];
|
|
@@ -2,8 +2,10 @@ import type { World } from './world';
|
|
|
2
2
|
type Vec3 = [number, number, number];
|
|
3
3
|
type Quad = [number, number, number, number];
|
|
4
4
|
export interface ReliefDef {
|
|
5
|
-
/**
|
|
5
|
+
/** A rectangle with no relief, x0, z0, x1, z1: the brushes are the floor there and a gap between them stays open (the moon's rille). */
|
|
6
6
|
hole: Quad;
|
|
7
|
+
/** More of them, small: the notches in the rille's lips. Absent: none. */
|
|
8
|
+
pits?: Quad[];
|
|
7
9
|
/** The edge nobody crosses, an ellipse: its centre x, z and its half axes along x and z. */
|
|
8
10
|
bound: Quad;
|
|
9
11
|
/** Metres between two nodes. */
|
|
@@ -23,6 +25,9 @@ export interface Relief {
|
|
|
23
25
|
nz: number;
|
|
24
26
|
h: Float32Array;
|
|
25
27
|
hole: Quad;
|
|
28
|
+
/** The definition's pits and the box round them all (none: an empty box). */
|
|
29
|
+
pits: Quad[];
|
|
30
|
+
box: Quad;
|
|
26
31
|
bound: Quad;
|
|
27
32
|
/** The highest node: a ray above it meets no ground. */
|
|
28
33
|
top: number;
|
|
@@ -35,7 +40,7 @@ export declare const noise: (x: number, y: number, s: number) => number;
|
|
|
35
40
|
export declare const raise: (def: ReliefDef) => Relief;
|
|
36
41
|
/**
|
|
37
42
|
* The height of the ground at (x, z), or -Infinity where there is none: a world without relief,
|
|
38
|
-
* and inside
|
|
43
|
+
* inside the hole and inside a pit. Each lattice square is two triangles split from node (i, j) to (i + 1, j + 1).
|
|
39
44
|
*/
|
|
40
45
|
export declare const ground: (w: World, x: number, z: number) => number;
|
|
41
46
|
/** Keeps a body inside the bound: put back on the ellipse, its speed out of it taken away. */
|
|
@@ -39,8 +39,8 @@ export declare const KEY: {
|
|
|
39
39
|
readonly BLADE: 512;
|
|
40
40
|
/**
|
|
41
41
|
* Set with FIRE by a double click (the client's choice): the katana's special cut, the special
|
|
42
|
-
* of the cut the keys give (see CUT)
|
|
43
|
-
* Ignored with the other guns.
|
|
42
|
+
* of the cut the keys give (see CUT). Set alone by G with the laser rifle in hand: a grenade from
|
|
43
|
+
* its launcher. Ignored with the other guns.
|
|
44
44
|
*/
|
|
45
45
|
readonly SPECIAL: 1024;
|
|
46
46
|
/**
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@korial29/tiny-fps",
|
|
3
3
|
"description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.108.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|