@korial29/tiny-fps 0.196.3 → 0.197.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 +53 -52
- package/dist/local.js +1 -1
- package/dist/server.js +142 -14
- package/dist/types/client/balls.d.ts +1 -1
- package/dist/types/client/body.d.ts +1 -1
- package/dist/types/client/combat.d.ts +3 -1
- package/dist/types/client/face.d.ts +2 -1
- package/dist/types/client/hud.d.ts +2 -0
- package/dist/types/client/hunter.d.ts +1 -0
- package/dist/types/client/input.d.ts +4 -0
- package/dist/types/client/katana.d.ts +6 -0
- package/dist/types/client/render.d.ts +2 -0
- package/dist/types/client/sfx.d.ts +6 -0
- package/dist/types/client/soldier.d.ts +1 -1
- package/dist/types/client/taunt.d.ts +3 -1
- package/dist/types/shared/constants.d.ts +16 -0
- package/dist/types/shared/gun.d.ts +1 -0
- package/dist/types/shared/kit.d.ts +3 -0
- package/dist/types/shared/plasma.d.ts +3 -1
- package/dist/types/shared/room.d.ts +4 -0
- package/dist/types/shared/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -233,6 +233,8 @@ var EXEC = {
|
|
|
233
233
|
/** How much faster than a man the xenomorph runs (the user, 2026-11-16: a little, not twice). */
|
|
234
234
|
var XENO_PACE = 1.25;
|
|
235
235
|
var PLASMA_R = .12;
|
|
236
|
+
var HARPOON_R = .08;
|
|
237
|
+
var DISK_R = .16;
|
|
236
238
|
/**
|
|
237
239
|
* What a vehicle's bolts take (the user, 2026-11-16: stronger, they grazed like the rifle's rounds):
|
|
238
240
|
* BOLT_HP from a player each one that hits him, and 1 from a hull every BOLT_GRAZE on it.
|
|
@@ -738,7 +740,8 @@ var ROLE = {
|
|
|
738
740
|
MARINE: 0,
|
|
739
741
|
NINJA: 1,
|
|
740
742
|
ASTRONAUT: 2,
|
|
741
|
-
XENO: 3
|
|
743
|
+
XENO: 3,
|
|
744
|
+
HUNTER: 4
|
|
742
745
|
};
|
|
743
746
|
var MARINE = {
|
|
744
747
|
run: 6,
|
|
@@ -813,16 +816,26 @@ var KITS = [
|
|
|
813
816
|
hp: 12,
|
|
814
817
|
gear: false,
|
|
815
818
|
xeno: true
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
...MARINE,
|
|
822
|
+
katana: true,
|
|
823
|
+
hunter: true
|
|
816
824
|
}
|
|
817
825
|
];
|
|
818
826
|
/**
|
|
819
827
|
* The classes a map offers, the first one the default: on a map with space helmets the astronaut
|
|
820
828
|
* and the xenomorph, who breathes none.
|
|
821
829
|
*/
|
|
822
|
-
var rolesOf = (def) => def.helmets ? [
|
|
830
|
+
var rolesOf = (def) => def.helmets ? [
|
|
831
|
+
ROLE.ASTRONAUT,
|
|
832
|
+
ROLE.XENO,
|
|
833
|
+
ROLE.HUNTER
|
|
834
|
+
] : [
|
|
823
835
|
ROLE.MARINE,
|
|
824
836
|
ROLE.NINJA,
|
|
825
|
-
ROLE.XENO
|
|
837
|
+
ROLE.XENO,
|
|
838
|
+
ROLE.HUNTER
|
|
826
839
|
];
|
|
827
840
|
/** The class a player plays on the map: his `role` when the map offers it, else the map's default. */
|
|
828
841
|
var roleOf = (role, def) => {
|
|
@@ -5917,7 +5930,7 @@ var drift = (n) => [RIFLE_DRIFT * Math.sin(n * 2.4), RIFLE_DRIFT * Math.cos(n *
|
|
|
5917
5930
|
* as the shot (`power`). The laser rifle's (the user, 2026-11-08: the gun's balls, in red) has
|
|
5918
5931
|
* power 0, RIFLE_RANGE to go, and leaves along the look drifted by its shot's pattern.
|
|
5919
5932
|
*/
|
|
5920
|
-
var launch$1 = (p, team = 0) => {
|
|
5933
|
+
var launch$1 = (p, team = 0, harpoon = false) => {
|
|
5921
5934
|
const [dy, dp] = p.rifled ? drift(p.shots) : [0, 0];
|
|
5922
5935
|
const [yaw, pitch] = [p.yaw + dy, p.pitch + dp];
|
|
5923
5936
|
const [sy, cy, sp, cp] = [
|
|
@@ -5936,11 +5949,17 @@ var launch$1 = (p, team = 0) => {
|
|
|
5936
5949
|
dx: -sy * cp,
|
|
5937
5950
|
dy: sp,
|
|
5938
5951
|
dz: -cy * cp,
|
|
5939
|
-
left: p.rifled ? 60 : 80,
|
|
5952
|
+
left: p.rifled ? 60 : harpoon ? 90 : 80,
|
|
5940
5953
|
burst: false,
|
|
5941
|
-
power: p.rifled ? 0 : p.power ?? 1
|
|
5954
|
+
power: p.rifled ? 0 : harpoon ? 8 : p.power ?? 1
|
|
5942
5955
|
};
|
|
5943
5956
|
};
|
|
5957
|
+
/** The Hunter's returning disc: a wide, fast shot that the room turns back toward its owner. */
|
|
5958
|
+
var disk = (p, team = 0) => ({
|
|
5959
|
+
...launch$1(p, team),
|
|
5960
|
+
power: 9,
|
|
5961
|
+
left: 28
|
|
5962
|
+
});
|
|
5944
5963
|
/**
|
|
5945
5964
|
* The arc of energy the ARC cut of `p` throws at its strike (`p` the state after that step): from
|
|
5946
5965
|
* the eye along the look like a ball, ARC_RANGE metres to go, its CUT in `arc`. Its id is the
|
|
@@ -5954,7 +5973,7 @@ var wave = (p, team = 0) => ({
|
|
|
5954
5973
|
arc: p.cut
|
|
5955
5974
|
});
|
|
5956
5975
|
/** The speed of the flight `b`, m/s: an arc's, a bolt's, a rifle round's (power 0) or a ball's. A grenade has its own (`Ball.v`). */
|
|
5957
|
-
var speedOf = (b) => b.arc ? ARC_SPEED : b.power === 6 ? 120 : b.power === 0 ? 400 : 80;
|
|
5976
|
+
var speedOf = (b) => b.arc ? ARC_SPEED : b.power === 9 || b.power === 10 ? 52 : b.power === 8 ? 72 : b.power === 6 ? 120 : b.power === 0 ? 400 : 80;
|
|
5958
5977
|
/** Metres the flight `b` goes in a tick. */
|
|
5959
5978
|
var stepOf = (b) => speedOf(b) / 60;
|
|
5960
5979
|
/**
|
|
@@ -5993,11 +6012,12 @@ var fly = (w, b, m, foes) => {
|
|
|
5993
6012
|
b.dz
|
|
5994
6013
|
];
|
|
5995
6014
|
const go = Math.min(m, b.left);
|
|
6015
|
+
const radius = b.power === 9 || b.power === 10 ? DISK_R : b.power === 8 ? HARPOON_R : PLASMA_R;
|
|
5996
6016
|
const seam = w.def.seam === void 0 || !d[1] ? Infinity : (w.def.seam - o[1]) / d[1];
|
|
5997
|
-
let t = ray(w, o, d, seam > 1e-6 ? Math.min(go, seam) : go,
|
|
6017
|
+
let t = ray(w, o, d, seam > 1e-6 ? Math.min(go, seam) : go, radius);
|
|
5998
6018
|
let hit;
|
|
5999
6019
|
for (const f of foes) {
|
|
6000
|
-
const u = cylinder(o, d, f, PLAYER_R + (b.arc ? ARC_R :
|
|
6020
|
+
const u = cylinder(o, d, f, PLAYER_R + (b.arc ? ARC_R : radius), heightOf(f));
|
|
6001
6021
|
if (u < t) [t, hit] = [u, f];
|
|
6002
6022
|
}
|
|
6003
6023
|
b.burst = t < go;
|
|
@@ -6762,7 +6782,8 @@ var STRIKE = {
|
|
|
6762
6782
|
CUT: 2,
|
|
6763
6783
|
RAIL: 3,
|
|
6764
6784
|
LASER: 4,
|
|
6765
|
-
NADE: 5
|
|
6785
|
+
NADE: 5,
|
|
6786
|
+
DISK: 6
|
|
6766
6787
|
};
|
|
6767
6788
|
/**
|
|
6768
6789
|
* One input: the move, then the weapons. Returns what struck on this step (STRIKE), for the host to
|
|
@@ -6933,6 +6954,11 @@ var step = (p, i, w, team, armed = true, bodies = [], kit = KITS[0]) => {
|
|
|
6933
6954
|
p.shots = p.shots + 1 & 255;
|
|
6934
6955
|
return STRIKE.NADE;
|
|
6935
6956
|
}
|
|
6957
|
+
if (kit.hunter && p.wield && i.keys & KEY.SPECIAL && !(i.keys & KEY.FIRE) && !busy && !p.swing && !p.cool) {
|
|
6958
|
+
p.cool = 75;
|
|
6959
|
+
p.shots = p.shots + 1 & 255;
|
|
6960
|
+
return STRIKE.DISK;
|
|
6961
|
+
}
|
|
6936
6962
|
if (p.wield && i.keys & KEY.SPECIAL && !busy && !p.swing) {
|
|
6937
6963
|
p.cut = i.keys & KEY.FIRE ? cutOf(i.keys) + 4 : (i.keys & (KEY.LEFT | KEY.RIGHT)) === KEY.LEFT ? CUT.ARC_L : CUT.ARC_R;
|
|
6938
6964
|
[p.swing, p.charge] = [CUTS[p.cut].ticks, 0];
|
|
@@ -9330,7 +9356,8 @@ var BOT_NAMES = [
|
|
|
9330
9356
|
var BOT_ROLES = [
|
|
9331
9357
|
ROLE.MARINE,
|
|
9332
9358
|
ROLE.NINJA,
|
|
9333
|
-
ROLE.XENO
|
|
9359
|
+
ROLE.XENO,
|
|
9360
|
+
ROLE.HUNTER
|
|
9334
9361
|
];
|
|
9335
9362
|
/** The two seats of a rover, the driver's first. */
|
|
9336
9363
|
var SEATS = ["driver", "rider"];
|
|
@@ -9444,6 +9471,8 @@ var Room = class {
|
|
|
9444
9471
|
gone;
|
|
9445
9472
|
/** The plasma balls in flight, and the ones that burst since the last snapshot, which sends them once more. */
|
|
9446
9473
|
balls = [];
|
|
9474
|
+
/** Last tick a Hunter's shoulder laser hit, by player id. */
|
|
9475
|
+
hunterLasers = /* @__PURE__ */ new Map();
|
|
9447
9476
|
/** The map's rovers, in the order of WorldDef.rovers, then its ships (ship.ts). */
|
|
9448
9477
|
rovers = [];
|
|
9449
9478
|
/** Collision geometry reused while a vehicle's pose is unchanged. */
|
|
@@ -9598,6 +9627,7 @@ var Room = class {
|
|
|
9598
9627
|
else if (struck === STRIKE.RAIL) this.rail(p, input.view);
|
|
9599
9628
|
else if (struck === STRIKE.LASER) this.shoot(p, input.view);
|
|
9600
9629
|
else if (struck === STRIKE.NADE) this.shoot(p, input.view, lob(p.state, p.info.team));
|
|
9630
|
+
else if (struck === STRIKE.DISK) this.shoot(p, input.view, disk(p.state, p.info.team));
|
|
9601
9631
|
Object.assign(p.state, here);
|
|
9602
9632
|
if (use && r && p.state.mode === MODE.RIDE) leave(p.state, r, 1, this.world);
|
|
9603
9633
|
else if (use && !this.feast(p, input.view) && !this.press(p)) this.enter(p);
|
|
@@ -9963,7 +9993,8 @@ var Room = class {
|
|
|
9963
9993
|
* against the others as they are now. Past PLASMA_MAX balls in flight, the oldest bursts. A
|
|
9964
9994
|
* grenade (lob()) is flown on the same way, a tick of its arc at a time.
|
|
9965
9995
|
*/
|
|
9966
|
-
shoot(p, view = 0, b
|
|
9996
|
+
shoot(p, view = 0, b) {
|
|
9997
|
+
b ??= launch$1(p.state, p.info.team, this.kit(p).hunter);
|
|
9967
9998
|
const lag = (this.ticks - view + 65536) % 65536;
|
|
9968
9999
|
this.balls.push(b);
|
|
9969
10000
|
const ticks = Math.min(lag < 32768 ? lag : 0, 12);
|
|
@@ -9989,6 +10020,31 @@ var Room = class {
|
|
|
9989
10020
|
b.y,
|
|
9990
10021
|
b.z
|
|
9991
10022
|
];
|
|
10023
|
+
if (b.returning || b.power === 10) {
|
|
10024
|
+
if (!by) {
|
|
10025
|
+
b.burst = true;
|
|
10026
|
+
return;
|
|
10027
|
+
}
|
|
10028
|
+
const delta = [
|
|
10029
|
+
by.state.x,
|
|
10030
|
+
by.state.y + eyeHeight(by.state),
|
|
10031
|
+
by.state.z
|
|
10032
|
+
].map((v, i) => v - o[i]);
|
|
10033
|
+
const distance = Math.hypot(...delta);
|
|
10034
|
+
if (distance < .65) {
|
|
10035
|
+
b.burst = true;
|
|
10036
|
+
return;
|
|
10037
|
+
}
|
|
10038
|
+
[b.dx, b.dy, b.dz] = delta.map((v) => v / distance);
|
|
10039
|
+
const travel = Math.min(distance, 52 / 60);
|
|
10040
|
+
[b.x, b.y, b.z] = [
|
|
10041
|
+
o[0] + b.dx * travel,
|
|
10042
|
+
o[1] + b.dy * travel,
|
|
10043
|
+
o[2] + b.dz * travel
|
|
10044
|
+
];
|
|
10045
|
+
b.power = 10;
|
|
10046
|
+
return;
|
|
10047
|
+
}
|
|
9992
10048
|
if (b.power === 7) {
|
|
9993
10049
|
toss(this.world, b, foes.map((f) => f.state));
|
|
9994
10050
|
this.ram(b, o);
|
|
@@ -10001,6 +10057,14 @@ var Room = class {
|
|
|
10001
10057
|
return;
|
|
10002
10058
|
}
|
|
10003
10059
|
const hit = fly(this.world, b, m, foes.map((f) => f.state));
|
|
10060
|
+
const turnDiskBack = () => {
|
|
10061
|
+
if (b.power === 9 && (b.burst || b.left <= 0)) {
|
|
10062
|
+
b.returning = true;
|
|
10063
|
+
b.power = 10;
|
|
10064
|
+
b.burst = false;
|
|
10065
|
+
b.left = 1;
|
|
10066
|
+
}
|
|
10067
|
+
};
|
|
10004
10068
|
const hull = this.ram(b, o);
|
|
10005
10069
|
if (hull) {
|
|
10006
10070
|
if (by) by.state.hits = by.state.hits + 1 & 255;
|
|
@@ -10008,17 +10072,26 @@ var Room = class {
|
|
|
10008
10072
|
const w = this.wear[this.rovers.indexOf(hull)];
|
|
10009
10073
|
w.graze = (w.graze + 1) % (b.power === 6 ? BOLT_GRAZE : VEHICLE.GRAZE);
|
|
10010
10074
|
if (!w.graze) this.hurt(hull, 1, b.by, b.team);
|
|
10011
|
-
} else
|
|
10075
|
+
} else if (b.power === 8) this.hurt(hull, 1, b.by, b.team);
|
|
10076
|
+
else if (b.power === 9) this.hurt(hull, 1, b.by, b.team);
|
|
10077
|
+
else this.hurt(hull, b.arc ? CUTS[b.arc].hp : b.power ?? 1, b.by, b.team);
|
|
10078
|
+
turnDiskBack();
|
|
10012
10079
|
return;
|
|
10013
10080
|
}
|
|
10014
10081
|
const foe = foes.find((q) => q.state === hit);
|
|
10015
|
-
if (!foe)
|
|
10082
|
+
if (!foe) {
|
|
10083
|
+
turnDiskBack();
|
|
10084
|
+
return;
|
|
10085
|
+
}
|
|
10016
10086
|
if (fends(foe.state, b) && roll(this.ticks, b.by, b.id, foe.info.id) < this.kit(foe).parry) {
|
|
10017
10087
|
this.deflect(foe, b);
|
|
10088
|
+
turnDiskBack();
|
|
10018
10089
|
return;
|
|
10019
10090
|
}
|
|
10020
10091
|
if (by) by.state.hits = by.state.hits + 1 & 255;
|
|
10021
10092
|
if (b.power === 6) this.shot(foe, BOLT_HP, by, b.dx, b.dz);
|
|
10093
|
+
else if (b.power === 8) this.shot(foe, 2, by, b.dx, b.dz, FRAG.GUN, b.back);
|
|
10094
|
+
else if (b.power === 9) this.shot(foe, 2, by, b.dx, b.dz, FRAG.GUN, b.back);
|
|
10022
10095
|
else if (b.power === 0) {
|
|
10023
10096
|
foe.graze = ((foe.graze ?? 0) + 1) % 2;
|
|
10024
10097
|
if (!foe.graze) this.shot(foe, 1, by, b.dx, b.dz, FRAG.GUN, b.back);
|
|
@@ -10042,6 +10115,7 @@ var Room = class {
|
|
|
10042
10115
|
foe.by = b.by;
|
|
10043
10116
|
this.ctf.drop(foe.state);
|
|
10044
10117
|
}
|
|
10118
|
+
turnDiskBack();
|
|
10045
10119
|
}
|
|
10046
10120
|
/**
|
|
10047
10121
|
* The katana of `p` met the ball `b`: it ends on the blade (its burst, no hit), and one as strong
|
|
@@ -10168,6 +10242,10 @@ var Room = class {
|
|
|
10168
10242
|
* and counts a hit. An enemy vehicle's hull is drained the same way, and shields who is behind it.
|
|
10169
10243
|
*/
|
|
10170
10244
|
rail(p, view) {
|
|
10245
|
+
if (this.kit(p).hunter) {
|
|
10246
|
+
this.shoulder(p, view);
|
|
10247
|
+
return;
|
|
10248
|
+
}
|
|
10171
10249
|
const { o, d, t, hit } = beam(this.world, p.state, this.enemies(p, view));
|
|
10172
10250
|
const [s, k] = this.hulls(p.info.team, view).reduce((best, [r, n]) => {
|
|
10173
10251
|
const u = struck(r, o, d, best[0]);
|
|
@@ -10199,6 +10277,56 @@ var Room = class {
|
|
|
10199
10277
|
}
|
|
10200
10278
|
}
|
|
10201
10279
|
}
|
|
10280
|
+
/** A lightly assisted shoulder shot: host-side target selection stays inside a narrow forward cone. */
|
|
10281
|
+
shoulder(p, view) {
|
|
10282
|
+
const foes = this.enemies(p, view);
|
|
10283
|
+
const origin = [
|
|
10284
|
+
p.state.x,
|
|
10285
|
+
p.state.y + eyeHeight(p.state),
|
|
10286
|
+
p.state.z
|
|
10287
|
+
];
|
|
10288
|
+
const cp = Math.cos(p.state.pitch);
|
|
10289
|
+
const look = [
|
|
10290
|
+
-Math.sin(p.state.yaw) * cp,
|
|
10291
|
+
Math.sin(p.state.pitch),
|
|
10292
|
+
-Math.cos(p.state.yaw) * cp
|
|
10293
|
+
];
|
|
10294
|
+
let target;
|
|
10295
|
+
let best = .985;
|
|
10296
|
+
for (const foe of foes) {
|
|
10297
|
+
const point = [
|
|
10298
|
+
foe.x,
|
|
10299
|
+
foe.y + eyeHeight(foe) * .65,
|
|
10300
|
+
foe.z
|
|
10301
|
+
];
|
|
10302
|
+
const delta = point.map((v, i) => v - origin[i]);
|
|
10303
|
+
const distance = Math.hypot(...delta);
|
|
10304
|
+
const alignment = distance ? delta.reduce((sum, v, i) => sum + v / distance * look[i], 0) : 1;
|
|
10305
|
+
if (distance < 80 && alignment > best && !hidden(this.world, origin, point)) {
|
|
10306
|
+
best = alignment;
|
|
10307
|
+
target = foe;
|
|
10308
|
+
}
|
|
10309
|
+
}
|
|
10310
|
+
if (!target || this.ticks - (this.hunterLasers.get(p.info.id) ?? -Infinity) < 18) return;
|
|
10311
|
+
const delta = [
|
|
10312
|
+
target.x,
|
|
10313
|
+
target.y + eyeHeight(target) * .65,
|
|
10314
|
+
target.z
|
|
10315
|
+
].map((v, i) => v - origin[i]);
|
|
10316
|
+
const distance = Math.hypot(...delta) || 1;
|
|
10317
|
+
const yaw = Math.atan2(-delta[0], -delta[2]);
|
|
10318
|
+
const pitch = Math.asin(delta[1] / distance);
|
|
10319
|
+
const aimed = beam(this.world, {
|
|
10320
|
+
...p.state,
|
|
10321
|
+
yaw,
|
|
10322
|
+
pitch
|
|
10323
|
+
}, [target]);
|
|
10324
|
+
if (aimed.hit?.id !== target.id) return;
|
|
10325
|
+
this.hunterLasers.set(p.info.id, this.ticks);
|
|
10326
|
+
p.state.hits = p.state.hits + 1 & 255;
|
|
10327
|
+
const foe = this.players().find((q) => q.info.id === target.id);
|
|
10328
|
+
if (foe) this.shot(foe, 1, p, aimed.d[0], aimed.d[2]);
|
|
10329
|
+
}
|
|
10202
10330
|
/** 1 hp of the bolt's drain to `foe`, as his railer deals it; if it puts him down he is disintegrated (`fried`). */
|
|
10203
10331
|
fry(foe) {
|
|
10204
10332
|
const r = foe.railer?.state ?? foe.state;
|
|
@@ -13,7 +13,7 @@ export declare const CATCH = 0.12;
|
|
|
13
13
|
export declare const TRAIL = 1.2;
|
|
14
14
|
export interface Balls {
|
|
15
15
|
/** The own player fired, or threw an arc with the katana: `p` is his state after the step, `now` the time of the step (ms). */
|
|
16
|
-
fire(p: PlayerState, now: number): void;
|
|
16
|
+
fire(p: PlayerState, now: number, harpoon?: boolean, disc?: boolean): void;
|
|
17
17
|
/** The balls of a snapshot received at `now` (ms); `me` is the own id. */
|
|
18
18
|
snapshot(balls: Ball[], me: number, now: number): void;
|
|
19
19
|
/**
|
|
@@ -29,7 +29,7 @@ export interface Body {
|
|
|
29
29
|
/** Appends the body's vertices (see STRIDE) in the jacket `color`; nothing when pose() has none. */
|
|
30
30
|
draw(out: Out, eye: Vec3, yaw: number, pitch: number, roll?: number, color?: number[]): void;
|
|
31
31
|
/** The own player's character (BUILD in rig.ts, PlayerInfo.body): the woman's arms are slimmer and her hands smaller, on the same grips; `tone` the skin he picked (the default's when absent). */
|
|
32
|
-
wear(build: number, tone?: number[], ninja?: boolean, xeno?: boolean): void;
|
|
32
|
+
wear(build: number, tone?: number[], ninja?: boolean, xeno?: boolean, hunter?: boolean): void;
|
|
33
33
|
}
|
|
34
34
|
export declare const inv: ([x, y, z, w]: Quat) => Quat;
|
|
35
35
|
/** The shortest rotation that turns the direction a into b. */
|
|
@@ -68,5 +68,7 @@ voice?: (id: number) => number,
|
|
|
68
68
|
/** A player's BODY: his death cries' voice. */
|
|
69
69
|
bodyOf?: (id: number) => number | undefined,
|
|
70
70
|
/** Whether a player is a xenomorph: its own cries, its acid, its hiss at a tail's charge, its shriek at a dash. */
|
|
71
|
-
beast?: (id: number) => boolean
|
|
71
|
+
beast?: (id: number) => boolean,
|
|
72
|
+
/** Whether a player fires the Hunter's harpoon rather than a plasma ball. */
|
|
73
|
+
hunter?: (id: number) => boolean) => Combat;
|
|
72
74
|
export {};
|
|
@@ -20,11 +20,12 @@ export declare const GLOW: number, DEAD: number, MORE: number, FRAMES: number;
|
|
|
20
20
|
export declare const frame: (level: number, e: number) => number;
|
|
21
21
|
/** The colours of the palette, RGBA as one number each (little-endian ABGR for ImageData). */
|
|
22
22
|
export declare const PALETTE: number[];
|
|
23
|
-
/** The faces of sprite(): the man's, the woman's and the
|
|
23
|
+
/** The faces of sprite(): the man's, the woman's, the xenomorph's and the Hunter's. */
|
|
24
24
|
export declare const LOOK: {
|
|
25
25
|
readonly MAN: 0;
|
|
26
26
|
readonly WOMAN: 1;
|
|
27
27
|
readonly XENO: 2;
|
|
28
|
+
readonly HUNTER: 3;
|
|
28
29
|
};
|
|
29
30
|
/**
|
|
30
31
|
* Frame `n`'s pixels, FW by FH palette indices, row by row; built once. `fem` (LOOK.WOMAN) is the
|
|
@@ -76,6 +76,8 @@ export interface Hud {
|
|
|
76
76
|
marks(list: Mark[]): void;
|
|
77
77
|
/** The orbital station's mission line (mission.ts), `hot` when urgent; none hides it. */
|
|
78
78
|
mission(text?: string, hot?: boolean): void;
|
|
79
|
+
/** The Hunter's current local vision mode. */
|
|
80
|
+
hunterVision(text?: string): void;
|
|
79
81
|
/** The dark rim of a space helmet's visor around the screen: on while the own player wears one, off otherwise. */
|
|
80
82
|
visor(on: boolean): void;
|
|
81
83
|
/** The red vignette of a tackle, 0 (none) to 1 (full). */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hunter(lod: 0 | 1 | 2): Record<string, number[]>;
|
|
@@ -49,6 +49,10 @@ export interface Controls {
|
|
|
49
49
|
* step after a double click of it (the special); G is a short press of it.
|
|
50
50
|
*/
|
|
51
51
|
beast: boolean;
|
|
52
|
+
/** Hunter-only local vision: 0 normal, 1 thermal, 2 alien scan. */
|
|
53
|
+
vision: number;
|
|
54
|
+
/** Whether the local player chose the Hunter class. */
|
|
55
|
+
hunter: boolean;
|
|
52
56
|
/**
|
|
53
57
|
* The KEY bits of the next step, read once per step. Same as `keys`, plus BLADE while the katana
|
|
54
58
|
* is chosen and RAIL while the rail gun is, except for the step right after a double tap: it carries DASH and only the tapped
|
|
@@ -15,6 +15,12 @@ export declare const S: number, C: number;
|
|
|
15
15
|
* rounded-square guard, a grip wrapped in a violet check and a pommel with a glowing bead.
|
|
16
16
|
*/
|
|
17
17
|
export declare const katana: (lod: number) => number[];
|
|
18
|
+
/** The Hunter's twin wrist blades and bracer, in the hand's local space. */
|
|
19
|
+
export declare const wristBlade: (lod: number) => number[];
|
|
20
|
+
/** Places the wrist blade at the Hunter's right wrist. */
|
|
21
|
+
export declare const heldWrist: (out: Out, pos: Vec3, q: Quat, lod: number, k?: number, list?: Pieces) => void;
|
|
22
|
+
/** The blade's sweep endpoints for the Hunter's cut trail. */
|
|
23
|
+
export declare const wristEnds: (pos: Vec3, q: Quat) => Vec3[];
|
|
18
24
|
/** Appends arcs of lightning flickering along the blade at the clock `t` (s): a few zigzags of thin crossed ribbons, each new every 70 ms. */
|
|
19
25
|
export declare const arcs: (out: Out, at: Vec3, [r, u, f]: Vec3[], t: number, lod: number, k?: number) => void;
|
|
20
26
|
/**
|
|
@@ -178,6 +178,8 @@ export interface Renderer {
|
|
|
178
178
|
parried(id: number, late: number): void;
|
|
179
179
|
/** The xenomorph's vision (the own player is one): a grey-blue world, the enemies in sight glowing. */
|
|
180
180
|
vision(on: boolean): void;
|
|
181
|
+
/** The Hunter's local vision filter and the players it can detect. */
|
|
182
|
+
hunterVision(mode: number, targets: PlayerState[]): void;
|
|
181
183
|
/** Let eligible glory kill targets flash during play. */
|
|
182
184
|
edge(on: boolean): void;
|
|
183
185
|
/** The body of each player (PlayerInfo.body, BODY), from the roster: the man's for one not in it; and the skin and haircut he picked, his id's for one not in `looks`. */
|
|
@@ -145,6 +145,12 @@ export declare const SOUND: {
|
|
|
145
145
|
readonly HER_DEATH: 71;
|
|
146
146
|
readonly GROAN: 72;
|
|
147
147
|
readonly HER_GROAN: 73;
|
|
148
|
+
/** A Hunter harpoon: a tight mechanical release, then a quick metallic flight zing. */
|
|
149
|
+
readonly HARPOON: 74;
|
|
150
|
+
/** Original Hunter voice: a pain rasp, a fatal throat shriek and the short radio click-call. */
|
|
151
|
+
readonly HUNTER_PAIN: 75;
|
|
152
|
+
readonly HUNTER_DEATH: 76;
|
|
153
|
+
readonly HUNTER_TAUNT: 77;
|
|
148
154
|
};
|
|
149
155
|
/**
|
|
150
156
|
* The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
|
|
@@ -164,7 +164,7 @@ export declare const lowered: (r: Runner) => number;
|
|
|
164
164
|
* seen from the runner's eye (the share `e` of it, so that it is drawn from the guard and back to
|
|
165
165
|
* it), and the trunk twisting, bending and leaning through it (trunk()).
|
|
166
166
|
*/
|
|
167
|
-
export declare const brandish: (from: Pose, p: PlayerState, prog: number, ph: number, t?: number, parry?: number) => Pose;
|
|
167
|
+
export declare const brandish: (from: Pose, p: PlayerState, prog: number, ph: number, t?: number, parry?: number, oneHand?: boolean) => Pose;
|
|
168
168
|
/**
|
|
169
169
|
* How closed the hands of `p` are, left then right (hand() in body.ts: 0 flat, 0.9 round a grip, 1
|
|
170
170
|
* a fist), as the own body closes its own: round what they hold and on the wheel, fists with
|
|
@@ -45,4 +45,6 @@ speaker: (id: number) => number,
|
|
|
45
45
|
/** A player's team from the roster. */
|
|
46
46
|
team?: (id: number) => number | undefined,
|
|
47
47
|
/** Whether a player is a xenomorph: it roars (ROAR), with no words, over the radio all the same. */
|
|
48
|
-
beast?: (id: number) => boolean
|
|
48
|
+
beast?: (id: number) => boolean,
|
|
49
|
+
/** Whether a player is a Hunter: its original click-call plays as a radio taunt. */
|
|
50
|
+
hunter?: (id: number) => boolean) => Taunts;
|
|
@@ -359,6 +359,22 @@ export declare const GUN_RANGE = 80;
|
|
|
359
359
|
export declare const PLASMA_SPEED = 80;
|
|
360
360
|
export declare const RIFLE_SPEED = 400;
|
|
361
361
|
export declare const PLASMA_R = 0.12;
|
|
362
|
+
/** Ball.power of the Hunter's harpoon: its own projectile kind in snapshots. */
|
|
363
|
+
export declare const HARPOON = 8;
|
|
364
|
+
export declare const HARPOON_SPEED = 72;
|
|
365
|
+
export declare const HARPOON_RANGE = 90;
|
|
366
|
+
export declare const HARPOON_R = 0.08;
|
|
367
|
+
export declare const HARPOON_HP = 2;
|
|
368
|
+
/** Ball.power values for a Hunter's returning disc (outbound, then returning). */
|
|
369
|
+
export declare const DISK = 9;
|
|
370
|
+
export declare const DISK_RETURN = 10;
|
|
371
|
+
export declare const DISK_SPEED = 52;
|
|
372
|
+
export declare const DISK_RANGE = 28;
|
|
373
|
+
export declare const DISK_R = 0.16;
|
|
374
|
+
export declare const DISK_HP = 2;
|
|
375
|
+
export declare const DISK_COOL = 75;
|
|
376
|
+
/** Ticks between assisted shoulder-laser hits. */
|
|
377
|
+
export declare const HUNTER_LASER_COOL = 18;
|
|
362
378
|
/** Plasma balls in flight in a room at most: past it the oldest bursts. They go on the wire. */
|
|
363
379
|
export declare const PLASMA_MAX = 64;
|
|
364
380
|
/** 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. */
|
|
@@ -4,6 +4,7 @@ export declare const ROLE: {
|
|
|
4
4
|
readonly NINJA: 1;
|
|
5
5
|
readonly ASTRONAUT: 2;
|
|
6
6
|
readonly XENO: 3;
|
|
7
|
+
readonly HUNTER: 4;
|
|
7
8
|
};
|
|
8
9
|
export interface Kit {
|
|
9
10
|
run: number;
|
|
@@ -48,6 +49,8 @@ export interface Kit {
|
|
|
48
49
|
* walls (MODE.CLING), a dash's burst that pins an enemy it reaches, acid for blood (room.ts).
|
|
49
50
|
*/
|
|
50
51
|
xeno: boolean;
|
|
52
|
+
/** The Hunter's class identity; its weapons and vision are introduced in later build steps. */
|
|
53
|
+
hunter?: boolean;
|
|
51
54
|
}
|
|
52
55
|
/** By ROLE. The astronaut moves and fights as the marine: the moon's gravity is the map's. */
|
|
53
56
|
export declare const KITS: readonly Kit[];
|
|
@@ -21,7 +21,9 @@ export declare const drift: (n: number) => [number, number];
|
|
|
21
21
|
* as the shot (`power`). The laser rifle's (the user, 2026-11-08: the gun's balls, in red) has
|
|
22
22
|
* power 0, RIFLE_RANGE to go, and leaves along the look drifted by its shot's pattern.
|
|
23
23
|
*/
|
|
24
|
-
export declare const launch: (p: PlayerState, team?: number) => Flying;
|
|
24
|
+
export declare const launch: (p: PlayerState, team?: number, harpoon?: boolean) => Flying;
|
|
25
|
+
/** The Hunter's returning disc: a wide, fast shot that the room turns back toward its owner. */
|
|
26
|
+
export declare const disk: (p: PlayerState, team?: number) => Flying;
|
|
25
27
|
/**
|
|
26
28
|
* The arc of energy the ARC cut of `p` throws at its strike (`p` the state after that step): from
|
|
27
29
|
* the eye along the look like a ball, ARC_RANGE metres to go, its CUT in `arc`. Its id is the
|
|
@@ -21,6 +21,8 @@ export declare class Room {
|
|
|
21
21
|
private gone;
|
|
22
22
|
/** The plasma balls in flight, and the ones that burst since the last snapshot, which sends them once more. */
|
|
23
23
|
private balls;
|
|
24
|
+
/** Last tick a Hunter's shoulder laser hit, by player id. */
|
|
25
|
+
private hunterLasers;
|
|
24
26
|
/** The map's rovers, in the order of WorldDef.rovers, then its ships (ship.ts). */
|
|
25
27
|
private rovers;
|
|
26
28
|
/** Collision geometry reused while a vehicle's pose is unchanged. */
|
|
@@ -190,6 +192,8 @@ export declare class Room {
|
|
|
190
192
|
* and counts a hit. An enemy vehicle's hull is drained the same way, and shields who is behind it.
|
|
191
193
|
*/
|
|
192
194
|
private rail;
|
|
195
|
+
/** A lightly assisted shoulder shot: host-side target selection stays inside a narrow forward cone. */
|
|
196
|
+
private shoulder;
|
|
193
197
|
/** 1 hp of the bolt's drain to `foe`, as his railer deals it; if it puts him down he is disintegrated (`fried`). */
|
|
194
198
|
private fry;
|
|
195
199
|
/**
|
|
@@ -362,7 +362,7 @@ export interface Ball {
|
|
|
362
362
|
dz: number;
|
|
363
363
|
/** It burst where it is: the last snapshot that carries it. */
|
|
364
364
|
burst: boolean;
|
|
365
|
-
/** Its strength, 1 to CHARGE_MAX: the health it takes. Absent reads 1. 0 is a laser rifle's, BOLT a rover's, NADE a grenade. */
|
|
365
|
+
/** Its strength, 1 to CHARGE_MAX: the health it takes. Absent reads 1. 0 is a laser rifle's, BOLT a rover's, NADE a grenade, HARPOON a Hunter's harpoon. */
|
|
366
366
|
power?: number;
|
|
367
367
|
/** A grenade's speed along its direction, m/s (the wire keeps whole m/s, 63 at most). Absent for the rest. */
|
|
368
368
|
v?: number;
|
|
@@ -370,6 +370,8 @@ export interface Ball {
|
|
|
370
370
|
arc?: number;
|
|
371
371
|
/** A ship's missile (power NADE): it flies straight, and its blast reaches MISSILE_R. */
|
|
372
372
|
missile?: boolean;
|
|
373
|
+
/** A Hunter disc which is steering back to its owner. */
|
|
374
|
+
returning?: boolean;
|
|
373
375
|
}
|
|
374
376
|
/** The flag of a team as a snapshot carries it: only the fields of its state are meaningful, the rest read 0. */
|
|
375
377
|
export interface FlagState {
|
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.197.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|