@korial29/tiny-fps 0.180.0 → 0.181.1
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 +36 -36
- package/dist/local.js +1 -1
- package/dist/server.js +101 -47
- package/dist/types/client/crawl.d.ts +13 -0
- package/dist/types/client/xeno.d.ts +3 -2
- package/dist/types/shared/blade.d.ts +6 -0
- package/dist/types/shared/constants.d.ts +28 -12
- package/dist/types/shared/physics.d.ts +5 -0
- package/dist/types/shared/room.d.ts +9 -7
- package/dist/types/shared/tackle.d.ts +7 -4
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -73,7 +73,7 @@ var CLAW = {
|
|
|
73
73
|
strike: 5,
|
|
74
74
|
reach: 1.8,
|
|
75
75
|
arc: .7,
|
|
76
|
-
hp:
|
|
76
|
+
hp: 2,
|
|
77
77
|
hold: -1,
|
|
78
78
|
knock: 0
|
|
79
79
|
};
|
|
@@ -105,12 +105,18 @@ var PUNCHES = [
|
|
|
105
105
|
* The xenomorph's tail (the user, 2026-11-16: it fights as the katana does, slower, and its sting
|
|
106
106
|
* kills). The right button (KEY.BLADE, input.ts) starts a strike by the keys as cutOf() reads them:
|
|
107
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())
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
|
|
108
|
+
* the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()), and the strike takes
|
|
109
|
+
* more the longer it charged (TAIL_HP, sting()). A double click of the right button (KEY.SPECIAL
|
|
110
|
+
* with it) is its special: a sweep's is the SPIN, the tail whipped all round the body; the stab's
|
|
111
|
+
* and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it lands; each takes its own
|
|
112
|
+
* `hp`. The xenomorph's `cut` reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
|
|
113
113
|
*/
|
|
114
|
+
/**
|
|
115
|
+
* The tail's strike (the user, 2026-11-16, after Aliens versus Predator, 1999: held, it charges; let
|
|
116
|
+
* go, it strikes as hard as it charged; full, it hurts a lot but kills no one fresh): TAIL_HP[0]
|
|
117
|
+
* health let go before a charge (HEAVY_TAP), up to TAIL_HP[1] at a full one (HEAVY_MAX), under HP_MAX.
|
|
118
|
+
*/
|
|
119
|
+
var TAIL_HP = [2, 6];
|
|
114
120
|
var STING = {
|
|
115
121
|
STAB: 0,
|
|
116
122
|
SWEEP_L: 1,
|
|
@@ -125,7 +131,7 @@ var TAILS = [
|
|
|
125
131
|
strike: 26,
|
|
126
132
|
reach: 3.4,
|
|
127
133
|
arc: .25,
|
|
128
|
-
hp:
|
|
134
|
+
hp: TAIL_HP[0],
|
|
129
135
|
hold: 18,
|
|
130
136
|
knock: 0
|
|
131
137
|
},
|
|
@@ -134,7 +140,7 @@ var TAILS = [
|
|
|
134
140
|
strike: 26,
|
|
135
141
|
reach: 2.8,
|
|
136
142
|
arc: 1.1,
|
|
137
|
-
hp:
|
|
143
|
+
hp: TAIL_HP[0],
|
|
138
144
|
hold: 16,
|
|
139
145
|
knock: 0
|
|
140
146
|
},
|
|
@@ -143,7 +149,7 @@ var TAILS = [
|
|
|
143
149
|
strike: 26,
|
|
144
150
|
reach: 2.8,
|
|
145
151
|
arc: 1.1,
|
|
146
|
-
hp:
|
|
152
|
+
hp: TAIL_HP[0],
|
|
147
153
|
hold: 16,
|
|
148
154
|
knock: 0
|
|
149
155
|
},
|
|
@@ -152,7 +158,7 @@ var TAILS = [
|
|
|
152
158
|
strike: 28,
|
|
153
159
|
reach: 3.1,
|
|
154
160
|
arc: .4,
|
|
155
|
-
hp:
|
|
161
|
+
hp: TAIL_HP[0],
|
|
156
162
|
hold: 20,
|
|
157
163
|
knock: 0
|
|
158
164
|
},
|
|
@@ -163,7 +169,7 @@ var TAILS = [
|
|
|
163
169
|
strike: 30,
|
|
164
170
|
reach: 2.6,
|
|
165
171
|
arc: Math.PI,
|
|
166
|
-
hp:
|
|
172
|
+
hp: 3,
|
|
167
173
|
hold: -1,
|
|
168
174
|
knock: 0
|
|
169
175
|
},
|
|
@@ -172,7 +178,7 @@ var TAILS = [
|
|
|
172
178
|
strike: 52,
|
|
173
179
|
reach: 2.8,
|
|
174
180
|
arc: .6,
|
|
175
|
-
hp:
|
|
181
|
+
hp: 5,
|
|
176
182
|
hold: -1,
|
|
177
183
|
knock: 0
|
|
178
184
|
}
|
|
@@ -182,14 +188,18 @@ var [PUNCH_HITS, PUNCH_STUN, PUNCH_MEMORY] = [
|
|
|
182
188
|
3,
|
|
183
189
|
180
|
|
184
190
|
];
|
|
191
|
+
/** Its walk on a wall, a share of its run: the sprint key runs there (the user, 2026-11-16). */
|
|
192
|
+
var CLING_WALK = .5;
|
|
185
193
|
/** 1.4: a step of its burst stays under PLAYER_R, so it cannot tunnel through a thin brush (physics.ts). */
|
|
186
194
|
var XENO_DASH = 1.4;
|
|
187
195
|
var [POUNCE_HP, POUNCE_STUN] = [2, 60];
|
|
188
196
|
/**
|
|
189
197
|
* The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
|
|
190
|
-
* flashes
|
|
191
|
-
*
|
|
192
|
-
*
|
|
198
|
+
* flashes to one with the katana in hand, who beheads him on E within GLORY_REACH metres. The
|
|
199
|
+
* xenomorph's takes any enemy up, with no flash (the user, 2026-11-16): E within GLORY_FAR metres
|
|
200
|
+
* of him, in sight, and GLORY_ARC radians of its look locks the two (`lock`, `foe`, as a saber
|
|
201
|
+
* lock) for GLORY_TICKS, where he does not move and it dashes to him, then it eats his head: he
|
|
202
|
+
* goes down through his armour (LIMB.EATEN), a frag of FRAG.GLORY.
|
|
193
203
|
*/
|
|
194
204
|
var [GLORY_HP, GLORY_REACH, GLORY_ARC, GLORY_TICKS] = [
|
|
195
205
|
3,
|
|
@@ -197,6 +207,12 @@ var [GLORY_HP, GLORY_REACH, GLORY_ARC, GLORY_TICKS] = [
|
|
|
197
207
|
1,
|
|
198
208
|
54
|
|
199
209
|
];
|
|
210
|
+
/**
|
|
211
|
+
* The xenomorph's glory kill from afar (the user, 2026-11-16): within GLORY_FAR metres, in sight,
|
|
212
|
+
* it dashes to a metre of its prey over the first GLORY_DASH ticks of the lock. 7 m in 20 ticks is
|
|
213
|
+
* 21 m/s, a step under PLAYER_R: it cannot tunnel.
|
|
214
|
+
*/
|
|
215
|
+
var [GLORY_FAR, GLORY_DASH] = [8, 20];
|
|
200
216
|
/** How much faster than a man the xenomorph runs (the user, 2026-11-16: a little, not twice). */
|
|
201
217
|
var XENO_PACE = 1.25;
|
|
202
218
|
var PLASMA_R = .12;
|
|
@@ -1381,6 +1397,18 @@ var steer$1 = (p, wish, top, run = 6, accel = 1) => {
|
|
|
1381
1397
|
p.vz = pz + par * wz;
|
|
1382
1398
|
};
|
|
1383
1399
|
/**
|
|
1400
|
+
* A step along its speed, through the boxes and bodies as fly() takes it, with no gravity and no
|
|
1401
|
+
* control: the xenomorph's dash to its glory kill's prey (gun.ts).
|
|
1402
|
+
*/
|
|
1403
|
+
var coast = (p, w, bodies) => {
|
|
1404
|
+
fly$1(p, w, heightOf(p), 0, false, bodies);
|
|
1405
|
+
[p.x, p.y, p.z] = [
|
|
1406
|
+
f32$2(p.x),
|
|
1407
|
+
f32$2(p.y),
|
|
1408
|
+
f32$2(p.z)
|
|
1409
|
+
];
|
|
1410
|
+
};
|
|
1411
|
+
/**
|
|
1384
1412
|
* Moves the cylinder by its speed for one step: sideways (sliding along the boxes, which takes the
|
|
1385
1413
|
* speed into them away), then up or down by g times the world's gravity (a ceiling stops a rise, a floor a
|
|
1386
1414
|
* fall). Returns the speed it came down on a floor at, or -1 when it is not on one. With `snap`
|
|
@@ -1594,8 +1622,8 @@ var clingTo = (p, w, c, speed) => {
|
|
|
1594
1622
|
/**
|
|
1595
1623
|
* On a wall, the wall is its floor (the user, 2026-11-16, to roam it freely): the look's heading
|
|
1596
1624
|
* turned onto it is forward, so W climbs looking at the wall, goes along it looking along it and
|
|
1597
|
-
* down it looking away, S the other way, A and D across. Crouch lets go; a jump
|
|
1598
|
-
*
|
|
1625
|
+
* down it looking away, S the other way, A and D across. Crouch lets go; a jump leaps where the
|
|
1626
|
+
* view turned over onto the wall looks. At a top under the head, climbing pulls
|
|
1599
1627
|
* it up onto the top (MODE.CLIMB); down on a floor, it stands.
|
|
1600
1628
|
*/
|
|
1601
1629
|
var cling = (p, w, c) => {
|
|
@@ -1608,16 +1636,11 @@ var cling = (p, w, c) => {
|
|
|
1608
1636
|
}
|
|
1609
1637
|
if (c.jump) {
|
|
1610
1638
|
enter(p, MODE.AIR);
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
const cp = Math.cos(p.pitch);
|
|
1617
|
-
p.vx = c.fx * cp * 10;
|
|
1618
|
-
p.vz = c.fz * cp * 10;
|
|
1619
|
-
leap$1(p, Math.max(Math.sin(p.pitch) * 10, WALL_KICK_UP / 2));
|
|
1620
|
-
}
|
|
1639
|
+
const [cp, out] = [Math.cos(p.pitch) * 10, Math.sin(p.pitch) * 10];
|
|
1640
|
+
const [k, a] = [Math.max(out, WALL_KICK_SPEED / 2), (c.fz * nx - c.fx * nz) * cp];
|
|
1641
|
+
p.vx = -nx * k - nz * a;
|
|
1642
|
+
p.vz = -nz * k + nx * a;
|
|
1643
|
+
leap$1(p, (c.fx * nx + c.fz * nz) * cp);
|
|
1621
1644
|
return;
|
|
1622
1645
|
}
|
|
1623
1646
|
const fw = (c.keys & KEY.FORWARD ? 1 : 0) - (c.keys & KEY.BACK ? 1 : 0);
|
|
@@ -1627,8 +1650,9 @@ var cling = (p, w, c) => {
|
|
|
1627
1650
|
const [wu, wa] = [fw * hu - s * ha, fw * ha + s * hu];
|
|
1628
1651
|
const n = Math.sqrt(wu * wu + wa * wa);
|
|
1629
1652
|
const was = Math.sqrt(p.vx * p.vx + p.vy * p.vy + p.vz * p.vz);
|
|
1630
|
-
const
|
|
1631
|
-
const
|
|
1653
|
+
const runs = c.keys & KEY.SPRINT;
|
|
1654
|
+
const run = c.kit.run * c.pace * (runs ? 1 : CLING_WALK);
|
|
1655
|
+
const top = runs ? c.kit.sprint * c.pace : run;
|
|
1632
1656
|
const sp = was > top ? Math.max(top, was - 12 * DT$2) : Math.min(top, Math.max(run, was + 3 * c.kit.accel * DT$2));
|
|
1633
1657
|
const v = n > 1 ? sp / n : sp;
|
|
1634
1658
|
const up = wu > .05 ? 1 : wu < -.05 ? -1 : 0;
|
|
@@ -1893,6 +1917,17 @@ var swingOf = (p, table = CUTS) => {
|
|
|
1893
1917
|
} : c;
|
|
1894
1918
|
};
|
|
1895
1919
|
/**
|
|
1920
|
+
* The health a xenomorph's swing `p` takes: the claws and the specials their own `hp`; the tail
|
|
1921
|
+
* TAIL_HP[0] let go before a charge, up to TAIL_HP[1] for a heavy release of a full one (`charge`
|
|
1922
|
+
* stays through the release, gun.ts).
|
|
1923
|
+
*/
|
|
1924
|
+
var sting = (p) => {
|
|
1925
|
+
const c = TAILS[p.cut ?? 0];
|
|
1926
|
+
if (c.hold < 0) return c.hp;
|
|
1927
|
+
const k = p.heavy ? Math.min(p.charge ?? 0, HEAVY_MAX) / HEAVY_MAX : 0;
|
|
1928
|
+
return TAIL_HP[0] + Math.round((TAIL_HP[1] - TAIL_HP[0]) * k);
|
|
1929
|
+
};
|
|
1930
|
+
/**
|
|
1896
1931
|
* The enemies the cut of `p` (`p.cut`, `p` the state after the step that struck) hits, of `foes`
|
|
1897
1932
|
* (as he saw them): each within CUTS reach of his centre less PLAYER_R on the floor plane, inside
|
|
1898
1933
|
* the arc round his look (the foe's own angular radius counts: his edge in the arc is a hit), with
|
|
@@ -6281,19 +6316,29 @@ var pouncing = (p) => p.dash > 50;
|
|
|
6281
6316
|
*/
|
|
6282
6317
|
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);
|
|
6283
6318
|
/**
|
|
6284
|
-
* The enemy
|
|
6285
|
-
*
|
|
6286
|
-
* GLORY_REACH on the floor plane,
|
|
6319
|
+
* The enemy `me` would glory kill with E (room.ts feast()), of `foes` as it sees them: the nearest
|
|
6320
|
+
* one up, in no lock and not seated, a body's height above or below and GLORY_ARC of its look. With
|
|
6321
|
+
* the katana (`w` undefined) within GLORY_REACH on the floor plane, with GLORY_HP health or less;
|
|
6322
|
+
* the xenomorph's within GLORY_FAR, in sight through the world `w`, at any health (the user,
|
|
6323
|
+
* 2026-11-16).
|
|
6287
6324
|
*/
|
|
6288
|
-
var glory = (me, foes) => {
|
|
6325
|
+
var glory = (me, foes, w) => {
|
|
6289
6326
|
const [fx, fz] = forward(me.yaw);
|
|
6290
6327
|
let best;
|
|
6291
|
-
let near = GLORY_REACH;
|
|
6328
|
+
let near = w ? GLORY_FAR : GLORY_REACH;
|
|
6292
6329
|
for (const f of foes) {
|
|
6293
6330
|
const [dx, dz] = [f.x - me.x, f.z - me.z];
|
|
6294
6331
|
const d = Math.hypot(dx, dz);
|
|
6295
6332
|
const facing = d < .001 || Math.acos(Math.min(1, (dx * fx + dz * fz) / d)) <= GLORY_ARC;
|
|
6296
|
-
if (!f.down && !f.lock && f.mode !== MODE.RIDE &&
|
|
6333
|
+
if (!f.down && !f.lock && f.mode !== MODE.RIDE && (w ? !hidden(w, [
|
|
6334
|
+
me.x,
|
|
6335
|
+
me.y + 1.3,
|
|
6336
|
+
me.z
|
|
6337
|
+
], [
|
|
6338
|
+
f.x,
|
|
6339
|
+
f.y + 1.3,
|
|
6340
|
+
f.z
|
|
6341
|
+
]) : f.hp <= GLORY_HP) && d <= near && Math.abs(f.y - me.y) < 1.8 && facing) [best, near] = [f, d];
|
|
6297
6342
|
}
|
|
6298
6343
|
return best;
|
|
6299
6344
|
};
|
|
@@ -6364,7 +6409,11 @@ var STRIKE = {
|
|
|
6364
6409
|
var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
6365
6410
|
const down = p.down > 0;
|
|
6366
6411
|
const locked = !down && (p.lock ?? 0) > 0;
|
|
6367
|
-
|
|
6412
|
+
if (locked && !p.wield && p.lock > GLORY_TICKS - GLORY_DASH && (p.vx || p.vz)) {
|
|
6413
|
+
coast(p, w, bodies);
|
|
6414
|
+
p.ev = p.lock == GLORY_TICKS ? EV.DASH : 0;
|
|
6415
|
+
if (p.lock <= GLORY_TICKS - GLORY_DASH + 1) p.vx = p.vz = 0;
|
|
6416
|
+
} else move(p, down || locked ? {
|
|
6368
6417
|
...i,
|
|
6369
6418
|
keys: 0
|
|
6370
6419
|
} : i, w, team, bodies, kit);
|
|
@@ -6422,16 +6471,17 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6422
6471
|
const top = !!p.swing && !p.heavy && ticks - (p.swing ?? 0) === hold;
|
|
6423
6472
|
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);
|
|
6424
6473
|
else if (top && armed && !busy && (p.charge ?? 0) >= HEAVY_TAP) {
|
|
6425
|
-
[p.heavy, p.charge] = [true, 0];
|
|
6474
|
+
[p.heavy, p.charge] = [true, kit.xeno ? p.charge : 0];
|
|
6426
6475
|
p.swing = swingOf(p, table).ticks;
|
|
6427
6476
|
} else {
|
|
6428
|
-
p.charge = top || kit.xeno ? 0 : p.charge;
|
|
6477
|
+
p.charge = top || kit.xeno && !p.heavy ? 0 : p.charge;
|
|
6429
6478
|
const s = p.swing ?? 0;
|
|
6430
6479
|
const c = swingOf(p, table);
|
|
6431
6480
|
const blow = PUNCHES[p.cut ?? 0] ?? PUNCHES[0];
|
|
6432
6481
|
const stop = (v) => v == s - 1 && (v == c.ticks - c.strike || v == blow.ticks - blow.strike || !p.heavy && v == ticks - hold);
|
|
6433
6482
|
p.swing = Math.max(0, kit.haste > 1 && stop(s - 1) ? s - 1 : s - kit.haste);
|
|
6434
6483
|
p.heavy = !!p.swing && !!p.heavy;
|
|
6484
|
+
p.charge = kit.xeno && !p.heavy ? 0 : p.charge;
|
|
6435
6485
|
}
|
|
6436
6486
|
p.mag = Math.min(p.mag ?? 0, Math.max(p.ammo, 0));
|
|
6437
6487
|
const has = [
|
|
@@ -9350,12 +9400,13 @@ var Room = class {
|
|
|
9350
9400
|
* whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
|
|
9351
9401
|
* a blow with a `knock`, stuns him as a tackle does: a stumble thrown the way `p` faces (`knock`
|
|
9352
9402
|
* times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
|
|
9353
|
-
* whole `hp` and never stun: its claws XENO_CLAW, its tail
|
|
9403
|
+
* whole `hp` and never stun: its claws XENO_CLAW, its tail as hard as it charged (sting()).
|
|
9354
9404
|
*/
|
|
9355
9405
|
punch(p, view) {
|
|
9356
9406
|
const xeno = this.kit(p).xeno;
|
|
9357
9407
|
const blow = xeno ? {
|
|
9358
9408
|
...swingOf(p.state, TAILS),
|
|
9409
|
+
hp: sting(p.state),
|
|
9359
9410
|
knock: 0
|
|
9360
9411
|
} : PUNCHES[p.state.cut ?? 0] ?? PUNCHES[0];
|
|
9361
9412
|
const seen = strike(this.world, p.state, this.enemies(p, view), blow);
|
|
@@ -9423,12 +9474,14 @@ var Room = class {
|
|
|
9423
9474
|
foe.state.fried = this.shot(foe, 1, foe.railer, foe.state.x - r.x, foe.state.z - r.z, FRAG.RAIL);
|
|
9424
9475
|
}
|
|
9425
9476
|
/**
|
|
9426
|
-
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up
|
|
9427
|
-
*
|
|
9428
|
-
*
|
|
9429
|
-
*
|
|
9430
|
-
*
|
|
9431
|
-
*
|
|
9477
|
+
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up,
|
|
9478
|
+
* within GLORY_ARC of its look where `p` drew him, and in no lock, is glory killed (glory()):
|
|
9479
|
+
* with the katana within GLORY_REACH and with GLORY_HP or less, the xenomorph's within
|
|
9480
|
+
* GLORY_FAR, in sight, at any health (the user, 2026-11-16). The katana takes his head at once
|
|
9481
|
+
* and throws the body back GLORY_PUSH m/s, the follow-through of a cut across in hand (the user,
|
|
9482
|
+
* 2026-11-16). The xenomorph holds him: the two locked (`lock`, `foe`) for GLORY_TICKS, his flag
|
|
9483
|
+
* dropped, `p` dashing to a metre of him (the user, 2026-11-16); duel() ends it. True when it
|
|
9484
|
+
* happened.
|
|
9432
9485
|
*/
|
|
9433
9486
|
feast(p, view) {
|
|
9434
9487
|
const me = p.state;
|
|
@@ -9444,7 +9497,7 @@ var Room = class {
|
|
|
9444
9497
|
lock,
|
|
9445
9498
|
mode
|
|
9446
9499
|
}] : [];
|
|
9447
|
-
}));
|
|
9500
|
+
}), xeno ? this.world : void 0);
|
|
9448
9501
|
const foe = this.players().find((q) => q.info.id === seen?.id);
|
|
9449
9502
|
if (!seen || !foe) return false;
|
|
9450
9503
|
const [dx, dz] = [seen.x - me.x, seen.z - me.z];
|
|
@@ -9486,7 +9539,8 @@ var Room = class {
|
|
|
9486
9539
|
vz: 0
|
|
9487
9540
|
});
|
|
9488
9541
|
}
|
|
9489
|
-
|
|
9542
|
+
const v = Math.max(d - 1, 0) * 60 / GLORY_DASH / d;
|
|
9543
|
+
[me.vx, me.vz] = [Math.fround(dx * v), Math.fround(dz * v)];
|
|
9490
9544
|
return true;
|
|
9491
9545
|
}
|
|
9492
9546
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PlayerState } from '../shared/types';
|
|
2
|
+
/**
|
|
3
|
+
* The yaw, pitch and roll of the view `yaw`, `pitch`, `roll` turned by `a` (a quarter turn is the
|
|
4
|
+
* whole way) about the horizontal of the wall on `wall` (SIDE).
|
|
5
|
+
*/
|
|
6
|
+
export declare const turned: (yaw: number, pitch: number, roll: number, wall: number, a: number) => [number, number, number];
|
|
7
|
+
export interface Crawl {
|
|
8
|
+
/** Follows the own player `p` for dt seconds: on a wall the view turns over onto it, off it back. */
|
|
9
|
+
update(p: PlayerState | undefined, dt: number): void;
|
|
10
|
+
/** The view `yaw`, `pitch`, `roll` as drawn: turned over onto the wall as far as it has gone. */
|
|
11
|
+
view(yaw: number, pitch: number, roll: number): [number, number, number];
|
|
12
|
+
}
|
|
13
|
+
export declare const createCrawl: () => Crawl;
|
|
@@ -38,8 +38,9 @@ export declare const HOOKED: Lash;
|
|
|
38
38
|
* Where its tail is through a strike (TAILS, by the cut): it goes from HOOKED to the strike's poise
|
|
39
39
|
* in the first third of the wind-up (or most of the way to the strike for a special), so it answers
|
|
40
40
|
* the click at once (the user, 2026-11-16), is driven to its end at the strike, eased in, then
|
|
41
|
-
* comes back. A charge holds
|
|
42
|
-
*
|
|
41
|
+
* comes back. A charge holds it cocked on its side, drawn in and coiled in an S over a tap of
|
|
42
|
+
* charge, then still but for its breath with the clock `t` (the user, 2026-11-16); let go, it
|
|
43
|
+
* strikes from there. The SPIN turns the tail low once round the body.
|
|
43
44
|
*/
|
|
44
45
|
export declare const lashOf: (p: Pick<PlayerState, "cut" | "swing" | "heavy" | "charge" | "down">, t?: number) => Lash;
|
|
45
46
|
/** A solved skeleton (solve() in rig.ts): each joint's place and turn in the world. */
|
|
@@ -30,6 +30,12 @@ export declare const swingOf: (p: Pick<PlayerState, "cut" | "heavy">, table?: ty
|
|
|
30
30
|
hp: number;
|
|
31
31
|
hold: number;
|
|
32
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* The health a xenomorph's swing `p` takes: the claws and the specials their own `hp`; the tail
|
|
35
|
+
* TAIL_HP[0] let go before a charge, up to TAIL_HP[1] for a heavy release of a full one (`charge`
|
|
36
|
+
* stays through the release, gun.ts).
|
|
37
|
+
*/
|
|
38
|
+
export declare const sting: (p: Pick<PlayerState, "cut" | "heavy" | "charge">) => number;
|
|
33
39
|
/**
|
|
34
40
|
* The enemies the cut of `p` (`p.cut`, `p` the state after the step that struck) hits, of `foes`
|
|
35
41
|
* (as he saw them): each within CUTS reach of his centre less PLAYER_R on the floor plane, inside
|
|
@@ -216,8 +216,8 @@ export declare const BLOW: {
|
|
|
216
216
|
readonly CLAW_L: 4;
|
|
217
217
|
readonly CLAW_R: 5;
|
|
218
218
|
};
|
|
219
|
-
/** A swipe of the claws: XENO_CLAW health (the user, 2026-11-16: they hurt). */
|
|
220
|
-
export declare const XENO_CLAW =
|
|
219
|
+
/** A swipe of the claws: XENO_CLAW health (the user, 2026-11-16: they hurt; then 4 was too much). */
|
|
220
|
+
export declare const XENO_CLAW = 2;
|
|
221
221
|
export declare const PUNCHES: {
|
|
222
222
|
ticks: number;
|
|
223
223
|
strike: number;
|
|
@@ -231,12 +231,18 @@ export declare const PUNCHES: {
|
|
|
231
231
|
* The xenomorph's tail (the user, 2026-11-16: it fights as the katana does, slower, and its sting
|
|
232
232
|
* kills). The right button (KEY.BLADE, input.ts) starts a strike by the keys as cutOf() reads them:
|
|
233
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())
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
|
|
234
|
+
* the top of its wind-up (`hold`) it charges as a cut does (HEAVY, swingOf()), and the strike takes
|
|
235
|
+
* more the longer it charged (TAIL_HP, sting()). A double click of the right button (KEY.SPECIAL
|
|
236
|
+
* with it) is its special: a sweep's is the SPIN, the tail whipped all round the body; the stab's
|
|
237
|
+
* and the lash's the LEAP, up TAIL_LEAP m/s and down on the foe as it lands; each takes its own
|
|
238
|
+
* `hp`. The xenomorph's `cut` reads this table: CLAW_L and CLAW_R are its claws, at their place in it.
|
|
239
239
|
*/
|
|
240
|
+
/**
|
|
241
|
+
* The tail's strike (the user, 2026-11-16, after Aliens versus Predator, 1999: held, it charges; let
|
|
242
|
+
* go, it strikes as hard as it charged; full, it hurts a lot but kills no one fresh): TAIL_HP[0]
|
|
243
|
+
* health let go before a charge (HEAVY_TAP), up to TAIL_HP[1] at a full one (HEAVY_MAX), under HP_MAX.
|
|
244
|
+
*/
|
|
245
|
+
export declare const TAIL_HP: readonly [2, 6];
|
|
240
246
|
export declare const STING: {
|
|
241
247
|
readonly STAB: 0;
|
|
242
248
|
readonly SWEEP_L: 1;
|
|
@@ -259,8 +265,8 @@ export declare const PUNCH_HITS: number, PUNCH_STUN: number, PUNCH_MEMORY: numbe
|
|
|
259
265
|
/**
|
|
260
266
|
* The xenomorph (the user, 2026-11-15; kit.ts). XENO_HP health. It clings to a wall it faces with
|
|
261
267
|
* forward and the sprint held (MODE.CLING, physics.ts; the sprint since the user, 2026-11-16):
|
|
262
|
-
* up, down or along it
|
|
263
|
-
* 2026-11-16) while the wall rises CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP
|
|
268
|
+
* up, down or along it at a walk (CLING_WALK of its run), with the sprint key at its run then its
|
|
269
|
+
* sprint as on a floor (the user, 2026-11-16) while the wall rises CLING_HOLD m over its feet; a jump kicks it off along the look at CLING_LEAP
|
|
264
270
|
* m/s. It dashes as a man does, XENO_DASH times as fast so as far, three in a row (kit.ts; the
|
|
265
271
|
* user, 2026-11-16: no more charged pounce); an enemy its dash's burst reaches is pinned (room.ts):
|
|
266
272
|
* POUNCE_HP health, his flag dropped, a stumble of POUNCE_STUN ticks, once per TACKLE_COOLDOWN. An
|
|
@@ -270,16 +276,26 @@ export declare const XENO_HP = 12;
|
|
|
270
276
|
export declare const CLING_FACING = 0.6;
|
|
271
277
|
export declare const CLING_HOLD = 0.4;
|
|
272
278
|
export declare const CLING_LEAP = 10;
|
|
279
|
+
/** Its walk on a wall, a share of its run: the sprint key runs there (the user, 2026-11-16). */
|
|
280
|
+
export declare const CLING_WALK = 0.5;
|
|
273
281
|
/** 1.4: a step of its burst stays under PLAYER_R, so it cannot tunnel through a thin brush (physics.ts). */
|
|
274
282
|
export declare const XENO_DASH = 1.4;
|
|
275
283
|
export declare const POUNCE_HP: number, POUNCE_STUN: number;
|
|
276
284
|
/**
|
|
277
285
|
* The glory kill (the user, 2026-11-16, after DOOM 2016): an enemy with GLORY_HP health or less, up,
|
|
278
|
-
* flashes
|
|
279
|
-
*
|
|
280
|
-
*
|
|
286
|
+
* flashes to one with the katana in hand, who beheads him on E within GLORY_REACH metres. The
|
|
287
|
+
* xenomorph's takes any enemy up, with no flash (the user, 2026-11-16): E within GLORY_FAR metres
|
|
288
|
+
* of him, in sight, and GLORY_ARC radians of its look locks the two (`lock`, `foe`, as a saber
|
|
289
|
+
* lock) for GLORY_TICKS, where he does not move and it dashes to him, then it eats his head: he
|
|
290
|
+
* goes down through his armour (LIMB.EATEN), a frag of FRAG.GLORY.
|
|
281
291
|
*/
|
|
282
292
|
export declare const GLORY_HP: number, GLORY_REACH: number, GLORY_ARC: number, GLORY_TICKS: number;
|
|
293
|
+
/**
|
|
294
|
+
* The xenomorph's glory kill from afar (the user, 2026-11-16): within GLORY_FAR metres, in sight,
|
|
295
|
+
* it dashes to a metre of its prey over the first GLORY_DASH ticks of the lock. 7 m in 20 ticks is
|
|
296
|
+
* 21 m/s, a step under PLAYER_R: it cannot tunnel.
|
|
297
|
+
*/
|
|
298
|
+
export declare const GLORY_FAR: number, GLORY_DASH: number;
|
|
283
299
|
/** The katana's glory kill (room.ts feast()): the speed it throws the beheaded body back at. */
|
|
284
300
|
export declare const GLORY_PUSH = 7;
|
|
285
301
|
/** How much faster than a man the xenomorph runs (the user, 2026-11-16: a little, not twice). */
|
|
@@ -105,6 +105,11 @@ 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
|
+
/**
|
|
109
|
+
* A step along its speed, through the boxes and bodies as fly() takes it, with no gravity and no
|
|
110
|
+
* control: the xenomorph's dash to its glory kill's prey (gun.ts).
|
|
111
|
+
*/
|
|
112
|
+
export declare const coast: (p: PlayerState, w: World, bodies: readonly Body[]) => void;
|
|
108
113
|
/**
|
|
109
114
|
* Applies one input for 1 / TICK_HZ s, in place: yaw and pitch from the input (pitch clamped to
|
|
110
115
|
* MAX_PITCH), then the step of the current mode (see the top of the file). Feet under the world's
|
|
@@ -173,7 +173,7 @@ export declare class Room {
|
|
|
173
173
|
* whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
|
|
174
174
|
* a blow with a `knock`, stuns him as a tackle does: a stumble thrown the way `p` faces (`knock`
|
|
175
175
|
* times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
|
|
176
|
-
* whole `hp` and never stun: its claws XENO_CLAW, its tail
|
|
176
|
+
* whole `hp` and never stun: its claws XENO_CLAW, its tail as hard as it charged (sting()).
|
|
177
177
|
*/
|
|
178
178
|
private punch;
|
|
179
179
|
/**
|
|
@@ -185,12 +185,14 @@ export declare class Room {
|
|
|
185
185
|
/** 1 hp of the bolt's drain to `foe`, as his railer deals it; if it puts him down he is disintegrated (`fried`). */
|
|
186
186
|
private fry;
|
|
187
187
|
/**
|
|
188
|
-
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
188
|
+
* E pressed by `p`, the xenomorph or one with the katana in hand: the nearest enemy who is up,
|
|
189
|
+
* within GLORY_ARC of its look where `p` drew him, and in no lock, is glory killed (glory()):
|
|
190
|
+
* with the katana within GLORY_REACH and with GLORY_HP or less, the xenomorph's within
|
|
191
|
+
* GLORY_FAR, in sight, at any health (the user, 2026-11-16). The katana takes his head at once
|
|
192
|
+
* and throws the body back GLORY_PUSH m/s, the follow-through of a cut across in hand (the user,
|
|
193
|
+
* 2026-11-16). The xenomorph holds him: the two locked (`lock`, `foe`) for GLORY_TICKS, his flag
|
|
194
|
+
* dropped, `p` dashing to a metre of him (the user, 2026-11-16); duel() ends it. True when it
|
|
195
|
+
* happened.
|
|
194
196
|
*/
|
|
195
197
|
private feast;
|
|
196
198
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlayerState } from './types';
|
|
2
|
+
import type { World } from './world';
|
|
2
3
|
/** Whether the player's body is a weapon: in a slide, or in the burst of a dash. */
|
|
3
4
|
export declare const tackling: (p: PlayerState) => boolean;
|
|
4
5
|
/**
|
|
@@ -12,8 +13,10 @@ export declare const pouncing: (p: PlayerState) => boolean;
|
|
|
12
13
|
*/
|
|
13
14
|
export declare const reaches: (a: PlayerState, b: PlayerState) => boolean;
|
|
14
15
|
/**
|
|
15
|
-
* The enemy
|
|
16
|
-
*
|
|
17
|
-
* GLORY_REACH on the floor plane,
|
|
16
|
+
* The enemy `me` would glory kill with E (room.ts feast()), of `foes` as it sees them: the nearest
|
|
17
|
+
* one up, in no lock and not seated, a body's height above or below and GLORY_ARC of its look. With
|
|
18
|
+
* the katana (`w` undefined) within GLORY_REACH on the floor plane, with GLORY_HP health or less;
|
|
19
|
+
* the xenomorph's within GLORY_FAR, in sight through the world `w`, at any health (the user,
|
|
20
|
+
* 2026-11-16).
|
|
18
21
|
*/
|
|
19
|
-
export declare const glory: (me: PlayerState, foes: readonly PlayerState[]) => PlayerState | undefined;
|
|
22
|
+
export declare const glory: (me: PlayerState, foes: readonly PlayerState[], w?: World) => PlayerState | undefined;
|
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.181.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|