@adatechnology/game-items-three 0.8.1 → 0.8.2
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 +109 -19
- package/dist/index.global.js.map +1 -1
- package/package.json +9 -9
package/dist/index.global.js
CHANGED
|
@@ -16175,6 +16175,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16175
16175
|
var BREACH_GRID_CAP = 4096;
|
|
16176
16176
|
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
16177
16177
|
var TILE_CLUMPS = 160;
|
|
16178
|
+
var TILE_THICKNESS = 0.018;
|
|
16178
16179
|
var PANEL_EDGE_PILLAR = 2;
|
|
16179
16180
|
var PANEL_EDGE_BASE = 4;
|
|
16180
16181
|
var PANEL_EDGE_BEAM = 3;
|
|
@@ -17287,10 +17288,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17287
17288
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
17288
17289
|
const cells = grid.filter((cell, i) => worn[i] !== -1 && !(op && p.st.opening && Math.hypot(cell.center[u] - op[u], cell.center[v] - op[v]) <= p.st.opening.radius));
|
|
17289
17290
|
const { c } = partXf(o, p);
|
|
17290
|
-
const
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
] : [];
|
|
17291
|
+
const tiles = isTiledCover(p);
|
|
17292
|
+
const pieces = cellFragments(o, p, clumpUnits(cells, p.thin, unitSpan(p), tiles ? TILE_CLUMPS : unitClumps), vec.add(c, [0, 1, 0]), null, MASONRY_CRUMBLE_SPEED, p.st.mass, "m_", true);
|
|
17293
|
+
const fragments = cells.length === 0 ? [] : tiles ? pieces.map((f) => ({ ...f, shape: "shard", size: f.size.map((x, k) => k === p.thin ? Math.min(x, TILE_THICKNESS) : x) })) : [...pieces, ...plasterFlakes(o, p, cells, vec.add(c, [0, 1, 0]), MASONRY_CRUMBLE_SPEED, "mp_")];
|
|
17294
17294
|
p.st.status = "broken";
|
|
17295
17295
|
p.st.hp = 0;
|
|
17296
17296
|
p.st.mass = 0;
|
|
@@ -18780,6 +18780,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18780
18780
|
return;
|
|
18781
18781
|
}
|
|
18782
18782
|
if (!force && giveAtCut(o, p, src)) return;
|
|
18783
|
+
if (!force && isTiledCover(p)) {
|
|
18784
|
+
crumbleMasonry(o, p, src);
|
|
18785
|
+
return;
|
|
18786
|
+
}
|
|
18783
18787
|
const ex = p.spec.explodes;
|
|
18784
18788
|
const style = force ?? (p.snap ? "snap" : p.mat.fracture === "none" ? "snap" : p.mat.fracture);
|
|
18785
18789
|
const { c, q } = partXf(o, p);
|
|
@@ -20801,6 +20805,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20801
20805
|
return loads;
|
|
20802
20806
|
}
|
|
20803
20807
|
var isBearing = (part) => part.role === "column" || part.role === "wall";
|
|
20808
|
+
function isRoofFrame2(part) {
|
|
20809
|
+
return part.role === "roof" || part.id.startsWith("rafter");
|
|
20810
|
+
}
|
|
20804
20811
|
function sizeCapacities(parts, supports, options) {
|
|
20805
20812
|
const loads = loadsAtRest(parts, supports);
|
|
20806
20813
|
const worst = /* @__PURE__ */ new Map();
|
|
@@ -20814,7 +20821,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20814
20821
|
for (const part of parts) {
|
|
20815
20822
|
const load = loads.get(part.id);
|
|
20816
20823
|
if (load === void 0 || part.role === "none") continue;
|
|
20817
|
-
const
|
|
20824
|
+
const afterLoss = (worst.get(part.id) ?? 1) / options.redundancy;
|
|
20825
|
+
const factor = isBearing(part) ? Math.max(1 / options.safety, afterLoss) : isRoofFrame2(part) ? Math.max(1 / options.safetyOthers, afterLoss) : 1 / options.safetyOthers;
|
|
20818
20826
|
capacities.set(part.id, Math.max(1, load * factor));
|
|
20819
20827
|
}
|
|
20820
20828
|
return capacities;
|
|
@@ -23524,7 +23532,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23524
23532
|
}
|
|
23525
23533
|
var residentialTower = residentialTowerTemplate();
|
|
23526
23534
|
|
|
23527
|
-
// ../game-floorplan-three/dist/chunk-
|
|
23535
|
+
// ../game-floorplan-three/dist/chunk-J3D4FCFR.js
|
|
23528
23536
|
var __defProp3 = Object.defineProperty;
|
|
23529
23537
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
23530
23538
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -24595,7 +24603,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24595
24603
|
}
|
|
24596
24604
|
const wref = R.walls.find((w) => w.floor === f && w.axis === j.axis && Math.abs((alongU ? w.v0 : w.u0) - L) < EPS3), th = wref ? wref.thickness || 0.15 : 0.15, t = 0.05, tt = th + 0.02;
|
|
24597
24605
|
const bar2 = (u0, y_0, u1, y_1, mat, color2, tw = tt) => alongU ? bx(mat, u0, y0 + y_0, L - tw / 2, u1, y0 + y_1, L + tw / 2, color2) : bx(mat, L - tw / 2, y0 + y_0, u0, L + tw / 2, y0 + y_1, u1, color2);
|
|
24598
|
-
|
|
24606
|
+
const frame2 = pieceRecord("window_frame:" + j.id, "aluminium", null, { floor: f });
|
|
24607
|
+
cursor.pc = frame2;
|
|
24599
24608
|
bar2(a, ya, a + t, yb, "metal", fr);
|
|
24600
24609
|
bar2(b - t, ya, b, yb, "metal", fr);
|
|
24601
24610
|
bar2(a, ya, b, ya + t, "metal", fr);
|
|
@@ -24608,6 +24617,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24608
24617
|
const am = (sd) => roomAt(f, alongU ? j.at : L + sd * 0.4, alongU ? L + sd * 0.4 : j.at);
|
|
24609
24618
|
const outside = !am(1) ? 1 : !am(-1) ? -1 : 0;
|
|
24610
24619
|
if (outside) {
|
|
24620
|
+
cursor.pc = frame2;
|
|
24611
24621
|
const off = outside * (th / 2 + 0.03);
|
|
24612
24622
|
if (alongU) bx("plaster", a - 0.05, y0 + ya - 0.04, L + (outside > 0 ? th / 2 : -th / 2 - 0.08), b + 0.05, y0 + ya, L + (outside > 0 ? th / 2 + 0.08 : -th / 2), pe_);
|
|
24613
24623
|
else bx("plaster", L + (outside > 0 ? th / 2 : -th / 2 - 0.08), y0 + ya - 0.04, a - 0.05, L + (outside > 0 ? th / 2 + 0.08 : -th / 2), y0 + ya, b + 0.05, pe_);
|
|
@@ -24623,6 +24633,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24623
24633
|
else bx("metal", L + go - 0.012, y0 + y, a, L + go + 0.012, y0 + y + 0.025, b, g);
|
|
24624
24634
|
}
|
|
24625
24635
|
}
|
|
24636
|
+
cursor.pc = null;
|
|
24626
24637
|
}
|
|
24627
24638
|
if (j.boards && !boardItems.has(j.id) && !cut) {
|
|
24628
24639
|
const inside2 = -(outside || -1), off = inside2 * (th / 2 + 0.04), n = Math.max(3, Math.round((yb - ya) / 0.16));
|
|
@@ -25555,7 +25566,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25555
25566
|
const { UV_SCALE, _Y, _h2, _q, accFor, cursor, put, rgbOf, structurePiece } = K;
|
|
25556
25567
|
const sh = (...a) => K.sh(...a);
|
|
25557
25568
|
const R_STYLE = () => shared2.ctx.r && shared2.ctx.r.style || "budget";
|
|
25558
|
-
function tileRelief(mat, pts, color2, type) {
|
|
25569
|
+
function tileRelief(mat, pts, color2, type, origin) {
|
|
25559
25570
|
const n = pts.length;
|
|
25560
25571
|
if (n < 3) return;
|
|
25561
25572
|
const [a, b, c] = pts;
|
|
@@ -25589,7 +25600,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25589
25600
|
ex /= el;
|
|
25590
25601
|
ey /= el;
|
|
25591
25602
|
ez /= el;
|
|
25592
|
-
const o = pts[0], S = [], T2 = [];
|
|
25603
|
+
const o = origin ?? pts[0], S = [], T2 = [];
|
|
25593
25604
|
for (const p of pts) {
|
|
25594
25605
|
const rx = p[0] - o[0], ry = p[1] - o[1], rz = p[2] - o[2];
|
|
25595
25606
|
S.push(rx * ex + ry * ey + rz * ez);
|
|
@@ -25654,6 +25665,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25654
25665
|
AC.nv += m * 2;
|
|
25655
25666
|
}
|
|
25656
25667
|
function ridge(a, b, type, roofColor) {
|
|
25668
|
+
const cuts = K.cfg.destruction ? baysAlong(a, b) : [];
|
|
25669
|
+
if (cuts.length) {
|
|
25670
|
+
let from = a;
|
|
25671
|
+
for (const f of [...cuts, 1]) {
|
|
25672
|
+
const to = [a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f, a[2] + (b[2] - a[2]) * f];
|
|
25673
|
+
ridgeCap(from, to, type, roofColor);
|
|
25674
|
+
from = to;
|
|
25675
|
+
}
|
|
25676
|
+
return;
|
|
25677
|
+
}
|
|
25678
|
+
ridgeCap(a, b, type, roofColor);
|
|
25679
|
+
}
|
|
25680
|
+
function ridgeCap(a, b, type, roofColor) {
|
|
25657
25681
|
cursor.pc = pieceOfPane((a[0] + b[0]) / 2, (a[2] + b[2]) / 2);
|
|
25658
25682
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2], Ln = Math.hypot(dx, dy, dz);
|
|
25659
25683
|
if (Ln < 0.05) return;
|
|
@@ -25680,7 +25704,81 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25680
25704
|
}
|
|
25681
25705
|
return m ? structurePiece(m.id) : null;
|
|
25682
25706
|
}
|
|
25683
|
-
|
|
25707
|
+
function paneTiles(mat, pts, color2, type) {
|
|
25708
|
+
const panes = panesUnder(pts), whole = centroidPiece(pts);
|
|
25709
|
+
if (panes.length < 2 || !whole || !K.cfg.destruction) {
|
|
25710
|
+
cursor.pc = whole;
|
|
25711
|
+
tileRelief(mat, pts, color2, type);
|
|
25712
|
+
return;
|
|
25713
|
+
}
|
|
25714
|
+
for (const r of panes) {
|
|
25715
|
+
const part = clipToRect(pts, r);
|
|
25716
|
+
if (part.length < 3 || planArea(part) < 1e-4) continue;
|
|
25717
|
+
cursor.pc = centroidPiece(part);
|
|
25718
|
+
tileRelief(mat, part, color2, type, pts[0]);
|
|
25719
|
+
}
|
|
25720
|
+
}
|
|
25721
|
+
function centroidPiece(pts) {
|
|
25722
|
+
let cx = 0, cz = 0;
|
|
25723
|
+
for (const p of pts) {
|
|
25724
|
+
cx += p[0];
|
|
25725
|
+
cz += p[2];
|
|
25726
|
+
}
|
|
25727
|
+
return pieceOfPane(cx / pts.length, cz / pts.length);
|
|
25728
|
+
}
|
|
25729
|
+
function panesUnder(pts) {
|
|
25730
|
+
if (shared2.ctx.noPiece || !shared2.ctx.panes.length) return [];
|
|
25731
|
+
let x0 = Infinity, z0 = Infinity, x1 = -Infinity, z1 = -Infinity;
|
|
25732
|
+
for (const p of pts) {
|
|
25733
|
+
x0 = Math.min(x0, p[0]);
|
|
25734
|
+
x1 = Math.max(x1, p[0]);
|
|
25735
|
+
z0 = Math.min(z0, p[2]);
|
|
25736
|
+
z1 = Math.max(z1, p[2]);
|
|
25737
|
+
}
|
|
25738
|
+
const boxes = shared2.ctx.panes.map((a) => a.aabb).filter((b) => !!b && b[0] < x1 - 1e-4 && b[2] > x0 + 1e-4 && b[1] < z1 - 1e-4 && b[3] > z0 + 1e-4);
|
|
25739
|
+
if (boxes.length < 2) return boxes;
|
|
25740
|
+
const lo = [Math.min(...boxes.map((b) => b[0])), Math.min(...boxes.map((b) => b[1]))], hi = [Math.max(...boxes.map((b) => b[2])), Math.max(...boxes.map((b) => b[3]))];
|
|
25741
|
+
return boxes.map((b) => [b[0] <= lo[0] + 1e-6 ? -Infinity : b[0], b[1] <= lo[1] + 1e-6 ? -Infinity : b[1], b[2] >= hi[0] - 1e-6 ? Infinity : b[2], b[3] >= hi[1] - 1e-6 ? Infinity : b[3]]);
|
|
25742
|
+
}
|
|
25743
|
+
function baysAlong(a, b) {
|
|
25744
|
+
const rects = panesUnder([a, b, [b[0] + 1e-3, b[1], b[2] + 1e-3], [a[0] - 1e-3, a[1], a[2] - 1e-3]]);
|
|
25745
|
+
const alongX = Math.abs(b[0] - a[0]) >= Math.abs(b[2] - a[2]), i = alongX ? 0 : 2, k = alongX ? 0 : 1, span = b[i] - a[i];
|
|
25746
|
+
if (Math.abs(span) < 1e-6) return [];
|
|
25747
|
+
const cuts = /* @__PURE__ */ new Set();
|
|
25748
|
+
for (const r of rects) for (const v of [r[k], r[k + 2]]) {
|
|
25749
|
+
const f = (v - a[i]) / span;
|
|
25750
|
+
if (Number.isFinite(f) && f > 0.01 && f < 0.99) cuts.add(+f.toFixed(4));
|
|
25751
|
+
}
|
|
25752
|
+
return [...cuts].sort((p, q) => p - q);
|
|
25753
|
+
}
|
|
25754
|
+
function clipToRect(pts, r) {
|
|
25755
|
+
let poly = pts.map((p) => [p[0], p[1], p[2]]);
|
|
25756
|
+
const edges = [[0, r[0], 1], [0, r[2], -1], [2, r[1], 1], [2, r[3], -1]];
|
|
25757
|
+
for (const [axis, at2, sign2] of edges) {
|
|
25758
|
+
if (!Number.isFinite(at2)) continue;
|
|
25759
|
+
const out = [];
|
|
25760
|
+
for (let i = 0; i < poly.length; i++) {
|
|
25761
|
+
const p = poly[i], q = poly[(i + 1) % poly.length], dp = (p[axis] - at2) * sign2, dq = (q[axis] - at2) * sign2;
|
|
25762
|
+
if (dp >= 0) out.push(p);
|
|
25763
|
+
if (dp >= 0 !== dq >= 0) {
|
|
25764
|
+
const t = dp / (dp - dq);
|
|
25765
|
+
out.push([p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t, p[2] + (q[2] - p[2]) * t]);
|
|
25766
|
+
}
|
|
25767
|
+
}
|
|
25768
|
+
poly = out;
|
|
25769
|
+
if (poly.length < 3) return [];
|
|
25770
|
+
}
|
|
25771
|
+
return poly;
|
|
25772
|
+
}
|
|
25773
|
+
function planArea(pts) {
|
|
25774
|
+
let a = 0;
|
|
25775
|
+
for (let i = 0; i < pts.length; i++) {
|
|
25776
|
+
const p = pts[i], q = pts[(i + 1) % pts.length];
|
|
25777
|
+
a += p[0] * q[2] - q[0] * p[2];
|
|
25778
|
+
}
|
|
25779
|
+
return Math.abs(a) / 2;
|
|
25780
|
+
}
|
|
25781
|
+
const defined = { R_STYLE, tileRelief, paneTiles, ridge, pieceOfPane };
|
|
25684
25782
|
Object.assign(K, defined);
|
|
25685
25783
|
}
|
|
25686
25784
|
function installRoofRect(K, shared2) {
|
|
@@ -25689,15 +25787,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25689
25787
|
function roofRect(type, X0, Z0, X1, Z1, yb, roofColor, gable, F, touchesU = [0, 0, 0, 0]) {
|
|
25690
25788
|
const C = shared2.ctx.colors, o = type === "fiber_cement" ? 0.3 : 0.45, x0 = X0 - (touchesU[0] ? 0 : o), x1 = X1 + (touchesU[2] ? 0 : o), z0 = Z0 - (touchesU[1] ? 0 : o), z1 = Z1 + (touchesU[3] ? 0 : o), dx = x1 - x0, dz = z1 - z0, xm = (x0 + x1) / 2, zm = (z0 + z1) / 2;
|
|
25691
25789
|
const mat = type === "fiber_cement" ? "fiber_cement" : "tile", tp = type === "fiber_cement" ? 0.2 : 0.5, alongX = dx >= dz, up = [0, 1, 0];
|
|
25692
|
-
const Q = (pts) =>
|
|
25693
|
-
let cx = 0, cz = 0;
|
|
25694
|
-
for (const p of pts) {
|
|
25695
|
-
cx += p[0];
|
|
25696
|
-
cz += p[2];
|
|
25697
|
-
}
|
|
25698
|
-
cursor.pc = pieceOfPane(cx / pts.length, cz / pts.length);
|
|
25699
|
-
return tileRelief(mat, pts, roofColor, type);
|
|
25700
|
-
};
|
|
25790
|
+
const Q = (pts) => K.paneTiles(mat, pts, roofColor, type);
|
|
25701
25791
|
cursor.pc = pieceOfPane(xm, zm);
|
|
25702
25792
|
{
|
|
25703
25793
|
const wt = 0.075, yc = yb - 0.2, cf = C.facade != null ? C.facade : 14209216, fas = R_STYLE() === "budget" ? 7228980 : sh(roofColor, 0.55), sof = 15131352, tz = 0.035;
|