@korial29/tiny-fps 0.165.1 → 0.167.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 +31 -31
- package/dist/local.js +1 -1
- package/dist/server.js +140 -46
- package/dist/types/client/combat.d.ts +5 -2
- package/dist/types/client/fours.d.ts +33 -0
- package/dist/types/client/gait.d.ts +19 -5
- package/dist/types/client/input.d.ts +5 -1
- package/dist/types/client/soldier.d.ts +3 -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 +31 -3
- package/dist/types/shared/kit.d.ts +2 -0
- package/dist/types/shared/physics.d.ts +4 -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] = [
|
|
@@ -632,6 +697,7 @@ var MARINE = {
|
|
|
632
697
|
clip: 60,
|
|
633
698
|
damage: 1,
|
|
634
699
|
slow: 1,
|
|
700
|
+
accel: 1,
|
|
635
701
|
hp: 8,
|
|
636
702
|
gear: true,
|
|
637
703
|
xeno: false
|
|
@@ -657,6 +723,7 @@ var KITS = [
|
|
|
657
723
|
clip: 30,
|
|
658
724
|
damage: .5,
|
|
659
725
|
slow: .55,
|
|
726
|
+
accel: 1,
|
|
660
727
|
hp: 8,
|
|
661
728
|
gear: true,
|
|
662
729
|
xeno: false
|
|
@@ -664,10 +731,11 @@ var KITS = [
|
|
|
664
731
|
MARINE,
|
|
665
732
|
{
|
|
666
733
|
...MARINE,
|
|
667
|
-
run:
|
|
668
|
-
sprint:
|
|
669
|
-
jump: 7 *
|
|
670
|
-
double: 6 *
|
|
734
|
+
run: 12,
|
|
735
|
+
sprint: 18,
|
|
736
|
+
jump: 7 * Math.SQRT2,
|
|
737
|
+
double: 6 * Math.SQRT2,
|
|
738
|
+
accel: 2,
|
|
671
739
|
ammo: 0,
|
|
672
740
|
rail: 0,
|
|
673
741
|
rifle: 0,
|
|
@@ -1259,7 +1327,7 @@ var unwalled = (p, w, c, h) => {
|
|
|
1259
1327
|
* Ground control: speed toward the wished direction (a vector of length 0 to 1), up to `top` times
|
|
1260
1328
|
* its length; friction with none.
|
|
1261
1329
|
*/
|
|
1262
|
-
var steer$1 = (p, wish, top, run = 6) => {
|
|
1330
|
+
var steer$1 = (p, wish, top, run = 6, accel = 1) => {
|
|
1263
1331
|
const m = len$1(wish[0], wish[1]);
|
|
1264
1332
|
if (m < EPS) {
|
|
1265
1333
|
const s = len$1(p.vx, p.vz);
|
|
@@ -1277,7 +1345,7 @@ var steer$1 = (p, wish, top, run = 6) => {
|
|
|
1277
1345
|
[px, pz] = [px * k, pz * k];
|
|
1278
1346
|
}
|
|
1279
1347
|
top *= m;
|
|
1280
|
-
par = par < top ? Math.min(top, par + (par >= run ? 3 : 50) * DT$2) : Math.max(top, par - 12 * DT$2);
|
|
1348
|
+
par = par < top ? Math.min(top, par + (par >= run ? 3 : 50) * accel * DT$2) : Math.max(top, par - 12 * DT$2);
|
|
1281
1349
|
p.vx = px + par * wx;
|
|
1282
1350
|
p.vz = pz + par * wz;
|
|
1283
1351
|
};
|
|
@@ -1465,11 +1533,12 @@ var holdAt = (p, w, side) => {
|
|
|
1465
1533
|
return best;
|
|
1466
1534
|
};
|
|
1467
1535
|
/**
|
|
1468
|
-
* The xenomorph takes hold of a wall it faces with forward
|
|
1469
|
-
*
|
|
1536
|
+
* The xenomorph takes hold of a wall it faces with forward and the sprint held (the user,
|
|
1537
|
+
* 2026-11-16: running into a wall, not walking): in the air within WALL_REACH, on a floor touching
|
|
1538
|
+
* it, a wall from the knees to the head (wallGap). Not the side it just kicked off.
|
|
1470
1539
|
*/
|
|
1471
1540
|
var clingTo = (p, w, c) => {
|
|
1472
|
-
if (!c.kit.xeno || !c.fwd || c.stumble) return false;
|
|
1541
|
+
if (!c.kit.xeno || !c.fwd || !(c.keys & KEY.SPRINT) || c.stumble) return false;
|
|
1473
1542
|
const reach = p.mode === MODE.AIR ? WALL_REACH : .05;
|
|
1474
1543
|
for (let side = 1; side <= 4; side++) {
|
|
1475
1544
|
const [nx, nz] = TOWARD[side];
|
|
@@ -1541,12 +1610,15 @@ var cling = (p, w, c) => {
|
|
|
1541
1610
|
p.ev |= EV.LAND;
|
|
1542
1611
|
}
|
|
1543
1612
|
};
|
|
1613
|
+
/** Whether the xenomorph's swing is its tail's (TAILS), not its claws'. */
|
|
1614
|
+
var tailing = (p) => !!p.swing && p.cut !== BLOW.CLAW_L && p.cut !== BLOW.CLAW_R;
|
|
1544
1615
|
/**
|
|
1545
1616
|
* The xenomorph's dash: DASH held on a floor or a wall, with the dash timer run out, charges a
|
|
1546
1617
|
* pounce (`charge`); let go, it leaps along the look, at least POUNCE_PITCH up, faster the longer
|
|
1547
1618
|
* the charge. Anywhere else, or stumbling, the charge is lost.
|
|
1548
1619
|
*/
|
|
1549
1620
|
var pounce = (p, c) => {
|
|
1621
|
+
if (tailing(p)) return;
|
|
1550
1622
|
const ready = !c.stumble && p.dash === 0 && (onFloor(p.mode) || p.mode === MODE.CLING);
|
|
1551
1623
|
if (ready && c.keys & KEY.DASH) {
|
|
1552
1624
|
p.charge = Math.min((p.charge ?? 0) + 1, 36);
|
|
@@ -1670,7 +1742,7 @@ var onGround = (p, w, c, burst) => {
|
|
|
1670
1742
|
else {
|
|
1671
1743
|
const sprint = (c.keys & KEY.SPRINT) !== 0 && c.fwd;
|
|
1672
1744
|
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);
|
|
1745
|
+
steer$1(p, unwalled(p, w, c, PLAYER_H), sprint ? c.kit.sprint * c.pace : run, run, c.kit.accel);
|
|
1674
1746
|
}
|
|
1675
1747
|
};
|
|
1676
1748
|
/** In the air: the extra jump, a jump just after an edge (coyote), and air control. */
|
|
@@ -1763,12 +1835,12 @@ var cutOf = (keys) => {
|
|
|
1763
1835
|
return l && !r ? CUT.LEFT : r && !l ? CUT.RIGHT : keys & KEY.FORWARD ? CUT.THRUST : CUT.SLASH;
|
|
1764
1836
|
};
|
|
1765
1837
|
/**
|
|
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.
|
|
1838
|
+
* The swing `p` is in, its numbers as CUTS has them (`table`; the xenomorph's is TAILS): the cut's
|
|
1839
|
+
* own, or, for a heavy release (`heavy`), the rest of it from the top of its wind-up, HEAVY times as
|
|
1840
|
+
* slow, with its own timer from there, and harder and wider.
|
|
1769
1841
|
*/
|
|
1770
|
-
var swingOf = (p) => {
|
|
1771
|
-
const c =
|
|
1842
|
+
var swingOf = (p, table = CUTS) => {
|
|
1843
|
+
const c = table[p.cut ?? 0];
|
|
1772
1844
|
return p.heavy ? {
|
|
1773
1845
|
...c,
|
|
1774
1846
|
ticks: Math.round((c.ticks - c.hold) * HEAVY),
|
|
@@ -6286,16 +6358,17 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6286
6358
|
p.cool = Math.max(0, p.cool - 1);
|
|
6287
6359
|
p.lob = Math.max(0, (p.lob ?? 0) - 1);
|
|
6288
6360
|
const busy = p.mode === MODE.HANG || p.mode === MODE.CLIMB;
|
|
6289
|
-
const
|
|
6290
|
-
const
|
|
6291
|
-
|
|
6361
|
+
const table = kit.xeno ? TAILS : CUTS;
|
|
6362
|
+
const { ticks, hold } = table[p.cut ?? 0];
|
|
6363
|
+
const top = !!p.swing && !p.heavy && ticks - (p.swing ?? 0) === hold;
|
|
6364
|
+
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
6365
|
else if (top && armed && !busy && (p.charge ?? 0) >= HEAVY_TAP) {
|
|
6293
6366
|
[p.heavy, p.charge] = [true, 0];
|
|
6294
|
-
p.swing = swingOf(p).ticks;
|
|
6367
|
+
p.swing = swingOf(p, table).ticks;
|
|
6295
6368
|
} else {
|
|
6296
6369
|
p.charge = top ? 0 : p.charge;
|
|
6297
6370
|
const s = p.swing ?? 0;
|
|
6298
|
-
const c = swingOf(p);
|
|
6371
|
+
const c = swingOf(p, table);
|
|
6299
6372
|
const blow = PUNCHES[p.cut ?? 0] ?? PUNCHES[0];
|
|
6300
6373
|
const stop = (v) => v == s - 1 && (v == c.ticks - c.strike || v == blow.ticks - blow.strike || !p.heavy && v == ticks - hold);
|
|
6301
6374
|
p.swing = Math.max(0, kit.haste > 1 && stop(s - 1) ? s - 1 : s - kit.haste);
|
|
@@ -6342,10 +6415,10 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6342
6415
|
if (!--p.reload) p[key] = full;
|
|
6343
6416
|
} else if (hand != 1 && carried >= 0 && !busy && load < full && (!load || i.keys & KEY.RELOAD)) [p.reload, p.charge] = [ticks2, 0];
|
|
6344
6417
|
const bare = hand < 0;
|
|
6345
|
-
const c = bare ? PUNCHES[p.cut ?? 0] ?? PUNCHES[0] : swingOf(p);
|
|
6418
|
+
const c = kit.xeno ? swingOf(p, TAILS) : bare ? PUNCHES[p.cut ?? 0] ?? PUNCHES[0] : swingOf(p);
|
|
6346
6419
|
if (p.swing && c.ticks - p.swing === c.strike) return STRIKE.CUT;
|
|
6347
6420
|
if (kit.xeno) {
|
|
6348
|
-
|
|
6421
|
+
beast(p, i, fresh, busy);
|
|
6349
6422
|
return STRIKE.NONE;
|
|
6350
6423
|
}
|
|
6351
6424
|
if (p.wield && !top || p.railed || p.rifled || busy || p.reload || !p.wield && !p.mag) p.charge = 0;
|
|
@@ -6403,18 +6476,35 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6403
6476
|
return STRIKE.NONE;
|
|
6404
6477
|
};
|
|
6405
6478
|
/**
|
|
6406
|
-
* The xenomorph's blows
|
|
6407
|
-
*
|
|
6408
|
-
*
|
|
6479
|
+
* The xenomorph's blows: FIRE swipes the left claws, then the right while it goes on, a fresh press
|
|
6480
|
+
* after a swipe's strike throwing the next at once (BLOW). The right button (KEY.BLADE) strikes with
|
|
6481
|
+
* the tail as FIRE cuts with the katana (TAILS): by the keys (cutOf()), its special with SPECIAL (a
|
|
6482
|
+
* double click), which also turns a strike just started into it within SPECIAL_LATE ticks. Not while
|
|
6483
|
+
* a pounce charges, nor with the hands busy (a hang, a climb); on a wall they are free.
|
|
6409
6484
|
*/
|
|
6410
|
-
var
|
|
6485
|
+
var beast = (p, i, fresh, busy) => {
|
|
6411
6486
|
if (busy) return;
|
|
6412
|
-
const c =
|
|
6413
|
-
const
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6487
|
+
const c = TAILS[p.cut ?? 0];
|
|
6488
|
+
const claw = p.cut === BLOW.CLAW_L || p.cut === BLOW.CLAW_R;
|
|
6489
|
+
const tail = !!(i.keys & KEY.BLADE);
|
|
6490
|
+
const late = c.ticks - (p.swing ?? 0);
|
|
6491
|
+
const special = tail && !!(i.keys & KEY.SPECIAL) && !!p.swing && !claw && !p.heavy && (p.cut ?? 0) < 4 && late <= 18;
|
|
6492
|
+
if (tail && (!p.swing && !p.charge || special)) {
|
|
6493
|
+
const base = cutOf(i.keys);
|
|
6494
|
+
p.cut = i.keys & KEY.SPECIAL ? base === CUT.LEFT || base === CUT.RIGHT ? STING.SPIN : STING.LEAP : base;
|
|
6495
|
+
[p.heavy, p.swing, p.charge] = [
|
|
6496
|
+
false,
|
|
6497
|
+
TAILS[p.cut].ticks,
|
|
6498
|
+
0
|
|
6499
|
+
];
|
|
6500
|
+
if (p.cut === STING.LEAP && p.mode === MODE.GROUND) {
|
|
6501
|
+
p.vy = 10;
|
|
6502
|
+
p.ev |= EV.JUMP;
|
|
6503
|
+
}
|
|
6504
|
+
} else if (i.keys & KEY.FIRE && (!p.swing || fresh && claw && c.ticks - p.swing > c.strike)) {
|
|
6505
|
+
p.cut = p.cut === BLOW.CLAW_L ? BLOW.CLAW_R : BLOW.CLAW_L;
|
|
6506
|
+
[p.heavy, p.swing] = [false, TAILS[p.cut].ticks];
|
|
6507
|
+
}
|
|
6418
6508
|
};
|
|
6419
6509
|
/**
|
|
6420
6510
|
* A step in a saber lock: the blade stays in hand and no cut starts. Each FIRE press (FIRE held
|
|
@@ -9138,15 +9228,19 @@ var Room = class {
|
|
|
9138
9228
|
* 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
9229
|
* whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
|
|
9140
9230
|
* 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.
|
|
9231
|
+
* times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
|
|
9232
|
+
* whole `hp` and never stun: its claws XENO_CLAW, its tail all.
|
|
9142
9233
|
*/
|
|
9143
9234
|
punch(p, view) {
|
|
9144
|
-
const
|
|
9235
|
+
const xeno = this.kit(p).xeno;
|
|
9236
|
+
const blow = xeno ? {
|
|
9237
|
+
...swingOf(p.state, TAILS),
|
|
9238
|
+
knock: 0
|
|
9239
|
+
} : PUNCHES[p.state.cut ?? 0] ?? PUNCHES[0];
|
|
9145
9240
|
const seen = strike(this.world, p.state, this.enemies(p, view), blow);
|
|
9146
9241
|
const foes = this.players().filter((q) => seen.some((s) => s.id === q.info.id));
|
|
9147
9242
|
if (!foes.length) return;
|
|
9148
9243
|
p.state.hits = p.state.hits + 1 & 255;
|
|
9149
|
-
const xeno = (p.state.cut ?? 0) >= BLOW.CLAW_L;
|
|
9150
9244
|
for (const foe of foes) {
|
|
9151
9245
|
this.acid(foe, p);
|
|
9152
9246
|
const fresh = this.ticks - (foe.punched ?? -Infinity) <= PUNCH_MEMORY;
|
|
@@ -9155,7 +9249,7 @@ var Room = class {
|
|
|
9155
9249
|
if (!blow.hp) foe.bruise = ((foe.bruise ?? 0) + 1) % PUNCH_HITS;
|
|
9156
9250
|
const fell = felled(FALL$1.STRUCK, ...forward(p.state.yaw));
|
|
9157
9251
|
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) {
|
|
9252
|
+
if (!xeno && (blow.knock || foe.blows >= PUNCH_STUN)) {
|
|
9159
9253
|
foe.blows = 0;
|
|
9160
9254
|
this.drop(foe.info.id);
|
|
9161
9255
|
const [dx, dz] = forward(p.state.yaw);
|
|
@@ -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: {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PlayerState } from '../shared/types';
|
|
2
|
+
import type { Floor } from './gait';
|
|
3
|
+
import type { Pose } from './rig';
|
|
4
|
+
/** How far the xenomorph's foot is tipped down from flat on its ball, radians: steep, the arch of its sole showing. */
|
|
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 12), under the second it stands again. */
|
|
7
|
+
export declare const DROP: number, RISE: number;
|
|
8
|
+
/**
|
|
9
|
+
* The gaits, per paw (hind left, hind right, fore left, fore right): where in the stride it touches
|
|
10
|
+
* down and the share of the stride it stays down. GALLOP is a cheetah's rotary gallop: the hind
|
|
11
|
+
* pair a beat apart and the fore pair the other way round, a flight between them with the back
|
|
12
|
+
* stretched out and one after with it gathered, the fore paws down for less time. CRAWL is a
|
|
13
|
+
* lizard's trot: the diagonal pairs together, the body bending side to side between them.
|
|
14
|
+
*/
|
|
15
|
+
export declare const GALLOP: {
|
|
16
|
+
at: number[];
|
|
17
|
+
duty: number[];
|
|
18
|
+
};
|
|
19
|
+
export declare const CRAWL: {
|
|
20
|
+
at: number[];
|
|
21
|
+
duty: number[];
|
|
22
|
+
};
|
|
23
|
+
export interface Fours {
|
|
24
|
+
/** Moves to the state `p` after dt seconds; `floor` is the height of the ground under a point. */
|
|
25
|
+
update(p: PlayerState, dt: number, floor?: Floor): void;
|
|
26
|
+
/** `pose` with the body on all fours laid over it, as far as it has blended in. */
|
|
27
|
+
apply(pose: Pose): Pose;
|
|
28
|
+
/** How far on all fours, 0 to 1. */
|
|
29
|
+
readonly weight: number;
|
|
30
|
+
/** The stride's phase, in cycles. */
|
|
31
|
+
readonly phase: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const createFours: () => Fours;
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
import type { Choice, PlayerState, Rover } from '../shared/types';
|
|
2
2
|
import type { World } from '../shared/world';
|
|
3
3
|
import type { Gait, Seat } from './gait';
|
|
4
|
+
import type { Fours } from './fours';
|
|
4
5
|
import type { Pieces } from './store';
|
|
5
6
|
import type { Tracer } from './beams';
|
|
6
7
|
import type { Piece } from './limbs';
|
|
@@ -14,6 +15,8 @@ export interface Runner {
|
|
|
14
15
|
/** The player as last seen. */
|
|
15
16
|
p: PlayerState;
|
|
16
17
|
gait: Gait;
|
|
18
|
+
/** The xenomorph's gait on all fours (fours.ts): none for the others. */
|
|
19
|
+
fours?: Fours;
|
|
17
20
|
/** How much of a dash it is in, eased from 0 to 1: the length of the streaks. */
|
|
18
21
|
dash: number;
|
|
19
22
|
/** Seconds since its last shot, and how far its gun arm is raised to aim, eased from 0 to 1. */
|
|
@@ -133,7 +136,6 @@ export declare const fried: (p: PlayerState) => number;
|
|
|
133
136
|
* thins to nothing.
|
|
134
137
|
*/
|
|
135
138
|
export declare const dissolve: (out: Out, from: number, k: number) => void;
|
|
136
|
-
/** The runner's pose this frame, solved: the gait, the fall and sink of one down, and the weapon's hold; and the way the body faces. */
|
|
137
139
|
export declare const stance: (r: Runner) => {
|
|
138
140
|
s: {
|
|
139
141
|
pos: Vec3[];
|
|
@@ -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
|
|
@@ -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. */
|
|
@@ -7,6 +7,8 @@ export declare const TAU: number;
|
|
|
7
7
|
export declare const norm: (a: number) => number;
|
|
8
8
|
/** Unit vector the player faces at yaw, on the floor plane: yaw 0 looks toward -z. */
|
|
9
9
|
export declare const forward: (yaw: number) => [x: number, z: number];
|
|
10
|
+
/** The unit vector from a player toward a wall or a ledge on each SIDE. */
|
|
11
|
+
export declare const TOWARD: number[][];
|
|
10
12
|
/** The movement fields of a player at rest on a floor, for a state built by hand. */
|
|
11
13
|
export declare const STILL: {
|
|
12
14
|
vx: number;
|
|
@@ -103,6 +105,8 @@ export declare const floored: (p: Pick<PlayerState, "zap" | "stun">) => boolean;
|
|
|
103
105
|
* two steps. The katana's shock calls it with its own ticks and knock.
|
|
104
106
|
*/
|
|
105
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;
|
|
106
110
|
/**
|
|
107
111
|
* Applies one input for 1 / TICK_HZ s, in place: yaw and pitch from the input (pitch clamped to
|
|
108
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.167.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|