@adatechnology/game-weapons-three 0.29.5 → 0.29.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 +205 -49
- package/dist/index.global.js.map +1 -1
- package/package.json +6 -6
package/dist/index.global.js
CHANGED
|
@@ -18175,12 +18175,12 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
18175
18175
|
}
|
|
18176
18176
|
return pack("TorusGeometry", parameters, { vertices, normals, uvs, indices, groups: [] });
|
|
18177
18177
|
}
|
|
18178
|
-
function difference(size,
|
|
18178
|
+
function difference(size, subtract3) {
|
|
18179
18179
|
const [w, h, d] = size;
|
|
18180
18180
|
const hw = w / 2;
|
|
18181
18181
|
const hh = h / 2;
|
|
18182
18182
|
const hd = d / 2;
|
|
18183
|
-
const holes =
|
|
18183
|
+
const holes = subtract3.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);
|
|
18184
18184
|
const cuts = (lo, hi, values) => [.../* @__PURE__ */ new Set([lo, hi, ...values.filter((v) => v > lo && v < hi)])].sort((a, b) => a - b);
|
|
18185
18185
|
const xs = cuts(-hw, hw, holes.flatMap((hole) => [hole.x0, hole.x1]));
|
|
18186
18186
|
const ys = cuts(-hh, hh, holes.flatMap((hole) => [hole.y0, hole.y1]));
|
|
@@ -23986,6 +23986,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23986
23986
|
heatCapacity: 1.5,
|
|
23987
23987
|
thermalShockC: 200
|
|
23988
23988
|
},
|
|
23989
|
+
visual: {
|
|
23990
|
+
innerColor: 13148794
|
|
23991
|
+
},
|
|
23989
23992
|
tags: [
|
|
23990
23993
|
"ceramic",
|
|
23991
23994
|
"brittle"
|
|
@@ -24283,7 +24286,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24283
24286
|
},
|
|
24284
24287
|
visual: {
|
|
24285
24288
|
charColor: 855309,
|
|
24286
|
-
innerColor:
|
|
24289
|
+
innerColor: 14271631
|
|
24287
24290
|
},
|
|
24288
24291
|
tags: [
|
|
24289
24292
|
"fabric",
|
|
@@ -25112,6 +25115,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25112
25115
|
return { ...base2, mesh: { vertices, indices: piece3.mesh.indices } };
|
|
25113
25116
|
};
|
|
25114
25117
|
var THIN_SHEET_DISHING = 5e-3;
|
|
25118
|
+
var TEAR_CALIBERS = 1.1;
|
|
25115
25119
|
var SHELL_YIELD_SHARE = 0.5;
|
|
25116
25120
|
var STEEL_YIELD_MPA = 250;
|
|
25117
25121
|
var SWEEP_BACK = 0.01;
|
|
@@ -25181,9 +25185,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25181
25185
|
var SURFACE_SAME = 5e-4;
|
|
25182
25186
|
var SEVER_ASPECT = 3;
|
|
25183
25187
|
var SEVER_BALLISTIC = 2;
|
|
25188
|
+
var SEVER_TRACK = 4;
|
|
25184
25189
|
var TEAR_JOULES = 150;
|
|
25185
25190
|
var STRIP_THICKNESS = 15e-4;
|
|
25186
|
-
var tears = 0;
|
|
25187
25191
|
var UNIT_FRAGMENT_FACTOR = 4;
|
|
25188
25192
|
var BREACH_GRID_CAP = 4096;
|
|
25189
25193
|
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
@@ -25204,7 +25208,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25204
25208
|
var MAX_PLASTER_FLAKES = 24;
|
|
25205
25209
|
var CHIP_ENERGY = 200;
|
|
25206
25210
|
var CHIP_SPLASH = 0.5;
|
|
25211
|
+
var MORTAR_JOINT = 0.01;
|
|
25212
|
+
var MIN_UNIT_SHARE = 0.8;
|
|
25213
|
+
var CHIP_DRIVE = 0.6;
|
|
25214
|
+
var BLAST_DRIVE = 2.5;
|
|
25207
25215
|
var CRATER_SPENT = 0.6;
|
|
25216
|
+
var BONDING_JOINTS = /* @__PURE__ */ new Set(["glue", "mortar", "nail", "screw"]);
|
|
25217
|
+
var PLATE_ASPECT = 0.25;
|
|
25218
|
+
var PLATE_BACK_SHARE = 0.5;
|
|
25219
|
+
var BONDED_REMNANT = 0.25;
|
|
25208
25220
|
var EDGE_REACH = 1.5;
|
|
25209
25221
|
var BAR_BOW = 0.08;
|
|
25210
25222
|
var BULLET_JOINT_SPAN = 0.3;
|
|
@@ -25354,6 +25366,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25354
25366
|
const rnd2 = () => rng2.next();
|
|
25355
25367
|
let time = 0;
|
|
25356
25368
|
let counter = 0;
|
|
25369
|
+
let tears = 0;
|
|
25357
25370
|
const objects = /* @__PURE__ */ new Map();
|
|
25358
25371
|
const slots = /* @__PURE__ */ new Map();
|
|
25359
25372
|
let slotCounter = 0;
|
|
@@ -27712,6 +27725,38 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27712
27725
|
};
|
|
27713
27726
|
const isTrim = (p) => (p.spec.structure?.role ?? "none") === "none";
|
|
27714
27727
|
const fixesTrim = (o, j) => isTrim(o.parts[j.ia]) !== isTrim(o.parts[j.ib]);
|
|
27728
|
+
const bondedPlate = (o, p) => isPlateTrim(p) && (o.byPart.get(p.spec.id) ?? []).some((j) => !j.st.open && bondsPlate(o, j));
|
|
27729
|
+
const isPlateTrim = (p) => {
|
|
27730
|
+
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;
|
|
27731
|
+
const [u, v] = planeAxes(p.thin);
|
|
27732
|
+
return p.dims[p.thin] <= PLATE_ASPECT * Math.min(p.dims[u], p.dims[v]) && gridOf(p).length >= 2;
|
|
27733
|
+
};
|
|
27734
|
+
const bondsPlate = (o, j) => {
|
|
27735
|
+
if (!BONDING_JOINTS.has(j.spec.kind)) return false;
|
|
27736
|
+
const a = o.parts[j.ia], b = o.parts[j.ib];
|
|
27737
|
+
return isPlateTrim(a) && !isTrim(b) && backOn(a, b) || isPlateTrim(b) && !isTrim(a) && backOn(b, a);
|
|
27738
|
+
};
|
|
27739
|
+
const backOn = (plate2, carrier) => {
|
|
27740
|
+
const A = aabbOf(plate2.spec.shape, plate2.spec.position, plate2.q);
|
|
27741
|
+
const B = aabbOf(carrier.spec.shape, carrier.spec.position, carrier.q);
|
|
27742
|
+
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);
|
|
27743
|
+
const sides = [0, 1, 2].sort((x, y) => A.max[y] - A.min[y] - (A.max[x] - A.min[x])).slice(0, 2);
|
|
27744
|
+
return sides.every((k) => face(k) >= PLATE_BACK_SHARE);
|
|
27745
|
+
};
|
|
27746
|
+
const bondCarriers = (o, p) => {
|
|
27747
|
+
if (!bondedPlate(o, p)) return [];
|
|
27748
|
+
return (o.byPart.get(p.spec.id) ?? []).filter((j) => !j.st.open && bondsPlate(o, j)).map((j) => o.parts[j.ia] === p ? o.parts[j.ib] : o.parts[j.ia]).filter((q) => !isLost(q));
|
|
27749
|
+
};
|
|
27750
|
+
const bondedShareLeft = (p) => {
|
|
27751
|
+
const whole2 = p.st.mass + (p.rt.removed ?? 0);
|
|
27752
|
+
return whole2 > 0 ? p.st.mass / whole2 : 0;
|
|
27753
|
+
};
|
|
27754
|
+
const settleBonded = (o, p, origin, dir, src) => {
|
|
27755
|
+
if (isLost(p)) return;
|
|
27756
|
+
const share = bondedShareLeft(p);
|
|
27757
|
+
p.st.hp = Math.max(1, Math.min(p.st.hp, p.st.maxHp * share));
|
|
27758
|
+
if (share < BONDED_REMNANT) failPart(o, p, origin, dir, 0, 4, src);
|
|
27759
|
+
};
|
|
27715
27760
|
const holdsEmbedded = (o, j) => {
|
|
27716
27761
|
const a = o.parts[j.ia], b = o.parts[j.ib];
|
|
27717
27762
|
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;
|
|
@@ -27729,6 +27774,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27729
27774
|
if (j.st.open) continue;
|
|
27730
27775
|
if (j.spec.kind === "rebar" && (isReinforced(o.parts[j.ia].spec) || isReinforced(o.parts[j.ib].spec))) continue;
|
|
27731
27776
|
if (holdsEmbedded(o, j)) continue;
|
|
27777
|
+
if (bondsPlate(o, j)) continue;
|
|
27732
27778
|
if (near && jointReach(o, j, near) > Math.max(radius, jointReachLimit(o, j))) continue;
|
|
27733
27779
|
if (blast && fixesTrim(o, j) && jointReach(o, j, blast.point) > Math.max(blast.reach, jointReachLimit(o, j))) continue;
|
|
27734
27780
|
j.st.hp -= span === void 0 ? amount : Math.min(amount, j.st.maxHp) * Math.min(1, span / Math.max(jointLength(o, j), 1e-6));
|
|
@@ -27768,19 +27814,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27768
27814
|
emit2({ ...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]) });
|
|
27769
27815
|
debris2(o, p, torn.layer.mat.hitDebris, toWorld(o.st.position, o.st.rotation, lp), normal, 5, 2, src, torn.layer.mat.id);
|
|
27770
27816
|
};
|
|
27771
|
-
const spallOuter = (o, p, wp, face, normal, radius, src) => {
|
|
27817
|
+
const spallOuter = (o, p, wp, face, normal, radius, src, tearRadius = radius) => {
|
|
27772
27818
|
var _a;
|
|
27773
27819
|
if (p.layers.length === 0) return;
|
|
27774
27820
|
const lp = objLocal(o, wp);
|
|
27775
27821
|
const torn = tornPatchAt(p.layers, p.rt.spalls, face, lp, radius);
|
|
27776
|
-
if (torn) return widenTear(o, p, torn, lp, normal,
|
|
27822
|
+
if (torn) return widenTear(o, p, torn, lp, normal, tearRadius, src);
|
|
27777
27823
|
const layer3 = outerLayer(p.layers, p.rt.spalls, face, lp);
|
|
27778
27824
|
if (!layer3) return;
|
|
27825
|
+
const patch = layer3.mat.fracture === "tear" ? tearRadius : radius;
|
|
27779
27826
|
const spalls = (_a = p.rt).spalls ?? (_a.spalls = []);
|
|
27780
|
-
spalls.push([layer3.index, face, lp[0], lp[1], lp[2],
|
|
27827
|
+
spalls.push([layer3.index, face, lp[0], lp[1], lp[2], patch]);
|
|
27781
27828
|
if (spalls.length > MAX_SPALLS) spalls.shift();
|
|
27782
27829
|
markDamaged(p);
|
|
27783
|
-
emit2({ ...base2(o, src), type: "spall", part: p.spec.id, layer: layer3.index, point: wp, area: Math.PI *
|
|
27830
|
+
emit2({ ...base2(o, src), type: "spall", part: p.spec.id, layer: layer3.index, point: wp, area: Math.PI * patch * patch, ...spallNormal(o, p, face) });
|
|
27784
27831
|
debris2(o, p, layer3.mat.hitDebris, wp, normal, 5, 2, src, layer3.mat.id);
|
|
27785
27832
|
setStage(o, p, 1, {}, src);
|
|
27786
27833
|
};
|
|
@@ -27820,7 +27867,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27820
27867
|
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])];
|
|
27821
27868
|
};
|
|
27822
27869
|
const FRAGMENT_SHAPE = { shatter: "shard", splinter: "splinter", tear: "scrap" };
|
|
27823
|
-
const cellFragments = (o, p, cells, hitW, dir, speed, mass, tag, inner = false, knownHoles) => {
|
|
27870
|
+
const cellFragments = (o, p, cells, hitW, dir, speed, mass, tag, inner = false, knownHoles, drive = CHIP_DRIVE) => {
|
|
27824
27871
|
const { c, q } = partXf(o, p);
|
|
27825
27872
|
const holes = knownHoles ?? (p.st.holes.length > 0 ? localHolesOf(p) : []);
|
|
27826
27873
|
const [u, v] = planeAxes(p.thin);
|
|
@@ -27831,16 +27878,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27831
27878
|
return cells.map((cell, i) => {
|
|
27832
27879
|
const cw = toWorld(c, q, cell.center);
|
|
27833
27880
|
const out = vec.normalize(vec.sub(cw, hitW), [0, 1, 0]);
|
|
27834
|
-
const dv = dir ? vec.normalize(vec.madd(out, dir,
|
|
27881
|
+
const dv = dir ? vec.normalize(vec.madd(out, dir, drive)) : out;
|
|
27835
27882
|
const k = speed * (0.6 + 0.8 * rnd2());
|
|
27836
27883
|
const marks = marksInBox(cell.center, cell.size, void 0, holes);
|
|
27884
|
+
const size = [cell.size[0], cell.size[1], cell.size[2]];
|
|
27885
|
+
if (laid) for (const a of [u, v]) size[a] = Math.max(size[a] * MIN_UNIT_SHARE, size[a] - MORTAR_JOINT);
|
|
27837
27886
|
return {
|
|
27838
27887
|
id: `${p.spec.id}#${tag}${i}`,
|
|
27839
27888
|
part: p.spec.id,
|
|
27840
27889
|
material: p.spec.material,
|
|
27841
27890
|
shape,
|
|
27842
27891
|
center: cw,
|
|
27843
|
-
size
|
|
27892
|
+
size,
|
|
27844
27893
|
rotation: q,
|
|
27845
27894
|
velocity: [dv[0] * k, dv[1] * k + 0.5 * rnd2(), dv[2] * k],
|
|
27846
27895
|
angularVelocity: bornSpin(cell.size, 8, rnd2),
|
|
@@ -28091,7 +28140,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28091
28140
|
};
|
|
28092
28141
|
const chipUnits = (o, p, kind, wp, hitEnergy, dir, radius, src) => {
|
|
28093
28142
|
var _a, _b, _c;
|
|
28094
|
-
|
|
28143
|
+
const bonded = bondedPlate(o, p);
|
|
28144
|
+
if (!bonded && (!p.spec.units || !p.staged) || chipEnergy <= 0 || p.st.stripped || isLost(p) || (p.st.stage ?? 0) >= 2) return;
|
|
28095
28145
|
const rule = p.mat.hits?.[kind];
|
|
28096
28146
|
const perKg = rule?.unitJoules ?? chipEnergy;
|
|
28097
28147
|
const energy = hitEnergy - (rule?.floor ?? 0);
|
|
@@ -28165,6 +28215,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28165
28215
|
if (Object.values(worn).filter((w) => w === -1).length > wholeBefore) dropUnsupported(o, p, src);
|
|
28166
28216
|
if (p.spec.reinforcement) exposeRebar(o, p, src);
|
|
28167
28217
|
for (const cell of out) addBreach(o, p, toWorld(c, q, cell.center), cell.size[u] * cell.size[v], energy, dir, src);
|
|
28218
|
+
if (bonded) settleBonded(o, p, wp, dir, src);
|
|
28168
28219
|
if (p.structural && !isLost(p)) {
|
|
28169
28220
|
solveStructure(o);
|
|
28170
28221
|
collapseCheck(o, src);
|
|
@@ -28279,15 +28330,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28279
28330
|
if (reinforcement) exposeRebar(o, p, src);
|
|
28280
28331
|
if (p.structural) solveStructure(o);
|
|
28281
28332
|
};
|
|
28282
|
-
const blastReachOf = (p, energy) => {
|
|
28283
|
-
const
|
|
28284
|
-
const resistance = Math.max(1, perKg * p.mat.density * p.thickness);
|
|
28333
|
+
const blastReachOf = (o, p, energy) => {
|
|
28334
|
+
const resistance = Math.max(1, ...[p, ...bondCarriers(o, p)].map((q) => (q.mat.hits?.blunt?.unitJoules ?? chipEnergy) * q.mat.density * q.thickness));
|
|
28285
28335
|
return BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3) * clamp2(Math.cbrt(BLAST_REFERENCE_RESISTANCE / resistance), 0.3, 2);
|
|
28286
28336
|
};
|
|
28287
|
-
const blastUnits = (o, p, wp, energy, dist2, src) => {
|
|
28337
|
+
const blastUnits = (o, p, wp, energy, dist2, src, from) => {
|
|
28288
28338
|
var _a;
|
|
28289
|
-
if (!p.staged || p.st.stripped || isLost(p) || chipEnergy <= 0) return false;
|
|
28290
|
-
const reach2 = blastReachOf(p, energy);
|
|
28339
|
+
if (!p.staged && !bondedPlate(o, p) || p.st.stripped || isLost(p) || chipEnergy <= 0) return false;
|
|
28340
|
+
const reach2 = blastReachOf(o, p, energy);
|
|
28291
28341
|
if (dist2 >= reach2) return false;
|
|
28292
28342
|
const radius = Math.sqrt(reach2 * reach2 - dist2 * dist2);
|
|
28293
28343
|
const [u, v] = planeAxes(p.thin);
|
|
@@ -28315,7 +28365,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28315
28365
|
}
|
|
28316
28366
|
}
|
|
28317
28367
|
if (out.length === 0) return false;
|
|
28318
|
-
return knockOutUnits(o, p, wp, energy, out, src);
|
|
28368
|
+
return knockOutUnits(o, p, wp, energy, out, src, from ? awayFromCharge(o, p, from) : void 0, BLAST_DRIVE);
|
|
28369
|
+
};
|
|
28370
|
+
const awayFromCharge = (o, p, charge2) => {
|
|
28371
|
+
const axis2 = [0, 0, 0];
|
|
28372
|
+
axis2[p.thin] = toLocal(p.pos, p.q, objLocal(o, charge2))[p.thin] >= 0 ? -1 : 1;
|
|
28373
|
+
return rotateVec(partXf(o, p).q, axis2);
|
|
28319
28374
|
};
|
|
28320
28375
|
const wedgedUnder = (o, p, loose) => {
|
|
28321
28376
|
if (loose.length === 0) return loose;
|
|
@@ -28407,7 +28462,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28407
28462
|
for (const i of out) worn[i] = -1;
|
|
28408
28463
|
return knockOutUnits(o, p, point, energy, out, src);
|
|
28409
28464
|
};
|
|
28410
|
-
const knockOutUnits = (o, p, wp, energy, out, src, d) => {
|
|
28465
|
+
const knockOutUnits = (o, p, wp, energy, out, src, d, drive = CHIP_DRIVE) => {
|
|
28411
28466
|
var _a, _b;
|
|
28412
28467
|
const [u, v] = planeAxes(p.thin);
|
|
28413
28468
|
const op = p.st.opening ? toLocal(p.pos, p.q, p.st.opening.center) : null;
|
|
@@ -28417,7 +28472,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28417
28472
|
out = out.filter((i) => !castHere.has(i));
|
|
28418
28473
|
if (out.length === 0) return false;
|
|
28419
28474
|
for (const i of out) worn[i] = -1;
|
|
28420
|
-
const
|
|
28475
|
+
const bonded = bondedPlate(o, p);
|
|
28476
|
+
const cast = p.spec.units?.mortar === p.spec.material || bonded;
|
|
28421
28477
|
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));
|
|
28422
28478
|
for (const i of loose) worn[i] = -1;
|
|
28423
28479
|
const blown = out.map((i) => grid[i]), fallen = loose.map((i) => grid[i]);
|
|
@@ -28430,7 +28486,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28430
28486
|
const tag = `x${chipped.length}_`;
|
|
28431
28487
|
const holes = localHolesOf(p);
|
|
28432
28488
|
const fragments = [
|
|
28433
|
-
...cellFragments(o, p, clumpUnits(blown, p.thin, unitSpan(p), unitClumps), wp, null, speed, blownMass, tag, true, holes),
|
|
28489
|
+
...cellFragments(o, p, clumpUnits(blown, p.thin, unitSpan(p), unitClumps), wp, d ?? null, speed, blownMass, tag, true, holes, drive),
|
|
28434
28490
|
...fallen.length > 0 ? cellFragments(o, p, clumpUnits(fallen, p.thin, unitSpan(p), fallenClumps), wp, null, 0.3, fallenMass, `${tag}f`, true, holes) : [],
|
|
28435
28491
|
...plasterFlakes(o, p, blown, wp, speed, `${tag}p`)
|
|
28436
28492
|
];
|
|
@@ -28455,6 +28511,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28455
28511
|
debris2(o, p, p.mat.breakDebris, center, vec.normalize(vec.sub(center, wp), [0, 1, 0]), 14, 3, src);
|
|
28456
28512
|
const cut = wornLocally(p) && cutBandsGone(o, p, cells, d ?? vec.normalize(vec.sub(partXf(o, p).c, wp), [1, 0, 0]), src);
|
|
28457
28513
|
if (p.spec.reinforcement && !cut) exposeRebar(o, p, src);
|
|
28514
|
+
if (bonded) settleBonded(o, p, wp, d ?? null, src);
|
|
28458
28515
|
if (p.structural && !isLost(p)) {
|
|
28459
28516
|
solveStructure(o);
|
|
28460
28517
|
collapseCheck(o, src);
|
|
@@ -28762,13 +28819,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28762
28819
|
const order2 = [0, 1, 2].sort((a, b) => d[b] - d[a]);
|
|
28763
28820
|
return d[order2[0]] >= SEVER_ASPECT * d[order2[1]] && d[order2[0]] >= 3 * SEVER_BAND ? order2[0] : -1;
|
|
28764
28821
|
};
|
|
28822
|
+
const roundSection = (o, p, d, holeWidth, depth) => {
|
|
28823
|
+
const axis2 = severAxis(p);
|
|
28824
|
+
if (axis2 < 0) return 1;
|
|
28825
|
+
const local2 = rotateVec(quat.conjugate(partXf(o, p).q), d);
|
|
28826
|
+
const [a, b] = [0, 1, 2].filter((k) => k !== axis2);
|
|
28827
|
+
const across2 = Math.abs(local2[a]) >= Math.abs(local2[b]) ? p.dims[b] : p.dims[a];
|
|
28828
|
+
return Math.min(1, SEVER_TRACK * holeWidth / Math.max(across2, 1e-6)) * clamp2(depth, 0, 1);
|
|
28829
|
+
};
|
|
28765
28830
|
const bandOf = (o, p, axis2, origin) => {
|
|
28766
28831
|
const { c, q } = partXf(o, p);
|
|
28767
28832
|
const along2 = toLocal(c, q, origin)[axis2];
|
|
28768
28833
|
const L = p.dims[axis2];
|
|
28769
28834
|
return clamp2(Math.floor((along2 + L / 2) / SEVER_BAND), 0, Math.ceil(L / SEVER_BAND) - 1);
|
|
28770
28835
|
};
|
|
28771
|
-
const applyDamage = (o, p, amount, type, origin, dir, fragEnergy, cap, src, weight = 1) => {
|
|
28836
|
+
const applyDamage = (o, p, amount, type, origin, dir, fragEnergy, cap, src, weight = 1, section = 1) => {
|
|
28772
28837
|
var _a;
|
|
28773
28838
|
if (isLost(p) || amount <= 0) return 0;
|
|
28774
28839
|
const prev = p.st.hp;
|
|
@@ -28777,7 +28842,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28777
28842
|
if (axis2 >= 0 && p.st.hp > 0) {
|
|
28778
28843
|
const band = bandOf(o, p, axis2, origin);
|
|
28779
28844
|
const cuts = (_a = p.rt).cuts ?? (_a.cuts = {});
|
|
28780
|
-
cuts[band] = (cuts[band] ?? 0) + amount * (type === "ballistic" ? SEVER_BALLISTIC : 1);
|
|
28845
|
+
cuts[band] = (cuts[band] ?? 0) + amount * section * (type === "ballistic" ? SEVER_BALLISTIC : 1);
|
|
28781
28846
|
if (cuts[band] >= p.st.maxHp * SEVER_BAND / p.dims[axis2]) {
|
|
28782
28847
|
p.rt.cutAt = -p.dims[axis2] / 2 + (band + 0.5) * SEVER_BAND;
|
|
28783
28848
|
p.st.hp = 0;
|
|
@@ -28789,6 +28854,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28789
28854
|
if (chained && p.st.hp <= 0 && p.rt.chainDue === void 0) p.st.hp = Math.min(prev, 1);
|
|
28790
28855
|
if (p.st.hp <= 0 && p.mat.fracture === "none" && !p.spec.explodes) p.st.hp = Math.min(prev, 1);
|
|
28791
28856
|
if (p.st.hp <= 0 && type === "ballistic" && wornLocally(p)) p.st.hp = Math.min(prev, 1);
|
|
28857
|
+
if (p.st.hp <= 0 && type !== "fire" && type !== "heat" && bondedPlate(o, p)) p.st.hp = Math.min(prev, 1);
|
|
28792
28858
|
const done = prev - p.st.hp;
|
|
28793
28859
|
if (done > 0) emit2({ ...base2(o, src), type: "damage", part: p.spec.id, amount: done, hp: Math.max(0, p.st.hp), damageType: type });
|
|
28794
28860
|
if (p.st.hp <= 0) failPart(o, p, origin, dir, fragEnergy * weight, cap, src);
|
|
@@ -28897,19 +28963,20 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28897
28963
|
const dmg2 = applyDamage(o, p, E * DMG_PER_J * scale * 0.2, "ballistic", entry2, d, E * 0.1, 12, src, weight);
|
|
28898
28964
|
return { penetrated: false, exitEnergy: 0, damage: dmg2 };
|
|
28899
28965
|
}
|
|
28900
|
-
if (p.layers.length > 0) spallOuter(o, p, entry2, face, n, Math.max(0.03, caliber / 1e3 * 4), src);
|
|
28966
|
+
if (p.layers.length > 0) spallOuter(o, p, entry2, face, n, Math.max(0.03, caliber / 1e3 * 4), src, caliber / 1e3 * TEAR_CALIBERS);
|
|
28901
28967
|
else if (mat.hits?.ballistic?.crater) crater(o, p, entry2, n, clamp2(0.02 + Math.sqrt(E) * 15e-4, 0.02, 0.15), src);
|
|
28902
28968
|
const brittle = mat.ductility < 0.3;
|
|
28903
28969
|
const ratio = Ep / Math.max(thr, 1e-6);
|
|
28904
28970
|
const crackLen = clamp2(0.03 + ratio * 0.2, 0.03, 0.8);
|
|
28905
28971
|
let exitPoint;
|
|
28906
28972
|
let shellShare = 0;
|
|
28973
|
+
const holeWidth = caliber / 1e3 * (mat.ductility >= 0.3 ? 1 : 1.5);
|
|
28907
28974
|
if (penetrated) {
|
|
28908
28975
|
const exitDist = p.spec.contains || p.spec.fill !== void 0 && p.spec.fill < 0.5 || p.thickness < pathLen * 0.5 ? pathLen : Math.min(pathLen, effM + layersThickness(p.layers, face) / slant + layersThickness(p.layers, -face) / slant);
|
|
28909
28976
|
exitPoint = vec.madd(entry2, d, exitDist);
|
|
28910
|
-
const hole = addHole(o, p, entry2, n,
|
|
28977
|
+
const hole = addHole(o, p, entry2, n, holeWidth, true, exitPoint, src);
|
|
28911
28978
|
shellShare = wearsShell(p, hole.diameter * 2);
|
|
28912
|
-
if (p.layers.length > 0) spallOuter(o, p, exitPoint, -face, vec.scale(n, -1), Math.max(0.03, caliber / 1e3 * 4), src);
|
|
28979
|
+
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);
|
|
28913
28980
|
addBreach(o, p, entry2, Math.PI * (hole.diameter / 2) * (hole.diameter / 2), E, d, src);
|
|
28914
28981
|
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);
|
|
28915
28982
|
if (brittle && mat.fracture === "shatter") addCrack(o, p, entry2, n, crackLen, src);
|
|
@@ -28937,7 +29004,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28937
29004
|
wearJoints(o, p, (penetrated ? thr : E) * 0.02 * weight, void 0, 0, src, true, BULLET_JOINT_SPAN);
|
|
28938
29005
|
const hollowTear = mat.fracture === "tear" && p.spec.fill !== void 0 && p.spec.fill < 0.5;
|
|
28939
29006
|
const absorbed = penetrated && (mat.ductility >= 0.5 && mat.fracture !== "tear" || hollowTear || mat.cellular === true) ? Math.min(E, thr) : E;
|
|
28940
|
-
const dmg = applyDamage(o, p, absorbed * DMG_PER_J * scale, "ballistic", entry2, d, absorbed * 0.1, 12, src, weight);
|
|
29007
|
+
const dmg = applyDamage(o, p, absorbed * DMG_PER_J * scale, "ballistic", entry2, d, absorbed * 0.1, 12, src, weight, roundSection(o, p, d, holeWidth, penetrated ? 1 : ratio));
|
|
28941
29008
|
if (shellShare > 0 && !isLost(p)) yieldShell(o, p, shellShare, entry2, d, src);
|
|
28942
29009
|
if (!isLost(p)) tearAt(o, p, "ballistic", entry2, penetrated ? exitPoint : void 0, d, E, caliber / 1e3, src);
|
|
28943
29010
|
if (!wearMember(o, p, entry2, d, E, caliber, penMm, src)) chipUnits(o, p, "ballistic", entry2, penetrated ? Math.min(E, Math.max(thr, E * 0.5)) : E, d, Math.max(0.05, caliber / 1e3 * 8), src);
|
|
@@ -29081,13 +29148,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
29081
29148
|
const breachReach = BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
|
|
29082
29149
|
const caged2 = Boolean(p.spec.reinforcement && p.spec.units);
|
|
29083
29150
|
const member = caged2 && (isMember(p.dims, p.spec.structure?.role) || dist2 > MEMBER_CUT_REACH * breachReach);
|
|
29084
|
-
const
|
|
29151
|
+
const bonded = bondedPlate(o, p);
|
|
29152
|
+
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);
|
|
29085
29153
|
res.damage += dealt;
|
|
29086
29154
|
if (p.bend && flexure.enabled) bendByBlast(o, p, point, energy, radius, reach2, src);
|
|
29087
29155
|
if (p.spec.units && p.spec.units.mortar !== p.spec.material) {
|
|
29088
29156
|
blastPanel(o, p, point, energy, src);
|
|
29089
|
-
if (!isLost(p)) blastUnits(o, p, wp, energy, dist2, src);
|
|
29090
|
-
} else if (member) blastUnits(o, p, wp, energy, dist2, src);
|
|
29157
|
+
if (!isLost(p)) blastUnits(o, p, wp, energy, dist2, src, point);
|
|
29158
|
+
} else if (member || bonded) blastUnits(o, p, wp, energy, dist2, src, point);
|
|
29091
29159
|
else if (dist2 <= breachReach) addBreach(o, p, wp, breachAreaOf(p, dealt, true), Ein, null, src);
|
|
29092
29160
|
return reach2;
|
|
29093
29161
|
};
|
|
@@ -30625,6 +30693,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30625
30693
|
}).events;
|
|
30626
30694
|
},
|
|
30627
30695
|
state: (id) => objects.get(id)?.st ?? impls.get(id)?.impl.state() ?? null,
|
|
30696
|
+
layers: (id, partId) => objects.get(id)?.byId.get(partId)?.spec.layers ?? [],
|
|
30628
30697
|
anchoredParts: (id) => objects.get(id)?.parts.filter((p) => p.anchored && !isLost(p)).map((p) => p.spec.id) ?? [],
|
|
30629
30698
|
fixedInPlace: (id) => {
|
|
30630
30699
|
const o = objects.get(id);
|
|
@@ -30661,6 +30730,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30661
30730
|
time,
|
|
30662
30731
|
rng: rng2.state(),
|
|
30663
30732
|
counter,
|
|
30733
|
+
...tears > 0 ? { tears } : {},
|
|
30664
30734
|
objects: [...objects.values()].map(serializeObject),
|
|
30665
30735
|
...impls.size ? { impls: [...impls.values()].map((im) => ({ id: im.impl.id, position: [...im.position], rotation: [...im.rotation], data: im.impl.serialize?.() })) } : {}
|
|
30666
30736
|
};
|
|
@@ -30685,6 +30755,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30685
30755
|
time = snap.time;
|
|
30686
30756
|
rng2.set(snap.rng);
|
|
30687
30757
|
counter = snap.counter ?? 0;
|
|
30758
|
+
tears = snap.tears ?? 0;
|
|
30688
30759
|
for (const e of snap.objects) putObject(e.id, buildFromEntry(e, e.id));
|
|
30689
30760
|
for (const e of snap.impls ?? []) {
|
|
30690
30761
|
const im = impls.get(e.id);
|
|
@@ -31174,7 +31245,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31174
31245
|
var MIN_PILLAR_AREA = 0.036;
|
|
31175
31246
|
var BEAM_DEPTH_RATIO = 10;
|
|
31176
31247
|
var PLASTER_PER_FACE = 0.015;
|
|
31177
|
-
var
|
|
31248
|
+
var MORTAR_JOINT2 = 0.01;
|
|
31178
31249
|
var SECTION_STEP = 0.05;
|
|
31179
31250
|
var ceilTo = (value, step) => Math.ceil(value / step - 1e-9) * step;
|
|
31180
31251
|
var round22 = (value) => Math.round(value * 100) / 100;
|
|
@@ -31188,7 +31259,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31188
31259
|
function coursingOf(unitId, assemblyUnits) {
|
|
31189
31260
|
if (unitId !== void 0) {
|
|
31190
31261
|
const unit = getMasonryUnit(unitId);
|
|
31191
|
-
return { courseHeight: round22(unit.height +
|
|
31262
|
+
return { courseHeight: round22(unit.height + MORTAR_JOINT2), unitLength: round22(unit.length + MORTAR_JOINT2) };
|
|
31192
31263
|
}
|
|
31193
31264
|
return assemblyUnits ? { courseHeight: assemblyUnits.size[1], unitLength: assemblyUnits.size[0] } : void 0;
|
|
31194
31265
|
}
|
|
@@ -56468,7 +56539,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
56468
56539
|
}
|
|
56469
56540
|
var residentialTower = residentialTowerTemplate();
|
|
56470
56541
|
|
|
56471
|
-
// ../game-floorplan-three/dist/chunk-
|
|
56542
|
+
// ../game-floorplan-three/dist/chunk-Y7TCDFDL.js
|
|
56472
56543
|
var __defProp4 = Object.defineProperty;
|
|
56473
56544
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
56474
56545
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -66180,6 +66251,25 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66180
66251
|
}
|
|
66181
66252
|
return [...groups.values()];
|
|
66182
66253
|
};
|
|
66254
|
+
function subtract2(boxes, cuts) {
|
|
66255
|
+
let out = [...boxes];
|
|
66256
|
+
for (const k of cuts) {
|
|
66257
|
+
const next = [];
|
|
66258
|
+
for (const b of out) {
|
|
66259
|
+
if (k.a >= b.b - EPSILON22 || k.b <= b.a + EPSILON22 || k.y0 >= b.y1 - EPSILON22 || k.y1 <= b.y0 + EPSILON22) {
|
|
66260
|
+
next.push(b);
|
|
66261
|
+
continue;
|
|
66262
|
+
}
|
|
66263
|
+
const y0 = Math.max(b.y0, k.y0), y1 = Math.min(b.y1, k.y1);
|
|
66264
|
+
if (y0 - b.y0 > EPSILON22) next.push({ a: b.a, b: b.b, y0: b.y0, y1: y0 });
|
|
66265
|
+
if (b.y1 - y1 > EPSILON22) next.push({ a: b.a, b: b.b, y0: y1, y1: b.y1 });
|
|
66266
|
+
if (k.a - b.a > EPSILON22) next.push({ a: b.a, b: k.a, y0, y1 });
|
|
66267
|
+
if (b.b - k.b > EPSILON22) next.push({ a: k.b, b: b.b, y0, y1 });
|
|
66268
|
+
}
|
|
66269
|
+
out = next;
|
|
66270
|
+
}
|
|
66271
|
+
return out;
|
|
66272
|
+
}
|
|
66183
66273
|
function mergeSpans(spans, share = JOINT_SHARE) {
|
|
66184
66274
|
const runs = [];
|
|
66185
66275
|
const unitLengths = /* @__PURE__ */ new Map();
|
|
@@ -66230,7 +66320,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66230
66320
|
const point = new THREE.Vector3();
|
|
66231
66321
|
const out = [];
|
|
66232
66322
|
for (const part of parts2) {
|
|
66233
|
-
const boxes = mergeSpans(part.spans);
|
|
66323
|
+
const boxes = part.gone?.length ? subtract2(mergeSpans(part.spans), part.gone) : mergeSpans(part.spans);
|
|
66234
66324
|
for (const s of line.open ? mergeSpans(carve(boxes, line.open), 0) : boxes) {
|
|
66235
66325
|
const along2 = line.start + (s.a + s.b) / 2;
|
|
66236
66326
|
point.set(line.alongU ? along2 : part.mid, (s.y0 + s.y1) / 2, line.alongU ? part.mid : along2).applyMatrix4(toMesh);
|
|
@@ -66736,11 +66826,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
66736
66826
|
function publishStanding(view) {
|
|
66737
66827
|
if (!view.saved) return;
|
|
66738
66828
|
const { mask } = view;
|
|
66829
|
+
const along2 = (p) => (mask.alongU ? p[0] : p[2]) - mask.start;
|
|
66739
66830
|
const parts2 = view.parts.map((id) => {
|
|
66740
66831
|
const part = structure.byId.get(id);
|
|
66741
66832
|
const thick = mask.alongU ? part.aabb[3] - part.aabb[1] : part.aabb[2] - part.aabb[0];
|
|
66742
66833
|
const mid = mask.alongU ? (part.aabb[1] + part.aabb[3]) / 2 : (part.aabb[0] + part.aabb[2]) / 2;
|
|
66743
|
-
|
|
66834
|
+
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 }));
|
|
66835
|
+
return { spans: view.kept.get(id) ?? [], gone, thick, mid };
|
|
66744
66836
|
});
|
|
66745
66837
|
const line = { alongU: mask.alongU, start: mask.start, open: view.core };
|
|
66746
66838
|
view.items.forEach((it, k) => publishSolids(it.mesh, it.v0, it.v1, k === 0 ? standingSolids(THREE, house, it.mesh, line, parts2) : []));
|
|
@@ -93759,6 +93851,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
93759
93851
|
y: 0,
|
|
93760
93852
|
z: 0,
|
|
93761
93853
|
r: 0.6,
|
|
93854
|
+
h: 0,
|
|
93762
93855
|
r0: 0.6,
|
|
93763
93856
|
grow: 0,
|
|
93764
93857
|
life: 6,
|
|
@@ -93784,6 +93877,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
93784
93877
|
fire.y = init.y ?? 0;
|
|
93785
93878
|
fire.z = init.z ?? 0;
|
|
93786
93879
|
fire.r = init.r ?? 0.6;
|
|
93880
|
+
fire.h = init.h ?? 0;
|
|
93787
93881
|
fire.r0 = init.startRadius ?? fire.r;
|
|
93788
93882
|
fire.grow = init.grow ?? 0;
|
|
93789
93883
|
fire.life = init.life ?? 6;
|
|
@@ -93808,19 +93902,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
93808
93902
|
core.trace?.fire?.(fire);
|
|
93809
93903
|
return fire;
|
|
93810
93904
|
}
|
|
93905
|
+
var FLAMES_PER_HEIGHT = 1.5;
|
|
93906
|
+
var SMOKE_PER_HEIGHT = 2;
|
|
93811
93907
|
function positionOf(follow) {
|
|
93812
93908
|
return "position" in follow ? follow.position : follow;
|
|
93813
93909
|
}
|
|
93910
|
+
var heightOf = (fire) => fire.h > 0 ? fire.rng.next() * fire.h : 0;
|
|
93911
|
+
var isBody = (follow) => "radius" in follow && "height" in follow;
|
|
93814
93912
|
function emitFlames(core, fire, radius, dt) {
|
|
93815
93913
|
const random = fire.rng;
|
|
93816
|
-
fire.acc += dt * fire.rate * (0.5 + radius * 0.9) * fire.fade * core.clock.lod;
|
|
93914
|
+
fire.acc += dt * fire.rate * (0.5 + radius * 0.9) * (1 + fire.h * FLAMES_PER_HEIGHT) * fire.fade * core.clock.lod;
|
|
93817
93915
|
while (fire.acc >= 1) {
|
|
93818
93916
|
fire.acc -= 1;
|
|
93819
93917
|
const angle = random.next() * Math.PI * 2;
|
|
93820
93918
|
const distance4 = Math.sqrt(random.next()) * radius;
|
|
93821
93919
|
addPuff(core, random, {
|
|
93822
93920
|
x: fire.x + Math.cos(angle) * distance4,
|
|
93823
|
-
y: fire.y + 0.05,
|
|
93921
|
+
y: fire.y + 0.05 + heightOf(fire),
|
|
93824
93922
|
z: fire.z + Math.sin(angle) * distance4,
|
|
93825
93923
|
vx: random.between(-0.2, 0.2),
|
|
93826
93924
|
vy: random.between(0.6, 1.4),
|
|
@@ -93842,12 +93940,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
93842
93940
|
}
|
|
93843
93941
|
function emitSmoke(core, fire, radius, dt) {
|
|
93844
93942
|
const random = fire.rng;
|
|
93845
|
-
fire.smokeAcc += dt * fire.smoke * (1 + radius * 0.8) * fire.fade * core.clock.lod;
|
|
93943
|
+
fire.smokeAcc += dt * fire.smoke * (1 + radius * 0.8) * (1 + fire.h * SMOKE_PER_HEIGHT) * fire.fade * core.clock.lod;
|
|
93846
93944
|
while (fire.smokeAcc >= 1 && core.layers.smoke) {
|
|
93847
93945
|
fire.smokeAcc -= 1;
|
|
93848
93946
|
addPuff(core, random, {
|
|
93849
93947
|
x: fire.x + random.between(-radius, radius) * 0.5,
|
|
93850
|
-
y: fire.y + 0.6 + radius * 0.3,
|
|
93948
|
+
y: fire.y + fire.h + 0.6 + radius * 0.3,
|
|
93851
93949
|
z: fire.z + random.between(-radius, radius) * 0.5,
|
|
93852
93950
|
vy: random.between(0.8, 1.5),
|
|
93853
93951
|
s0: 0.25,
|
|
@@ -93869,7 +93967,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
93869
93967
|
if (!(random.next() < dt * 6 * fire.fade && core.layers.shrapnel)) return;
|
|
93870
93968
|
addSpark(core, {
|
|
93871
93969
|
x: fire.x + random.between(-radius, radius) * 0.6,
|
|
93872
|
-
y: fire.y + 0.4,
|
|
93970
|
+
y: fire.y + 0.4 + heightOf(fire),
|
|
93873
93971
|
z: fire.z + random.between(-radius, radius) * 0.6,
|
|
93874
93972
|
vx: random.between(-0.4, 0.4),
|
|
93875
93973
|
vy: random.between(1.5, 3.2),
|
|
@@ -93893,6 +93991,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
93893
93991
|
fire.x = point.x + fire.fx;
|
|
93894
93992
|
fire.y = point.y + fire.fy;
|
|
93895
93993
|
fire.z = point.z + fire.fz;
|
|
93994
|
+
if (isBody(fire.follow)) {
|
|
93995
|
+
fire.r = fire.follow.radius;
|
|
93996
|
+
fire.h = fire.follow.height;
|
|
93997
|
+
}
|
|
93896
93998
|
}
|
|
93897
93999
|
const radius = fire.grow ? lerp2(fire.r0, fire.r, Math.min(1, fire.t / fire.grow)) : fire.r;
|
|
93898
94000
|
fire.fade = fire.t < fire.life - 1.5 ? Math.min(1, fire.t * 3) : Math.max(0, (fire.life - fire.t) / 1.5);
|
|
@@ -99772,10 +99874,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99772
99874
|
},
|
|
99773
99875
|
fire(fireOptions) {
|
|
99774
99876
|
const handle = ++handles.next;
|
|
99775
|
-
const { point, offset, seed, radius, smokeColor, ...rest2 } = fireOptions;
|
|
99877
|
+
const { point, offset, seed, radius, height, smokeColor, ...rest2 } = fireOptions;
|
|
99776
99878
|
addFire(core, streamOf(seed), {
|
|
99777
99879
|
...rest2,
|
|
99778
99880
|
r: radius,
|
|
99881
|
+
...height !== void 0 ? { h: height } : {},
|
|
99779
99882
|
x: point[0],
|
|
99780
99883
|
y: point[1],
|
|
99781
99884
|
z: point[2],
|
|
@@ -99910,7 +100013,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
99910
100013
|
}
|
|
99911
100014
|
var DEGREES = 180 / Math.PI;
|
|
99912
100015
|
|
|
99913
|
-
// ../game-vfx-three/dist/chunk-
|
|
100016
|
+
// ../game-vfx-three/dist/chunk-BLUUVMCE.js
|
|
99914
100017
|
var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
|
|
99915
100018
|
void main(){vec3 R=vec3(viewMatrix[0][0],viewMatrix[1][0],viewMatrix[2][0]);vec3 Up=vec3(viewMatrix[0][1],viewMatrix[1][1],viewMatrix[2][1]);
|
|
99916
100019
|
vec3 wp=aP.xyz+(R*position.x+Up*position.y)*aP.w;vU=position.xy;vC=aC;gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.);}`;
|
|
@@ -99926,6 +100029,59 @@ float vn(vec3 x){vec3 i=floor(x),f=fract(x);f=f*f*(3.-2.*f);
|
|
|
99926
100029
|
`;
|
|
99927
100030
|
var PUFF_VERTEX = `${GL_NOISE}
|
|
99928
100031
|
attribute vec4 aP;attribute vec4 aD;attribute vec3 aC;
|
|
100032
|
+
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;
|
|
100033
|
+
void main(){
|
|
100034
|
+
vec3 p=position;
|
|
100035
|
+
float s=aD.z;
|
|
100036
|
+
float n=vn(p*1.6+vec3(s*11.0,s*7.0,s*3.0));
|
|
100037
|
+
p*=0.78+0.5*n;
|
|
100038
|
+
float a=s*6.2831;float c=cos(a),si=sin(a);p.xz=mat2(c,-si,si,c)*p.xz;
|
|
100039
|
+
vL=p;
|
|
100040
|
+
vec3 wp=aP.xyz+p*aP.w;
|
|
100041
|
+
vWP=wp;vD=aD;vC=aC;
|
|
100042
|
+
gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.0);
|
|
100043
|
+
}`;
|
|
100044
|
+
var PUFF_FRAGMENT = `${GL_NOISE}
|
|
100045
|
+
uniform vec3 uLight;uniform vec3 uSky;uniform vec3 uGround;uniform vec3 uGlowPos;uniform vec3 uGlowCol;uniform float uGlowI;
|
|
100046
|
+
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;
|
|
100047
|
+
vec3 L(vec3 c){return pow(c,vec3(2.2));}
|
|
100048
|
+
vec3 ramp(float h){
|
|
100049
|
+
vec3 c0=L(vec3(.36,.07,.03)),c1=L(vec3(.76,.21,.1)),c2=L(vec3(1.,.54,.16)),c3=L(vec3(1.,.83,.42)),c4=L(vec3(1.,.96,.84));
|
|
100050
|
+
if(h<.25)return mix(c0,c1,h/.25);
|
|
100051
|
+
if(h<.5)return mix(c1,c2,(h-.25)/.25);
|
|
100052
|
+
if(h<.8)return mix(c2,c3,(h-.5)/.3);
|
|
100053
|
+
return mix(c3,c4,clamp((h-.8)/.4,0.,1.));
|
|
100054
|
+
}
|
|
100055
|
+
void main(){
|
|
100056
|
+
vec3 N=normalize(cross(dFdx(vWP),dFdy(vWP)));
|
|
100057
|
+
float age=vD.x,heat=vD.y,kind=vD.w;
|
|
100058
|
+
float n=vn(vL*2.4+vD.z*13.0);
|
|
100059
|
+
float diss=smoothstep(.5,1.,age);
|
|
100060
|
+
if(n<diss*1.08-.04)discard;
|
|
100061
|
+
float lam=max(dot(N,uLight),0.);
|
|
100062
|
+
float band=lam>.55?1.:lam>.15?.68:.42;
|
|
100063
|
+
// soot: a dark smoke still scatters some light, so it never goes flat black, and its rim takes the sky so its volume reads (only the dark puffs; the rest as the Lab)
|
|
100064
|
+
float dark=1.-smoothstep(.02,.12,dot(vC,vec3(.2126,.7152,.0722)));
|
|
100065
|
+
vec3 alb=max(vC,vec3(.055)*dark);
|
|
100066
|
+
vec3 col=alb*(vec3(.5,.56,.7)*band*1.05+vec3(.2,.19,.18)+uGround*(.4-.4*N.y));
|
|
100067
|
+
float rim=pow(1.-clamp(abs(dot(N,normalize(cameraPosition-vWP))),0.,1.),2.);
|
|
100068
|
+
col+=dark*rim*(uSky*.9+alb);
|
|
100069
|
+
vec3 tg=uGlowPos-vWP;float dg=length(tg)+.001;
|
|
100070
|
+
float gi=uGlowI/(1.+dg*dg*.05)*(.3+.7*max(dot(N,tg/dg),0.));
|
|
100071
|
+
col+=uGlowCol*gi*alb*1.6;
|
|
100072
|
+
float h=heat*(.72+.56*n)+heat*(-N.y)*.18;
|
|
100073
|
+
if(h>.05){
|
|
100074
|
+
float hq=floor(h*5.+.5)/5.;
|
|
100075
|
+
vec3 fc=ramp(clamp(hq,0.,1.2))*(1.1+3.1*hq);
|
|
100076
|
+
col=mix(col,fc,smoothstep(.04,.2,h));
|
|
100077
|
+
}
|
|
100078
|
+
if(kind>2.5&&kind<3.5){col+=vec3(.02,.025,.03);}
|
|
100079
|
+
gl_FragColor=vec4(col,1.);
|
|
100080
|
+
#include <tonemapping_fragment>
|
|
100081
|
+
#include <colorspace_fragment>
|
|
100082
|
+
}`;
|
|
100083
|
+
var SOFT_PUFF_VERTEX = `${GL_NOISE}
|
|
100084
|
+
attribute vec4 aP;attribute vec4 aD;attribute vec3 aC;
|
|
99929
100085
|
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;varying vec3 vN;
|
|
99930
100086
|
void main(){
|
|
99931
100087
|
vec3 p=position;
|
|
@@ -99939,7 +100095,7 @@ void main(){
|
|
|
99939
100095
|
vWP=wp;vD=aD;vC=aC;
|
|
99940
100096
|
gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.0);
|
|
99941
100097
|
}`;
|
|
99942
|
-
var
|
|
100098
|
+
var SOFT_PUFF_FRAGMENT = `${GL_NOISE}
|
|
99943
100099
|
uniform vec3 uLight;uniform vec3 uSky;uniform vec3 uGround;uniform vec3 uGlowPos;uniform vec3 uGlowCol;uniform float uGlowI;
|
|
99944
100100
|
varying vec3 vWP;varying vec3 vL;varying vec4 vD;varying vec3 vC;varying vec3 vN;
|
|
99945
100101
|
vec3 L(vec3 c){return pow(c,vec3(2.2));}
|
|
@@ -100014,11 +100170,11 @@ void main(){
|
|
|
100014
100170
|
function dynamic(THREE, array, size) {
|
|
100015
100171
|
return new THREE.InstancedBufferAttribute(array, size).setUsage(THREE.DynamicDrawUsage);
|
|
100016
100172
|
}
|
|
100017
|
-
var PUFF_DETAIL = 2;
|
|
100018
|
-
function createPuffLayer(THREE, pool, uniforms) {
|
|
100173
|
+
var PUFF_DETAIL = { faceted: 1, soft: 2 };
|
|
100174
|
+
function createPuffLayer(THREE, pool, uniforms, style = "faceted") {
|
|
100019
100175
|
const capacity = pool.capacity;
|
|
100020
100176
|
const geometry = new THREE.InstancedBufferGeometry();
|
|
100021
|
-
geometry.setAttribute("position", new THREE.IcosahedronGeometry(1, PUFF_DETAIL).getAttribute("position"));
|
|
100177
|
+
geometry.setAttribute("position", new THREE.IcosahedronGeometry(1, PUFF_DETAIL[style]).getAttribute("position"));
|
|
100022
100178
|
const a = new Float32Array(capacity * 4);
|
|
100023
100179
|
const d = new Float32Array(capacity * 4);
|
|
100024
100180
|
const c = new Float32Array(capacity * 3);
|
|
@@ -100027,7 +100183,7 @@ void main(){
|
|
|
100027
100183
|
geometry.setAttribute("aD", attributes[1]);
|
|
100028
100184
|
geometry.setAttribute("aC", attributes[2]);
|
|
100029
100185
|
geometry.instanceCount = 0;
|
|
100030
|
-
const material = new THREE.ShaderMaterial({ uniforms, vertexShader: PUFF_VERTEX, fragmentShader: PUFF_FRAGMENT, transparent: true, depthWrite: false });
|
|
100186
|
+
const material = style === "faceted" ? new THREE.ShaderMaterial({ uniforms, vertexShader: PUFF_VERTEX, fragmentShader: PUFF_FRAGMENT }) : new THREE.ShaderMaterial({ uniforms, vertexShader: SOFT_PUFF_VERTEX, fragmentShader: SOFT_PUFF_FRAGMENT, transparent: true, depthWrite: false });
|
|
100031
100187
|
const mesh3 = new THREE.Mesh(geometry, material);
|
|
100032
100188
|
mesh3.name = "vfx-puffs";
|
|
100033
100189
|
mesh3.frustumCulled = false;
|
|
@@ -101349,7 +101505,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
101349
101505
|
uGlowI: { value: 0 },
|
|
101350
101506
|
uTime: { value: 0 }
|
|
101351
101507
|
};
|
|
101352
|
-
const puffs = createPuffLayer(THREE, pools.puffs, uniforms);
|
|
101508
|
+
const puffs = createPuffLayer(THREE, pools.puffs, uniforms, options.puffStyle ?? "faceted");
|
|
101353
101509
|
const sparks2 = createSparkLayer(THREE, pools.sparks);
|
|
101354
101510
|
const glows = createGlowLayer(THREE, pools.glows);
|
|
101355
101511
|
const rockGeometry = new THREE.DodecahedronGeometry(0.5, 0);
|