@adatechnology/game-destruction 0.13.0 → 0.13.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.global.js +17 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.global.js
CHANGED
|
@@ -2984,6 +2984,7 @@ var GameDestruction = (() => {
|
|
|
2984
2984
|
var CHIP_ENERGY = 200;
|
|
2985
2985
|
var CHIP_SPLASH = 0.5;
|
|
2986
2986
|
var CRATER_SPENT = 0.6;
|
|
2987
|
+
var EDGE_REACH = 1.5;
|
|
2987
2988
|
var BAR_BOW = 0.08;
|
|
2988
2989
|
var BULLET_JOINT_SPAN = 0.3;
|
|
2989
2990
|
var CUT_SLICE = 1;
|
|
@@ -4357,6 +4358,9 @@ var GameDestruction = (() => {
|
|
|
4357
4358
|
const lo = cell.center[a] - cell.size[a] / 2 + w / 2, hi = cell.center[a] + cell.size[a] / 2 - w / 2;
|
|
4358
4359
|
size[a] = w;
|
|
4359
4360
|
center[a] = clamp2(lp[a], lo, hi);
|
|
4361
|
+
const [from, to] = tornToEdge({ p, cell, a, b: a === u ? v : u, at: lp[a], crater: [center[a] - w / 2, center[a] + w / 2], reach: w * EDGE_REACH, gone: (k) => worn[k] === -1 });
|
|
4362
|
+
size[a] = to - from;
|
|
4363
|
+
center[a] = (from + to) / 2;
|
|
4360
4364
|
}
|
|
4361
4365
|
const taken2 = (cut[i] ?? 0) + size[u] * size[v];
|
|
4362
4366
|
if (taken2 >= cell.size[u] * cell.size[v] * CRATER_SPENT) {
|
|
@@ -4394,6 +4398,19 @@ var GameDestruction = (() => {
|
|
|
4394
4398
|
collapseCheck(o, src);
|
|
4395
4399
|
}
|
|
4396
4400
|
};
|
|
4401
|
+
const tornToEdge = (o) => {
|
|
4402
|
+
const { p, cell, a, b, at, crater: crater2, reach, gone } = o;
|
|
4403
|
+
const half = p.dims[a] / 2;
|
|
4404
|
+
const lo = cell.center[a] - cell.size[a] / 2, hi = cell.center[a] + cell.size[a] / 2;
|
|
4405
|
+
const free = (side, sign) => {
|
|
4406
|
+
if (sign > 0 ? side >= half - 1e-6 : side <= -half + 1e-6) return sign > 0 || a !== planeAxes(p.thin)[1];
|
|
4407
|
+
const probe = side + sign * 1e-3;
|
|
4408
|
+
return gridOf(p).some((c, k) => gone(k) && Math.abs(probe - c.center[a]) <= c.size[a] / 2 && Math.abs(cell.center[b] - c.center[b]) <= c.size[b] / 2);
|
|
4409
|
+
};
|
|
4410
|
+
if (at - lo <= reach && free(lo, -1)) return [lo, Math.max(crater2[1], lo)];
|
|
4411
|
+
if (hi - at <= reach && free(hi, 1)) return [Math.min(crater2[0], hi), hi];
|
|
4412
|
+
return crater2;
|
|
4413
|
+
};
|
|
4397
4414
|
const craterAcross = (energy) => clamp2(0.03 + 12e-4 * Math.sqrt(Math.max(0, energy)), 0.03, 0.14);
|
|
4398
4415
|
const craterFragments = (o, p, cell, dir, speed, mass, tag) => {
|
|
4399
4416
|
const { c, q } = partXf(o, p);
|