@adatechnology/game-items-three 0.11.6 → 0.11.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 +152 -35
- package/dist/index.global.js.map +1 -1
- package/package.json +9 -9
package/dist/index.global.js
CHANGED
|
@@ -573,12 +573,12 @@ var GameItemsThree = (() => {
|
|
|
573
573
|
}
|
|
574
574
|
return pack("TorusGeometry", parameters, { vertices, normals, uvs, indices, groups: [] });
|
|
575
575
|
}
|
|
576
|
-
function difference(size,
|
|
576
|
+
function difference(size, subtract2) {
|
|
577
577
|
const [w, h, d] = size;
|
|
578
578
|
const hw = w / 2;
|
|
579
579
|
const hh = h / 2;
|
|
580
580
|
const hd = d / 2;
|
|
581
|
-
const holes =
|
|
581
|
+
const holes = subtract2.map((hole) => ({ x0: Math.max(-hw, Math.min(hole.min[0], hole.max[0])), x1: Math.min(hw, Math.max(hole.min[0], hole.max[0])), y0: Math.max(-hh, Math.min(hole.min[1], hole.max[1])), y1: Math.min(hh, Math.max(hole.min[1], hole.max[1])) })).filter((hole) => hole.x1 > hole.x0 && hole.y1 > hole.y0);
|
|
582
582
|
const cuts = (lo, hi, values) => [.../* @__PURE__ */ new Set([lo, hi, ...values.filter((v) => v > lo && v < hi)])].sort((a, b) => a - b);
|
|
583
583
|
const xs = cuts(-hw, hw, holes.flatMap((hole) => [hole.x0, hole.x1]));
|
|
584
584
|
const ys = cuts(-hh, hh, holes.flatMap((hole) => [hole.y0, hole.y1]));
|
|
@@ -15222,6 +15222,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15222
15222
|
heatCapacity: 1.5,
|
|
15223
15223
|
thermalShockC: 200
|
|
15224
15224
|
},
|
|
15225
|
+
visual: {
|
|
15226
|
+
innerColor: 13148794
|
|
15227
|
+
},
|
|
15225
15228
|
tags: [
|
|
15226
15229
|
"ceramic",
|
|
15227
15230
|
"brittle"
|
|
@@ -15519,7 +15522,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
15519
15522
|
},
|
|
15520
15523
|
visual: {
|
|
15521
15524
|
charColor: 855309,
|
|
15522
|
-
innerColor:
|
|
15525
|
+
innerColor: 14271631
|
|
15523
15526
|
},
|
|
15524
15527
|
tags: [
|
|
15525
15528
|
"fabric",
|
|
@@ -16348,6 +16351,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16348
16351
|
return { ...base2, mesh: { vertices, indices: piece3.mesh.indices } };
|
|
16349
16352
|
};
|
|
16350
16353
|
var THIN_SHEET_DISHING = 5e-3;
|
|
16354
|
+
var TEAR_CALIBERS = 1.1;
|
|
16351
16355
|
var SHELL_YIELD_SHARE = 0.5;
|
|
16352
16356
|
var STEEL_YIELD_MPA = 250;
|
|
16353
16357
|
var SWEEP_BACK = 0.01;
|
|
@@ -16440,7 +16444,16 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16440
16444
|
var MAX_PLASTER_FLAKES = 24;
|
|
16441
16445
|
var CHIP_ENERGY = 200;
|
|
16442
16446
|
var CHIP_SPLASH = 0.5;
|
|
16447
|
+
var SHARD_CUT = [0.3, 0.7];
|
|
16448
|
+
var MORTAR_JOINT = 0.01;
|
|
16449
|
+
var MIN_UNIT_SHARE = 0.8;
|
|
16450
|
+
var CHIP_DRIVE = 0.6;
|
|
16451
|
+
var BLAST_DRIVE = 2.5;
|
|
16443
16452
|
var CRATER_SPENT = 0.6;
|
|
16453
|
+
var BONDING_JOINTS = /* @__PURE__ */ new Set(["glue", "mortar", "nail", "screw"]);
|
|
16454
|
+
var PLATE_ASPECT = 0.25;
|
|
16455
|
+
var PLATE_BACK_SHARE = 0.5;
|
|
16456
|
+
var BONDED_REMNANT = 0.25;
|
|
16444
16457
|
var EDGE_REACH = 1.5;
|
|
16445
16458
|
var BAR_BOW = 0.08;
|
|
16446
16459
|
var BULLET_JOINT_SPAN = 0.3;
|
|
@@ -18949,6 +18962,34 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18949
18962
|
};
|
|
18950
18963
|
const isTrim = (p) => (p.spec.structure?.role ?? "none") === "none";
|
|
18951
18964
|
const fixesTrim = (o, j) => isTrim(o.parts[j.ia]) !== isTrim(o.parts[j.ib]);
|
|
18965
|
+
const bondedPlate = (o, p) => isPlateTrim(p) && (o.byPart.get(p.spec.id) ?? []).some((j) => !j.st.open && bondsPlate(o, j));
|
|
18966
|
+
const isPlateTrim = (p) => {
|
|
18967
|
+
if (!isTrim(p) || p.spec.units || p.spec.reinforcement || p.mat.ductility >= 0.5 || p.mat.fracture === "none" || p.mat.tags?.includes("glass") === true || p.spec.shape.kind !== "box") return false;
|
|
18968
|
+
const [u, v] = planeAxes(p.thin);
|
|
18969
|
+
return p.dims[p.thin] <= PLATE_ASPECT * Math.min(p.dims[u], p.dims[v]) && gridOf(p).length >= 2;
|
|
18970
|
+
};
|
|
18971
|
+
const bondsPlate = (o, j) => {
|
|
18972
|
+
if (!BONDING_JOINTS.has(j.spec.kind)) return false;
|
|
18973
|
+
const a = o.parts[j.ia], b = o.parts[j.ib];
|
|
18974
|
+
return isPlateTrim(a) && !isTrim(b) && backOn(a, b) || isPlateTrim(b) && !isTrim(a) && backOn(b, a);
|
|
18975
|
+
};
|
|
18976
|
+
const backOn = (plate, carrier) => {
|
|
18977
|
+
const A = aabbOf(plate.spec.shape, plate.spec.position, plate.q);
|
|
18978
|
+
const B = aabbOf(carrier.spec.shape, carrier.spec.position, carrier.q);
|
|
18979
|
+
const face = (k) => (Math.min(A.max[k], B.max[k]) - Math.max(A.min[k], B.min[k])) / Math.max(A.max[k] - A.min[k], 1e-9);
|
|
18980
|
+
const sides = [0, 1, 2].sort((x, y) => A.max[y] - A.min[y] - (A.max[x] - A.min[x])).slice(0, 2);
|
|
18981
|
+
return sides.every((k) => face(k) >= PLATE_BACK_SHARE);
|
|
18982
|
+
};
|
|
18983
|
+
const bondedShareLeft = (p) => {
|
|
18984
|
+
const whole2 = p.st.mass + (p.rt.removed ?? 0);
|
|
18985
|
+
return whole2 > 0 ? p.st.mass / whole2 : 0;
|
|
18986
|
+
};
|
|
18987
|
+
const settleBonded = (o, p, origin, dir, src) => {
|
|
18988
|
+
if (isLost(p)) return;
|
|
18989
|
+
const share = bondedShareLeft(p);
|
|
18990
|
+
p.st.hp = Math.max(1, Math.min(p.st.hp, p.st.maxHp * share));
|
|
18991
|
+
if (share < BONDED_REMNANT) failPart(o, p, origin, dir, 0, 4, src);
|
|
18992
|
+
};
|
|
18952
18993
|
const holdsEmbedded = (o, j) => {
|
|
18953
18994
|
const a = o.parts[j.ia], b = o.parts[j.ib];
|
|
18954
18995
|
return a.embedded === true && a.spec.hostedIn === b.spec.id && a.st.exposed !== true || b.embedded === true && b.spec.hostedIn === a.spec.id && b.st.exposed !== true;
|
|
@@ -18966,6 +19007,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18966
19007
|
if (j.st.open) continue;
|
|
18967
19008
|
if (j.spec.kind === "rebar" && (isReinforced(o.parts[j.ia].spec) || isReinforced(o.parts[j.ib].spec))) continue;
|
|
18968
19009
|
if (holdsEmbedded(o, j)) continue;
|
|
19010
|
+
if (bondsPlate(o, j)) continue;
|
|
18969
19011
|
if (near && jointReach(o, j, near) > Math.max(radius, jointReachLimit(o, j))) continue;
|
|
18970
19012
|
if (blast && fixesTrim(o, j) && jointReach(o, j, blast.point) > Math.max(blast.reach, jointReachLimit(o, j))) continue;
|
|
18971
19013
|
j.st.hp -= span === void 0 ? amount : Math.min(amount, j.st.maxHp) * Math.min(1, span / Math.max(jointLength(o, j), 1e-6));
|
|
@@ -19005,19 +19047,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19005
19047
|
emit({ ...base2(o, src), type: "spall", part: p.spec.id, layer: torn.layer.index, point: centre, area: Math.PI * r * r, ...spallNormal(o, p, s[1]) });
|
|
19006
19048
|
debris(o, p, torn.layer.mat.hitDebris, toWorld(o.st.position, o.st.rotation, lp), normal, 5, 2, src, torn.layer.mat.id);
|
|
19007
19049
|
};
|
|
19008
|
-
const spallOuter = (o, p, wp, face, normal, radius, src) => {
|
|
19050
|
+
const spallOuter = (o, p, wp, face, normal, radius, src, tearRadius = radius) => {
|
|
19009
19051
|
var _a;
|
|
19010
19052
|
if (p.layers.length === 0) return;
|
|
19011
19053
|
const lp = objLocal(o, wp);
|
|
19012
19054
|
const torn = tornPatchAt(p.layers, p.rt.spalls, face, lp, radius);
|
|
19013
|
-
if (torn) return widenTear(o, p, torn, lp, normal,
|
|
19055
|
+
if (torn) return widenTear(o, p, torn, lp, normal, tearRadius, src);
|
|
19014
19056
|
const layer = outerLayer(p.layers, p.rt.spalls, face, lp);
|
|
19015
19057
|
if (!layer) return;
|
|
19058
|
+
const patch = layer.mat.fracture === "tear" ? tearRadius : radius;
|
|
19016
19059
|
const spalls = (_a = p.rt).spalls ?? (_a.spalls = []);
|
|
19017
|
-
spalls.push([layer.index, face, lp[0], lp[1], lp[2],
|
|
19060
|
+
spalls.push([layer.index, face, lp[0], lp[1], lp[2], patch]);
|
|
19018
19061
|
if (spalls.length > MAX_SPALLS) spalls.shift();
|
|
19019
19062
|
markDamaged(p);
|
|
19020
|
-
emit({ ...base2(o, src), type: "spall", part: p.spec.id, layer: layer.index, point: wp, area: Math.PI *
|
|
19063
|
+
emit({ ...base2(o, src), type: "spall", part: p.spec.id, layer: layer.index, point: wp, area: Math.PI * patch * patch, ...spallNormal(o, p, face) });
|
|
19021
19064
|
debris(o, p, layer.mat.hitDebris, wp, normal, 5, 2, src, layer.mat.id);
|
|
19022
19065
|
setStage(o, p, 1, {}, src);
|
|
19023
19066
|
};
|
|
@@ -19057,7 +19100,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19057
19100
|
return first && first.size[u] > size[0] + 1e-6 ? [first.size[u], first.size[v]] : [Math.min(size[0], p.dims[u]), Math.min(size[1], p.dims[v])];
|
|
19058
19101
|
};
|
|
19059
19102
|
const FRAGMENT_SHAPE = { shatter: "shard", splinter: "splinter", tear: "scrap" };
|
|
19060
|
-
const
|
|
19103
|
+
const shardsOfCell = (cell, u, v) => {
|
|
19104
|
+
const own = createRng(seedOf2(cell.center[0], cell.center[1], cell.center[2]));
|
|
19105
|
+
const cu = SHARD_CUT[0] + (SHARD_CUT[1] - SHARD_CUT[0]) * own.next(), cv = SHARD_CUT[0] + (SHARD_CUT[1] - SHARD_CUT[0]) * own.next();
|
|
19106
|
+
const out = [];
|
|
19107
|
+
for (const [a0, a1] of [[0, cu], [cu, 1]]) for (const [b0, b1] of [[0, cv], [cv, 1]]) {
|
|
19108
|
+
const size = [cell.size[0], cell.size[1], cell.size[2]];
|
|
19109
|
+
const center = [cell.center[0], cell.center[1], cell.center[2]];
|
|
19110
|
+
size[u] = cell.size[u] * (a1 - a0);
|
|
19111
|
+
size[v] = cell.size[v] * (b1 - b0);
|
|
19112
|
+
center[u] = cell.center[u] - cell.size[u] / 2 + cell.size[u] * (a0 + a1) / 2;
|
|
19113
|
+
center[v] = cell.center[v] - cell.size[v] / 2 + cell.size[v] * (b0 + b1) / 2;
|
|
19114
|
+
out.push({ ...cell, center, size });
|
|
19115
|
+
}
|
|
19116
|
+
return out;
|
|
19117
|
+
};
|
|
19118
|
+
const cellFragments = (o, p, cells, hitW, dir, speed, mass, tag, inner = false, knownHoles, drive = CHIP_DRIVE) => {
|
|
19061
19119
|
const { c, q } = partXf(o, p);
|
|
19062
19120
|
const holes = knownHoles ?? (p.st.holes.length > 0 ? localHolesOf(p) : []);
|
|
19063
19121
|
const [u, v] = planeAxes(p.thin);
|
|
@@ -19065,19 +19123,22 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19065
19123
|
const total = cells.reduce((sum, cell) => sum + faceArea(cell), 0) || 1;
|
|
19066
19124
|
const shape = p.spec.units ? "chunk" : FRAGMENT_SHAPE[p.mat.fracture] ?? "chunk";
|
|
19067
19125
|
const laid = !!p.spec.units && p.spec.units.mortar !== p.spec.material;
|
|
19068
|
-
|
|
19126
|
+
const pieces = shape === "shard" && bondedPlate(o, p) ? cells.flatMap((cell) => shardsOfCell(cell, u, v)) : cells;
|
|
19127
|
+
return pieces.map((cell, i) => {
|
|
19069
19128
|
const cw = toWorld(c, q, cell.center);
|
|
19070
19129
|
const out = vec.normalize(vec.sub(cw, hitW), [0, 1, 0]);
|
|
19071
|
-
const dv = dir ? vec.normalize(vec.madd(out, dir,
|
|
19130
|
+
const dv = dir ? vec.normalize(vec.madd(out, dir, drive)) : out;
|
|
19072
19131
|
const k = speed * (0.6 + 0.8 * rnd());
|
|
19073
19132
|
const marks = marksInBox(cell.center, cell.size, void 0, holes);
|
|
19133
|
+
const size = [cell.size[0], cell.size[1], cell.size[2]];
|
|
19134
|
+
if (laid) for (const a of [u, v]) size[a] = Math.max(size[a] * MIN_UNIT_SHARE, size[a] - MORTAR_JOINT);
|
|
19074
19135
|
return {
|
|
19075
19136
|
id: `${p.spec.id}#${tag}${i}`,
|
|
19076
19137
|
part: p.spec.id,
|
|
19077
19138
|
material: p.spec.material,
|
|
19078
19139
|
shape,
|
|
19079
19140
|
center: cw,
|
|
19080
|
-
size
|
|
19141
|
+
size,
|
|
19081
19142
|
rotation: q,
|
|
19082
19143
|
velocity: [dv[0] * k, dv[1] * k + 0.5 * rnd(), dv[2] * k],
|
|
19083
19144
|
angularVelocity: bornSpin(cell.size, 8, rnd),
|
|
@@ -19328,7 +19389,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19328
19389
|
};
|
|
19329
19390
|
const chipUnits = (o, p, kind, wp, hitEnergy, dir, radius, src) => {
|
|
19330
19391
|
var _a, _b, _c;
|
|
19331
|
-
|
|
19392
|
+
const bonded = bondedPlate(o, p);
|
|
19393
|
+
if (!bonded && (!p.spec.units || !p.staged) || chipEnergy <= 0 || p.st.stripped || isLost(p) || (p.st.stage ?? 0) >= 2) return;
|
|
19332
19394
|
const rule = p.mat.hits?.[kind];
|
|
19333
19395
|
const perKg = rule?.unitJoules ?? chipEnergy;
|
|
19334
19396
|
const energy = hitEnergy - (rule?.floor ?? 0);
|
|
@@ -19402,6 +19464,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19402
19464
|
if (Object.values(worn).filter((w) => w === -1).length > wholeBefore) dropUnsupported(o, p, src);
|
|
19403
19465
|
if (p.spec.reinforcement) exposeRebar(o, p, src);
|
|
19404
19466
|
for (const cell of out) addBreach(o, p, toWorld(c, q, cell.center), cell.size[u] * cell.size[v], energy, dir, src);
|
|
19467
|
+
if (bonded) settleBonded(o, p, wp, dir, src);
|
|
19405
19468
|
if (p.structural && !isLost(p)) {
|
|
19406
19469
|
solveStructure(o);
|
|
19407
19470
|
collapseCheck(o, src);
|
|
@@ -19517,18 +19580,19 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19517
19580
|
if (p.structural) solveStructure(o);
|
|
19518
19581
|
};
|
|
19519
19582
|
const blastReachOf = (p, energy) => {
|
|
19520
|
-
const
|
|
19521
|
-
const resistance = Math.max(1, perKg * p.mat.density * p.thickness);
|
|
19583
|
+
const resistance = Math.max(1, (p.mat.hits?.blunt?.unitJoules ?? chipEnergy) * p.mat.density * p.thickness);
|
|
19522
19584
|
return BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3) * clamp2(Math.cbrt(BLAST_REFERENCE_RESISTANCE / resistance), 0.3, 2);
|
|
19523
19585
|
};
|
|
19524
|
-
const blastUnits = (o, p, wp, energy, dist, src) => {
|
|
19586
|
+
const blastUnits = (o, p, wp, energy, dist, src, from) => {
|
|
19525
19587
|
var _a;
|
|
19526
|
-
if (!p.staged || p.st.stripped || isLost(p) || chipEnergy <= 0) return false;
|
|
19588
|
+
if (!p.staged && !bondedPlate(o, p) || p.st.stripped || isLost(p) || chipEnergy <= 0) return false;
|
|
19527
19589
|
const reach2 = blastReachOf(p, energy);
|
|
19528
19590
|
if (dist >= reach2) return false;
|
|
19529
|
-
const radius = Math.sqrt(reach2 * reach2 - dist * dist);
|
|
19530
19591
|
const [u, v] = planeAxes(p.thin);
|
|
19531
|
-
const
|
|
19592
|
+
const charge = from ? toLocal(p.pos, p.q, objLocal(o, from)) : null;
|
|
19593
|
+
const lp = charge ?? toLocal(p.pos, p.q, objLocal(o, wp));
|
|
19594
|
+
const off = charge ? Math.max(0, Math.abs(charge[p.thin]) - p.dims[p.thin] / 2) : dist;
|
|
19595
|
+
const radius = Math.sqrt(Math.max(0, reach2 * reach2 - off * off));
|
|
19532
19596
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
19533
19597
|
const grid = gridOf(p);
|
|
19534
19598
|
const worn = (_a = p.rt).chips ?? (_a.chips = {});
|
|
@@ -19552,7 +19616,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19552
19616
|
}
|
|
19553
19617
|
}
|
|
19554
19618
|
if (out.length === 0) return false;
|
|
19555
|
-
return knockOutUnits(o, p, wp, energy, out, src);
|
|
19619
|
+
return knockOutUnits(o, p, wp, energy, out, src, from ? awayFromCharge(o, p, from) : void 0, BLAST_DRIVE);
|
|
19620
|
+
};
|
|
19621
|
+
const awayFromCharge = (o, p, charge) => {
|
|
19622
|
+
const axis = [0, 0, 0];
|
|
19623
|
+
axis[p.thin] = toLocal(p.pos, p.q, objLocal(o, charge))[p.thin] >= 0 ? -1 : 1;
|
|
19624
|
+
return rotateVec(partXf(o, p).q, axis);
|
|
19556
19625
|
};
|
|
19557
19626
|
const wedgedUnder = (o, p, loose) => {
|
|
19558
19627
|
if (loose.length === 0) return loose;
|
|
@@ -19644,7 +19713,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19644
19713
|
for (const i of out) worn[i] = -1;
|
|
19645
19714
|
return knockOutUnits(o, p, point, energy, out, src);
|
|
19646
19715
|
};
|
|
19647
|
-
const knockOutUnits = (o, p, wp, energy, out, src, d) => {
|
|
19716
|
+
const knockOutUnits = (o, p, wp, energy, out, src, d, drive = CHIP_DRIVE) => {
|
|
19648
19717
|
var _a, _b;
|
|
19649
19718
|
const [u, v] = planeAxes(p.thin);
|
|
19650
19719
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
@@ -19654,7 +19723,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19654
19723
|
out = out.filter((i) => !castHere.has(i));
|
|
19655
19724
|
if (out.length === 0) return false;
|
|
19656
19725
|
for (const i of out) worn[i] = -1;
|
|
19657
|
-
const
|
|
19726
|
+
const bonded = bondedPlate(o, p);
|
|
19727
|
+
const cast = p.spec.units?.mortar === p.spec.material || bonded;
|
|
19658
19728
|
const loose = cast ? [] : wedgedUnder(o, p, 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))).filter((i) => !castHere.has(i));
|
|
19659
19729
|
for (const i of loose) worn[i] = -1;
|
|
19660
19730
|
const blown = out.map((i) => grid[i]), fallen = loose.map((i) => grid[i]);
|
|
@@ -19667,7 +19737,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19667
19737
|
const tag = `x${chipped.length}_`;
|
|
19668
19738
|
const holes = localHolesOf(p);
|
|
19669
19739
|
const fragments = [
|
|
19670
|
-
...cellFragments(o, p, clumpUnits(blown, p.thin, unitSpan(p), unitClumps), wp, null, speed, blownMass, tag, true, holes),
|
|
19740
|
+
...cellFragments(o, p, clumpUnits(blown, p.thin, unitSpan(p), unitClumps), wp, d ?? null, speed, blownMass, tag, true, holes, drive),
|
|
19671
19741
|
...fallen.length > 0 ? cellFragments(o, p, clumpUnits(fallen, p.thin, unitSpan(p), fallenClumps), wp, null, 0.3, fallenMass, `${tag}f`, true, holes) : [],
|
|
19672
19742
|
...plasterFlakes(o, p, blown, wp, speed, `${tag}p`)
|
|
19673
19743
|
];
|
|
@@ -19692,6 +19762,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19692
19762
|
debris(o, p, p.mat.breakDebris, center, vec.normalize(vec.sub(center, wp), [0, 1, 0]), 14, 3, src);
|
|
19693
19763
|
const cut = wornLocally(p) && cutBandsGone(o, p, cells, d ?? vec.normalize(vec.sub(partXf(o, p).c, wp), [1, 0, 0]), src);
|
|
19694
19764
|
if (p.spec.reinforcement && !cut) exposeRebar(o, p, src);
|
|
19765
|
+
if (bonded) settleBonded(o, p, wp, d ?? null, src);
|
|
19695
19766
|
if (p.structural && !isLost(p)) {
|
|
19696
19767
|
solveStructure(o);
|
|
19697
19768
|
collapseCheck(o, src);
|
|
@@ -20034,6 +20105,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20034
20105
|
if (chained && p.st.hp <= 0 && p.rt.chainDue === void 0) p.st.hp = Math.min(prev, 1);
|
|
20035
20106
|
if (p.st.hp <= 0 && p.mat.fracture === "none" && !p.spec.explodes) p.st.hp = Math.min(prev, 1);
|
|
20036
20107
|
if (p.st.hp <= 0 && type === "ballistic" && wornLocally(p)) p.st.hp = Math.min(prev, 1);
|
|
20108
|
+
if (p.st.hp <= 0 && type !== "fire" && type !== "heat" && bondedPlate(o, p)) p.st.hp = Math.min(prev, 1);
|
|
20037
20109
|
const done = prev - p.st.hp;
|
|
20038
20110
|
if (done > 0) emit({ ...base2(o, src), type: "damage", part: p.spec.id, amount: done, hp: Math.max(0, p.st.hp), damageType: type });
|
|
20039
20111
|
if (p.st.hp <= 0) failPart(o, p, origin, dir, fragEnergy * weight, cap, src);
|
|
@@ -20142,7 +20214,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20142
20214
|
const dmg2 = applyDamage(o, p, E * DMG_PER_J * scale * 0.2, "ballistic", entry2, d, E * 0.1, 12, src, weight);
|
|
20143
20215
|
return { penetrated: false, exitEnergy: 0, damage: dmg2 };
|
|
20144
20216
|
}
|
|
20145
|
-
if (p.layers.length > 0) spallOuter(o, p, entry2, face, n, Math.max(0.03, caliber / 1e3 * 4), src);
|
|
20217
|
+
if (p.layers.length > 0) spallOuter(o, p, entry2, face, n, Math.max(0.03, caliber / 1e3 * 4), src, caliber / 1e3 * TEAR_CALIBERS);
|
|
20146
20218
|
else if (mat.hits?.ballistic?.crater) crater(o, p, entry2, n, clamp2(0.02 + Math.sqrt(E) * 15e-4, 0.02, 0.15), src);
|
|
20147
20219
|
const brittle = mat.ductility < 0.3;
|
|
20148
20220
|
const ratio = Ep / Math.max(thr, 1e-6);
|
|
@@ -20155,7 +20227,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20155
20227
|
exitPoint = vec.madd(entry2, d, exitDist);
|
|
20156
20228
|
const hole = addHole(o, p, entry2, n, holeWidth, true, exitPoint, src);
|
|
20157
20229
|
shellShare = wearsShell(p, hole.diameter * 2);
|
|
20158
|
-
if (p.layers.length > 0) spallOuter(o, p, exitPoint, -face, vec.scale(n, -1), Math.max(0.03, caliber / 1e3 * 4), src);
|
|
20230
|
+
if (p.layers.length > 0) spallOuter(o, p, exitPoint, -face, vec.scale(n, -1), Math.max(0.03, caliber / 1e3 * 4), src, caliber / 1e3 * TEAR_CALIBERS);
|
|
20159
20231
|
addBreach(o, p, entry2, Math.PI * (hole.diameter / 2) * (hole.diameter / 2), E, d, src);
|
|
20160
20232
|
if (mat.ductility >= 0.5 && p.thickness <= THIN_SHEET_DISHING) addDent(o, p, entry2, n, Math.max(caliber * 3 / 1e3, 0.012), clamp2(E * 2e-5, 1e-3, 0.03), src);
|
|
20161
20233
|
if (brittle && mat.fracture === "shatter") addCrack(o, p, entry2, n, crackLen, src);
|
|
@@ -20327,13 +20399,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20327
20399
|
const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
|
|
20328
20400
|
const caged2 = Boolean(p.spec.reinforcement && p.spec.units);
|
|
20329
20401
|
const member = caged2 && (isMember(p.dims, p.spec.structure?.role) || dist > MEMBER_CUT_REACH * breachReach);
|
|
20330
|
-
const
|
|
20402
|
+
const bonded = bondedPlate(o, p);
|
|
20403
|
+
const dealt = bonded ? applyDamage(o, p, Math.min(amount, Math.max(0, p.st.hp - 1)), "explosive", null, null, Ein * 0.3, 40, src) : member ? 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);
|
|
20331
20404
|
res.damage += dealt;
|
|
20332
20405
|
if (p.bend && flexure.enabled) bendByBlast(o, p, point, energy, radius, reach2, src);
|
|
20333
20406
|
if (p.spec.units && p.spec.units.mortar !== p.spec.material) {
|
|
20334
20407
|
blastPanel(o, p, point, energy, src);
|
|
20335
|
-
if (!isLost(p)) blastUnits(o, p, wp, energy, dist, src);
|
|
20336
|
-
} else if (member) blastUnits(o, p, wp, energy, dist, src);
|
|
20408
|
+
if (!isLost(p)) blastUnits(o, p, wp, energy, dist, src, point);
|
|
20409
|
+
} else if (member || bonded) blastUnits(o, p, wp, energy, dist, src, point);
|
|
20337
20410
|
else if (dist <= breachReach) addBreach(o, p, wp, breachAreaOf(p, dealt, true), Ein, null, src);
|
|
20338
20411
|
return reach2;
|
|
20339
20412
|
};
|
|
@@ -21871,6 +21944,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21871
21944
|
}).events;
|
|
21872
21945
|
},
|
|
21873
21946
|
state: (id) => objects.get(id)?.st ?? impls.get(id)?.impl.state() ?? null,
|
|
21947
|
+
layers: (id, partId) => objects.get(id)?.byId.get(partId)?.spec.layers ?? [],
|
|
21874
21948
|
anchoredParts: (id) => objects.get(id)?.parts.filter((p) => p.anchored && !isLost(p)).map((p) => p.spec.id) ?? [],
|
|
21875
21949
|
fixedInPlace: (id) => {
|
|
21876
21950
|
const o = objects.get(id);
|
|
@@ -22422,7 +22496,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22422
22496
|
var MIN_PILLAR_AREA = 0.036;
|
|
22423
22497
|
var BEAM_DEPTH_RATIO = 10;
|
|
22424
22498
|
var PLASTER_PER_FACE = 0.015;
|
|
22425
|
-
var
|
|
22499
|
+
var MORTAR_JOINT2 = 0.01;
|
|
22426
22500
|
var SECTION_STEP = 0.05;
|
|
22427
22501
|
var ceilTo = (value, step) => Math.ceil(value / step - 1e-9) * step;
|
|
22428
22502
|
var round22 = (value) => Math.round(value * 100) / 100;
|
|
@@ -22436,7 +22510,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
22436
22510
|
function coursingOf(unitId, assemblyUnits) {
|
|
22437
22511
|
if (unitId !== void 0) {
|
|
22438
22512
|
const unit = getMasonryUnit(unitId);
|
|
22439
|
-
return { courseHeight: round22(unit.height +
|
|
22513
|
+
return { courseHeight: round22(unit.height + MORTAR_JOINT2), unitLength: round22(unit.length + MORTAR_JOINT2) };
|
|
22440
22514
|
}
|
|
22441
22515
|
return assemblyUnits ? { courseHeight: assemblyUnits.size[1], unitLength: assemblyUnits.size[0] } : void 0;
|
|
22442
22516
|
}
|
|
@@ -35743,7 +35817,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35743
35817
|
],
|
|
35744
35818
|
estimated: [
|
|
35745
35819
|
"parts"
|
|
35746
|
-
]
|
|
35820
|
+
],
|
|
35821
|
+
consumable: {
|
|
35822
|
+
form: "bar",
|
|
35823
|
+
unit: "g",
|
|
35824
|
+
amount: 100,
|
|
35825
|
+
dose: 1.5,
|
|
35826
|
+
emptyKg: 0
|
|
35827
|
+
}
|
|
35747
35828
|
},
|
|
35748
35829
|
{
|
|
35749
35830
|
id: "shampoo",
|
|
@@ -35761,7 +35842,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35761
35842
|
stack: 3,
|
|
35762
35843
|
shape: "bottle",
|
|
35763
35844
|
color: 4885200,
|
|
35764
|
-
rarity: "common"
|
|
35845
|
+
rarity: "common",
|
|
35846
|
+
consumable: {
|
|
35847
|
+
form: "liquid",
|
|
35848
|
+
unit: "ml",
|
|
35849
|
+
amount: 300,
|
|
35850
|
+
dose: 8,
|
|
35851
|
+
emptyKg: 0.044,
|
|
35852
|
+
density: 1.02
|
|
35853
|
+
}
|
|
35765
35854
|
},
|
|
35766
35855
|
{
|
|
35767
35856
|
id: "toothpaste",
|
|
@@ -35779,7 +35868,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
35779
35868
|
stack: 3,
|
|
35780
35869
|
shape: "tube",
|
|
35781
35870
|
color: 15790320,
|
|
35782
|
-
rarity: "common"
|
|
35871
|
+
rarity: "common",
|
|
35872
|
+
consumable: {
|
|
35873
|
+
form: "paste",
|
|
35874
|
+
unit: "g",
|
|
35875
|
+
amount: 90,
|
|
35876
|
+
dose: 1,
|
|
35877
|
+
emptyKg: 0.01
|
|
35878
|
+
}
|
|
35783
35879
|
},
|
|
35784
35880
|
{
|
|
35785
35881
|
id: "toothbrush",
|
|
@@ -47303,7 +47399,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
47303
47399
|
}
|
|
47304
47400
|
var residentialTower = residentialTowerTemplate();
|
|
47305
47401
|
|
|
47306
|
-
// ../game-floorplan-three/dist/chunk-
|
|
47402
|
+
// ../game-floorplan-three/dist/chunk-Y7TCDFDL.js
|
|
47307
47403
|
var __defProp3 = Object.defineProperty;
|
|
47308
47404
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
47309
47405
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -57015,6 +57111,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57015
57111
|
}
|
|
57016
57112
|
return [...groups.values()];
|
|
57017
57113
|
};
|
|
57114
|
+
function subtract(boxes, cuts) {
|
|
57115
|
+
let out = [...boxes];
|
|
57116
|
+
for (const k of cuts) {
|
|
57117
|
+
const next = [];
|
|
57118
|
+
for (const b of out) {
|
|
57119
|
+
if (k.a >= b.b - EPSILON22 || k.b <= b.a + EPSILON22 || k.y0 >= b.y1 - EPSILON22 || k.y1 <= b.y0 + EPSILON22) {
|
|
57120
|
+
next.push(b);
|
|
57121
|
+
continue;
|
|
57122
|
+
}
|
|
57123
|
+
const y0 = Math.max(b.y0, k.y0), y1 = Math.min(b.y1, k.y1);
|
|
57124
|
+
if (y0 - b.y0 > EPSILON22) next.push({ a: b.a, b: b.b, y0: b.y0, y1: y0 });
|
|
57125
|
+
if (b.y1 - y1 > EPSILON22) next.push({ a: b.a, b: b.b, y0: y1, y1: b.y1 });
|
|
57126
|
+
if (k.a - b.a > EPSILON22) next.push({ a: b.a, b: k.a, y0, y1 });
|
|
57127
|
+
if (b.b - k.b > EPSILON22) next.push({ a: k.b, b: b.b, y0, y1 });
|
|
57128
|
+
}
|
|
57129
|
+
out = next;
|
|
57130
|
+
}
|
|
57131
|
+
return out;
|
|
57132
|
+
}
|
|
57018
57133
|
function mergeSpans(spans, share = JOINT_SHARE) {
|
|
57019
57134
|
const runs = [];
|
|
57020
57135
|
const unitLengths = /* @__PURE__ */ new Map();
|
|
@@ -57065,7 +57180,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57065
57180
|
const point = new THREE.Vector3();
|
|
57066
57181
|
const out = [];
|
|
57067
57182
|
for (const part of parts2) {
|
|
57068
|
-
const boxes = mergeSpans(part.spans);
|
|
57183
|
+
const boxes = part.gone?.length ? subtract(mergeSpans(part.spans), part.gone) : mergeSpans(part.spans);
|
|
57069
57184
|
for (const s of line.open ? mergeSpans(carve(boxes, line.open), 0) : boxes) {
|
|
57070
57185
|
const along2 = line.start + (s.a + s.b) / 2;
|
|
57071
57186
|
point.set(line.alongU ? along2 : part.mid, (s.y0 + s.y1) / 2, line.alongU ? part.mid : along2).applyMatrix4(toMesh);
|
|
@@ -57571,11 +57686,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
57571
57686
|
function publishStanding(view) {
|
|
57572
57687
|
if (!view.saved) return;
|
|
57573
57688
|
const { mask } = view;
|
|
57689
|
+
const along2 = (p) => (mask.alongU ? p[0] : p[2]) - mask.start;
|
|
57574
57690
|
const parts2 = view.parts.map((id) => {
|
|
57575
57691
|
const part = structure.byId.get(id);
|
|
57576
57692
|
const thick = mask.alongU ? part.aabb[3] - part.aabb[1] : part.aabb[2] - part.aabb[0];
|
|
57577
57693
|
const mid = mask.alongU ? (part.aabb[1] + part.aabb[3]) / 2 : (part.aabb[0] + part.aabb[2]) / 2;
|
|
57578
|
-
|
|
57694
|
+
const gone = (view.chips.get(id) ?? []).map((k) => ({ a: along2(k.center) - k.along, b: along2(k.center) + k.along, y0: k.center[1] - k.up, y1: k.center[1] + k.up }));
|
|
57695
|
+
return { spans: view.kept.get(id) ?? [], gone, thick, mid };
|
|
57579
57696
|
});
|
|
57580
57697
|
const line = { alongU: mask.alongU, start: mask.start, open: view.core };
|
|
57581
57698
|
view.items.forEach((it, k) => publishSolids(it.mesh, it.v0, it.v1, k === 0 ? standingSolids(THREE, house, it.mesh, line, parts2) : []));
|