@adatechnology/game-items-three 0.7.7 → 0.7.8
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.global.js +90 -5
- package/dist/index.global.js.map +1 -1
- package/package.json +8 -8
package/dist/index.global.js
CHANGED
|
@@ -1561,6 +1561,26 @@ var GameItemsThree = (() => {
|
|
|
1561
1561
|
|
|
1562
1562
|
// ../game-contracts/dist/index.js
|
|
1563
1563
|
var DEFAULT_BLAST_IMPULSE = { bodyArea: 0.7, lift: 0.15, minSpeed: 0.3, tntPerJoule: 0.24 / 2e5 };
|
|
1564
|
+
var NEAREST = 0.3;
|
|
1565
|
+
function sideOnImpulse(tnt, distance2) {
|
|
1566
|
+
if (!(tnt > 0)) return 0;
|
|
1567
|
+
const w3 = Math.cbrt(tnt);
|
|
1568
|
+
const z = Math.max(distance2, NEAREST) / w3;
|
|
1569
|
+
const scaled = 0.067 * Math.sqrt(1 + (z / 0.23) ** 4) / (z * z * Math.cbrt(1 + (z / 1.55) ** 3));
|
|
1570
|
+
return scaled * w3 * 100;
|
|
1571
|
+
}
|
|
1572
|
+
var ATMOSPHERE = 101325;
|
|
1573
|
+
function sideOnOverpressure(tnt, distance2) {
|
|
1574
|
+
if (!(tnt > 0)) return 0;
|
|
1575
|
+
const z = Math.max(distance2, NEAREST) / Math.cbrt(tnt);
|
|
1576
|
+
const ratio = 808 * (1 + (z / 4.5) ** 2) / (Math.sqrt(1 + (z / 0.048) ** 2) * Math.sqrt(1 + (z / 0.32) ** 2) * Math.sqrt(1 + (z / 1.35) ** 2));
|
|
1577
|
+
return ratio * ATMOSPHERE;
|
|
1578
|
+
}
|
|
1579
|
+
function bodyImpulse(tnt, distance2) {
|
|
1580
|
+
if (!(tnt > 0)) return 0;
|
|
1581
|
+
const z = Math.max(distance2, NEAREST) / Math.cbrt(tnt);
|
|
1582
|
+
return sideOnImpulse(tnt, distance2) * (2 + 4 / (1 + z * z));
|
|
1583
|
+
}
|
|
1564
1584
|
var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
|
|
1565
1585
|
var DEFAULT_IGNITION_RULES = {
|
|
1566
1586
|
fillCurve: [
|
|
@@ -15854,9 +15874,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15854
15874
|
var BREACH_AREA = 0.25;
|
|
15855
15875
|
var BREACH_BLAST_REACH = 0.12;
|
|
15856
15876
|
var MEMBER_CUT_REACH = 0.5;
|
|
15877
|
+
var FAR_MEMBER_HP_FLOOR = 0.25;
|
|
15857
15878
|
var BLAST_REFERENCE_RESISTANCE = 200 * 1900 * 0.13;
|
|
15858
15879
|
var BLAST_EDGE_RAGGED = 0.3;
|
|
15859
15880
|
var BLAST_EDGE_LOOSE = 1.35;
|
|
15881
|
+
var PANEL_PRESSURE = 7e4;
|
|
15882
|
+
var PANEL_IMPULSE = 150;
|
|
15883
|
+
var PANEL_PI = 6e6;
|
|
15884
|
+
var PANEL_POINTS = [[0, 0], [-0.3, 0], [0.3, 0], [0, -0.3], [0, 0.3]];
|
|
15885
|
+
var PANEL_POINTS_LOADED = 4;
|
|
15860
15886
|
var BLAST_EDGE_WEAR = 0.6;
|
|
15861
15887
|
var RESIDUAL_CAPACITY = 0.15;
|
|
15862
15888
|
var SEVER_BAND = 0.1;
|
|
@@ -17450,7 +17476,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17450
17476
|
return BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3) * clamp2(Math.cbrt(BLAST_REFERENCE_RESISTANCE / resistance), 0.3, 2);
|
|
17451
17477
|
};
|
|
17452
17478
|
const blastUnits = (o, p, wp, energy, dist, src) => {
|
|
17453
|
-
var _a
|
|
17479
|
+
var _a;
|
|
17454
17480
|
if (!p.staged || p.st.stripped || isLost(p) || chipEnergy <= 0) return false;
|
|
17455
17481
|
const reach = blastReachOf(p, energy);
|
|
17456
17482
|
if (dist >= reach) return false;
|
|
@@ -17480,6 +17506,62 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17480
17506
|
}
|
|
17481
17507
|
}
|
|
17482
17508
|
if (out.length === 0) return false;
|
|
17509
|
+
return knockOutUnits(o, p, wp, energy, out, src);
|
|
17510
|
+
};
|
|
17511
|
+
const blastPanel = (o, p, point, energy, src) => {
|
|
17512
|
+
var _a;
|
|
17513
|
+
if (!p.staged || p.st.stripped || isLost(p) || !p.spec.units || p.spec.units.mortar === p.spec.material || p.spec.reinforcement) return false;
|
|
17514
|
+
const [u, v] = planeAxes(p.thin);
|
|
17515
|
+
const lp = toLocal(p.pos, p.q, objLocal(o, point));
|
|
17516
|
+
const half = p.dims[u] / 2;
|
|
17517
|
+
const posts = [];
|
|
17518
|
+
for (const m of o.parts) {
|
|
17519
|
+
if (m === p || !m.spec.reinforcement || isLost(m) || m.spec.shape.kind !== "box") continue;
|
|
17520
|
+
const mp = toLocal(p.pos, p.q, m.pos);
|
|
17521
|
+
if (Math.abs(mp[p.thin]) > p.dims[p.thin] + 0.15 || Math.abs(mp[u]) > half + 0.15 || m.dims[v] < p.dims[v] * 0.5) continue;
|
|
17522
|
+
posts.push(mp[u]);
|
|
17523
|
+
}
|
|
17524
|
+
let from = -half, to = half;
|
|
17525
|
+
for (const x of posts) {
|
|
17526
|
+
if (x <= lp[u] && x > from) from = x;
|
|
17527
|
+
if (x >= lp[u] && x < to) to = x;
|
|
17528
|
+
}
|
|
17529
|
+
if (to - from < 0.2) return false;
|
|
17530
|
+
const tnt = energy * DEFAULT_BLAST_IMPULSE.tntPerJoule;
|
|
17531
|
+
const centre = objLocal(o, point);
|
|
17532
|
+
const span = to - from, height = p.dims[v];
|
|
17533
|
+
let loaded = 0;
|
|
17534
|
+
for (const [fu, fv] of PANEL_POINTS) {
|
|
17535
|
+
const at2 = [0, 0, 0];
|
|
17536
|
+
at2[u] = (from + to) / 2 + fu * span;
|
|
17537
|
+
at2[v] = fv * height;
|
|
17538
|
+
at2[p.thin] = Math.sign(lp[p.thin]) * p.dims[p.thin] / 2;
|
|
17539
|
+
const r = vec.distance(toWorld(p.pos, p.q, at2), centre);
|
|
17540
|
+
const side = sideOnOverpressure(tnt, r);
|
|
17541
|
+
const reflected = 2 * side + 6 * side * side / (side + 7 * 101325);
|
|
17542
|
+
const impulse = bodyImpulse(tnt, r);
|
|
17543
|
+
if (reflected > PANEL_PRESSURE && impulse > PANEL_IMPULSE && (reflected - PANEL_PRESSURE) * (impulse - PANEL_IMPULSE) >= PANEL_PI) loaded++;
|
|
17544
|
+
}
|
|
17545
|
+
if (loaded < PANEL_POINTS_LOADED) return false;
|
|
17546
|
+
const grid = gridOf(p);
|
|
17547
|
+
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
17548
|
+
const out = [];
|
|
17549
|
+
for (let i = 0; i < grid.length; i++) {
|
|
17550
|
+
const cell = grid[i];
|
|
17551
|
+
if (worn[i] === -1) continue;
|
|
17552
|
+
if (cell.center[u] - cell.size[u] / 2 >= from - 1e-6 && cell.center[u] + cell.size[u] / 2 <= to + 1e-6) out.push(i);
|
|
17553
|
+
}
|
|
17554
|
+
if (out.length === 0) return false;
|
|
17555
|
+
for (const i of out) worn[i] = -1;
|
|
17556
|
+
return knockOutUnits(o, p, point, energy, out, src);
|
|
17557
|
+
};
|
|
17558
|
+
const knockOutUnits = (o, p, wp, energy, out, src) => {
|
|
17559
|
+
var _a, _b;
|
|
17560
|
+
const [u, v] = planeAxes(p.thin);
|
|
17561
|
+
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
17562
|
+
const grid = gridOf(p);
|
|
17563
|
+
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
17564
|
+
for (const i of out) worn[i] = -1;
|
|
17483
17565
|
const loose = unsupportedCells(grid, p.thin, p.dims, (i) => worn[i] !== -1 && !(op && p.st.opening && Math.hypot(grid[i].center[u] - op[u], grid[i].center[v] - op[v]) <= p.st.opening.radius));
|
|
17484
17566
|
for (const i of loose) worn[i] = -1;
|
|
17485
17567
|
const blown = out.map((i) => grid[i]), fallen = loose.map((i) => grid[i]);
|
|
@@ -17962,12 +18044,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17962
18044
|
return reach;
|
|
17963
18045
|
}
|
|
17964
18046
|
if (Ein > 20 && p.layers.length > 0) spallOuter(o, p, wp, faceOf(o, p, wn), wn, clamp2(0.05 + Math.sqrt(Ein) * 2e-3, 0.05, 0.4), src);
|
|
17965
|
-
const
|
|
18047
|
+
const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
|
|
18048
|
+
const farMember = Boolean(p.spec.reinforcement && p.spec.units) && dist > MEMBER_CUT_REACH * breachReach;
|
|
18049
|
+
const dealt = farMember ? applyDamage(o, p, Math.min(amount, Math.max(0, p.st.hp - p.st.maxHp * FAR_MEMBER_HP_FLOOR)), "explosive", null, null, Ein * 0.3, 40, src) : applyDamage(o, p, amount, "explosive", point, null, Ein * 0.3, 40, src);
|
|
17966
18050
|
res.damage += dealt;
|
|
17967
18051
|
if (p.bend && flexure.enabled) bendByBlast(o, p, point, energy, radius, reach, src);
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
18052
|
+
if (p.spec.units && p.spec.units.mortar !== p.spec.material) {
|
|
18053
|
+
blastPanel(o, p, point, energy, src);
|
|
18054
|
+
if (!isLost(p)) blastUnits(o, p, wp, energy, dist, src);
|
|
18055
|
+
} else if (farMember) blastUnits(o, p, wp, energy, dist, src);
|
|
17971
18056
|
else if (dist <= breachReach) addBreach(o, p, wp, breachAreaOf(p, dealt, true), Ein, null, src);
|
|
17972
18057
|
return reach;
|
|
17973
18058
|
};
|