@korial29/tiny-fps 0.175.0 → 0.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -20
- package/dist/local.js +1 -1
- package/dist/server.js +158 -66
- package/dist/types/client/announce.d.ts +1 -1
- package/dist/types/client/body.d.ts +6 -0
- package/dist/types/client/combat.d.ts +1 -1
- package/dist/types/client/foley.d.ts +1 -1
- package/dist/types/client/limbs.d.ts +2 -0
- package/dist/types/client/render.d.ts +2 -0
- package/dist/types/client/sfx.d.ts +1 -1
- package/dist/types/shared/constants.d.ts +21 -11
- package/dist/types/shared/kit.d.ts +3 -1
- package/dist/types/shared/physics.d.ts +0 -2
- package/dist/types/shared/protocol.d.ts +2 -0
- package/dist/types/shared/room.d.ts +12 -3
- package/dist/types/shared/tackle.d.ts +8 -2
- package/dist/types/shared/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -182,14 +182,23 @@ var [PUNCH_HITS, PUNCH_STUN, PUNCH_MEMORY] = [
|
|
|
182
182
|
3,
|
|
183
183
|
180
|
|
184
184
|
];
|
|
185
|
-
|
|
186
|
-
var
|
|
187
|
-
9,
|
|
188
|
-
17,
|
|
189
|
-
.3
|
|
190
|
-
];
|
|
191
|
-
var [POUNCE_COOL, POUNCE_FLY] = [48, 40];
|
|
185
|
+
/** 1.4: a step of its burst stays under PLAYER_R, so it cannot tunnel through a thin brush (physics.ts). */
|
|
186
|
+
var XENO_DASH = 1.4;
|
|
192
187
|
var [POUNCE_HP, POUNCE_STUN] = [2, 60];
|
|
188
|
+
/**
|
|
189
|
+
* The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
|
|
190
|
+
* flashes in the xenomorph's vision and to one with the katana in hand, who beheads him on E; E (KEY.USE) within GLORY_REACH metres of him and GLORY_ARC
|
|
191
|
+
* radians of its look locks the two (`lock`, `foe`, as a saber lock) for GLORY_TICKS, where neither
|
|
192
|
+
* moves, then it eats his head: he goes down through his armour (LIMB.EATEN), a frag of FRAG.GLORY.
|
|
193
|
+
*/
|
|
194
|
+
var [GLORY_HP, GLORY_REACH, GLORY_ARC, GLORY_TICKS] = [
|
|
195
|
+
3,
|
|
196
|
+
2.5,
|
|
197
|
+
1,
|
|
198
|
+
54
|
|
199
|
+
];
|
|
200
|
+
/** How much faster than a man the xenomorph runs (the user, 2026-11-16: a little, not twice). */
|
|
201
|
+
var XENO_PACE = 1.25;
|
|
193
202
|
var PLASMA_R = .12;
|
|
194
203
|
/**
|
|
195
204
|
* What a vehicle's bolts take (the user, 2026-11-16: stronger, they grazed like the rifle's rounds):
|
|
@@ -596,7 +605,9 @@ var LIMB = {
|
|
|
596
605
|
ARM_L: 2,
|
|
597
606
|
ARM_R: 3,
|
|
598
607
|
LEG_L: 4,
|
|
599
|
-
LEG_R: 5
|
|
608
|
+
LEG_R: 5,
|
|
609
|
+
/** The head a xenomorph's glory kill ate (GLORY_HP): gone, not thrown. */
|
|
610
|
+
EATEN: 6
|
|
600
611
|
};
|
|
601
612
|
/**
|
|
602
613
|
* How a player went down (bits 5-6 of PlayerState.fell), for the clients' fall: PLAIN as before,
|
|
@@ -697,6 +708,7 @@ var MARINE = {
|
|
|
697
708
|
double: 6,
|
|
698
709
|
wallrun: 75,
|
|
699
710
|
dashes: 1,
|
|
711
|
+
dash: 16,
|
|
700
712
|
haste: 1,
|
|
701
713
|
ammo: 60,
|
|
702
714
|
rail: 240,
|
|
@@ -724,6 +736,7 @@ var KITS = [
|
|
|
724
736
|
double: 6 * 1.3,
|
|
725
737
|
wallrun: 150,
|
|
726
738
|
dashes: 3,
|
|
739
|
+
dash: 16,
|
|
727
740
|
haste: 2,
|
|
728
741
|
ammo: 30,
|
|
729
742
|
rail: 120,
|
|
@@ -744,11 +757,13 @@ var KITS = [
|
|
|
744
757
|
MARINE,
|
|
745
758
|
{
|
|
746
759
|
...MARINE,
|
|
747
|
-
run:
|
|
748
|
-
sprint:
|
|
760
|
+
run: 6 * XENO_PACE,
|
|
761
|
+
sprint: 9 * XENO_PACE,
|
|
749
762
|
jump: 7 * Math.SQRT2,
|
|
750
763
|
double: 6 * Math.SQRT2,
|
|
751
|
-
|
|
764
|
+
dashes: 3,
|
|
765
|
+
dash: 16 * XENO_DASH,
|
|
766
|
+
accel: XENO_PACE,
|
|
752
767
|
ammo: 0,
|
|
753
768
|
rail: 0,
|
|
754
769
|
rifle: 0,
|
|
@@ -1030,7 +1045,8 @@ var gap = (b, x, z) => [x - clamp$3(x, b.min[0], b.max[0]), z - clamp$3(z, b.min
|
|
|
1030
1045
|
* A centre inside a footprint (it never gets there by walking, see below) leaves by the nearest
|
|
1031
1046
|
* side. Returns the whole push, for the caller to take the speed into the wall away.
|
|
1032
1047
|
*
|
|
1033
|
-
* Tunnelling is impossible: a step is at most
|
|
1048
|
+
* Tunnelling is impossible: a step is at most the xenomorph's dash, DASH_SPEED * XENO_DASH / TICK_HZ
|
|
1049
|
+
* = 0.37 m (a man's 0.27), and each push leaves
|
|
1034
1050
|
* the centre at least PLAYER_R = 0.4 m from the footprint of every box it started beside, so a
|
|
1035
1051
|
* step of that size cannot bring the centre across one, however thin. The candidates come from
|
|
1036
1052
|
* near() with twice PLAYER_R, enough for the one push of at most PLAYER_R that matters.
|
|
@@ -1569,9 +1585,11 @@ var clingTo = (p, w, c) => {
|
|
|
1569
1585
|
return false;
|
|
1570
1586
|
};
|
|
1571
1587
|
/**
|
|
1572
|
-
* On a wall
|
|
1573
|
-
*
|
|
1574
|
-
*
|
|
1588
|
+
* On a wall, the wall is its floor (the user, 2026-11-16, to roam it freely): the look's heading
|
|
1589
|
+
* turned onto it is forward, so W climbs looking at the wall, goes along it looking along it and
|
|
1590
|
+
* down it looking away, S the other way, A and D across. Crouch lets go; a jump kicks off it,
|
|
1591
|
+
* straight back when looking at it, else along the look. At a top under the head, climbing pulls
|
|
1592
|
+
* it up onto the top (MODE.CLIMB); down on a floor, it stands.
|
|
1575
1593
|
*/
|
|
1576
1594
|
var cling = (p, w, c) => {
|
|
1577
1595
|
const [nx, nz] = TOWARD[p.wall];
|
|
@@ -1595,10 +1613,15 @@ var cling = (p, w, c) => {
|
|
|
1595
1613
|
}
|
|
1596
1614
|
return;
|
|
1597
1615
|
}
|
|
1598
|
-
const
|
|
1616
|
+
const fw = (c.keys & KEY.FORWARD ? 1 : 0) - (c.keys & KEY.BACK ? 1 : 0);
|
|
1599
1617
|
const s = (c.keys & KEY.RIGHT ? 1 : 0) - (c.keys & KEY.LEFT ? 1 : 0);
|
|
1600
1618
|
const [tx, tz] = [-nz, nx];
|
|
1601
|
-
const
|
|
1619
|
+
const [hu, ha] = [c.fx * nx + c.fz * nz, c.fx * tx + c.fz * tz];
|
|
1620
|
+
const [wu, wa] = [fw * hu - s * ha, fw * ha + s * hu];
|
|
1621
|
+
const n = Math.sqrt(wu * wu + wa * wa);
|
|
1622
|
+
const v = n > 1 ? 8 / n : 8;
|
|
1623
|
+
const up = wu > .05 ? 1 : wu < -.05 ? -1 : 0;
|
|
1624
|
+
const k = wa * v;
|
|
1602
1625
|
const { a, sign } = along(p, p.wall);
|
|
1603
1626
|
if (up > 0 && hold.top < p.y + 1.8) {
|
|
1604
1627
|
const land = hold.face + sign * CLIMB_INSET;
|
|
@@ -1612,7 +1635,7 @@ var cling = (p, w, c) => {
|
|
|
1612
1635
|
}
|
|
1613
1636
|
p.vx = tx * k;
|
|
1614
1637
|
p.vz = tz * k;
|
|
1615
|
-
p.vy = up > 0 && hold.top - p.y <= .45 ? 0 :
|
|
1638
|
+
p.vy = up > 0 && hold.top - p.y <= .45 ? 0 : wu * v;
|
|
1616
1639
|
const pull = Math.min(hold.gap, 4 * DT$2);
|
|
1617
1640
|
p.x += nx * pull;
|
|
1618
1641
|
p.z += nz * pull;
|
|
@@ -1623,36 +1646,6 @@ var cling = (p, w, c) => {
|
|
|
1623
1646
|
p.ev |= EV.LAND;
|
|
1624
1647
|
}
|
|
1625
1648
|
};
|
|
1626
|
-
/** Whether the xenomorph's swing is its tail's (TAILS), not its claws'. */
|
|
1627
|
-
var tailing = (p) => !!p.swing && p.cut !== BLOW.CLAW_L && p.cut !== BLOW.CLAW_R;
|
|
1628
|
-
/**
|
|
1629
|
-
* The xenomorph's dash: DASH held on a floor or a wall, with the dash timer run out, charges a
|
|
1630
|
-
* pounce (`charge`); let go, it leaps toward the keys held (the look with none: the user,
|
|
1631
|
-
* 2026-11-16), at least POUNCE_PITCH up, faster the longer the charge. Anywhere else, or stumbling, the charge is lost.
|
|
1632
|
-
*/
|
|
1633
|
-
var pounce = (p, c) => {
|
|
1634
|
-
if (tailing(p)) return;
|
|
1635
|
-
const ready = !c.stumble && p.dash === 0 && (onFloor(p.mode) || p.mode === MODE.CLING);
|
|
1636
|
-
if (ready && c.keys & KEY.DASH) {
|
|
1637
|
-
p.charge = Math.min((p.charge ?? 0) + 1, 36);
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
if (ready && p.charge) {
|
|
1641
|
-
const v = POUNCE_MIN + (POUNCE_MAX - POUNCE_MIN) * p.charge / 36;
|
|
1642
|
-
const pitch = Math.max(p.pitch, POUNCE_PITCH);
|
|
1643
|
-
const cp = Math.cos(pitch);
|
|
1644
|
-
if (p.mode !== MODE.CLING) p.wall = SIDE$1.NONE;
|
|
1645
|
-
p.ev |= p.mode === MODE.SLIDE ? EV.SLIDE_END : 0;
|
|
1646
|
-
enter(p, MODE.AIR);
|
|
1647
|
-
const [dx, dz] = c.wx || c.wz ? [c.wx, c.wz] : [c.fx, c.fz];
|
|
1648
|
-
p.vx = dx * cp * v;
|
|
1649
|
-
p.vz = dz * cp * v;
|
|
1650
|
-
leap$1(p, Math.sin(pitch) * v);
|
|
1651
|
-
p.dash = POUNCE_COOL;
|
|
1652
|
-
p.ev |= EV.DASH;
|
|
1653
|
-
}
|
|
1654
|
-
p.charge = 0;
|
|
1655
|
-
};
|
|
1656
1649
|
/** Takes hold of a ledge: hang there. */
|
|
1657
1650
|
var grab = (p, l, dashes) => {
|
|
1658
1651
|
enter(p, MODE.HANG);
|
|
@@ -1672,7 +1665,7 @@ var free$1 = (p, w, c) => {
|
|
|
1672
1665
|
const ground = p.mode === MODE.GROUND;
|
|
1673
1666
|
const chain = c.kit.dashes > 1;
|
|
1674
1667
|
if (chain && ground && p.dash === 0) p.dashes = c.kit.dashes;
|
|
1675
|
-
if (
|
|
1668
|
+
if (c.dash && (p.dash === 0 || chain && p.dashes > 0 && p.dash <= 44) && (ground ? !chain || p.dashes > 0 : (p.mode === MODE.AIR || p.mode === MODE.WALLRUN) && p.dashes > 0)) {
|
|
1676
1669
|
const [dx, dz] = c.wx || c.wz ? [c.wx, c.wz] : [c.fx, c.fz];
|
|
1677
1670
|
p.dashes -= +(ground && chain);
|
|
1678
1671
|
if (!ground) {
|
|
@@ -1683,8 +1676,8 @@ var free$1 = (p, w, c) => {
|
|
|
1683
1676
|
p.ev |= EV.WALLRUN_END;
|
|
1684
1677
|
}
|
|
1685
1678
|
}
|
|
1686
|
-
p.vx = dx *
|
|
1687
|
-
p.vz = dz *
|
|
1679
|
+
p.vx = dx * c.kit.dash;
|
|
1680
|
+
p.vz = dz * c.kit.dash;
|
|
1688
1681
|
p.dash = 60;
|
|
1689
1682
|
p.ev |= EV.DASH;
|
|
1690
1683
|
}
|
|
@@ -1814,7 +1807,6 @@ var move = (p, i, w, team = 0, bodies = [], kit = KITS[0]) => {
|
|
|
1814
1807
|
p.dash--;
|
|
1815
1808
|
if (p.dash === 50) cap(p, 10);
|
|
1816
1809
|
}
|
|
1817
|
-
if (kit.xeno && p.mode !== MODE.HANG && p.mode !== MODE.CLIMB && !riding) pounce(p, c);
|
|
1818
1810
|
if (p.mode === MODE.HANG) hang(p, w, c);
|
|
1819
1811
|
if (p.mode === MODE.CLING) cling(p, w, c);
|
|
1820
1812
|
if (p.mode === MODE.CLIMB) climb(p, w);
|
|
@@ -6263,15 +6255,32 @@ var reach$1 = (r, c) => {
|
|
|
6263
6255
|
/** Whether the player's body is a weapon: in a slide, or in the burst of a dash. */
|
|
6264
6256
|
var tackling = (p) => p.mode === MODE.SLIDE || p.dash > 50;
|
|
6265
6257
|
/**
|
|
6266
|
-
* Whether a xenomorph is in the strike of its pounce:
|
|
6267
|
-
*
|
|
6258
|
+
* Whether a xenomorph is in the strike of its pounce: the burst of a dash. Only for a xenomorph:
|
|
6259
|
+
* another's dash runs through an enemy.
|
|
6268
6260
|
*/
|
|
6269
|
-
var pouncing = (p) => p.
|
|
6261
|
+
var pouncing = (p) => p.dash > 50;
|
|
6270
6262
|
/**
|
|
6271
6263
|
* Whether the cylinders of `a` and `b` overlap, with TACKLE_REACH of reach on top: closer than
|
|
6272
6264
|
* two radii and the reach on the floor plane, and their heights (low in a slide) overlap.
|
|
6273
6265
|
*/
|
|
6274
6266
|
var reaches = (a, b) => Math.hypot(a.x - b.x, a.z - b.z) < 1.1 && a.y < b.y + heightOf(b) && b.y < a.y + heightOf(a);
|
|
6267
|
+
/**
|
|
6268
|
+
* The enemy the xenomorph `me` would glory kill with E (room.ts feast()), of `foes` as it sees
|
|
6269
|
+
* them: the nearest one up, in no lock and not seated, with GLORY_HP health or less, within
|
|
6270
|
+
* GLORY_REACH on the floor plane, a body's height above or below, and GLORY_ARC of its look.
|
|
6271
|
+
*/
|
|
6272
|
+
var glory = (me, foes) => {
|
|
6273
|
+
const [fx, fz] = forward(me.yaw);
|
|
6274
|
+
let best;
|
|
6275
|
+
let near = GLORY_REACH;
|
|
6276
|
+
for (const f of foes) {
|
|
6277
|
+
const [dx, dz] = [f.x - me.x, f.z - me.z];
|
|
6278
|
+
const d = Math.hypot(dx, dz);
|
|
6279
|
+
const facing = d < .001 || Math.acos(Math.min(1, (dx * fx + dz * fz) / d)) <= GLORY_ARC;
|
|
6280
|
+
if (!f.down && !f.lock && f.mode !== MODE.RIDE && f.hp <= GLORY_HP && d <= near && Math.abs(f.y - me.y) < 1.8 && facing) [best, near] = [f, d];
|
|
6281
|
+
}
|
|
6282
|
+
return best;
|
|
6283
|
+
};
|
|
6275
6284
|
// src/shared/gun.ts
|
|
6276
6285
|
/** Whether the feet of `p` are within `r` of the point `at` on the floor plane and within PICK_H of its height. */
|
|
6277
6286
|
var within = (p, at, r) => {
|
|
@@ -6400,7 +6409,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6400
6409
|
[p.heavy, p.charge] = [true, 0];
|
|
6401
6410
|
p.swing = swingOf(p, table).ticks;
|
|
6402
6411
|
} else {
|
|
6403
|
-
p.charge = top ? 0 : p.charge;
|
|
6412
|
+
p.charge = top || kit.xeno ? 0 : p.charge;
|
|
6404
6413
|
const s = p.swing ?? 0;
|
|
6405
6414
|
const c = swingOf(p, table);
|
|
6406
6415
|
const blow = PUNCHES[p.cut ?? 0] ?? PUNCHES[0];
|
|
@@ -6514,7 +6523,7 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6514
6523
|
* after a swipe's strike throwing the next at once (BLOW). The right button (KEY.BLADE) strikes with
|
|
6515
6524
|
* the tail as FIRE cuts with the katana (TAILS): by the keys (cutOf()), its special with SPECIAL (a
|
|
6516
6525
|
* double click), which also turns a strike just started into it within SPECIAL_LATE ticks. Not while
|
|
6517
|
-
*
|
|
6526
|
+
* the tail charges, nor with the hands busy (a hang, a climb); on a wall they are free.
|
|
6518
6527
|
*/
|
|
6519
6528
|
var beast = (p, i, fresh, busy) => {
|
|
6520
6529
|
if (busy) return;
|
|
@@ -6552,7 +6561,7 @@ var duel = (p, i) => {
|
|
|
6552
6561
|
p.away = i.keys & (KEY.LEFT | KEY.RIGHT | KEY.BACK) ? Math.min((p.away ?? 0) + 1, 24) : 0;
|
|
6553
6562
|
p.lock = Math.max(1, p.lock - 1);
|
|
6554
6563
|
[p.wield, p.swing, p.charge] = [
|
|
6555
|
-
|
|
6564
|
+
!!p.blade,
|
|
6556
6565
|
0,
|
|
6557
6566
|
0
|
|
6558
6567
|
];
|
|
@@ -8305,7 +8314,9 @@ var FRAG = {
|
|
|
8305
8314
|
RAIL: 3,
|
|
8306
8315
|
NADE: 4,
|
|
8307
8316
|
VEHICLE: 5,
|
|
8308
|
-
CLAW: 6
|
|
8317
|
+
CLAW: 6,
|
|
8318
|
+
/** The xenomorph's pounce that ate his head (GLORY_HP). */
|
|
8319
|
+
GLORY: 7
|
|
8309
8320
|
};
|
|
8310
8321
|
/** A rover's floats, in wire order. */
|
|
8311
8322
|
var ROVER_F = [...[
|
|
@@ -8784,7 +8795,7 @@ var Room = class {
|
|
|
8784
8795
|
else if (struck === STRIKE.NADE) this.shoot(p, input.view, lob(p.state, p.info.team));
|
|
8785
8796
|
Object.assign(p.state, here);
|
|
8786
8797
|
if (use && r && p.state.mode === MODE.RIDE) leave(p.state, r, 1, this.world);
|
|
8787
|
-
else if (use && !this.press(p)) this.enter(p);
|
|
8798
|
+
else if (use && !this.feast(p, input.view) && !this.press(p)) this.enter(p);
|
|
8788
8799
|
}
|
|
8789
8800
|
p.burn = slow ? (p.burn ?? 0) + 1 : 0;
|
|
8790
8801
|
if (slow && !(p.burn % 60)) this.fry(p);
|
|
@@ -8990,8 +9001,8 @@ var Room = class {
|
|
|
8990
9001
|
*/
|
|
8991
9002
|
tackle(p, view) {
|
|
8992
9003
|
const me = p.state;
|
|
8993
|
-
if (
|
|
8994
|
-
this.pin(p, view);
|
|
9004
|
+
if (this.kit(p).xeno) {
|
|
9005
|
+
if (!me.down && pouncing(me) && this.ticks - p.tackled >= 30) this.pin(p, view);
|
|
8995
9006
|
return;
|
|
8996
9007
|
}
|
|
8997
9008
|
if (me.down || !tackling(me) || this.ticks - p.tackled < 30) return;
|
|
@@ -9007,9 +9018,9 @@ var Room = class {
|
|
|
9007
9018
|
p.tackled = this.ticks;
|
|
9008
9019
|
}
|
|
9009
9020
|
/**
|
|
9010
|
-
* A xenomorph's
|
|
9011
|
-
* of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it
|
|
9012
|
-
* ends on him:
|
|
9021
|
+
* A xenomorph's dash `p` meets an enemy who is up, where `p` drew him: he is pinned, POUNCE_HP
|
|
9022
|
+
* of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it went. The burst
|
|
9023
|
+
* ends on him, and the next pin waits TACKLE_COOLDOWN: three dashes in a row are not three pins.
|
|
9013
9024
|
*/
|
|
9014
9025
|
pin(p, view) {
|
|
9015
9026
|
const me = p.state;
|
|
@@ -9018,8 +9029,9 @@ var Room = class {
|
|
|
9018
9029
|
if (!foe) return;
|
|
9019
9030
|
const v = speedOf$1(me);
|
|
9020
9031
|
const [dx, dz] = v > .001 ? [me.vx / v, me.vz / v] : forward(me.yaw);
|
|
9021
|
-
me.dash = Math.min(me.dash,
|
|
9032
|
+
me.dash = Math.min(me.dash, 50);
|
|
9022
9033
|
[me.vx, me.vz] = [me.vx * .2, me.vz * .2];
|
|
9034
|
+
p.tackled = this.ticks;
|
|
9023
9035
|
me.hits = me.hits + 1 & 255;
|
|
9024
9036
|
if (this.harm(foe, POUNCE_HP, p, FRAG.CLAW, felled(FALL$1.STRUCK, dx, dz))) return;
|
|
9025
9037
|
this.drop(foe.info.id);
|
|
@@ -9359,6 +9371,73 @@ var Room = class {
|
|
|
9359
9371
|
foe.state.fried = this.shot(foe, 1, foe.railer, foe.state.x - r.x, foe.state.z - r.z, FRAG.RAIL);
|
|
9360
9372
|
}
|
|
9361
9373
|
/**
|
|
9374
|
+
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up with
|
|
9375
|
+
* GLORY_HP or less, within GLORY_REACH and GLORY_ARC of its look where `p` drew him, and in no
|
|
9376
|
+
* lock, is glory killed. The katana takes his head at once and throws the body back GLORY_PUSH
|
|
9377
|
+
* m/s, the follow-through of a cut across in hand (the user, 2026-11-16). The xenomorph holds
|
|
9378
|
+
* him: the two locked (`lock`, `foe`) for GLORY_TICKS, his flag dropped, `p` brought in a metre
|
|
9379
|
+
* from him; duel() ends it. True when it happened.
|
|
9380
|
+
*/
|
|
9381
|
+
feast(p, view) {
|
|
9382
|
+
const me = p.state;
|
|
9383
|
+
const xeno = this.kit(p).xeno;
|
|
9384
|
+
if (!xeno && !me.wield || me.down || me.stun || me.lock || me.mode === MODE.RIDE) return false;
|
|
9385
|
+
const seen = glory(me, this.enemies(p, view).flatMap((s) => {
|
|
9386
|
+
const q = this.players().find((o) => o.info.id === s.id);
|
|
9387
|
+
const { hp, down, lock, mode } = q?.state ?? s;
|
|
9388
|
+
return q ? [{
|
|
9389
|
+
...s,
|
|
9390
|
+
hp,
|
|
9391
|
+
down,
|
|
9392
|
+
lock,
|
|
9393
|
+
mode
|
|
9394
|
+
}] : [];
|
|
9395
|
+
}));
|
|
9396
|
+
const foe = this.players().find((q) => q.info.id === seen?.id);
|
|
9397
|
+
if (!seen || !foe) return false;
|
|
9398
|
+
const [dx, dz] = [seen.x - me.x, seen.z - me.z];
|
|
9399
|
+
const d = Math.hypot(dx, dz) || 1;
|
|
9400
|
+
if (!xeno) {
|
|
9401
|
+
const c = CUTS[CUT.RIGHT];
|
|
9402
|
+
[me.cut, me.swing, me.heavy, me.charge] = [
|
|
9403
|
+
CUT.RIGHT,
|
|
9404
|
+
c.ticks - c.strike - 1,
|
|
9405
|
+
false,
|
|
9406
|
+
0
|
|
9407
|
+
];
|
|
9408
|
+
me.hits = me.hits + 1 & 255;
|
|
9409
|
+
this.harm(foe, Infinity, p, FRAG.GLORY, felled(FALL$1.STRUCK, dx / d, dz / d));
|
|
9410
|
+
Object.assign(foe.state, {
|
|
9411
|
+
lost: LIMB.HEAD,
|
|
9412
|
+
vx: dx / d * 7,
|
|
9413
|
+
vy: 3,
|
|
9414
|
+
vz: dz / d * 7,
|
|
9415
|
+
ground: false,
|
|
9416
|
+
mode: MODE.AIR
|
|
9417
|
+
});
|
|
9418
|
+
return true;
|
|
9419
|
+
}
|
|
9420
|
+
this.drop(foe.info.id);
|
|
9421
|
+
for (const [a, b] of [[p, foe], [foe, p]]) {
|
|
9422
|
+
Object.assign(a.state, {
|
|
9423
|
+
...FREE,
|
|
9424
|
+
lock: GLORY_TICKS,
|
|
9425
|
+
foe: b.info.id,
|
|
9426
|
+
pressed: true
|
|
9427
|
+
});
|
|
9428
|
+
Object.assign(a.state, {
|
|
9429
|
+
swing: 0,
|
|
9430
|
+
charge: 0,
|
|
9431
|
+
stun: 0,
|
|
9432
|
+
zap: false,
|
|
9433
|
+
vx: 0,
|
|
9434
|
+
vz: 0
|
|
9435
|
+
});
|
|
9436
|
+
}
|
|
9437
|
+
if (d > 1) [me.x, me.z] = [Math.fround(me.x + dx * (d - 1) / d), Math.fround(me.z + dz * (d - 1) / d)];
|
|
9438
|
+
return true;
|
|
9439
|
+
}
|
|
9440
|
+
/**
|
|
9362
9441
|
* A saber lock of `p`, after his input: it ends when a side leads by LOCK_WIN presses (the other
|
|
9363
9442
|
* takes LOCK_HP and the katana's shock, thrown along the winner's look), when one has stepped out
|
|
9364
9443
|
* (LOCK_BREAK ticks of a side or back key: both are free), or when it has run its LOCK_TICKS (both
|
|
@@ -9372,6 +9451,19 @@ var Room = class {
|
|
|
9372
9451
|
Object.assign(q, FREE);
|
|
9373
9452
|
return;
|
|
9374
9453
|
}
|
|
9454
|
+
const [x, y] = [p, o].map((r) => this.kit(r).xeno);
|
|
9455
|
+
if (x !== y) {
|
|
9456
|
+
if (q.lock > 1 && o.state.lock > 1) return;
|
|
9457
|
+
const [eater, prey] = x ? [p, o] : [o, p];
|
|
9458
|
+
Object.assign(q, FREE);
|
|
9459
|
+
Object.assign(o.state, FREE);
|
|
9460
|
+
eater.state.hits = eater.state.hits + 1 & 255;
|
|
9461
|
+
const [dx, dz] = [prey.state.x - eater.state.x, prey.state.z - eater.state.z];
|
|
9462
|
+
const d = Math.hypot(dx, dz) || 1;
|
|
9463
|
+
this.harm(prey, Infinity, eater, FRAG.GLORY, felled(FALL$1.STRUCK, dx / d, dz / d));
|
|
9464
|
+
prey.state.lost = LIMB.EATEN;
|
|
9465
|
+
return;
|
|
9466
|
+
}
|
|
9375
9467
|
const lead = (q.pushes ?? 0) - (o.state.pushes ?? 0);
|
|
9376
9468
|
const out = (q.away ?? 0) >= 24 || (o.state.away ?? 0) >= 24;
|
|
9377
9469
|
if (Math.abs(lead) < 8 && !out && q.lock > 1) return;
|
|
@@ -4,7 +4,7 @@ import type { Beat } from './beats';
|
|
|
4
4
|
/** Seconds between two frags for them to count as a double kill, a multi kill and on. */
|
|
5
5
|
export declare const MULTI = 4;
|
|
6
6
|
/** The lines of the 2nd, 3rd, 4th, 5th frag in quick succession; the last for every one after. */
|
|
7
|
-
export declare const QUICK: (16 | 14 | 18 |
|
|
7
|
+
export declare const QUICK: (16 | 14 | 18 | 15 | 17)[];
|
|
8
8
|
/** Frags without going down between two lines of a run; the last line for every SPREE after. */
|
|
9
9
|
export declare const SPREE = 5;
|
|
10
10
|
export declare const RUNS: (20 | 21 | 22 | 23 | 19)[];
|
|
@@ -161,5 +161,11 @@ export interface Grip {
|
|
|
161
161
|
export declare const hands: (out: Out, s: Solved, build: number, curls: number[], glove: number[], bare: number[], { point, push, to, cup, lights, claws }?: Grip, lite?: boolean, skip?: number) => void;
|
|
162
162
|
/** On a wall run the rail gun is put away, unless its bolt is going out. */
|
|
163
163
|
export declare const stowed: (p: PlayerState) => boolean;
|
|
164
|
+
/**
|
|
165
|
+
* The bite of a glory kill (the user, 2026-11-16, after DOOM 2016) at `lock` ticks left of its
|
|
166
|
+
* GLORY_TICKS: the head drawn back over the first two thirds as the claws hold the prey, then
|
|
167
|
+
* driven down into him; the neck's turn for menace().
|
|
168
|
+
*/
|
|
169
|
+
export declare const devour: (lock: number) => number;
|
|
164
170
|
export declare const createBody: (world?: World) => Body;
|
|
165
171
|
export {};
|
|
@@ -58,6 +58,6 @@ drawn?: (id: number) => Vec3 | undefined,
|
|
|
58
58
|
voice?: (id: number) => number,
|
|
59
59
|
/** A player's own voice in the players' sprite (speakerOf()). */
|
|
60
60
|
speaker?: (id: number) => number,
|
|
61
|
-
/** Whether a player is a xenomorph: its own cries, its acid, its hiss
|
|
61
|
+
/** Whether a player is a xenomorph: its own cries, its acid, its hiss at a tail's charge, its shriek at a dash. */
|
|
62
62
|
beast?: (id: number) => boolean) => Combat;
|
|
63
63
|
export {};
|
|
@@ -29,5 +29,5 @@ export declare const PAWS: number[];
|
|
|
29
29
|
/** The rover: a sideways slide from this speed (m/s) skids, and is at its loudest this much over it. */
|
|
30
30
|
export declare const SKID_FROM = 2.5;
|
|
31
31
|
export declare const createFoley: (a: Audio,
|
|
32
|
-
/** Whether a player is a xenomorph: chitin feet that click, and a shriek for its
|
|
32
|
+
/** Whether a player is a xenomorph: chitin feet that click, and a shriek for its dash. */
|
|
33
33
|
beast?: (id: number) => boolean) => Foley;
|
|
@@ -14,6 +14,8 @@ export type Ground = (x: number, y: number, z: number) => number;
|
|
|
14
14
|
export declare const ground: (world: World | undefined, y0: number) => Ground;
|
|
15
15
|
export interface Piece {
|
|
16
16
|
limb: number;
|
|
17
|
+
/** The head a xenomorph ate (LIMB.EATEN): the stump is drawn, raw and unlit, not the piece. */
|
|
18
|
+
eaten?: boolean;
|
|
17
19
|
/** The joints in the pose of the cut, which the limb is skinned with, and its middle then. */
|
|
18
20
|
s: ReturnType<typeof solve>;
|
|
19
21
|
c: Vec3;
|
|
@@ -153,6 +153,8 @@ export interface Renderer {
|
|
|
153
153
|
parried(id: number, late: number): void;
|
|
154
154
|
/** The xenomorph's vision (the own player is one): a grey-blue world, the enemies in sight glowing. */
|
|
155
155
|
vision(on: boolean): void;
|
|
156
|
+
/** The own katana in hand (the user, 2026-11-16): an enemy it could glory kill flashes. */
|
|
157
|
+
edge(on: boolean): void;
|
|
156
158
|
/** The body of each player (PlayerInfo.body, BODY), from the roster: the man's for one not in it; and the skin and haircut he picked, his id's for one not in `looks`. */
|
|
157
159
|
wear(builds: ReadonlyMap<number, number>, looks?: ReadonlyMap<number, Choice>): void;
|
|
158
160
|
/**
|
|
@@ -120,7 +120,7 @@ export declare const SOUND: {
|
|
|
120
120
|
readonly STRIKE: 59;
|
|
121
121
|
/**
|
|
122
122
|
* The xenomorph's own (the user, 2026-11-16: not a runner's): a hiss with a growl under it as it
|
|
123
|
-
* charges
|
|
123
|
+
* charges its tail, a shriek as it dashes, its claws' swipe and the whip of its tail, a screech of
|
|
124
124
|
* pain and a big roar going down, its footfall (claws, wet pad, weight) at each step, the sizzle of
|
|
125
125
|
* its acid blood, a roar after a kill, and the heavier footfall of a landing.
|
|
126
126
|
*/
|
|
@@ -258,23 +258,33 @@ export declare const TAIL_LEAP = 10;
|
|
|
258
258
|
export declare const PUNCH_HITS: number, PUNCH_STUN: number, PUNCH_MEMORY: number;
|
|
259
259
|
/**
|
|
260
260
|
* The xenomorph (the user, 2026-11-15; kit.ts). XENO_HP health. It clings to a wall it faces with
|
|
261
|
-
* forward and the sprint held (MODE.CLING, physics.ts; the sprint since the user, 2026-11-16):
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* whose katana or fists hit it loses ACID_HP.
|
|
261
|
+
* forward and the sprint held (MODE.CLING, physics.ts; the sprint since the user, 2026-11-16):
|
|
262
|
+
* CLING_SPEED m/s up, down or along it (faster than a man runs, the user 2026-11-16: it was slow)
|
|
263
|
+
* while the wall rises CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP
|
|
264
|
+
* m/s. It dashes as a man does, XENO_DASH times as fast so as far, three in a row (kit.ts; the
|
|
265
|
+
* user, 2026-11-16: no more charged pounce); an enemy its dash's burst reaches is pinned (room.ts):
|
|
266
|
+
* POUNCE_HP health, his flag dropped, a stumble of POUNCE_STUN ticks, once per TACKLE_COOLDOWN. An
|
|
267
|
+
* enemy whose katana or fists hit it loses ACID_HP.
|
|
268
268
|
*/
|
|
269
269
|
export declare const XENO_HP = 12;
|
|
270
|
-
export declare const CLING_SPEED =
|
|
270
|
+
export declare const CLING_SPEED = 8;
|
|
271
271
|
export declare const CLING_FACING = 0.6;
|
|
272
272
|
export declare const CLING_HOLD = 0.4;
|
|
273
273
|
export declare const CLING_LEAP = 10;
|
|
274
|
-
|
|
275
|
-
export declare const
|
|
276
|
-
export declare const POUNCE_COOL: number, POUNCE_FLY: number;
|
|
274
|
+
/** 1.4: a step of its burst stays under PLAYER_R, so it cannot tunnel through a thin brush (physics.ts). */
|
|
275
|
+
export declare const XENO_DASH = 1.4;
|
|
277
276
|
export declare const POUNCE_HP: number, POUNCE_STUN: number;
|
|
277
|
+
/**
|
|
278
|
+
* The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
|
|
279
|
+
* flashes in the xenomorph's vision and to one with the katana in hand, who beheads him on E; E (KEY.USE) within GLORY_REACH metres of him and GLORY_ARC
|
|
280
|
+
* radians of its look locks the two (`lock`, `foe`, as a saber lock) for GLORY_TICKS, where neither
|
|
281
|
+
* moves, then it eats his head: he goes down through his armour (LIMB.EATEN), a frag of FRAG.GLORY.
|
|
282
|
+
*/
|
|
283
|
+
export declare const GLORY_HP: number, GLORY_REACH: number, GLORY_ARC: number, GLORY_TICKS: number;
|
|
284
|
+
/** The katana's glory kill (room.ts feast()): the speed it throws the beheaded body back at. */
|
|
285
|
+
export declare const GLORY_PUSH = 7;
|
|
286
|
+
/** How much faster than a man the xenomorph runs (the user, 2026-11-16: a little, not twice). */
|
|
287
|
+
export declare const XENO_PACE = 1.25;
|
|
278
288
|
export declare const ACID_HP = 1;
|
|
279
289
|
/** Shots the rack loads. */
|
|
280
290
|
export declare const AMMO_MAX = 60;
|
|
@@ -14,6 +14,8 @@ export interface Kit {
|
|
|
14
14
|
wallrun: number;
|
|
15
15
|
/** Dashes in a row before the full DASH_COOLDOWN; 1 is the old rule: one in the air, any on the ground. */
|
|
16
16
|
dashes: number;
|
|
17
|
+
/** A dash's burst, m/s: its length goes with it, the burst's ticks being everyone's. */
|
|
18
|
+
dash: number;
|
|
17
19
|
/** Swing ticks the katana runs down per step. */
|
|
18
20
|
haste: number;
|
|
19
21
|
/** What the racks fill and the packs top up to: the gun's shots, the rail gun's lightning, the rifle's rounds. */
|
|
@@ -41,7 +43,7 @@ export interface Kit {
|
|
|
41
43
|
gear: boolean;
|
|
42
44
|
/**
|
|
43
45
|
* The xenomorph's body: claws and a tail for weapons (PUNCHES from BLOW.CLAW_L), clinging to the
|
|
44
|
-
* walls (MODE.CLING),
|
|
46
|
+
* walls (MODE.CLING), a dash's burst that pins an enemy it reaches, acid for blood (room.ts).
|
|
45
47
|
*/
|
|
46
48
|
xeno: boolean;
|
|
47
49
|
}
|
|
@@ -105,8 +105,6 @@ export declare const floored: (p: Pick<PlayerState, "zap" | "stun">) => boolean;
|
|
|
105
105
|
* two steps. The katana's shock calls it with its own ticks and knock.
|
|
106
106
|
*/
|
|
107
107
|
export declare const stumble: (p: PlayerState, dx: number, dz: number, ticks?: number, knock?: number) => void;
|
|
108
|
-
/** Whether the xenomorph's swing is its tail's (TAILS), not its claws'. */
|
|
109
|
-
export declare const tailing: (p: Pick<PlayerState, "swing" | "cut">) => boolean;
|
|
110
108
|
/**
|
|
111
109
|
* Applies one input for 1 / TICK_HZ s, in place: yaw and pitch from the input (pitch clamped to
|
|
112
110
|
* MAX_PITCH), then the step of the current mode (see the top of the file). Feet under the world's
|
|
@@ -104,9 +104,9 @@ export declare class Room {
|
|
|
104
104
|
*/
|
|
105
105
|
private tackle;
|
|
106
106
|
/**
|
|
107
|
-
* A xenomorph's
|
|
108
|
-
* of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it
|
|
109
|
-
* ends on him:
|
|
107
|
+
* A xenomorph's dash `p` meets an enemy who is up, where `p` drew him: he is pinned, POUNCE_HP
|
|
108
|
+
* of health, his flag dropped and a stumble of POUNCE_STUN thrown the way it went. The burst
|
|
109
|
+
* ends on him, and the next pin waits TACKLE_COOLDOWN: three dashes in a row are not three pins.
|
|
110
110
|
*/
|
|
111
111
|
private pin;
|
|
112
112
|
/** The class `p` plays on this map (kit.ts). */
|
|
@@ -183,6 +183,15 @@ export declare class Room {
|
|
|
183
183
|
private rail;
|
|
184
184
|
/** 1 hp of the bolt's drain to `foe`, as his railer deals it; if it puts him down he is disintegrated (`fried`). */
|
|
185
185
|
private fry;
|
|
186
|
+
/**
|
|
187
|
+
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up with
|
|
188
|
+
* GLORY_HP or less, within GLORY_REACH and GLORY_ARC of its look where `p` drew him, and in no
|
|
189
|
+
* lock, is glory killed. The katana takes his head at once and throws the body back GLORY_PUSH
|
|
190
|
+
* m/s, the follow-through of a cut across in hand (the user, 2026-11-16). The xenomorph holds
|
|
191
|
+
* him: the two locked (`lock`, `foe`) for GLORY_TICKS, his flag dropped, `p` brought in a metre
|
|
192
|
+
* from him; duel() ends it. True when it happened.
|
|
193
|
+
*/
|
|
194
|
+
private feast;
|
|
186
195
|
/**
|
|
187
196
|
* A saber lock of `p`, after his input: it ends when a side leads by LOCK_WIN presses (the other
|
|
188
197
|
* takes LOCK_HP and the katana's shock, thrown along the winner's look), when one has stepped out
|
|
@@ -2,8 +2,8 @@ import type { PlayerState } from './types';
|
|
|
2
2
|
/** Whether the player's body is a weapon: in a slide, or in the burst of a dash. */
|
|
3
3
|
export declare const tackling: (p: PlayerState) => boolean;
|
|
4
4
|
/**
|
|
5
|
-
* Whether a xenomorph is in the strike of its pounce:
|
|
6
|
-
*
|
|
5
|
+
* Whether a xenomorph is in the strike of its pounce: the burst of a dash. Only for a xenomorph:
|
|
6
|
+
* another's dash runs through an enemy.
|
|
7
7
|
*/
|
|
8
8
|
export declare const pouncing: (p: PlayerState) => boolean;
|
|
9
9
|
/**
|
|
@@ -11,3 +11,9 @@ export declare const pouncing: (p: PlayerState) => boolean;
|
|
|
11
11
|
* two radii and the reach on the floor plane, and their heights (low in a slide) overlap.
|
|
12
12
|
*/
|
|
13
13
|
export declare const reaches: (a: PlayerState, b: PlayerState) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The enemy the xenomorph `me` would glory kill with E (room.ts feast()), of `foes` as it sees
|
|
16
|
+
* them: the nearest one up, in no lock and not seated, with GLORY_HP health or less, within
|
|
17
|
+
* GLORY_REACH on the floor plane, a body's height above or below, and GLORY_ARC of its look.
|
|
18
|
+
*/
|
|
19
|
+
export declare const glory: (me: PlayerState, foes: readonly PlayerState[]) => PlayerState | undefined;
|
|
@@ -106,6 +106,8 @@ export declare const LIMB: {
|
|
|
106
106
|
readonly ARM_R: 3;
|
|
107
107
|
readonly LEG_L: 4;
|
|
108
108
|
readonly LEG_R: 5;
|
|
109
|
+
/** The head a xenomorph's glory kill ate (GLORY_HP): gone, not thrown. */
|
|
110
|
+
readonly EATEN: 6;
|
|
109
111
|
};
|
|
110
112
|
/**
|
|
111
113
|
* How a player went down (bits 5-6 of PlayerState.fell), for the clients' fall: PLAIN as before,
|
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.177.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|