@korial29/tiny-fps 0.181.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/server.js CHANGED
@@ -73,7 +73,7 @@ var CLAW = {
73
73
  strike: 5,
74
74
  reach: 1.8,
75
75
  arc: .7,
76
- hp: 4,
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()). 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.
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: Infinity,
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: Infinity,
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: Infinity,
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: Infinity,
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: Infinity,
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: Infinity,
181
+ hp: 5,
176
182
  hold: -1,
177
183
  knock: 0
178
184
  }
@@ -1911,6 +1917,17 @@ var swingOf = (p, table = CUTS) => {
1911
1917
  } : c;
1912
1918
  };
1913
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
+ /**
1914
1931
  * The enemies the cut of `p` (`p.cut`, `p` the state after the step that struck) hits, of `foes`
1915
1932
  * (as he saw them): each within CUTS reach of his centre less PLAYER_R on the floor plane, inside
1916
1933
  * the arc round his look (the foe's own angular radius counts: his edge in the arc is a hit), with
@@ -6454,16 +6471,17 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
6454
6471
  const top = !!p.swing && !p.heavy && ticks - (p.swing ?? 0) === hold;
6455
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);
6456
6473
  else if (top && armed && !busy && (p.charge ?? 0) >= HEAVY_TAP) {
6457
- [p.heavy, p.charge] = [true, 0];
6474
+ [p.heavy, p.charge] = [true, kit.xeno ? p.charge : 0];
6458
6475
  p.swing = swingOf(p, table).ticks;
6459
6476
  } else {
6460
- p.charge = top || kit.xeno ? 0 : p.charge;
6477
+ p.charge = top || kit.xeno && !p.heavy ? 0 : p.charge;
6461
6478
  const s = p.swing ?? 0;
6462
6479
  const c = swingOf(p, table);
6463
6480
  const blow = PUNCHES[p.cut ?? 0] ?? PUNCHES[0];
6464
6481
  const stop = (v) => v == s - 1 && (v == c.ticks - c.strike || v == blow.ticks - blow.strike || !p.heavy && v == ticks - hold);
6465
6482
  p.swing = Math.max(0, kit.haste > 1 && stop(s - 1) ? s - 1 : s - kit.haste);
6466
6483
  p.heavy = !!p.swing && !!p.heavy;
6484
+ p.charge = kit.xeno && !p.heavy ? 0 : p.charge;
6467
6485
  }
6468
6486
  p.mag = Math.min(p.mag ?? 0, Math.max(p.ammo, 0));
6469
6487
  const has = [
@@ -9382,12 +9400,13 @@ var Room = class {
9382
9400
  * whole one. The PUNCH_STUN-th blow he takes with no more than PUNCH_MEMORY ticks between two, or
9383
9401
  * a blow with a `knock`, stuns him as a tackle does: a stumble thrown the way `p` faces (`knock`
9384
9402
  * times as hard), the flag dropped, `by` the puncher. The xenomorph's swings (TAILS) take their
9385
- * whole `hp` and never stun: its claws XENO_CLAW, its tail all.
9403
+ * whole `hp` and never stun: its claws XENO_CLAW, its tail as hard as it charged (sting()).
9386
9404
  */
9387
9405
  punch(p, view) {
9388
9406
  const xeno = this.kit(p).xeno;
9389
9407
  const blow = xeno ? {
9390
9408
  ...swingOf(p.state, TAILS),
9409
+ hp: sting(p.state),
9391
9410
  knock: 0
9392
9411
  } : PUNCHES[p.state.cut ?? 0] ?? PUNCHES[0];
9393
9412
  const seen = strike(this.world, p.state, this.enemies(p, view), blow);
@@ -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 = 4;
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()). 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.
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;
@@ -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 all.
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
  /**
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.181.0",
5
+ "version": "0.181.1",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"