@korial29/tiny-fps 0.148.1 → 0.149.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 +22 -22
- package/dist/local.js +1 -1
- package/dist/server.js +71 -51
- package/dist/types/client/balls.d.ts +1 -1
- package/dist/types/client/props.d.ts +1 -1
- package/dist/types/client/sfx.d.ts +6 -0
- package/dist/types/shared/constants.d.ts +12 -4
- package/dist/types/shared/plasma.d.ts +6 -4
- package/dist/types/shared/room.d.ts +2 -1
- package/dist/types/shared/rover.d.ts +9 -2
- package/dist/types/shared/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -858,7 +858,7 @@ var heightOf = (p) => p.mode === MODE.SLIDE || p.mode === MODE.CROUCH ? LOW_H :
|
|
|
858
858
|
/** The camera height above the feet in this mode. */
|
|
859
859
|
var eyeHeight = (p) => p.mode === MODE.SLIDE || p.mode === MODE.CROUCH ? LOW_EYE : EYE;
|
|
860
860
|
/** Horizontal speed, m/s. */
|
|
861
|
-
var speedOf = (p) => len$1(p.vx, p.vz);
|
|
861
|
+
var speedOf$1 = (p) => len$1(p.vx, p.vz);
|
|
862
862
|
/** Whether the brush stops a body of height h whose feet are at y when it walks sideways into it. */
|
|
863
863
|
var blocks = (b, y, h) => b.max[1] > y + .5 + SKIN && b.min[1] < y + h - SKIN;
|
|
864
864
|
/** The closest point of the brush footprint to (x, z), as the offset from it to (x, z). */
|
|
@@ -3057,14 +3057,8 @@ var PAD$1 = [
|
|
|
3057
3057
|
220,
|
|
3058
3058
|
13
|
|
3059
3059
|
];
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
[52.7, 207.3],
|
|
3063
|
-
[27.3, 232.7],
|
|
3064
|
-
[52.7, 232.7],
|
|
3065
|
-
[106.2, 230.4],
|
|
3066
|
-
[103.2, 212.4]
|
|
3067
|
-
];
|
|
3060
|
+
/** By the tubes. The four at the pad's corners went (the user, 2026-11-14): a ship hit them for nothing. */
|
|
3061
|
+
var MASTS = [[106.2, 230.4], [103.2, 212.4]];
|
|
3068
3062
|
/** Red's flag: in the hall, 2 m from the dome's centre toward the door. */
|
|
3069
3063
|
var FLAG = DOME[1] - 2;
|
|
3070
3064
|
var c1 = (t) => Math.min(Math.max(t, 0), 1);
|
|
@@ -4069,7 +4063,7 @@ var half = [
|
|
|
4069
4063
|
},
|
|
4070
4064
|
box(60, 0, 259, 70, 1.5, 265, STEEL, PAINT, RED),
|
|
4071
4065
|
box(27, 0, 207, 53, .25, 233, METAL),
|
|
4072
|
-
...MASTS.map(([x, z]) => box(x - .2,
|
|
4066
|
+
...MASTS.map(([x, z]) => box(x - .2, 0, z - .2, x + .2, 10, z + .2, STEEL)),
|
|
4073
4067
|
box(12, -30, 148 - 2.5 / 2, 24, 0, 148, PAINT, STONE, [
|
|
4074
4068
|
1,
|
|
4075
4069
|
.42,
|
|
@@ -4874,6 +4868,34 @@ var build = (w) => {
|
|
|
4874
4868
|
};
|
|
4875
4869
|
};
|
|
4876
4870
|
/**
|
|
4871
|
+
* The node a bot goes to, or from, when no straight walk joins it to the point `p`: among the nodes
|
|
4872
|
+
* `ok` takes, within NEAR, the best by `weigh` whose height off `p` a body manages (a stair, a
|
|
4873
|
+
* ledge to climb, a drop that does not hurt), `up` 1 when the bot goes from `p` to the node and -1
|
|
4874
|
+
* when it goes from the node to `p`; with nothing in the way of the head first, then even hidden.
|
|
4875
|
+
*/
|
|
4876
|
+
var close = (w, nodes, p, ok, weigh, up) => {
|
|
4877
|
+
for (const clear of [true, false]) {
|
|
4878
|
+
let best = -1;
|
|
4879
|
+
let least = Infinity;
|
|
4880
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
4881
|
+
const [d, dy] = [flat$1(p, nodes[i]), (nodes[i][1] - p[1]) * up];
|
|
4882
|
+
const [ux, uz] = [(nodes[i][0] - p[0]) / (d || 1), (nodes[i][2] - p[2]) / (d || 1)];
|
|
4883
|
+
const head = Math.max(p[1], nodes[i][1]) + 1.5;
|
|
4884
|
+
if (ok(i) && d < NEAR && dy <= ABOVE && dy >= -8 && weigh(d, i) < least && (!clear || ray(w, [
|
|
4885
|
+
p[0],
|
|
4886
|
+
head,
|
|
4887
|
+
p[2]
|
|
4888
|
+
], [
|
|
4889
|
+
ux,
|
|
4890
|
+
0,
|
|
4891
|
+
uz
|
|
4892
|
+
], d) >= d)) [best, least] = [i, weigh(d, i)];
|
|
4893
|
+
}
|
|
4894
|
+
if (best >= 0) return best;
|
|
4895
|
+
}
|
|
4896
|
+
return -1;
|
|
4897
|
+
};
|
|
4898
|
+
/**
|
|
4877
4899
|
* The cheapest way from the point `a` to the point `b`. No entry when `a` walks straight to `b`, or
|
|
4878
4900
|
* when the map has no way. The legs of the routes other than `prefer` (an index of ROUTES) cost
|
|
4879
4901
|
* more, so bots that prefer different ones spread over the map.
|
|
@@ -4887,23 +4909,9 @@ var path = (nav, w, a, b, prefer = -1) => {
|
|
|
4887
4909
|
const back = new Array(n).fill(-1);
|
|
4888
4910
|
const done = new Array(n).fill(false);
|
|
4889
4911
|
for (let i = 0; i < n; i++) if (!runUp.has(i) && flat$1(a, nodes[i]) <= WALK && walkable(w, a, nodes[i])) cost[i] = flat$1(a, nodes[i]) / PACE;
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
for (let i = 0; i < n; i++) {
|
|
4894
|
-
const [d, dy] = [flat$1(a, nodes[i]), nodes[i][1] - a[1]];
|
|
4895
|
-
const [ux, uz] = [(nodes[i][0] - a[0]) / (d || 1), (nodes[i][2] - a[2]) / (d || 1)];
|
|
4896
|
-
if (!runUp.has(i) && d < NEAR && dy <= ABOVE && dy >= -8 && (!clear || ray(w, [
|
|
4897
|
-
a[0],
|
|
4898
|
-
a[1] + 1.5,
|
|
4899
|
-
a[2]
|
|
4900
|
-
], [
|
|
4901
|
-
ux,
|
|
4902
|
-
0,
|
|
4903
|
-
uz
|
|
4904
|
-
], d) >= d) && (near < 0 || d < flat$1(a, nodes[near]))) near = i;
|
|
4905
|
-
}
|
|
4906
|
-
if (near >= 0) cost[near] = flat$1(a, nodes[near]) / PACE;
|
|
4912
|
+
if (!cost.some((c) => c < Infinity)) {
|
|
4913
|
+
const first = close(w, nodes, a, (i) => !runUp.has(i), (d) => d, 1);
|
|
4914
|
+
if (first >= 0) cost[first] = flat$1(a, nodes[first]) / PACE;
|
|
4907
4915
|
}
|
|
4908
4916
|
for (;;) {
|
|
4909
4917
|
let i = -1;
|
|
@@ -4925,6 +4933,7 @@ var path = (nav, w, a, b, prefer = -1) => {
|
|
|
4925
4933
|
const c = cost[i] + flat$1(nodes[i], b) / PACE;
|
|
4926
4934
|
if (cost[i] < Infinity && c < total && flat$1(nodes[i], b) <= WALK && walkable(w, nodes[i], b)) [best, total] = [i, c];
|
|
4927
4935
|
}
|
|
4936
|
+
if (best < 0) best = close(w, nodes, b, (i) => cost[i] < Infinity, (d, i) => cost[i] + d / PACE, -1);
|
|
4928
4937
|
const edges = [];
|
|
4929
4938
|
let i = best;
|
|
4930
4939
|
for (; i >= 0 && prev[i]; i = back[i]) edges.unshift(prev[i]);
|
|
@@ -4933,10 +4942,7 @@ var path = (nav, w, a, b, prefer = -1) => {
|
|
|
4933
4942
|
edges
|
|
4934
4943
|
};
|
|
4935
4944
|
};
|
|
4936
|
-
|
|
4937
|
-
/** Metres a ball flies in a tick, and an arc. */
|
|
4938
|
-
var PLASMA_STEP = 40 / 60;
|
|
4939
|
-
var ARC_STEP = ARC_SPEED / 60;
|
|
4945
|
+
ARC_SPEED / 60;
|
|
4940
4946
|
/** How far shot `n` of the laser rifle drifts off the look, yaw and pitch: a pattern within RIFLE_DRIFT, the same for the host and every client. */
|
|
4941
4947
|
var drift = (n) => [RIFLE_DRIFT * Math.sin(n * 2.4), RIFLE_DRIFT * Math.cos(n * 1.7)];
|
|
4942
4948
|
/**
|
|
@@ -4981,8 +4987,10 @@ var wave = (p, team = 0) => ({
|
|
|
4981
4987
|
power: 1,
|
|
4982
4988
|
arc: p.cut
|
|
4983
4989
|
});
|
|
4990
|
+
/** 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`). */
|
|
4991
|
+
var speedOf = (b) => b.arc ? ARC_SPEED : b.power === 6 ? 120 : b.power === 0 ? 400 : 80;
|
|
4984
4992
|
/** Metres the flight `b` goes in a tick. */
|
|
4985
|
-
var stepOf = (b) => b
|
|
4993
|
+
var stepOf = (b) => speedOf(b) / 60;
|
|
4986
4994
|
/**
|
|
4987
4995
|
* Distance at which the ray from `o` along the unit `d` enters the upright cylinder of radius `r`
|
|
4988
4996
|
* on `c`'s feet, `h` tall; Infinity on a miss.
|
|
@@ -5048,7 +5056,7 @@ var lob = (p, team = 0) => ({
|
|
|
5048
5056
|
v: 36
|
|
5049
5057
|
});
|
|
5050
5058
|
/**
|
|
5051
|
-
* One tick of the grenade `b`: the map's gravity bends its flight, then it flies on as a ball
|
|
5059
|
+
* One tick of the grenade `b`: the map's gravity bends its flight (not a missile's), then it flies on as a ball
|
|
5052
5060
|
* (fly()) and bursts on the first brush or foe, or at the end of its range. Float32, so the
|
|
5053
5061
|
* shooter's client flies the same one.
|
|
5054
5062
|
*/
|
|
@@ -5056,7 +5064,7 @@ var toss = (w, b, foes) => {
|
|
|
5056
5064
|
const f = Math.fround;
|
|
5057
5065
|
const [vx, vy, vz] = [
|
|
5058
5066
|
b.dx * b.v,
|
|
5059
|
-
b.dy * b.v - gravity(w) / 60,
|
|
5067
|
+
b.dy * b.v - (b.missile ? 0 : gravity(w)) / 60,
|
|
5060
5068
|
b.dz * b.v
|
|
5061
5069
|
];
|
|
5062
5070
|
const v = Math.sqrt(vx * vx + vy * vy + vz * vz) || 1;
|
|
@@ -5078,10 +5086,10 @@ var toss = (w, b, foes) => {
|
|
|
5078
5086
|
};
|
|
5079
5087
|
/**
|
|
5080
5088
|
* The health a grenade bursting at `c` takes from `p`: NADE_HP at the body, less with the distance
|
|
5081
|
-
* to its nearest point (the axis, feet to head), nothing from NADE_R
|
|
5082
|
-
* a brush hides both that point and the chest.
|
|
5089
|
+
* to its nearest point (the axis, feet to head), nothing from `r` (NADE_R, a missile's MISSILE_R)
|
|
5090
|
+
* on, rounded up. Nothing when a brush hides both that point and the chest.
|
|
5083
5091
|
*/
|
|
5084
|
-
var blast = (w, c, p) => {
|
|
5092
|
+
var blast = (w, c, p, r = 8) => {
|
|
5085
5093
|
const h = heightOf(p);
|
|
5086
5094
|
const near = [
|
|
5087
5095
|
p.x,
|
|
@@ -5094,11 +5102,11 @@ var blast = (w, c, p) => {
|
|
|
5094
5102
|
near[2] - c[2]
|
|
5095
5103
|
];
|
|
5096
5104
|
const d = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
5097
|
-
return d >=
|
|
5105
|
+
return d >= r || hidden(w, c, near) && hidden(w, c, [
|
|
5098
5106
|
p.x,
|
|
5099
5107
|
p.y + .7 * h,
|
|
5100
5108
|
p.z
|
|
5101
|
-
]) ? 0 : Math.ceil(5 * (1 - d /
|
|
5109
|
+
]) ? 0 : Math.ceil(5 * (1 - d / r));
|
|
5102
5110
|
};
|
|
5103
5111
|
// src/shared/bot.ts
|
|
5104
5112
|
var { FORWARD, BACK, LEFT, RIGHT, JUMP, SPRINT, DASH, CROUCH, FIRE, RELOAD } = KEY;
|
|
@@ -5717,7 +5725,7 @@ var Bot = class {
|
|
|
5717
5725
|
this.aim = norm(p.yaw + (this.rnd() < .5 ? miss : -miss));
|
|
5718
5726
|
}
|
|
5719
5727
|
const d = flat(p.x, p.z, q.x, q.z);
|
|
5720
|
-
const lead = d /
|
|
5728
|
+
const lead = d / (p.rifled ? 400 : 80);
|
|
5721
5729
|
const [tx, ty, tz] = [
|
|
5722
5730
|
q.x + q.vx * lead,
|
|
5723
5731
|
q.y + 1.1 + q.vy * lead,
|
|
@@ -6433,7 +6441,7 @@ var encodeSnapshot = (s) => {
|
|
|
6433
6441
|
].forEach((c, k) => v.setInt16(o + 2 + 2 * k, clamp16(c * BALL_POS)));
|
|
6434
6442
|
v.setUint8(o + 8, Math.round(Math.atan2(-b.dx, -b.dz) * YAW8) & 255);
|
|
6435
6443
|
v.setInt8(o + 9, Math.round(Math.asin(Math.max(-1, Math.min(1, b.dy))) * PITCH8));
|
|
6436
|
-
v.setUint8(o + 10, b.arc ? 128 | b.arc : b.power === 7 ? 64 | Math.min(63, Math.round(b.v)) : b.power ?? 1);
|
|
6444
|
+
v.setUint8(o + 10, b.arc ? 128 | b.arc : b.power === 7 ? (b.missile ? 192 : 64) | Math.min(63, Math.round(b.v)) : b.power ?? 1);
|
|
6437
6445
|
o += 11;
|
|
6438
6446
|
}
|
|
6439
6447
|
if (gate) {
|
|
@@ -7097,6 +7105,13 @@ var ROVER = {
|
|
|
7097
7105
|
BRAKE: 14,
|
|
7098
7106
|
ROLL: .6,
|
|
7099
7107
|
HB: 6,
|
|
7108
|
+
/**
|
|
7109
|
+
* The boost (the user, 2026-11-14), Shift with W as on the ship: a rocket at the back pushes
|
|
7110
|
+
* BOOST m/s² more along the nose, fading to nothing at VBOOST. It is not the tyres' (the moon's
|
|
7111
|
+
* grip already caps the engine), so it pushes with any wheel down.
|
|
7112
|
+
*/
|
|
7113
|
+
BOOST: 10,
|
|
7114
|
+
VBOOST: 34,
|
|
7100
7115
|
/** Grip sideways and in traction, as shares of the load; under the handbrake, the share left sideways and how much faster the nose comes round. */
|
|
7101
7116
|
MU: 1.1,
|
|
7102
7117
|
MUL: 1.2,
|
|
@@ -7347,6 +7362,7 @@ var drive = (r, i, w, fleet = [], crash) => {
|
|
|
7347
7362
|
const keys = i ? i.keys : 0;
|
|
7348
7363
|
const thr = (keys & KEY.FORWARD ? 1 : 0) - (keys & KEY.BACK ? 1 : 0);
|
|
7349
7364
|
const hb = keys & KEY.JUMP;
|
|
7365
|
+
const boost = thr > 0 && keys & KEY.SPRINT;
|
|
7350
7366
|
const [fx, fz] = forward(r.yaw);
|
|
7351
7367
|
const [cp, cr] = [cos(r.pitch), cos(r.roll)];
|
|
7352
7368
|
const c = corners(r, w);
|
|
@@ -7397,6 +7413,7 @@ var drive = (r, i, w, fleet = [], crash) => {
|
|
|
7397
7413
|
r.wy += (spin - r.wy) * ROVER.YRESP * DT * min(1, load);
|
|
7398
7414
|
const grip = g * load * DT;
|
|
7399
7415
|
let dl = clamp((thr * vl < 0 ? thr * ROVER.BRAKE : thr * ROVER.ENGINE * max(0, 1 - abs(vl) / (thr > 0 ? ROVER.VMAX : ROVER.VREV))) * DT, -MUL * grip, MUL * grip);
|
|
7416
|
+
if (boost) dl += ROVER.BOOST * clamp(1 - vl / ROVER.VBOOST, 0, 1) * DT;
|
|
7400
7417
|
const drag = (ROVER.ROLL + (hb || !i ? ROVER.HB : 0)) * load * DT;
|
|
7401
7418
|
dl -= clamp(vl + dl, -drag, drag);
|
|
7402
7419
|
const side = MU * grip * (hb ? ROVER.HBG : 1);
|
|
@@ -7637,8 +7654,8 @@ var bolts = (r, by, team, yaw, pitch, id, sight) => {
|
|
|
7637
7654
|
};
|
|
7638
7655
|
/**
|
|
7639
7656
|
* A ship's missile from its pod `k` (0 left, 1 right) toward where its lasers cross: a grenade
|
|
7640
|
-
* (plasma.ts's toss() flies it, blast() is its burst) launched at
|
|
7641
|
-
* speed along the way, 63 m/s at most (the wire's six bits).
|
|
7657
|
+
* (plasma.ts's toss() flies it, straight, blast() to MISSILE_R is its burst) launched at
|
|
7658
|
+
* MISSILE_SPEED plus the ship's own speed along the way, 63 m/s at most (the wire's six bits).
|
|
7642
7659
|
*/
|
|
7643
7660
|
var missile = (r, by, team, yaw, pitch, id, k, sight) => {
|
|
7644
7661
|
const o = muzzle(r, PODS[k]);
|
|
@@ -7657,7 +7674,8 @@ var missile = (r, by, team, yaw, pitch, id, k, sight) => {
|
|
|
7657
7674
|
left: 2 * SHIP.GUN_RANGE,
|
|
7658
7675
|
burst: false,
|
|
7659
7676
|
power: 7,
|
|
7660
|
-
v: Math.min(63, SHIP.MISSILE_SPEED + Math.max(0, own))
|
|
7677
|
+
v: Math.min(63, SHIP.MISSILE_SPEED + Math.max(0, own)),
|
|
7678
|
+
missile: true
|
|
7661
7679
|
};
|
|
7662
7680
|
};
|
|
7663
7681
|
// src/shared/room.ts
|
|
@@ -8127,7 +8145,7 @@ var Room = class {
|
|
|
8127
8145
|
const hit = this.rewind(p.info.id, view).find((seen) => reaches(me, seen) && foes.some((q) => q.info.id === seen.id && this.ctf.carrying(q.info.id) >= 0));
|
|
8128
8146
|
const foe = foes.find((q) => q.info.id === hit?.id);
|
|
8129
8147
|
if (!foe || !this.drop(foe.info.id)) return;
|
|
8130
|
-
const v = speedOf(me);
|
|
8148
|
+
const v = speedOf$1(me);
|
|
8131
8149
|
const [dx, dz] = v > .001 ? [me.vx / v, me.vz / v] : forward(me.yaw);
|
|
8132
8150
|
stumble(foe.state, dx, dz);
|
|
8133
8151
|
foe.state.zap = false;
|
|
@@ -8247,11 +8265,12 @@ var Room = class {
|
|
|
8247
8265
|
if (b.power === 7) {
|
|
8248
8266
|
toss(this.world, b, foes.map((f) => f.state));
|
|
8249
8267
|
this.ram(b, o);
|
|
8268
|
+
const r = b.missile ? 14 : 8;
|
|
8250
8269
|
if (b.burst && this.boom([
|
|
8251
8270
|
b.x,
|
|
8252
8271
|
b.y,
|
|
8253
8272
|
b.z
|
|
8254
|
-
], b.by, b.team) && by) by.state.hits = by.state.hits + 1 & 255;
|
|
8273
|
+
], b.by, b.team, r) && by) by.state.hits = by.state.hits + 1 & 255;
|
|
8255
8274
|
return;
|
|
8256
8275
|
}
|
|
8257
8276
|
const hit = fly(this.world, b, m, foes.map((f) => f.state));
|
|
@@ -8720,26 +8739,27 @@ var Room = class {
|
|
|
8720
8739
|
/**
|
|
8721
8740
|
* A blast at `c`, the grenade's rule, of player `by` of `team`: every enemy on foot who is up,
|
|
8722
8741
|
* and `by` himself, lose what blast() gives where they stand now; every enemy vehicle loses
|
|
8723
|
-
* NADE_HP at its hull, less with the distance to it, nothing from NADE_R
|
|
8742
|
+
* NADE_HP at its hull, less with the distance to it, nothing from `w` (NADE_R, a missile's
|
|
8743
|
+
* MISSILE_R) on or behind a brush.
|
|
8724
8744
|
* Who is seated is behind his hull: the blast takes nothing from him. True when it hurt an enemy
|
|
8725
8745
|
* or his vehicle.
|
|
8726
8746
|
*/
|
|
8727
|
-
boom(c, by, team) {
|
|
8747
|
+
boom(c, by, team, w = 8) {
|
|
8728
8748
|
let hit = false;
|
|
8729
8749
|
for (const r of this.targets(team)) {
|
|
8730
8750
|
const d = reach(r, c);
|
|
8731
|
-
if (d <
|
|
8751
|
+
if (d < w && !hidden(this.world, c, [
|
|
8732
8752
|
r.x,
|
|
8733
8753
|
r.y,
|
|
8734
8754
|
r.z
|
|
8735
8755
|
])) {
|
|
8736
|
-
this.hurt(r, Math.ceil(5 * (1 - d /
|
|
8756
|
+
this.hurt(r, Math.ceil(5 * (1 - d / w)), by, team);
|
|
8737
8757
|
hit = true;
|
|
8738
8758
|
}
|
|
8739
8759
|
}
|
|
8740
8760
|
for (const q of this.players()) {
|
|
8741
8761
|
const own = q.info.id === by;
|
|
8742
|
-
const hp = !q.state.down && q.state.mode !== MODE.RIDE && (own || q.info.team !== team) ? blast(this.world, c, q.state) : 0;
|
|
8762
|
+
const hp = !q.state.down && q.state.mode !== MODE.RIDE && (own || q.info.team !== team) ? blast(this.world, c, q.state, w) : 0;
|
|
8743
8763
|
if (hp) {
|
|
8744
8764
|
this.shot(q, hp, this.players().find((o) => o.info.id === by), q.state.x - c[0], q.state.z - c[2], FRAG.NADE);
|
|
8745
8765
|
hit ||= !own;
|
|
@@ -19,5 +19,5 @@ export declare const kit: (out: Out, at: Vec3, t: number) => void;
|
|
|
19
19
|
export declare const cell: (out: Out, at: Vec3, t: number) => void;
|
|
20
20
|
/** A rail cell at `at`: a gunmetal box with a glowing violet-white bolt on each side, the rail gun's colours. */
|
|
21
21
|
export declare const battery: (out: Out, at: Vec3, t: number) => void;
|
|
22
|
-
/** An armour at `at`: a
|
|
22
|
+
/** An armour at `at`: a green cuirass turning and bobbing over it, its shield pulsing. */
|
|
23
23
|
export declare const vest: (out: Out, at: Vec3, t: number) => void;
|
|
@@ -109,6 +109,12 @@ export declare const SOUND: {
|
|
|
109
109
|
*/
|
|
110
110
|
readonly PAIN: 54;
|
|
111
111
|
readonly DEATH: 55;
|
|
112
|
+
/**
|
|
113
|
+
* The pickups' own sounds (the user, 2026-11-14: one for each), PACK being the health's: an ammo
|
|
114
|
+
* pack's clack of a magazine and a blip up a fifth; an armour's rising hum under a ringing chord.
|
|
115
|
+
*/
|
|
116
|
+
readonly AMMO: 56;
|
|
117
|
+
readonly ARMOR: 57;
|
|
112
118
|
};
|
|
113
119
|
/**
|
|
114
120
|
* The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
|
|
@@ -252,9 +252,12 @@ export declare const GUN_RANGE = 80;
|
|
|
252
252
|
/**
|
|
253
253
|
* A shot is a plasma ball (the user, 2026-11-06, Doom-like): it leaves the eye along the look at
|
|
254
254
|
* PLASMA_SPEED m/s, is a sphere of PLASMA_R metres, and bursts on the first brush or enemy body it
|
|
255
|
-
* touches (teammates and the shooter let it through). It lives GUN_RANGE / PLASMA_SPEED s.
|
|
255
|
+
* touches (teammates and the shooter let it through). It lives GUN_RANGE / PLASMA_SPEED s. The
|
|
256
|
+
* laser rifle's rounds fly at RIFLE_SPEED. Both were 40 until the user, 2026-11-14: the pistol's
|
|
257
|
+
* twice as fast, the rifle's ten times.
|
|
256
258
|
*/
|
|
257
|
-
export declare const PLASMA_SPEED =
|
|
259
|
+
export declare const PLASMA_SPEED = 80;
|
|
260
|
+
export declare const RIFLE_SPEED = 400;
|
|
258
261
|
export declare const PLASMA_R = 0.12;
|
|
259
262
|
/** Plasma balls in flight in a room at most: past it the oldest bursts. They go on the wire. */
|
|
260
263
|
export declare const PLASMA_MAX = 64;
|
|
@@ -372,7 +375,7 @@ export declare const SLOW_SPEED = 3;
|
|
|
372
375
|
* The laser rifle (the user, 2026-11-08), held in both hands, after Halo's assault rifle: taken at
|
|
373
376
|
* the team's fourth rack with RIFLE_MAX rounds, it fires while FIRE is held, one round each
|
|
374
377
|
* RIFLE_COOL ticks (20 a second) from a power cell of RIFLE_CLIP (RIFLE_RELOAD to swap). Each shot
|
|
375
|
-
* is
|
|
378
|
+
* is a red ball at RIFLE_SPEED, RIFLE_RANGE metres along the look, drifted by up to RIFLE_DRIFT radians in a
|
|
376
379
|
* pattern of the shot count; every RIFLE_HITS of them that enter an enemy take 1 hp from him.
|
|
377
380
|
* Rounds and the cell are u8 on the wire.
|
|
378
381
|
*/
|
|
@@ -400,7 +403,12 @@ export declare const NADE_COOL = 60;
|
|
|
400
403
|
export declare const NADE_HOLD = 7;
|
|
401
404
|
export declare const NADE_SPEED = 36;
|
|
402
405
|
export declare const NADE_RANGE = 150;
|
|
403
|
-
export declare const NADE_R =
|
|
406
|
+
export declare const NADE_R = 8;
|
|
407
|
+
/**
|
|
408
|
+
* A ship's missile (Ball.missile, rover.ts's missile()): a grenade that flies straight, no gravity,
|
|
409
|
+
* and whose blast reaches MISSILE_R metres (the user, 2026-11-14; the grenade's went 5 to 8 m).
|
|
410
|
+
*/
|
|
411
|
+
export declare const MISSILE_R = 14;
|
|
404
412
|
export declare const NADE_HP = 5;
|
|
405
413
|
/** Seconds a carrier who is made to drop the flag cannot take it again: he would pick it up where he stands. */
|
|
406
414
|
export declare const FLAG_LOCK = 2;
|
|
@@ -26,6 +26,8 @@ export declare const launch: (p: PlayerState, team?: number) => Flying;
|
|
|
26
26
|
* `shots` count with the top bit turned, apart from his balls' (one arc is gone before the next).
|
|
27
27
|
*/
|
|
28
28
|
export declare const wave: (p: PlayerState, team?: number) => Flying;
|
|
29
|
+
/** 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`). */
|
|
30
|
+
export declare const speedOf: (b: Pick<Ball, "arc" | "power">) => number;
|
|
29
31
|
/** Metres the flight `b` goes in a tick. */
|
|
30
32
|
export declare const stepOf: (b: Ball) => number;
|
|
31
33
|
/**
|
|
@@ -50,15 +52,15 @@ export declare const lob: (p: PlayerState, team?: number) => Flying;
|
|
|
50
52
|
*/
|
|
51
53
|
export declare const lobbed: (p: PlayerState) => boolean;
|
|
52
54
|
/**
|
|
53
|
-
* One tick of the grenade `b`: the map's gravity bends its flight, then it flies on as a ball
|
|
55
|
+
* One tick of the grenade `b`: the map's gravity bends its flight (not a missile's), then it flies on as a ball
|
|
54
56
|
* (fly()) and bursts on the first brush or foe, or at the end of its range. Float32, so the
|
|
55
57
|
* shooter's client flies the same one.
|
|
56
58
|
*/
|
|
57
59
|
export declare const toss: (w: World, b: Flying, foes: PlayerState[]) => PlayerState | undefined;
|
|
58
60
|
/**
|
|
59
61
|
* The health a grenade bursting at `c` takes from `p`: NADE_HP at the body, less with the distance
|
|
60
|
-
* to its nearest point (the axis, feet to head), nothing from NADE_R
|
|
61
|
-
* a brush hides both that point and the chest.
|
|
62
|
+
* to its nearest point (the axis, feet to head), nothing from `r` (NADE_R, a missile's MISSILE_R)
|
|
63
|
+
* on, rounded up. Nothing when a brush hides both that point and the chest.
|
|
62
64
|
*/
|
|
63
|
-
export declare const blast: (w: World, c: Vec3, p: PlayerState) => number;
|
|
65
|
+
export declare const blast: (w: World, c: Vec3, p: PlayerState, r?: number) => number;
|
|
64
66
|
export {};
|
|
@@ -248,7 +248,8 @@ export declare class Room {
|
|
|
248
248
|
/**
|
|
249
249
|
* A blast at `c`, the grenade's rule, of player `by` of `team`: every enemy on foot who is up,
|
|
250
250
|
* and `by` himself, lose what blast() gives where they stand now; every enemy vehicle loses
|
|
251
|
-
* NADE_HP at its hull, less with the distance to it, nothing from NADE_R
|
|
251
|
+
* NADE_HP at its hull, less with the distance to it, nothing from `w` (NADE_R, a missile's
|
|
252
|
+
* MISSILE_R) on or behind a brush.
|
|
252
253
|
* Who is seated is behind his hull: the blast takes nothing from him. True when it hurt an enemy
|
|
253
254
|
* or his vehicle.
|
|
254
255
|
*/
|
|
@@ -25,6 +25,13 @@ export declare const ROVER: {
|
|
|
25
25
|
readonly BRAKE: 14;
|
|
26
26
|
readonly ROLL: 0.6;
|
|
27
27
|
readonly HB: 6;
|
|
28
|
+
/**
|
|
29
|
+
* The boost (the user, 2026-11-14), Shift with W as on the ship: a rocket at the back pushes
|
|
30
|
+
* BOOST m/s² more along the nose, fading to nothing at VBOOST. It is not the tyres' (the moon's
|
|
31
|
+
* grip already caps the engine), so it pushes with any wheel down.
|
|
32
|
+
*/
|
|
33
|
+
readonly BOOST: 10;
|
|
34
|
+
readonly VBOOST: 34;
|
|
28
35
|
/** Grip sideways and in traction, as shares of the load; under the handbrake, the share left sideways and how much faster the nose comes round. */
|
|
29
36
|
readonly MU: 1.1;
|
|
30
37
|
readonly MUL: 1.2;
|
|
@@ -206,8 +213,8 @@ export declare const aimOf: (r: Rover, yaw: number, pitch: number, sight?: Sight
|
|
|
206
213
|
export declare const bolts: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, sight?: Sight) => Flying[];
|
|
207
214
|
/**
|
|
208
215
|
* A ship's missile from its pod `k` (0 left, 1 right) toward where its lasers cross: a grenade
|
|
209
|
-
* (plasma.ts's toss() flies it, blast() is its burst) launched at
|
|
210
|
-
* speed along the way, 63 m/s at most (the wire's six bits).
|
|
216
|
+
* (plasma.ts's toss() flies it, straight, blast() to MISSILE_R is its burst) launched at
|
|
217
|
+
* MISSILE_SPEED plus the ship's own speed along the way, 63 m/s at most (the wire's six bits).
|
|
211
218
|
*/
|
|
212
219
|
export declare const missile: (r: Rover, by: number, team: number, yaw: number, pitch: number, id: number, k: number, sight?: Sight) => Flying;
|
|
213
220
|
export {};
|
|
@@ -356,6 +356,8 @@ export interface Ball {
|
|
|
356
356
|
v?: number;
|
|
357
357
|
/** An arc of energy, not a ball: the CUT that threw it (ARC_L or ARC_R). Absent for a ball. */
|
|
358
358
|
arc?: number;
|
|
359
|
+
/** A ship's missile (power NADE): it flies straight, and its blast reaches MISSILE_R. */
|
|
360
|
+
missile?: boolean;
|
|
359
361
|
}
|
|
360
362
|
/** The flag of a team as a snapshot carries it: only the fields of its state are meaningful, the rest read 0. */
|
|
361
363
|
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.149.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|