@adatechnology/game-items-three 0.7.5 → 0.7.7
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 +105 -21
- package/dist/index.global.js.map +1 -1
- package/package.json +8 -8
package/dist/index.global.js
CHANGED
|
@@ -15881,23 +15881,42 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15881
15881
|
const v = table[mat.penetrationClass ?? mat.id] ?? table[mat.id];
|
|
15882
15882
|
return v === void 0 ? void 0 : v * (mat.penetrationScale ?? 1);
|
|
15883
15883
|
};
|
|
15884
|
-
var
|
|
15884
|
+
var BURIED_BLAST_REACH = 0.5;
|
|
15885
|
+
var GIVE_AT_CUT_HP = 0.5;
|
|
15886
|
+
var capacityScale = (p, borne, through) => {
|
|
15885
15887
|
const residual = p.spec.reinforcement?.residualCapacity ?? RESIDUAL_CAPACITY;
|
|
15886
15888
|
if (p.st.stripped) return residual;
|
|
15887
|
-
const kept = Math.min(p.rt.removed ? 1 - p.rt.removed / p.mass0 : 1,
|
|
15889
|
+
const kept = Math.min(p.rt.removed ? 1 - p.rt.removed / p.mass0 : 1, sectionKept(p, residual, borne, through));
|
|
15888
15890
|
return Math.max(p.spec.reinforcement ? residual : 0.05, kept);
|
|
15889
15891
|
};
|
|
15890
|
-
var
|
|
15892
|
+
var sectionKept = (p, residual, borne, through) => {
|
|
15893
|
+
let kept = 1;
|
|
15894
|
+
forEachSection(p, borne, (c, along, gone) => {
|
|
15895
|
+
const share = through?.(c.center, along) ?? 1;
|
|
15896
|
+
if (share <= 0) return;
|
|
15897
|
+
kept = Math.min(kept, Math.max(p.spec.reinforcement ? residual : 0, 1 - gone) / share);
|
|
15898
|
+
});
|
|
15899
|
+
return kept;
|
|
15900
|
+
};
|
|
15901
|
+
var sectionLoss = (p, borne) => {
|
|
15902
|
+
let worst = 0;
|
|
15903
|
+
forEachSection(p, borne, (_c, _along, gone) => {
|
|
15904
|
+
worst = Math.max(worst, gone);
|
|
15905
|
+
});
|
|
15906
|
+
return Math.min(1, worst);
|
|
15907
|
+
};
|
|
15908
|
+
var forEachSection = (p, borne, visit) => {
|
|
15891
15909
|
const cells = p.st.chipped;
|
|
15892
|
-
if (!cells?.length) return
|
|
15910
|
+
if (!cells?.length) return;
|
|
15893
15911
|
const [u, v] = planeAxes(p.thin);
|
|
15894
15912
|
const role = p.spec.structure?.role;
|
|
15895
15913
|
const up = rotateVec(p.q, [0, 0, 0].map((_, k) => k === v ? 1 : 0));
|
|
15896
15914
|
const upright = Math.abs(up[1]) > 0.7 ? v : Math.abs(rotateVec(p.q, [0, 0, 0].map((_, k) => k === u ? 1 : 0))[1]) > 0.7 ? u : -1;
|
|
15897
15915
|
const along = (role === "wall" || role === "partition" || role === "column") && upright >= 0 ? upright : p.dims[u] >= p.dims[v] ? u : v;
|
|
15898
15916
|
const across2 = along === u ? v : u;
|
|
15899
|
-
|
|
15917
|
+
const lying = along !== upright || upright < 0;
|
|
15900
15918
|
for (const c of cells) {
|
|
15919
|
+
if (lying && borne?.(c.center, along)) continue;
|
|
15901
15920
|
const spans = [];
|
|
15902
15921
|
for (const d of cells) if (Math.abs(d.center[along] - c.center[along]) < d.size[along] / 2 + 1e-6) spans.push([d.center[across2] - d.size[across2] / 2, d.center[across2] + d.size[across2] / 2]);
|
|
15903
15922
|
spans.sort((a, b) => a[0] - b[0]);
|
|
@@ -15907,9 +15926,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15907
15926
|
gone += b - Math.max(a, end);
|
|
15908
15927
|
end = b;
|
|
15909
15928
|
}
|
|
15910
|
-
|
|
15929
|
+
visit(c, along, Math.min(1, gone / Math.max(p.dims[across2], 1e-6)));
|
|
15911
15930
|
}
|
|
15912
|
-
return Math.min(1, worst);
|
|
15913
15931
|
};
|
|
15914
15932
|
var isLost = (p) => p.st.status === "broken" || p.st.status === "melted" || p.st.status === "ashes";
|
|
15915
15933
|
var clone = (v) => structuredClone(v);
|
|
@@ -16220,6 +16238,26 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16220
16238
|
byTouching.set(support, { version: poseVersion, box: box4 });
|
|
16221
16239
|
return box4;
|
|
16222
16240
|
};
|
|
16241
|
+
const throughOf = (p) => {
|
|
16242
|
+
const load = p.st.load ?? 0;
|
|
16243
|
+
if (load <= 0) return void 0;
|
|
16244
|
+
const above = Math.max(0, load - p.st.mass);
|
|
16245
|
+
const up = rotateVec(p.q, [0, 1, 0]);
|
|
16246
|
+
return (local, along) => {
|
|
16247
|
+
const axis = [0, 0, 0];
|
|
16248
|
+
axis[along] = 1;
|
|
16249
|
+
const sign2 = Math.sign(rotateVec(p.q, axis)[1]);
|
|
16250
|
+
if (Math.abs(up[1]) < 0.7 && Math.abs(rotateVec(p.q, axis)[1]) < 0.7) return 1;
|
|
16251
|
+
const half = p.dims[along] / 2;
|
|
16252
|
+
const share = clamp2((half - sign2 * local[along]) / Math.max(p.dims[along], 1e-6), 0, 1);
|
|
16253
|
+
return (above + p.st.mass * share) / load;
|
|
16254
|
+
};
|
|
16255
|
+
};
|
|
16256
|
+
const borneOn = (p, supports) => {
|
|
16257
|
+
if (supports.length === 0) return void 0;
|
|
16258
|
+
const boxes = supports.map((support) => contactBox(p, support));
|
|
16259
|
+
return (local, along) => boxes.some(([lo, hi]) => local[along] >= lo[along] - SUPPORT_TOLERANCE && local[along] <= hi[along] + SUPPORT_TOLERANCE);
|
|
16260
|
+
};
|
|
16223
16261
|
const measureContact = (p, support) => {
|
|
16224
16262
|
const A = aabbOf(p.spec.shape, p.pos, p.q), B = aabbOf(support.spec.shape, support.pos, support.q);
|
|
16225
16263
|
const lo = [0, 0, 0], hi = [0, 0, 0];
|
|
@@ -16427,7 +16465,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16427
16465
|
o.unsup[i] = o.anyAnchor && !isLost(p) && !p.orphan;
|
|
16428
16466
|
continue;
|
|
16429
16467
|
}
|
|
16430
|
-
p.st.stress = p.st.load * structureSafety / (p.cap * capacityScale(p));
|
|
16468
|
+
p.st.stress = p.st.load * structureSafety / (p.cap * capacityScale(p, borneOn(p, (lowerOf.get(i) ?? []).map((k) => parts[k])), throughOf(p)));
|
|
16431
16469
|
if (p.bend) {
|
|
16432
16470
|
p.bendLoad = p.st.mass + bending[i];
|
|
16433
16471
|
const bent = restFlexure(o, p, lowerOf.get(i) ?? []);
|
|
@@ -17517,6 +17555,27 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17517
17555
|
debris(o, p, p.mat.breakDebris, center, [0, -1, 0], 6, 1, src);
|
|
17518
17556
|
return loose.length;
|
|
17519
17557
|
};
|
|
17558
|
+
const giveAtCut = (o, p, src) => {
|
|
17559
|
+
if (!p.spec.reinforcement || !p.spec.units || !p.st.chipped?.length || sectionLoss(p) <= 0) return false;
|
|
17560
|
+
const opened = [];
|
|
17561
|
+
for (const j of o.byPart.get(p.spec.id) ?? []) {
|
|
17562
|
+
if (j.st.open) continue;
|
|
17563
|
+
const onIt = j.bears === "a_on_b" && j.spec.b === p.spec.id || j.bears === "b_on_a" && j.spec.a === p.spec.id;
|
|
17564
|
+
if (!onIt) continue;
|
|
17565
|
+
j.st.open = true;
|
|
17566
|
+
j.st.openedBy = "break";
|
|
17567
|
+
opened.push(j);
|
|
17568
|
+
}
|
|
17569
|
+
if (opened.length === 0) return false;
|
|
17570
|
+
p.st.hp = Math.max(p.st.hp, p.st.maxHp * GIVE_AT_CUT_HP);
|
|
17571
|
+
markDamaged(p);
|
|
17572
|
+
solveStructure(o);
|
|
17573
|
+
recomputeGroups(o);
|
|
17574
|
+
detachEvents(o, opened, "break", src);
|
|
17575
|
+
exposeRebar(o, p, src);
|
|
17576
|
+
collapseCheck(o, src);
|
|
17577
|
+
return true;
|
|
17578
|
+
};
|
|
17520
17579
|
const stripPart = (o, p, reinforcement, src) => {
|
|
17521
17580
|
const bars = rebarBars(p.dims, p.thin, reinforcement.spacing);
|
|
17522
17581
|
p.st.stripped = true;
|
|
@@ -17574,6 +17633,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17574
17633
|
hingeDrop(o, p, src);
|
|
17575
17634
|
return;
|
|
17576
17635
|
}
|
|
17636
|
+
if (!force && giveAtCut(o, p, src)) return;
|
|
17577
17637
|
const ex = p.spec.explodes;
|
|
17578
17638
|
const style = force ?? (p.snap ? "snap" : p.mat.fracture === "none" ? "snap" : p.mat.fracture);
|
|
17579
17639
|
const { c, q } = partXf(o, p);
|
|
@@ -17920,7 +17980,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17920
17980
|
const dx = local[0] - p.pos[0];
|
|
17921
17981
|
const dy = local[1] - p.pos[1];
|
|
17922
17982
|
const dz = local[2] - p.pos[2];
|
|
17923
|
-
if (dx * dx + dy * dy + dz * dz
|
|
17983
|
+
if (dx * dx + dy * dy + dz * dz >= reach * reach) continue;
|
|
17984
|
+
if (p.spec.anchored && p.spec.structure?.role === "foundation" && distToPart(o, p, point) > BURIED_BLAST_REACH) continue;
|
|
17985
|
+
near.push(p);
|
|
17924
17986
|
}
|
|
17925
17987
|
blastProbe.partsTested += o.parts.length;
|
|
17926
17988
|
blastProbe.partsNear += near.length;
|
|
@@ -21120,7 +21182,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21120
21182
|
}
|
|
21121
21183
|
var towerLocales = { en: { labels: en_default.labels }, "pt-BR": { labels: pt_BR_default.labels } };
|
|
21122
21184
|
|
|
21123
|
-
// ../game-floorplan-three/dist/chunk-
|
|
21185
|
+
// ../game-floorplan-three/dist/chunk-PJ4WEP6U.js
|
|
21124
21186
|
var __defProp2 = Object.defineProperty;
|
|
21125
21187
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
21126
21188
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -24019,8 +24081,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24019
24081
|
const defined = { electricalStructure, pipe2 };
|
|
24020
24082
|
Object.assign(K, defined);
|
|
24021
24083
|
}
|
|
24084
|
+
var BASEBOARD_TILES = { length: 0.6, joint: 3e-3, material: "ceramic", density: 2300 };
|
|
24085
|
+
var SIDEWALK_SLABS = { length: 1.2, joint: 0.01, material: "concrete", density: 2400 };
|
|
24022
24086
|
function installHouseBaseboard(K, shared2) {
|
|
24023
|
-
const { Y0, bx, cursor, sideOf } = K;
|
|
24087
|
+
const { Y0, bx, cursor, pieceRecord, sideOf } = K;
|
|
24024
24088
|
const sh = (...a) => K.sh(...a);
|
|
24025
24089
|
function baseboardAndSidewalk() {
|
|
24026
24090
|
const R = shared2.ctx.r, W = 0.6, t = 0.012, ht = 0.35, color2 = sh(shared2.ctx.colors.facade != null ? shared2.ctx.colors.facade : 14209216, 0.62), y0 = Y0(0), cal = 13947078;
|
|
@@ -24042,15 +24106,29 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24042
24106
|
};
|
|
24043
24107
|
for (const A of ws) for (const [side, sd] of [[A.w.sides[0], -1], [A.w.sides[1], 1]]) {
|
|
24044
24108
|
if (!sideOf(side, false).exterior) continue;
|
|
24045
|
-
const strip = (k, y1, y2, o0, o1, mat, c,
|
|
24109
|
+
const strip = (k, y1, y2, o0, o1, mat, c, piece2, laid = BASEBOARD_TILES) => {
|
|
24046
24110
|
const ea = junction(A, A.a, sd) > 0 ? A.th / 2 + k : junction(A, A.a, sd) < 0 ? -A.th / 2 : 0, eb = junction(A, A.b, sd) > 0 ? A.th / 2 + k : junction(A, A.b, sd) < 0 ? -A.th / 2 : 0;
|
|
24047
24111
|
const s0 = A.a - ea, s1 = A.b + eb, f0 = A.L + sd * (A.th / 2 + o0), f1 = A.L + sd * (A.th / 2 + o1), lo = Math.min(f0, f1), hi = Math.max(f0, f1);
|
|
24048
24112
|
if (s1 - s0 < 1e-3) return;
|
|
24049
|
-
|
|
24050
|
-
|
|
24113
|
+
const box4 = (a, b) => {
|
|
24114
|
+
if (A.au) bx(mat, a, y1, lo, b, y2, hi, c);
|
|
24115
|
+
else bx(mat, lo, y1, a, hi, y2, b, c);
|
|
24116
|
+
};
|
|
24117
|
+
const tag = laid === BASEBOARD_TILES ? "baseboard" : "sidewalk";
|
|
24118
|
+
const tile = (id, a, b) => {
|
|
24119
|
+
cursor.pc = pieceRecord(id, laid.material, null, { floor: 0, mass: Math.round((b - a) * (y2 - y1) * (hi - lo) * laid.density * 100) / 100, tags: [tag] });
|
|
24120
|
+
box4(a, b);
|
|
24121
|
+
};
|
|
24122
|
+
if (!piece2) box4(s0, s1);
|
|
24123
|
+
else if (shared2.ctx.baseboardBand) tile(piece2, s0, s1);
|
|
24124
|
+
else {
|
|
24125
|
+
const n = Math.max(1, Math.round((s1 - s0) / laid.length)), w = (s1 - s0) / n, j = laid.joint / 2;
|
|
24126
|
+
for (let i = 0; i < n; i++) tile(`${piece2}:${i}`, s0 + i * w + (i > 0 ? j : 0), s0 + (i + 1) * w - (i < n - 1 ? j : 0));
|
|
24127
|
+
}
|
|
24128
|
+
cursor.pc = null;
|
|
24051
24129
|
};
|
|
24052
|
-
strip(t, y0, y0 + ht, 0, t, "plaster", color2);
|
|
24053
|
-
strip(W, y0, y0 + 0.045, 0, W, "sidewalk", cal);
|
|
24130
|
+
strip(t, y0, y0 + ht, 0, t, "plaster", color2, A.w.id ? `baseboard:${A.w.id}:${sd < 0 ? 0 : 1}` : void 0);
|
|
24131
|
+
strip(W, y0, y0 + 0.045, 0, W, "sidewalk", cal, A.w.id ? `sidewalk:${A.w.id}:${sd < 0 ? 0 : 1}` : void 0, SIDEWALK_SLABS);
|
|
24054
24132
|
}
|
|
24055
24133
|
}
|
|
24056
24134
|
const defined = { baseboardAndSidewalk };
|
|
@@ -27383,7 +27461,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27383
27461
|
l.push(it);
|
|
27384
27462
|
};
|
|
27385
27463
|
root.updateMatrixWorld(true);
|
|
27386
|
-
root.traverse((
|
|
27464
|
+
root.traverse((o0) => {
|
|
27465
|
+
const o = o0;
|
|
27387
27466
|
if (o.isMesh && o.userData.ranges) {
|
|
27388
27467
|
const nv = o.geometry.attributes.position.count;
|
|
27389
27468
|
for (const f of o.userData.ranges) add(f.id, { mesh: o, v0: f.v0, v1: f.v1, i0: f.i0, i1: f.i1, whole: f.v0 === 0 && f.v1 === nv });
|
|
@@ -27419,7 +27498,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27419
27498
|
if (!b) continue;
|
|
27420
27499
|
const vol = Math.max(1e-6, (b[3] - b[0]) * (b[4] - b[1]) * (b[5] - b[2]));
|
|
27421
27500
|
const p = { id, role: "none", material: pc.mat, aabb: [b[0], b[2], b[3], b[5]], y0: b[1], y1: b[4], floor: pc.floor != null ? pc.floor : floorAtY(b[1] + 0.1), mass: pc.mass != null ? pc.mass : Math.max(0.5, vol * (DENSITY[pc.mat] || 800) * (pc.fill != null ? pc.fill : 0.15)), meshes: meshes.get(id).length, extra: true };
|
|
27422
|
-
for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill"]) if (pc[k] != null) p[k] = pc[k];
|
|
27501
|
+
for (const k of ["contains", "explodes", "tags", "form", "thickness", "fill", "units"]) if (pc[k] != null) p[k] = pc[k];
|
|
27423
27502
|
parts.push(p);
|
|
27424
27503
|
byId.set(id, p);
|
|
27425
27504
|
}
|
|
@@ -27428,7 +27507,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27428
27507
|
return cx >= q.aabb[0] - m && cx <= q.aabb[2] + m && cz >= q.aabb[1] - m && cz <= q.aabb[3] + m && cy >= q.y0 - m && cy <= q.y1 + m;
|
|
27429
27508
|
};
|
|
27430
27509
|
for (const p of parts.slice(base)) {
|
|
27431
|
-
if (
|
|
27510
|
+
if (/^sidewalk:/.test(p.id)) {
|
|
27511
|
+
supports.push({ part: p.id, on: "ground", joint: "mortar", extra: true });
|
|
27512
|
+
continue;
|
|
27513
|
+
}
|
|
27514
|
+
if (!/^(window|window_pane|door|jamb|pipe|water_tank|baseboard)/.test(p.id)) continue;
|
|
27432
27515
|
const target = /^water_tank/.test(p.id) ? ["slab"] : ["wall", "partition"];
|
|
27433
27516
|
let m = null, md = 1e9;
|
|
27434
27517
|
for (const q of parts.slice(0, base)) {
|
|
@@ -27439,7 +27522,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27439
27522
|
m = q;
|
|
27440
27523
|
}
|
|
27441
27524
|
}
|
|
27442
|
-
if (m) supports.push({ part: p.id, on: m.id, joint: /^(window|jamb)/.test(p.id) ? "glue" : "clip", bears: false, extra: true });
|
|
27525
|
+
if (m) supports.push({ part: p.id, on: m.id, joint: /^(window|jamb|baseboard)/.test(p.id) ? "glue" : "clip", bears: false, extra: true });
|
|
27443
27526
|
}
|
|
27444
27527
|
const specParts = parts.slice(), specSupports = supports.slice();
|
|
27445
27528
|
if (view.panels.length) {
|
|
@@ -27876,7 +27959,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27876
27959
|
return { center: local(chip.center), along: a, up: u };
|
|
27877
27960
|
}
|
|
27878
27961
|
function newView(hostId) {
|
|
27879
|
-
const items = structure.meshesOf(hostId).filter((it) => it.mesh);
|
|
27962
|
+
const items = structure.meshesOf(hostId).filter((it) => !!it.mesh);
|
|
27880
27963
|
if (!items.length) return null;
|
|
27881
27964
|
const parts = [hostId, ...riders(hostId)].filter((id) => structure.byId.get(id) && specOf(id)?.units);
|
|
27882
27965
|
const mask = maskOf(hostId, parts), core = maskOf(hostId, parts);
|
|
@@ -28535,6 +28618,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28535
28618
|
cursor.separate = opts.pieces === "meshes";
|
|
28536
28619
|
cursor.pc = null;
|
|
28537
28620
|
shared2.ctx.showPillars = opts.pillars !== "hidden";
|
|
28621
|
+
shared2.ctx.baseboardBand = opts.baseboard === "band";
|
|
28538
28622
|
shared2.ctx.apartment = r.template === "apartment_modern";
|
|
28539
28623
|
shared2.ctx.pa = Math.max(3, Math.min(20, pr.floors != null ? pr.floors : 5));
|
|
28540
28624
|
shared2.ctx.pf = Math.max(1, Math.min(shared2.ctx.pa, pr.floor != null ? pr.floor : 3));
|