@korial29/tiny-fps 0.166.0 → 0.168.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 +35 -35
- package/dist/local.js +1 -1
- package/dist/server.js +148 -48
- package/dist/types/client/balls.d.ts +6 -0
- package/dist/types/client/combat.d.ts +5 -2
- package/dist/types/client/fours.d.ts +1 -1
- package/dist/types/client/gait.d.ts +19 -5
- package/dist/types/client/input.d.ts +5 -1
- package/dist/types/client/xeno.d.ts +36 -7
- package/dist/types/shared/blade.d.ts +5 -4
- package/dist/types/shared/constants.d.ts +37 -4
- package/dist/types/shared/kit.d.ts +2 -0
- package/dist/types/shared/physics.d.ts +2 -0
- package/dist/types/shared/room.d.ts +2 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -66,16 +66,14 @@ var BLOW = {
|
|
|
66
66
|
LUNGE: 3,
|
|
67
67
|
/** The xenomorph's (kit.ts): a swipe of the left claws, then of the right, while FIRE goes on. */
|
|
68
68
|
CLAW_L: 4,
|
|
69
|
-
CLAW_R: 5
|
|
70
|
-
/** Its tail's sting, on SPECIAL: slow, far, and it throws whoever it stings. */
|
|
71
|
-
TAIL: 6
|
|
69
|
+
CLAW_R: 5
|
|
72
70
|
};
|
|
73
71
|
var CLAW = {
|
|
74
72
|
ticks: 16,
|
|
75
73
|
strike: 5,
|
|
76
74
|
reach: 1.8,
|
|
77
75
|
arc: .7,
|
|
78
|
-
hp:
|
|
76
|
+
hp: 4,
|
|
79
77
|
hold: -1,
|
|
80
78
|
knock: 0
|
|
81
79
|
};
|
|
@@ -101,15 +99,82 @@ var PUNCHES = [
|
|
|
101
99
|
knock: 1.2
|
|
102
100
|
},
|
|
103
101
|
CLAW,
|
|
102
|
+
CLAW
|
|
103
|
+
];
|
|
104
|
+
/**
|
|
105
|
+
* The xenomorph's tail (the user, 2026-11-16: it fights as the katana does, slower, and its sting
|
|
106
|
+
* kills). The right button (KEY.BLADE, input.ts) starts a strike by the keys as cutOf() reads them:
|
|
107
|
+
* a STAB ahead with FORWARD, a SWEEP across from LEFT or RIGHT, else a LASH down from above. Held at
|
|
108
|
+
* the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()). A double click of the
|
|
109
|
+
* right button (KEY.SPECIAL with it) is its special: a sweep's is the SPIN, the tail whipped all
|
|
110
|
+
* round the body; the stab's and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it
|
|
111
|
+
* lands. Whoever a strike reaches goes down (`hp` Infinity: through armour). The xenomorph's `cut`
|
|
112
|
+
* reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
|
|
113
|
+
*/
|
|
114
|
+
var STING = {
|
|
115
|
+
STAB: 0,
|
|
116
|
+
SWEEP_L: 1,
|
|
117
|
+
SWEEP_R: 2,
|
|
118
|
+
LASH: 3,
|
|
119
|
+
SPIN: 6,
|
|
120
|
+
LEAP: 7
|
|
121
|
+
};
|
|
122
|
+
var TAILS = [
|
|
123
|
+
{
|
|
124
|
+
ticks: 52,
|
|
125
|
+
strike: 26,
|
|
126
|
+
reach: 3.4,
|
|
127
|
+
arc: .25,
|
|
128
|
+
hp: Infinity,
|
|
129
|
+
hold: 18,
|
|
130
|
+
knock: 0
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
ticks: 50,
|
|
134
|
+
strike: 26,
|
|
135
|
+
reach: 2.8,
|
|
136
|
+
arc: 1.1,
|
|
137
|
+
hp: Infinity,
|
|
138
|
+
hold: 16,
|
|
139
|
+
knock: 0
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
ticks: 50,
|
|
143
|
+
strike: 26,
|
|
144
|
+
reach: 2.8,
|
|
145
|
+
arc: 1.1,
|
|
146
|
+
hp: Infinity,
|
|
147
|
+
hold: 16,
|
|
148
|
+
knock: 0
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
ticks: 54,
|
|
152
|
+
strike: 28,
|
|
153
|
+
reach: 3.1,
|
|
154
|
+
arc: .4,
|
|
155
|
+
hp: Infinity,
|
|
156
|
+
hold: 20,
|
|
157
|
+
knock: 0
|
|
158
|
+
},
|
|
159
|
+
CLAW,
|
|
104
160
|
CLAW,
|
|
105
161
|
{
|
|
106
|
-
ticks:
|
|
107
|
-
strike:
|
|
108
|
-
reach:
|
|
109
|
-
arc: .
|
|
110
|
-
hp:
|
|
162
|
+
ticks: 60,
|
|
163
|
+
strike: 30,
|
|
164
|
+
reach: 2.6,
|
|
165
|
+
arc: Math.PI,
|
|
166
|
+
hp: Infinity,
|
|
111
167
|
hold: -1,
|
|
112
|
-
knock:
|
|
168
|
+
knock: 0
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
ticks: 63,
|
|
172
|
+
strike: 52,
|
|
173
|
+
reach: 2.8,
|
|
174
|
+
arc: .6,
|
|
175
|
+
hp: Infinity,
|
|
176
|
+
hold: -1,
|
|
177
|
+
knock: 0
|
|
113
178
|
}
|
|
114
179
|
];
|
|
115
180
|
var [PUNCH_HITS, PUNCH_STUN, PUNCH_MEMORY] = [
|
|
@@ -127,6 +192,11 @@ var [POUNCE_COOL, POUNCE_FLY] = [48, 40];
|
|
|
127
192
|
var [POUNCE_HP, POUNCE_STUN] = [2, 60];
|
|
128
193
|
var PLASMA_R = .12;
|
|
129
194
|
/**
|
|
195
|
+
* What a vehicle's bolts take (the user, 2026-11-16: stronger, they grazed like the rifle's rounds):
|
|
196
|
+
* BOLT_HP from a player each one that hits him, and 1 from a hull every BOLT_GRAZE on it.
|
|
197
|
+
*/
|
|
198
|
+
var [BOLT_HP, BOLT_GRAZE] = [1, 2];
|
|
199
|
+
/**
|
|
130
200
|
* The cuts, by CUT. A swing lasts `ticks`, during which no other starts, and strikes once, `strike`
|
|
131
201
|
* ticks after its start. `hold` is the top of its wind-up, where FIRE held keeps it (a charge; -1:
|
|
132
202
|
* a special, which does not charge). It hits every enemy whose body comes within `reach` metres of the
|
|
@@ -632,6 +702,7 @@ var MARINE = {
|
|
|
632
702
|
clip: 60,
|
|
633
703
|
damage: 1,
|
|
634
704
|
slow: 1,
|
|
705
|
+
accel: 1,
|
|
635
706
|
hp: 8,
|
|
636
707
|
gear: true,
|
|
637
708
|
xeno: false
|
|
@@ -657,6 +728,7 @@ var KITS = [
|
|
|
657
728
|
clip: 30,
|
|
658
729
|
damage: .5,
|
|
659
730
|
slow: .55,
|
|
731
|
+
accel: 1,
|
|
660
732
|
hp: 8,
|
|
661
733
|
gear: true,
|
|
662
734
|
xeno: false
|
|
@@ -664,10 +736,11 @@ var KITS = [
|
|
|
664
736
|
MARINE,
|
|
665
737
|
{
|
|
666
738
|
...MARINE,
|
|
667
|
-
run:
|
|
668
|
-
sprint:
|
|
669
|
-
jump: 7 *
|
|
670
|
-
double: 6 *
|
|
739
|
+
run: 12,
|
|
740
|
+
sprint: 18,
|
|
741
|
+
jump: 7 * Math.SQRT2,
|
|
742
|
+
double: 6 * Math.SQRT2,
|
|
743
|
+
accel: 2,
|
|
671
744
|
ammo: 0,
|
|
672
745
|
rail: 0,
|
|
673
746
|
rifle: 0,
|
|
@@ -1259,7 +1332,7 @@ var unwalled = (p, w, c, h) => {
|
|
|
1259
1332
|
* Ground control: speed toward the wished direction (a vector of length 0 to 1), up to `top` times
|
|
1260
1333
|
* its length; friction with none.
|
|
1261
1334
|
*/
|
|
1262
|
-
var steer$1 = (p, wish, top, run = 6) => {
|
|
1335
|
+
var steer$1 = (p, wish, top, run = 6, accel = 1) => {
|
|
1263
1336
|
const m = len$1(wish[0], wish[1]);
|
|
1264
1337
|
if (m < EPS) {
|
|
1265
1338
|
const s = len$1(p.vx, p.vz);
|
|
@@ -1277,7 +1350,7 @@ var steer$1 = (p, wish, top, run = 6) => {
|
|
|
1277
1350
|
[px, pz] = [px * k, pz * k];
|
|
1278
1351
|
}
|
|
1279
1352
|
top *= m;
|
|
1280
|
-
par = par < top ? Math.min(top, par + (par >= run ? 3 : 50) * DT$2) : Math.max(top, par - 12 * DT$2);
|
|
1353
|
+
par = par < top ? Math.min(top, par + (par >= run ? 3 : 50) * accel * DT$2) : Math.max(top, par - 12 * DT$2);
|
|
1281
1354
|
p.vx = px + par * wx;
|
|
1282
1355
|
p.vz = pz + par * wz;
|
|
1283
1356
|
};
|
|
@@ -1465,11 +1538,12 @@ var holdAt = (p, w, side) => {
|
|
|
1465
1538
|
return best;
|
|
1466
1539
|
};
|
|
1467
1540
|
/**
|
|
1468
|
-
* The xenomorph takes hold of a wall it faces with forward
|
|
1469
|
-
*
|
|
1541
|
+
* The xenomorph takes hold of a wall it faces with forward and the sprint held (the user,
|
|
1542
|
+
* 2026-11-16: running into a wall, not walking): in the air within WALL_REACH, on a floor touching
|
|
1543
|
+
* it, a wall from the knees to the head (wallGap). Not the side it just kicked off.
|
|
1470
1544
|
*/
|
|
1471
1545
|
var clingTo = (p, w, c) => {
|
|
1472
|
-
if (!c.kit.xeno || !c.fwd || c.stumble) return false;
|
|
1546
|
+
if (!c.kit.xeno || !c.fwd || !(c.keys & KEY.SPRINT) || c.stumble) return false;
|
|
1473
1547
|
const reach = p.mode === MODE.AIR ? WALL_REACH : .05;
|
|
1474
1548
|
for (let side = 1; side <= 4; side++) {
|
|
1475
1549
|
const [nx, nz] = TOWARD[side];
|
|
@@ -1541,12 +1615,15 @@ var cling = (p, w, c) => {
|
|
|
1541
1615
|
p.ev |= EV.LAND;
|
|
1542
1616
|
}
|
|
1543
1617
|
};
|
|
1618
|
+
/** Whether the xenomorph's swing is its tail's (TAILS), not its claws'. */
|
|
1619
|
+
var tailing = (p) => !!p.swing && p.cut !== BLOW.CLAW_L && p.cut !== BLOW.CLAW_R;
|
|
1544
1620
|
/**
|
|
1545
1621
|
* The xenomorph's dash: DASH held on a floor or a wall, with the dash timer run out, charges a
|
|
1546
1622
|
* pounce (`charge`); let go, it leaps along the look, at least POUNCE_PITCH up, faster the longer
|
|
1547
1623
|
* the charge. Anywhere else, or stumbling, the charge is lost.
|
|
1548
1624
|
*/
|
|
1549
1625
|
var pounce = (p, c) => {
|
|
1626
|
+
if (tailing(p)) return;
|
|
1550
1627
|
const ready = !c.stumble && p.dash === 0 && (onFloor(p.mode) || p.mode === MODE.CLING);
|
|
1551
1628
|
if (ready && c.keys & KEY.DASH) {
|
|
1552
1629
|
p.charge = Math.min((p.charge ?? 0) + 1, 36);
|
|
@@ -1670,7 +1747,7 @@ var onGround = (p, w, c, burst) => {
|
|
|
1670
1747
|
else {
|
|
1671
1748
|
const sprint = (c.keys & KEY.SPRINT) !== 0 && c.fwd;
|
|
1672
1749
|
const run = c.kit.run * c.pace;
|
|
1673
|
-
steer$1(p, unwalled(p, w, c, PLAYER_H), sprint ? c.kit.sprint * c.pace : run, run);
|
|
1750
|
+
steer$1(p, unwalled(p, w, c, PLAYER_H), sprint ? c.kit.sprint * c.pace : run, run, c.kit.accel);
|
|
1674
1751
|
}
|
|
1675
1752
|
};
|
|
1676
1753
|
/** In the air: the extra jump, a jump just after an edge (coyote), and air control. */
|
|
@@ -1763,12 +1840,12 @@ var cutOf = (keys) => {
|
|
|
1763
1840
|
return l && !r ? CUT.LEFT : r && !l ? CUT.RIGHT : keys & KEY.FORWARD ? CUT.THRUST : CUT.SLASH;
|
|
1764
1841
|
};
|
|
1765
1842
|
/**
|
|
1766
|
-
* The swing `p` is in, its numbers as CUTS has them
|
|
1767
|
-
* the rest of it from the top of its wind-up, HEAVY times as
|
|
1768
|
-
* and harder and wider.
|
|
1843
|
+
* The swing `p` is in, its numbers as CUTS has them (`table`; the xenomorph's is TAILS): the cut's
|
|
1844
|
+
* own, or, for a heavy release (`heavy`), the rest of it from the top of its wind-up, HEAVY times as
|
|
1845
|
+
* slow, with its own timer from there, and harder and wider.
|
|
1769
1846
|
*/
|
|
1770
|
-
var swingOf = (p) => {
|
|
1771
|
-
const c =
|
|
1847
|
+
var swingOf = (p, table = CUTS) => {
|
|
1848
|
+
const c = table[p.cut ?? 0];
|
|
1772
1849
|
return p.heavy ? {
|
|
1773
1850
|
...c,
|
|
1774
1851
|
ticks: Math.round((c.ticks - c.hold) * HEAVY),
|
|
@@ -6286,16 +6363,17 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6286
6363
|
p.cool = Math.max(0, p.cool - 1);
|
|
6287
6364
|
p.lob = Math.max(0, (p.lob ?? 0) - 1);
|
|
6288
6365
|
const busy = p.mode === MODE.HANG || p.mode === MODE.CLIMB;
|
|
6289
|
-
const
|
|
6290
|
-
const
|
|
6291
|
-
|
|
6366
|
+
const table = kit.xeno ? TAILS : CUTS;
|
|
6367
|
+
const { ticks, hold } = table[p.cut ?? 0];
|
|
6368
|
+
const top = !!p.swing && !p.heavy && ticks - (p.swing ?? 0) === hold;
|
|
6369
|
+
if (top && (p.wield || kit.xeno) && armed && !busy && i.keys & (kit.xeno ? KEY.BLADE : KEY.FIRE)) p.charge = Math.min((p.charge ?? 0) + 1, HEAVY_MAX);
|
|
6292
6370
|
else if (top && armed && !busy && (p.charge ?? 0) >= HEAVY_TAP) {
|
|
6293
6371
|
[p.heavy, p.charge] = [true, 0];
|
|
6294
|
-
p.swing = swingOf(p).ticks;
|
|
6372
|
+
p.swing = swingOf(p, table).ticks;
|
|
6295
6373
|
} else {
|
|
6296
6374
|
p.charge = top ? 0 : p.charge;
|
|
6297
6375
|
const s = p.swing ?? 0;
|
|
6298
|
-
const c = swingOf(p);
|
|
6376
|
+
const c = swingOf(p, table);
|
|
6299
6377
|
const blow = PUNCHES[p.cut ?? 0] ?? PUNCHES[0];
|
|
6300
6378
|
const stop = (v) => v == s - 1 && (v == c.ticks - c.strike || v == blow.ticks - blow.strike || !p.heavy && v == ticks - hold);
|
|
6301
6379
|
p.swing = Math.max(0, kit.haste > 1 && stop(s - 1) ? s - 1 : s - kit.haste);
|
|
@@ -6342,10 +6420,10 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6342
6420
|
if (!--p.reload) p[key] = full;
|
|
6343
6421
|
} else if (hand != 1 && carried >= 0 && !busy && load < full && (!load || i.keys & KEY.RELOAD)) [p.reload, p.charge] = [ticks2, 0];
|
|
6344
6422
|
const bare = hand < 0;
|
|
6345
|
-
const c = bare ? PUNCHES[p.cut ?? 0] ?? PUNCHES[0] : swingOf(p);
|
|
6423
|
+
const c = kit.xeno ? swingOf(p, TAILS) : bare ? PUNCHES[p.cut ?? 0] ?? PUNCHES[0] : swingOf(p);
|
|
6346
6424
|
if (p.swing && c.ticks - p.swing === c.strike) return STRIKE.CUT;
|
|
6347
6425
|
if (kit.xeno) {
|
|
6348
|
-
|
|
6426
|
+
beast(p, i, fresh, busy);
|
|
6349
6427
|
return STRIKE.NONE;
|
|
6350
6428
|
}
|
|
6351
6429
|
if (p.wield && !top || p.railed || p.rifled || busy || p.reload || !p.wield && !p.mag) p.charge = 0;
|
|
@@ -6403,18 +6481,35 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6403
6481
|
return STRIKE.NONE;
|
|
6404
6482
|
};
|
|
6405
6483
|
/**
|
|
6406
|
-
* The xenomorph's blows
|
|
6407
|
-
*
|
|
6408
|
-
*
|
|
6484
|
+
* The xenomorph's blows: FIRE swipes the left claws, then the right while it goes on, a fresh press
|
|
6485
|
+
* after a swipe's strike throwing the next at once (BLOW). The right button (KEY.BLADE) strikes with
|
|
6486
|
+
* the tail as FIRE cuts with the katana (TAILS): by the keys (cutOf()), its special with SPECIAL (a
|
|
6487
|
+
* double click), which also turns a strike just started into it within SPECIAL_LATE ticks. Not while
|
|
6488
|
+
* a pounce charges, nor with the hands busy (a hang, a climb); on a wall they are free.
|
|
6409
6489
|
*/
|
|
6410
|
-
var
|
|
6490
|
+
var beast = (p, i, fresh, busy) => {
|
|
6411
6491
|
if (busy) return;
|
|
6412
|
-
const c =
|
|
6413
|
-
const
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6492
|
+
const c = TAILS[p.cut ?? 0];
|
|
6493
|
+
const claw = p.cut === BLOW.CLAW_L || p.cut === BLOW.CLAW_R;
|
|
6494
|
+
const tail = !!(i.keys & KEY.BLADE);
|
|
6495
|
+
const late = c.ticks - (p.swing ?? 0);
|
|
6496
|
+
const special = tail && !!(i.keys & KEY.SPECIAL) && !!p.swing && !claw && !p.heavy && (p.cut ?? 0) < 4 && late <= 18;
|
|
6497
|
+
if (tail && (!p.swing && !p.charge || special)) {
|
|
6498
|
+
const base = cutOf(i.keys);
|
|
6499
|
+
p.cut = i.keys & KEY.SPECIAL ? base === CUT.LEFT || base === CUT.RIGHT ? STING.SPIN : STING.LEAP : base;
|
|
6500
|
+
[p.heavy, p.swing, p.charge] = [
|
|
6501
|
+
false,
|
|
6502
|
+
TAILS[p.cut].ticks,
|
|
6503
|
+
0
|
|
6504
|
+
];
|
|
6505
|
+
if (p.cut === STING.LEAP && p.mode === MODE.GROUND) {
|
|
6506
|
+
p.vy = 10;
|
|
6507
|
+
p.ev |= EV.JUMP;
|
|
6508
|
+
}
|
|
6509
|
+
} else if (i.keys & KEY.FIRE && (!p.swing || fresh && claw && c.ticks - p.swing > c.strike)) {
|
|
6510
|
+
p.cut = p.cut === BLOW.CLAW_L ? BLOW.CLAW_R : BLOW.CLAW_L;
|
|
6511
|
+
[p.heavy, p.swing] = [false, TAILS[p.cut].ticks];
|
|
6512
|
+
}
|
|
6418
6513
|
};
|
|
6419
6514
|
/**
|
|
6420
6515
|
* A step in a saber lock: the blade stays in hand and no cut starts. Each FIRE press (FIRE held
|
|
@@ -9041,7 +9136,7 @@ var Room = class {
|
|
|
9041
9136
|
if (by) by.state.hits = by.state.hits + 1 & 255;
|
|
9042
9137
|
if (b.power === 0 || b.power === 6) {
|
|
9043
9138
|
const w = this.wear[this.rovers.indexOf(hull)];
|
|
9044
|
-
w.graze = (w.graze + 1) % VEHICLE.GRAZE;
|
|
9139
|
+
w.graze = (w.graze + 1) % (b.power === 6 ? BOLT_GRAZE : VEHICLE.GRAZE);
|
|
9045
9140
|
if (!w.graze) this.hurt(hull, 1, b.by, b.team);
|
|
9046
9141
|
} else this.hurt(hull, b.arc ? CUTS[b.arc].hp : b.power ?? 1, b.by, b.team);
|
|
9047
9142
|
return;
|
|
@@ -9049,7 +9144,8 @@ var Room = class {
|
|
|
9049
9144
|
const foe = foes.find((q) => q.state === hit);
|
|
9050
9145
|
if (!foe) return;
|
|
9051
9146
|
if (by) by.state.hits = by.state.hits + 1 & 255;
|
|
9052
|
-
if (b.power ===
|
|
9147
|
+
if (b.power === 6) this.shot(foe, BOLT_HP, by, b.dx, b.dz);
|
|
9148
|
+
else if (b.power === 0) {
|
|
9053
9149
|
foe.graze = ((foe.graze ?? 0) + 1) % 2;
|
|
9054
9150
|
if (!foe.graze) this.shot(foe, 1, by, b.dx, b.dz);
|
|
9055
9151
|
} else if (!b.arc) this.shot(foe, b.power ?? 1, by, b.dx, b.dz);
|
|
@@ -9138,15 +9234,19 @@ var Room = class {
|
|
|
9138
9234
|
* up once. A jab or a cross takes half a point, 1 hp every PUNCH_HITS of them; a hook or a lunge a
|
|
9139
9235
|
* whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
|
|
9140
9236
|
* a blow with a `knock`, stuns him as a tackle does: a stumble thrown the way `p` faces (`knock`
|
|
9141
|
-
* times as hard), the flag dropped, `by` the puncher.
|
|
9237
|
+
* times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
|
|
9238
|
+
* whole `hp` and never stun: its claws XENO_CLAW, its tail all.
|
|
9142
9239
|
*/
|
|
9143
9240
|
punch(p, view) {
|
|
9144
|
-
const
|
|
9241
|
+
const xeno = this.kit(p).xeno;
|
|
9242
|
+
const blow = xeno ? {
|
|
9243
|
+
...swingOf(p.state, TAILS),
|
|
9244
|
+
knock: 0
|
|
9245
|
+
} : PUNCHES[p.state.cut ?? 0] ?? PUNCHES[0];
|
|
9145
9246
|
const seen = strike(this.world, p.state, this.enemies(p, view), blow);
|
|
9146
9247
|
const foes = this.players().filter((q) => seen.some((s) => s.id === q.info.id));
|
|
9147
9248
|
if (!foes.length) return;
|
|
9148
9249
|
p.state.hits = p.state.hits + 1 & 255;
|
|
9149
|
-
const xeno = (p.state.cut ?? 0) >= BLOW.CLAW_L;
|
|
9150
9250
|
for (const foe of foes) {
|
|
9151
9251
|
this.acid(foe, p);
|
|
9152
9252
|
const fresh = this.ticks - (foe.punched ?? -Infinity) <= PUNCH_MEMORY;
|
|
@@ -9155,7 +9255,7 @@ var Room = class {
|
|
|
9155
9255
|
if (!blow.hp) foe.bruise = ((foe.bruise ?? 0) + 1) % PUNCH_HITS;
|
|
9156
9256
|
const fell = felled(FALL$1.STRUCK, ...forward(p.state.yaw));
|
|
9157
9257
|
if ((blow.hp || !foe.bruise) && this.harm(foe, blow.hp || 1, p, xeno ? FRAG.CLAW : FRAG.FIST, fell)) continue;
|
|
9158
|
-
if (blow.knock || foe.blows >= PUNCH_STUN) {
|
|
9258
|
+
if (!xeno && (blow.knock || foe.blows >= PUNCH_STUN)) {
|
|
9159
9259
|
foe.blows = 0;
|
|
9160
9260
|
this.drop(foe.info.id);
|
|
9161
9261
|
const [dx, dz] = forward(p.state.yaw);
|
|
@@ -19,4 +19,10 @@ export interface Balls {
|
|
|
19
19
|
bursts: [Vec3, number, number?][];
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* The key of a ball the host sends: its shooter and id, and apart for a vehicle's bolts and
|
|
24
|
+
* missiles, which a driver's bolt count names (room.ts) and could meet the number of a shot of his
|
|
25
|
+
* own gun: one of those, in flight or spent, would hide it.
|
|
26
|
+
*/
|
|
27
|
+
export declare const keyOf: (b: Ball) => number;
|
|
22
28
|
export declare const createBalls: (world: World) => Balls;
|
|
@@ -42,8 +42,11 @@ type Blade = Pick<PlayerState, 'swing' | 'cut' | 'wield' | 'blade' | 'heavy' | '
|
|
|
42
42
|
* only counts down), or the cut changed under a running one.
|
|
43
43
|
*/
|
|
44
44
|
export declare const swung: (a?: Blade, b?: Blade) => number;
|
|
45
|
-
/**
|
|
46
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Whether the step from a to b is the strike of its cut: `swing` went down through the strike tick
|
|
47
|
+
* (CUTS; the xenomorph's, `xeno`, TAILS).
|
|
48
|
+
*/
|
|
49
|
+
export declare const struck: (a?: Blade, b?: Blade, xeno?: boolean) => boolean;
|
|
47
50
|
/** The pitch of a player's voice: the woman's higher, and each a little off the next by his id. */
|
|
48
51
|
export declare const voiceOf: (id: number, body?: number) => number;
|
|
49
52
|
export declare const createCombat: (world: World, audio: Pick<Audio, "play"> & Partial<Pick<Audio, "loop" | "speak">>, hud: Pick<Hud, "vitals" | "hit" | "down">, fx: Pick<Effects, "fire" | "cut" | "wound" | "lie" | "quake" | "blow" | "punch">, tracer: Pick<Tracer, "flash" | "burst" | "blast" | "orbs" | "update" | "mount" | "crackle" | "charging" | "lightning">, ctl: {
|
|
@@ -3,7 +3,7 @@ import type { Floor } from './gait';
|
|
|
3
3
|
import type { Pose } from './rig';
|
|
4
4
|
/** How far the xenomorph's foot is tipped down from flat on its ball, radians: steep, the arch of its sole showing. */
|
|
5
5
|
export declare const FOOT_UP = 1;
|
|
6
|
-
/** Floor speeds, m/s: past the first it drops on all fours (a sprint: its run is
|
|
6
|
+
/** Floor speeds, m/s: past the first it drops on all fours (a sprint: its run is 12), under the second it stands again. */
|
|
7
7
|
export declare const DROP: number, RISE: number;
|
|
8
8
|
/**
|
|
9
9
|
* The gaits, per paw (hind left, hind right, fore left, fore right): where in the stride it touches
|
|
@@ -108,16 +108,30 @@ export declare const LUNGE: {
|
|
|
108
108
|
out: number[];
|
|
109
109
|
twist: number;
|
|
110
110
|
};
|
|
111
|
-
/**
|
|
111
|
+
/** Any strike of the xenomorph's tail, as a blow: none of BLOW's, told apart for its arm and its sound. */
|
|
112
|
+
export declare const TAIL_BLOW = 6;
|
|
113
|
+
/** The striking arm of each blow (BLOW): -1 the left, 1 the right; the xenomorph's claws, and its tail (TAIL_BLOW), which takes no arm (0). */
|
|
112
114
|
export declare const SIDE: number[];
|
|
113
115
|
/** Whether the player has no weapon at all: FIRE punches. */
|
|
114
116
|
export declare const bare: (p: PlayerState) => boolean;
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
+
/**
|
|
118
|
+
* The blow (BLOW) of a bare-handed swing. The xenomorph's (`xeno`) cut reads TAILS: its claws, else
|
|
119
|
+
* its tail's TAIL_BLOW.
|
|
120
|
+
*/
|
|
121
|
+
export declare const blowOf: (p: Pick<PlayerState, "cut">, xeno?: boolean) => number;
|
|
122
|
+
/** The numbers of the swing a bare-handed player is in: the blow's, or the xenomorph's (TAILS, a heavy one's own). */
|
|
123
|
+
export declare const blowing: (p: Pick<PlayerState, "cut" | "heavy">, xeno?: boolean) => {
|
|
124
|
+
ticks: number;
|
|
125
|
+
strike: number;
|
|
126
|
+
reach: number;
|
|
127
|
+
arc: number;
|
|
128
|
+
hp: number;
|
|
129
|
+
hold: number;
|
|
130
|
+
};
|
|
117
131
|
/**
|
|
118
132
|
* How far out the fist of a punch is, 0 to 1, by the swing of a player with no weapon at all: out
|
|
119
|
-
* at the strike of its blow, back by the swing's end.
|
|
133
|
+
* at the strike of its blow, back by the swing's end. None for the xenomorph's tail.
|
|
120
134
|
*/
|
|
121
|
-
export declare const thrown: (p: PlayerState) => number;
|
|
135
|
+
export declare const thrown: (p: PlayerState, xeno?: boolean) => number;
|
|
122
136
|
/** `bow` is the guard's lean forward: none for the eye's own body, whose arms hold to the view and which stands in no sword guard. */
|
|
123
137
|
export declare const createGait: (bow?: number, kind?: number) => Gait;
|
|
@@ -44,7 +44,11 @@ export interface Controls {
|
|
|
44
44
|
weapon: number;
|
|
45
45
|
/** At a ship's stick (the client sets it): a press of G is a missile whatever the weapon, a double click nothing more than a click. */
|
|
46
46
|
pilot: boolean;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Playing the xenomorph (the client sets it): the right button strikes with the tail as FIRE cuts
|
|
49
|
+
* with the katana, KEY.BLADE while it is held (a charge at the strike's top), with SPECIAL on the
|
|
50
|
+
* step after a double click of it (the special); G is a short press of it.
|
|
51
|
+
*/
|
|
48
52
|
beast: boolean;
|
|
49
53
|
/**
|
|
50
54
|
* The KEY bits of the next step, read once per step. Same as `keys`, plus BLADE while the katana
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PlayerState } from '../shared/types';
|
|
1
2
|
import type { Vec3 } from './mesh';
|
|
2
3
|
import type { Quat } from './rig';
|
|
3
4
|
import type { Out } from './verts';
|
|
@@ -6,13 +7,39 @@ import type { Out } from './verts';
|
|
|
6
7
|
* drew a collar's line round the neck.
|
|
7
8
|
*/
|
|
8
9
|
export declare const CHITIN_X: number[];
|
|
9
|
-
/** Metres: the tail's length, its root's radius and its tip's, the stinger's length. */
|
|
10
|
+
/** Metres: the tail's length, its root's radius and its tip's, the stinger's length, width and thickness. */
|
|
10
11
|
export declare const TAIL: {
|
|
11
12
|
len: number;
|
|
12
13
|
root: number;
|
|
13
14
|
tip: number;
|
|
14
15
|
sting: number;
|
|
16
|
+
wide: number;
|
|
17
|
+
thin: number;
|
|
15
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* A pose of the tail, as bonesOf() takes it: its arch over the back (0 behind, 1 over the head and
|
|
21
|
+
* forward down into the view), its turn about the pelvis' up (radians, to its left: through its
|
|
22
|
+
* right side, a tail pointing back turns forward), its lean to the right, its reach (as a share of
|
|
23
|
+
* its length, a whip stretched), how much of the hook at its tip it keeps, and how far its root
|
|
24
|
+
* rises (radians, less toward the tip).
|
|
25
|
+
*/
|
|
26
|
+
export type Lash = readonly [
|
|
27
|
+
sting: number,
|
|
28
|
+
side: number,
|
|
29
|
+
lean: number,
|
|
30
|
+
reach: number,
|
|
31
|
+
hook: number,
|
|
32
|
+
rise: number
|
|
33
|
+
];
|
|
34
|
+
/** At rest: behind, hooked. */
|
|
35
|
+
export declare const HOOKED: Lash;
|
|
36
|
+
/**
|
|
37
|
+
* Where its tail is through a strike (TAILS, by the cut): it goes from HOOKED to the strike's poise
|
|
38
|
+
* by the top of the wind-up (or most of the way to the strike for a special), is driven to its end
|
|
39
|
+
* at the strike, eased in, then comes back. A charge holds the poise and trembles with the clock
|
|
40
|
+
* `t`. The SPIN turns the tail low once round the body.
|
|
41
|
+
*/
|
|
42
|
+
export declare const lashOf: (p: Pick<PlayerState, "cut" | "swing" | "heavy" | "charge" | "down">, t?: number) => Lash;
|
|
16
43
|
/** A solved skeleton (solve() in rig.ts): each joint's place and turn in the world. */
|
|
17
44
|
interface Solved {
|
|
18
45
|
pos: Vec3[];
|
|
@@ -49,13 +76,15 @@ export declare const PIPE: number[];
|
|
|
49
76
|
*/
|
|
50
77
|
export declare const backOf: (lod: number) => Back;
|
|
51
78
|
/**
|
|
52
|
-
* Its tail, in the world, from the solved skeleton `s
|
|
53
|
-
* on (the back's is in the skin, backOf()), each vertebra a bead
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
79
|
+
* Its tail, in the world, from the solved skeleton `s`, in the pose `lash` (lashOf()): the column's
|
|
80
|
+
* free part, from the pelvis on (the back's is in the skin, backOf()), thick, each vertebra a bead
|
|
81
|
+
* pinched at its joints (the user, 2026-11-16: a spine), with a spine standing out of its top and,
|
|
82
|
+
* close, a process out of each side swept back, but near the tip; its rings follow the curve's own
|
|
83
|
+
* up, so a tail turned round the hip stays round. The stinger at its end: a curved knife's blade
|
|
84
|
+
* (blade()), glowing in the team's `color`. Written straight into `out`. `lod` 0 far, 1 near, 3 close.
|
|
85
|
+
* `fours` (0 to 1): how far the body is on all fours (fours.ts).
|
|
57
86
|
*/
|
|
58
|
-
export declare const tail: (out: Out, s: Solved, t: number, run: number,
|
|
87
|
+
export declare const tail: (out: Out, s: Solved, t: number, run: number, lash: Lash, color: number[], lod: number, fours?: number) => void;
|
|
59
88
|
/** Bone: its claws and teeth, nothing else. */
|
|
60
89
|
export declare const BONE: number[];
|
|
61
90
|
/** Where the metatarsal (the foot) ends, from the ankle, in the foot joint's frame: longer than the rig's foot. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CUTS } from './constants';
|
|
1
2
|
import type { PlayerState } from './types';
|
|
2
3
|
import type { World } from './world';
|
|
3
4
|
/** Where on the body the blade is, as a share of its height: the chest, which a brush must not cover. */
|
|
@@ -8,11 +9,11 @@ export declare const CHEST = 0.7;
|
|
|
8
9
|
*/
|
|
9
10
|
export declare const cutOf: (keys: number) => number;
|
|
10
11
|
/**
|
|
11
|
-
* The swing `p` is in, its numbers as CUTS has them
|
|
12
|
-
* the rest of it from the top of its wind-up, HEAVY times as
|
|
13
|
-
* and harder and wider.
|
|
12
|
+
* The swing `p` is in, its numbers as CUTS has them (`table`; the xenomorph's is TAILS): the cut's
|
|
13
|
+
* own, or, for a heavy release (`heavy`), the rest of it from the top of its wind-up, HEAVY times as
|
|
14
|
+
* slow, with its own timer from there, and harder and wider.
|
|
14
15
|
*/
|
|
15
|
-
export declare const swingOf: (p: Pick<PlayerState, "cut" | "heavy"
|
|
16
|
+
export declare const swingOf: (p: Pick<PlayerState, "cut" | "heavy">, table?: typeof CUTS) => {
|
|
16
17
|
ticks: number;
|
|
17
18
|
strike: number;
|
|
18
19
|
reach: number;
|
|
@@ -215,9 +215,9 @@ export declare const BLOW: {
|
|
|
215
215
|
/** The xenomorph's (kit.ts): a swipe of the left claws, then of the right, while FIRE goes on. */
|
|
216
216
|
readonly CLAW_L: 4;
|
|
217
217
|
readonly CLAW_R: 5;
|
|
218
|
-
/** Its tail's sting, on SPECIAL: slow, far, and it throws whoever it stings. */
|
|
219
|
-
readonly TAIL: 6;
|
|
220
218
|
};
|
|
219
|
+
/** A swipe of the claws: XENO_CLAW health (the user, 2026-11-16: they hurt). */
|
|
220
|
+
export declare const XENO_CLAW = 4;
|
|
221
221
|
export declare const PUNCHES: {
|
|
222
222
|
ticks: number;
|
|
223
223
|
strike: number;
|
|
@@ -227,10 +227,38 @@ export declare const PUNCHES: {
|
|
|
227
227
|
hold: number;
|
|
228
228
|
knock: number;
|
|
229
229
|
}[];
|
|
230
|
+
/**
|
|
231
|
+
* The xenomorph's tail (the user, 2026-11-16: it fights as the katana does, slower, and its sting
|
|
232
|
+
* kills). The right button (KEY.BLADE, input.ts) starts a strike by the keys as cutOf() reads them:
|
|
233
|
+
* a STAB ahead with FORWARD, a SWEEP across from LEFT or RIGHT, else a LASH down from above. Held at
|
|
234
|
+
* the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()). A double click of the
|
|
235
|
+
* right button (KEY.SPECIAL with it) is its special: a sweep's is the SPIN, the tail whipped all
|
|
236
|
+
* round the body; the stab's and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it
|
|
237
|
+
* lands. Whoever a strike reaches goes down (`hp` Infinity: through armour). The xenomorph's `cut`
|
|
238
|
+
* reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
|
|
239
|
+
*/
|
|
240
|
+
export declare const STING: {
|
|
241
|
+
readonly STAB: 0;
|
|
242
|
+
readonly SWEEP_L: 1;
|
|
243
|
+
readonly SWEEP_R: 2;
|
|
244
|
+
readonly LASH: 3;
|
|
245
|
+
readonly SPIN: 6;
|
|
246
|
+
readonly LEAP: 7;
|
|
247
|
+
};
|
|
248
|
+
export declare const TAILS: {
|
|
249
|
+
ticks: number;
|
|
250
|
+
strike: number;
|
|
251
|
+
reach: number;
|
|
252
|
+
arc: number;
|
|
253
|
+
hp: number;
|
|
254
|
+
hold: number;
|
|
255
|
+
knock: number;
|
|
256
|
+
}[];
|
|
257
|
+
export declare const TAIL_LEAP = 10;
|
|
230
258
|
export declare const PUNCH_HITS: number, PUNCH_STUN: number, PUNCH_MEMORY: number;
|
|
231
259
|
/**
|
|
232
260
|
* The xenomorph (the user, 2026-11-15; kit.ts). XENO_HP health. It clings to a wall it faces with
|
|
233
|
-
* forward held (MODE.CLING, physics.ts): CLING_SPEED m/s up, down or along it while the wall rises
|
|
261
|
+
* forward and the sprint held (MODE.CLING, physics.ts; the sprint since the user, 2026-11-16): CLING_SPEED m/s up, down or along it while the wall rises
|
|
234
262
|
* CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP m/s. DASH held on a
|
|
235
263
|
* floor or a wall charges a pounce for up to POUNCE_HOLD ticks (PlayerState.charge); let go, it
|
|
236
264
|
* leaps POUNCE_MIN to POUNCE_MAX m/s along the look, at least POUNCE_PITCH up, and the dash timer
|
|
@@ -286,9 +314,14 @@ export declare const RIFLE_SPEED = 400;
|
|
|
286
314
|
export declare const PLASMA_R = 0.12;
|
|
287
315
|
/** Plasma balls in flight in a room at most: past it the oldest bursts. They go on the wire. */
|
|
288
316
|
export declare const PLASMA_MAX = 64;
|
|
289
|
-
/** Ball.power of a
|
|
317
|
+
/** Ball.power of a vehicle's laser bolt (rover.ts): past CHARGE_MAX, so it names the bolt. It flies at BOLT_SPEED m/s. */
|
|
290
318
|
export declare const BOLT = 6;
|
|
291
319
|
export declare const BOLT_SPEED = 120;
|
|
320
|
+
/**
|
|
321
|
+
* What a vehicle's bolts take (the user, 2026-11-16: stronger, they grazed like the rifle's rounds):
|
|
322
|
+
* BOLT_HP from a player each one that hits him, and 1 from a hull every BOLT_GRAZE on it.
|
|
323
|
+
*/
|
|
324
|
+
export declare const BOLT_HP: number, BOLT_GRAZE: number;
|
|
292
325
|
/** Radians the view kicks up per shot (client side: the kick is in the pitch the inputs carry). */
|
|
293
326
|
export declare const RECOIL = 0.012;
|
|
294
327
|
/** Ticks a player lies down after the health ran out, then he is back at a spawn of his team. */
|
|
@@ -31,6 +31,8 @@ export interface Kit {
|
|
|
31
31
|
damage: number;
|
|
32
32
|
/** His running speeds with a gun in hand, of his own. */
|
|
33
33
|
slow: number;
|
|
34
|
+
/** The ground's accelerations (ACCEL, SPRINT_ACCEL), as a share of the marine's. */
|
|
35
|
+
accel: number;
|
|
34
36
|
/** Health at a spawn, and what the packs heal up to. */
|
|
35
37
|
hp: number;
|
|
36
38
|
/** Whether the racks give him their weapons and he wears the armour pickups. */
|
|
@@ -105,6 +105,8 @@ 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;
|
|
108
110
|
/**
|
|
109
111
|
* Applies one input for 1 / TICK_HZ s, in place: yaw and pitch from the input (pitch clamped to
|
|
110
112
|
* MAX_PITCH), then the step of the current mode (see the top of the file). Feet under the world's
|
|
@@ -165,7 +165,8 @@ export declare class Room {
|
|
|
165
165
|
* up once. A jab or a cross takes half a point, 1 hp every PUNCH_HITS of them; a hook or a lunge a
|
|
166
166
|
* whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
|
|
167
167
|
* a blow with a `knock`, stuns him as a tackle does: a stumble thrown the way `p` faces (`knock`
|
|
168
|
-
* times as hard), the flag dropped, `by` the puncher.
|
|
168
|
+
* times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
|
|
169
|
+
* whole `hp` and never stun: its claws XENO_CLAW, its tail all.
|
|
169
170
|
*/
|
|
170
171
|
private punch;
|
|
171
172
|
/**
|
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.168.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|