@adatechnology/game-weapons-three 0.21.3 → 0.21.5
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 +225 -36
- package/dist/index.global.js.map +1 -1
- package/package.json +9 -9
package/dist/index.global.js
CHANGED
|
@@ -15136,6 +15136,10 @@ var GameWeaponsThree = (() => {
|
|
|
15136
15136
|
get fuseRemaining() {
|
|
15137
15137
|
return this.fuseLeft;
|
|
15138
15138
|
}
|
|
15139
|
+
/** Whether this trigger sets it off (`impact` for a rocket or a 40 mm grenade, `timer` for a hand grenade). */
|
|
15140
|
+
isTriggeredBy(trigger) {
|
|
15141
|
+
return this.triggers.has(trigger);
|
|
15142
|
+
}
|
|
15139
15143
|
step(dt, probe) {
|
|
15140
15144
|
const events = [];
|
|
15141
15145
|
if (this.isDone) return events;
|
|
@@ -23965,7 +23969,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23965
23969
|
ricochetDeg: 10,
|
|
23966
23970
|
hitDebris: "chips",
|
|
23967
23971
|
breakDebris: "dust",
|
|
23968
|
-
visual: { innerColor: 12085567 },
|
|
23972
|
+
visual: { innerColor: 12085567, unitColor: 11031866 },
|
|
23969
23973
|
thermal: {
|
|
23970
23974
|
conductivity: 0.15,
|
|
23971
23975
|
heatCapacity: 2.5
|
|
@@ -24906,8 +24910,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24906
24910
|
var PANEL_POINTS_LOADED = 4;
|
|
24907
24911
|
var MEMBER_BAND = 0.1;
|
|
24908
24912
|
var MEMBER_CRATER_CALIBRES = 3.4;
|
|
24909
|
-
var MEMBER_BARED_MAX = 24;
|
|
24910
24913
|
var MEMBER_CUT_LOSS = 0.9;
|
|
24914
|
+
var MEMBER_UNIT_LOSS = 0.12;
|
|
24911
24915
|
var BLAST_EDGE_WEAR = 0.6;
|
|
24912
24916
|
var RESIDUAL_CAPACITY = 0.15;
|
|
24913
24917
|
var SEVER_BAND = 0.1;
|
|
@@ -26838,7 +26842,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26838
26842
|
for (let k = 0; k < 3; k++) len = Math.max(len, Math.min(A.max[k], B.max[k]) - Math.max(A.min[k], B.min[k]));
|
|
26839
26843
|
return len;
|
|
26840
26844
|
};
|
|
26841
|
-
const
|
|
26845
|
+
const isTrim = (p) => (p.spec.structure?.role ?? "none") === "none";
|
|
26846
|
+
const wearJoints = (o, p, amount, near, radius = 0.06, src, split = false, span, blast) => {
|
|
26842
26847
|
if (amount <= 0) return;
|
|
26843
26848
|
const mine = (o.byPart.get(p.spec.id) ?? []).filter((j) => !j.st.open);
|
|
26844
26849
|
if (split && mine.length) amount /= mine.length;
|
|
@@ -26846,6 +26851,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26846
26851
|
if (j.st.open) continue;
|
|
26847
26852
|
if (j.spec.kind === "rebar" && (isReinforced(o.parts[j.ia].spec) || isReinforced(o.parts[j.ib].spec))) continue;
|
|
26848
26853
|
if (near && jointReach(o, j, near) > Math.max(radius, jointReachLimit(o, j))) continue;
|
|
26854
|
+
if (blast && (isTrim(o.parts[j.ia]) || isTrim(o.parts[j.ib])) && jointReach(o, j, blast.point) > Math.max(blast.reach, jointReachLimit(o, j))) continue;
|
|
26849
26855
|
j.st.hp -= span === void 0 ? amount : Math.min(amount, j.st.maxHp) * Math.min(1, span / Math.max(jointLength(o, j), 1e-6));
|
|
26850
26856
|
if (j.st.hp <= 0) {
|
|
26851
26857
|
j.st.hp = 0;
|
|
@@ -26909,6 +26915,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26909
26915
|
const faceArea = (cell) => cell.size[u] * cell.size[v];
|
|
26910
26916
|
const total = cells.reduce((sum2, cell) => sum2 + faceArea(cell), 0) || 1;
|
|
26911
26917
|
const shape = p.spec.units ? "chunk" : FRAGMENT_SHAPE[p.mat.fracture] ?? "chunk";
|
|
26918
|
+
const laid = !!p.spec.units && p.spec.units.mortar !== p.spec.material;
|
|
26912
26919
|
return cells.map((cell, i) => {
|
|
26913
26920
|
const cw = toWorld(c, q, cell.center);
|
|
26914
26921
|
const out = vec.normalize(vec.sub(cw, hitW), [0, 1, 0]);
|
|
@@ -26927,7 +26934,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
26927
26934
|
angularVelocity: [(rnd2() - 0.5) * 8, (rnd2() - 0.5) * 8, (rnd2() - 0.5) * 8],
|
|
26928
26935
|
mass: mass * faceArea(cell) / total,
|
|
26929
26936
|
...marks.length > 0 ? { marks } : {},
|
|
26930
|
-
...inner ? { inner } : {}
|
|
26937
|
+
...inner && laid ? { unit: true } : inner ? { inner } : {}
|
|
26931
26938
|
};
|
|
26932
26939
|
});
|
|
26933
26940
|
};
|
|
@@ -27003,10 +27010,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27003
27010
|
if (!cells?.length) return false;
|
|
27004
27011
|
const [u, v] = planeAxes(p.thin);
|
|
27005
27012
|
const lp = toLocal(p.pos, p.q, objectPoint);
|
|
27013
|
+
if (p.spec.reinforcement && isMember(p.dims) && !p.st.stripped) {
|
|
27014
|
+
const along = p.dims.indexOf(Math.max(...p.dims));
|
|
27015
|
+
const bands = Math.max(1, Math.round(p.dims[along] / MEMBER_BAND));
|
|
27016
|
+
const band = clamp2(Math.floor((lp[along] + p.dims[along] / 2) / p.dims[along] * bands), 0, bands - 1);
|
|
27017
|
+
if ((p.rt.bands?.[band] ?? 0) < MEMBER_CUT_LOSS) return false;
|
|
27018
|
+
}
|
|
27006
27019
|
return cells.some((c) => Math.abs(lp[u] - c.center[u]) <= c.size[u] / 2 && Math.abs(lp[v] - c.center[v]) <= c.size[v] / 2);
|
|
27007
27020
|
};
|
|
27021
|
+
const wornLocally = (p) => !!p.spec.reinforcement && !!p.spec.units && p.spec.units.mortar === p.spec.material && isMember(p.dims) && p.spec.shape.kind === "box";
|
|
27008
27022
|
const wearMember = (o, p, entry2, d, E, caliber, penMm, src) => {
|
|
27009
|
-
var _a, _b;
|
|
27023
|
+
var _a, _b, _c;
|
|
27010
27024
|
if (!p.spec.reinforcement || !p.spec.units || !isMember(p.dims) || p.st.stripped || isLost(p) || p.spec.shape.kind !== "box") return false;
|
|
27011
27025
|
const along = p.dims.indexOf(Math.max(...p.dims));
|
|
27012
27026
|
const lp = toLocal(p.pos, p.q, objLocal(o, entry2));
|
|
@@ -27028,29 +27042,23 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27028
27042
|
worn[band] = after2;
|
|
27029
27043
|
markDamaged(p);
|
|
27030
27044
|
const bandCenter = -p.dims[along] / 2 + (band + 0.5) * height;
|
|
27031
|
-
if (h > REBAR_COVER && after2 < MEMBER_CUT_LOSS) {
|
|
27032
|
-
const bared = (_b = p.rt).bared ?? (_b.bared = []);
|
|
27033
|
-
const center = [lp[0], lp[1], lp[2]];
|
|
27034
|
-
const size = [p.dims[0], p.dims[1], p.dims[2]];
|
|
27035
|
-
for (let a = 0; a < 3; a++) if (Math.abs(ld[a]) < 0.5) size[a] = 2 * r;
|
|
27036
|
-
if (bared.length < MEMBER_BARED_MAX && !bared.some((box5) => box5.center.every((x, a) => Math.abs(x - center[a]) < box5.size[a] / 4))) {
|
|
27037
|
-
bared.push({ center, size });
|
|
27038
|
-
exposeRebar(o, p, src);
|
|
27039
|
-
}
|
|
27040
|
-
}
|
|
27041
|
-
if (before >= MEMBER_CUT_LOSS || after2 < MEMBER_CUT_LOSS) return true;
|
|
27042
|
-
const axisUp = rotateVec(p.q, [0, 0, 0].map((_, k) => k === along ? 1 : 0));
|
|
27043
|
-
const standing = Math.abs(axisUp[1]) > 0.7;
|
|
27044
|
-
const upward = axisUp[1] >= 0 ? 1 : -1;
|
|
27045
27045
|
const grid = gridOf(p);
|
|
27046
|
-
const gone = p.rt.chips ?? {};
|
|
27046
|
+
const gone = (_b = p.rt).chips ?? (_b.chips = {});
|
|
27047
|
+
if (before >= MEMBER_CUT_LOSS || after2 < MEMBER_CUT_LOSS) {
|
|
27048
|
+
if (h <= REBAR_COVER) return true;
|
|
27049
|
+
const [u, v] = planeAxes(p.thin);
|
|
27050
|
+
const hit = grid.findIndex((cell2, i) => gone[i] !== -1 && Math.abs(lp[u] - cell2.center[u]) <= cell2.size[u] / 2 && Math.abs(lp[v] - cell2.center[v]) <= cell2.size[v] / 2);
|
|
27051
|
+
if (hit < 0) return true;
|
|
27052
|
+
const wear = (_c = p.rt).cellWear ?? (_c.cellWear = {});
|
|
27053
|
+
const cell = grid[hit];
|
|
27054
|
+
wear[hit] = (wear[hit] ?? 0) + volume;
|
|
27055
|
+
if (wear[hit] >= MEMBER_UNIT_LOSS * cell.size[0] * cell.size[1] * cell.size[2]) knockOutUnits(o, p, entry2, E, [hit], src);
|
|
27056
|
+
return true;
|
|
27057
|
+
}
|
|
27047
27058
|
const out = [];
|
|
27048
27059
|
for (let i = 0; i < grid.length; i++) {
|
|
27049
27060
|
if (gone[i] === -1) continue;
|
|
27050
|
-
|
|
27051
|
-
const inBand = Math.abs(at4 - bandCenter) <= height / 2 + 1e-6;
|
|
27052
|
-
const above2 = standing && (at4 - bandCenter) * upward > height / 2;
|
|
27053
|
-
if (inBand || above2) out.push(i);
|
|
27061
|
+
if (Math.abs(grid[i].center[along] - bandCenter) <= height / 2 + 1e-6) out.push(i);
|
|
27054
27062
|
}
|
|
27055
27063
|
if (out.length > 0) knockOutUnits(o, p, entry2, E, out, src);
|
|
27056
27064
|
giveAtCut(o, p, src);
|
|
@@ -27641,6 +27649,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27641
27649
|
const chained = trigger !== void 0 && chainDelayOf(p.spec, trigger) !== void 0;
|
|
27642
27650
|
if (chained && p.st.hp <= 0 && p.rt.chainDue === void 0) p.st.hp = Math.min(prev, 1);
|
|
27643
27651
|
if (p.st.hp <= 0 && p.mat.fracture === "none" && !p.spec.explodes) p.st.hp = Math.min(prev, 1);
|
|
27652
|
+
if (p.st.hp <= 0 && type === "ballistic" && wornLocally(p)) p.st.hp = Math.min(prev, 1);
|
|
27644
27653
|
const done = prev - p.st.hp;
|
|
27645
27654
|
if (done > 0) emit2({ ...base(o, src), type: "damage", part: p.spec.id, amount: done, hp: Math.max(0, p.st.hp), damageType: type });
|
|
27646
27655
|
if (p.st.hp <= 0) failPart(o, p, origin, dir, fragEnergy, cap, src);
|
|
@@ -27850,7 +27859,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
27850
27859
|
checkIgnite(o, p, src);
|
|
27851
27860
|
}
|
|
27852
27861
|
}
|
|
27853
|
-
|
|
27862
|
+
const stretch = 2 * BREACH_BLAST_REACH * Math.cbrt(Math.max(0, energy) / 1e3);
|
|
27863
|
+
wearJoints(o, p, Ein * 0.5, void 0, 0, src, false, stretch, { point, reach: stretch });
|
|
27854
27864
|
const amount = Ein * DMG_PER_J * (mat.damageScale?.explosive ?? 1);
|
|
27855
27865
|
if (blastFrontSpeed > 0 && dist2 > 0 && mat.tags?.includes("glass")) {
|
|
27856
27866
|
frontQueue.push({ o, p, due: time + dist2 / blastFrontSpeed, amount, fragEnergy: Ein * 0.3, point, ...src !== void 0 ? { src } : {} });
|
|
@@ -32277,7 +32287,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
32277
32287
|
}
|
|
32278
32288
|
var residentialTower = residentialTowerTemplate();
|
|
32279
32289
|
|
|
32280
|
-
// ../game-floorplan-three/dist/chunk-
|
|
32290
|
+
// ../game-floorplan-three/dist/chunk-FUZURKX2.js
|
|
32281
32291
|
var __defProp4 = Object.defineProperty;
|
|
32282
32292
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
32283
32293
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -38816,6 +38826,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
38816
38826
|
var SPALL_MIN = 0.025;
|
|
38817
38827
|
var SPALL_RAGGED = 0.045;
|
|
38818
38828
|
var COVER2 = 0.015;
|
|
38829
|
+
var LUMP_BAR_INSET = 0.035;
|
|
38830
|
+
var LUMPS_PER_BAR = 1;
|
|
38831
|
+
var LUMP_CHANCE = 0.5;
|
|
38832
|
+
var LUMP_MIN = 0.025;
|
|
38833
|
+
var LUMP_MAX = 0.05;
|
|
38834
|
+
var EDGE_LUMPS = 2;
|
|
38835
|
+
var EDGE_LUMP_MIN = 0.04;
|
|
38836
|
+
var EDGE_LUMP_MAX = 0.08;
|
|
38819
38837
|
var MAX_FLAKES = 64;
|
|
38820
38838
|
function clipToBox(unit, box5) {
|
|
38821
38839
|
const lo = [Math.max(unit.x - unit.sx / 2, box5[0]), Math.max(unit.y - unit.sy / 2, box5[1]), Math.max(unit.z - unit.sz / 2, box5[2])];
|
|
@@ -38861,6 +38879,26 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
38861
38879
|
const dropped = [];
|
|
38862
38880
|
let lod = 0;
|
|
38863
38881
|
const unitGeometry = new THREE.BoxGeometry(1, 1, 1);
|
|
38882
|
+
let lumpShape = null;
|
|
38883
|
+
const lumpGeometry = () => {
|
|
38884
|
+
if (lumpShape) return lumpShape;
|
|
38885
|
+
const g = new THREE.IcosahedronGeometry(0.62, 0).toNonIndexed();
|
|
38886
|
+
const at4 = g.getAttribute("position");
|
|
38887
|
+
const moved = /* @__PURE__ */ new Map();
|
|
38888
|
+
for (let i = 0; i < at4.count; i++) {
|
|
38889
|
+
const key2 = `${at4.getX(i).toFixed(3)},${at4.getY(i).toFixed(3)},${at4.getZ(i).toFixed(3)}`;
|
|
38890
|
+
let k = moved.get(key2);
|
|
38891
|
+
if (k === void 0) {
|
|
38892
|
+
const x = Math.sin(moved.size * 12.9898 + 4.1) * 43758.5453;
|
|
38893
|
+
k = 0.7 + 0.45 * (x - Math.floor(x));
|
|
38894
|
+
moved.set(key2, k);
|
|
38895
|
+
}
|
|
38896
|
+
at4.setXYZ(i, at4.getX(i) * k, at4.getY(i) * k * 0.85, at4.getZ(i) * k);
|
|
38897
|
+
}
|
|
38898
|
+
g.computeVertexNormals();
|
|
38899
|
+
lumpShape = g;
|
|
38900
|
+
return g;
|
|
38901
|
+
};
|
|
38864
38902
|
const tmp = { m: new THREE.Matrix4(), q: new THREE.Quaternion(), p: new THREE.Vector3(), s: new THREE.Vector3(), c: new THREE.Color() };
|
|
38865
38903
|
const local2 = (p) => {
|
|
38866
38904
|
house.updateMatrixWorld(true);
|
|
@@ -39036,6 +39074,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39036
39074
|
const discs = [];
|
|
39037
39075
|
const flakes = [];
|
|
39038
39076
|
const shown = [];
|
|
39077
|
+
const castGone = [];
|
|
39039
39078
|
const pillars = pillarSpans(view);
|
|
39040
39079
|
for (const id of view.parts) {
|
|
39041
39080
|
const part = structure.byId.get(id), units2 = specOf(id).units, chips2 = view.chips.get(id), opening = view.openings.get(id), spalls = view.spalls.get(id);
|
|
@@ -39043,6 +39082,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39043
39082
|
const all = id === view.host ? own.flatMap((c) => besidePillars(c, pillars)) : own;
|
|
39044
39083
|
if (view.fallen.has(id)) {
|
|
39045
39084
|
holes.push(...all);
|
|
39085
|
+
view.kept.set(id, []);
|
|
39046
39086
|
continue;
|
|
39047
39087
|
}
|
|
39048
39088
|
const thick = mask.alongU ? part.aabb[3] - part.aabb[1] : part.aabb[2] - part.aabb[0];
|
|
@@ -39060,6 +39100,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39060
39100
|
const open = (c) => gone(c) || opening !== void 0 && Math.hypot((c.a + c.b) / 2 - along(opening.center), (c.y0 + c.y1) / 2 - opening.center[1]) < opening.radius;
|
|
39061
39101
|
const kept = [];
|
|
39062
39102
|
for (const c of all) (open(c) ? holes : kept).push(c);
|
|
39103
|
+
view.kept.set(id, kept);
|
|
39104
|
+
if (units2.mortar === part.material) {
|
|
39105
|
+
for (const c of all) if (!kept.includes(c)) castGone.push({ c, part, thick, mid });
|
|
39106
|
+
}
|
|
39063
39107
|
for (const c of kept) shown.push({ c, part, units: units2, thick, mid });
|
|
39064
39108
|
for (const box5 of boxes) {
|
|
39065
39109
|
if (holes.some((h) => box5.s0 >= h.a - 1e-4 && box5.s1 <= h.b + 1e-4 && box5.y0 >= h.y0 - 1e-4 && box5.y1 <= h.y1 + 1e-4)) continue;
|
|
@@ -39120,10 +39164,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39120
39164
|
at4(len - 0.012, h - 0.012, thick - 2 * COVER2, tone(base, 0.8 + 0.35 * n));
|
|
39121
39165
|
}
|
|
39122
39166
|
}
|
|
39123
|
-
|
|
39124
|
-
|
|
39125
|
-
view.units.dispose();
|
|
39126
|
-
}
|
|
39167
|
+
const lumps = stuckLumps(castGone, mask, view.bounds);
|
|
39168
|
+
if (view.units) dropUnits(view.units);
|
|
39127
39169
|
const units = new THREE.InstancedMesh(unitGeometry, view.unitMaterial, Math.max(1, list2.length));
|
|
39128
39170
|
units.name = "breach:" + view.host;
|
|
39129
39171
|
list2.forEach((u, i) => {
|
|
@@ -39137,6 +39179,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39137
39179
|
units.castShadow = true;
|
|
39138
39180
|
units.receiveShadow = true;
|
|
39139
39181
|
units.visible = lod === 0;
|
|
39182
|
+
if (lumps.length > 0) units.add(lumpMesh(lumps, view.unitMaterial));
|
|
39140
39183
|
house.add(units);
|
|
39141
39184
|
view.units = units;
|
|
39142
39185
|
view.gone = holes.length;
|
|
@@ -39176,9 +39219,77 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39176
39219
|
spalls: new Map(parts.map((id) => [id, []])),
|
|
39177
39220
|
openings: /* @__PURE__ */ new Map(),
|
|
39178
39221
|
flakes: 0,
|
|
39179
|
-
fallen: /* @__PURE__ */ new Set()
|
|
39222
|
+
fallen: /* @__PURE__ */ new Set(),
|
|
39223
|
+
kept: /* @__PURE__ */ new Map()
|
|
39180
39224
|
};
|
|
39181
39225
|
}
|
|
39226
|
+
function stuckLumps(gone, mask, bounds2) {
|
|
39227
|
+
const out = [];
|
|
39228
|
+
const grey = fragmentMaterial("concrete").color.getHex();
|
|
39229
|
+
const stone = (s, y, d, size, r) => {
|
|
39230
|
+
const centre = mask.start + s;
|
|
39231
|
+
const unit = clipToBox({ x: mask.alongU ? centre : d, y, z: mask.alongU ? d : centre, sx: mask.alongU ? size[0] : size[2], sy: size[1], sz: mask.alongU ? size[2] : size[0], colour: tmp.c.setHex(grey).multiplyScalar(0.85 + 0.2 * r(7)).getHex() }, bounds2);
|
|
39232
|
+
if (unit) out.push(unit);
|
|
39233
|
+
};
|
|
39234
|
+
for (const { c, part, thick, mid } of gone) {
|
|
39235
|
+
const p0 = (mask.alongU ? part.aabb[0] : part.aabb[1]) - mask.start, p1 = (mask.alongU ? part.aabb[2] : part.aabb[3]) - mask.start;
|
|
39236
|
+
const lying = p1 - p0 > part.y1 - part.y0;
|
|
39237
|
+
const random = (seed) => (n) => {
|
|
39238
|
+
const x = Math.sin(seed + n * 3.3) * 43758.5453;
|
|
39239
|
+
return x - Math.floor(x);
|
|
39240
|
+
};
|
|
39241
|
+
const faces = lying ? [[c.a, 1], [c.b, 2]] : [[c.y0, 1], [c.y1, 2]];
|
|
39242
|
+
for (const [face, f] of faces) {
|
|
39243
|
+
const open = gone.some((g) => g.part === part && g.c !== c && (lying ? Math.abs((f === 1 ? g.c.b : g.c.a) - face) < 1e-4 && g.c.y1 > c.y0 + 1e-4 && g.c.y0 < c.y1 - 1e-4 : Math.abs((f === 1 ? g.c.y1 : g.c.y0) - face) < 1e-4 && g.c.b > c.a + 1e-4 && g.c.a < c.b - 1e-4));
|
|
39244
|
+
if (open) continue;
|
|
39245
|
+
for (let k = 0; k < EDGE_LUMPS; k++) {
|
|
39246
|
+
const r = random(c.a * 63.1 + c.y0 * 29.7 + mid * 17.3 + f * 11.1 + k * 5.3);
|
|
39247
|
+
const size = EDGE_LUMP_MIN + (EDGE_LUMP_MAX - EDGE_LUMP_MIN) * r(1);
|
|
39248
|
+
const d = mid + (r(3) - 0.5) * (thick - 2 * LUMP_BAR_INSET);
|
|
39249
|
+
const s = lying ? face : c.a + (0.1 + 0.8 * r(2)) * (c.b - c.a);
|
|
39250
|
+
const y = lying ? c.y0 + (0.1 + 0.8 * r(2)) * (c.y1 - c.y0) : face;
|
|
39251
|
+
stone(s, y, d, [size, size * (0.6 + 0.5 * r(4)), size], r);
|
|
39252
|
+
}
|
|
39253
|
+
}
|
|
39254
|
+
const bars = lying ? [part.y0 + LUMP_BAR_INSET, part.y1 - LUMP_BAR_INSET].filter((y) => y >= c.y0 - 1e-6 && y <= c.y1 + 1e-6) : [p0 + LUMP_BAR_INSET, p1 - LUMP_BAR_INSET].filter((s) => s >= c.a - 1e-6 && s <= c.b + 1e-6);
|
|
39255
|
+
for (const bar2 of bars) {
|
|
39256
|
+
for (const side of [-1, 1]) {
|
|
39257
|
+
const d = mid + side * (thick / 2 - LUMP_BAR_INSET);
|
|
39258
|
+
for (let k = 0; k < LUMPS_PER_BAR; k++) {
|
|
39259
|
+
const r = random(bar2 * 91.7 + d * 47.3 + c.y0 * 113.1 + c.a * 19.9 + k * 7.9);
|
|
39260
|
+
if (r(1) > LUMP_CHANCE) continue;
|
|
39261
|
+
const at4 = 0.15 + 0.7 * r(2), jitter = (r(6) - 0.5) * 0.02;
|
|
39262
|
+
const s = lying ? c.a + at4 * (c.b - c.a) : bar2 + jitter;
|
|
39263
|
+
const y = lying ? bar2 + jitter : c.y0 + at4 * (c.y1 - c.y0);
|
|
39264
|
+
stone(s, y, d, [LUMP_MIN + (LUMP_MAX - LUMP_MIN) * r(3), LUMP_MIN + (LUMP_MAX - LUMP_MIN) * r(4), LUMP_MIN + (LUMP_MAX - LUMP_MIN) * r(5)], r);
|
|
39265
|
+
}
|
|
39266
|
+
}
|
|
39267
|
+
}
|
|
39268
|
+
}
|
|
39269
|
+
return out;
|
|
39270
|
+
}
|
|
39271
|
+
function dropUnits(units) {
|
|
39272
|
+
for (const child of [...units.children]) if (child instanceof THREE.InstancedMesh) child.dispose();
|
|
39273
|
+
units.removeFromParent();
|
|
39274
|
+
units.dispose();
|
|
39275
|
+
}
|
|
39276
|
+
function lumpMesh(lumps, material) {
|
|
39277
|
+
const mesh3 = new THREE.InstancedMesh(lumpGeometry(), material, lumps.length);
|
|
39278
|
+
mesh3.name = "breach-lumps";
|
|
39279
|
+
lumps.forEach((u, i) => {
|
|
39280
|
+
const r = (n) => {
|
|
39281
|
+
const x = Math.sin(u.x * 71.3 + u.y * 37.9 + u.z * 53.1 + n * 9.7) * 43758.5453;
|
|
39282
|
+
return x - Math.floor(x);
|
|
39283
|
+
};
|
|
39284
|
+
tmp.q.setFromEuler(new THREE.Euler(r(1) * Math.PI, r(2) * Math.PI, r(3) * Math.PI));
|
|
39285
|
+
tmp.m.compose(tmp.p.set(u.x, u.y, u.z), tmp.q, tmp.s.set(u.sx, u.sy, u.sz));
|
|
39286
|
+
mesh3.setMatrixAt(i, tmp.m);
|
|
39287
|
+
mesh3.setColorAt(i, tmp.c.setHex(u.colour));
|
|
39288
|
+
});
|
|
39289
|
+
mesh3.castShadow = true;
|
|
39290
|
+
mesh3.receiveShadow = true;
|
|
39291
|
+
return mesh3;
|
|
39292
|
+
}
|
|
39182
39293
|
function cut(view) {
|
|
39183
39294
|
if (view.saved) return;
|
|
39184
39295
|
view.shells = view.items.map((it) => shell(it, view.mask));
|
|
@@ -39263,10 +39374,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39263
39374
|
paintQueues.add(queue);
|
|
39264
39375
|
function dispose(view) {
|
|
39265
39376
|
dirty.delete(view);
|
|
39266
|
-
if (view.units)
|
|
39267
|
-
view.units.removeFromParent();
|
|
39268
|
-
view.units.dispose();
|
|
39269
|
-
}
|
|
39377
|
+
if (view.units) dropUnits(view.units);
|
|
39270
39378
|
view.unitMaterial.dispose();
|
|
39271
39379
|
for (const m of view.shells) {
|
|
39272
39380
|
m.removeFromParent();
|
|
@@ -39277,6 +39385,15 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39277
39385
|
view.core.texture.dispose();
|
|
39278
39386
|
}
|
|
39279
39387
|
return {
|
|
39388
|
+
/**
|
|
39389
|
+
* What still stands of the units of `partId` once its wall is cut, as drawn: spans along the wall from `start` (in the house's space, along u when
|
|
39390
|
+
* `alongU`) and up. Null while the wall is whole (all of the part stands).
|
|
39391
|
+
*/
|
|
39392
|
+
standing(partId) {
|
|
39393
|
+
const hostId = hostOf(partId), view = hostId ? views.get(hostId) : void 0;
|
|
39394
|
+
const spans = view?.saved ? view.kept.get(partId) : void 0;
|
|
39395
|
+
return view && spans ? { spans, alongU: view.mask.alongU, start: view.mask.start } : null;
|
|
39396
|
+
},
|
|
39280
39397
|
/** Handles a `stage` event of the house's object. Returns true when the wall was cut. */
|
|
39281
39398
|
stage(event) {
|
|
39282
39399
|
return event.stage === 2 && !!event.opening ? draw2(event.part, { opening: event.opening }) : false;
|
|
@@ -39671,13 +39788,48 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
39671
39788
|
breach.flush(Infinity);
|
|
39672
39789
|
}, FOLLOW_FLUSH_FALLBACK_MS);
|
|
39673
39790
|
});
|
|
39791
|
+
const holders = /* @__PURE__ */ new Map();
|
|
39792
|
+
const holderOf = (pid) => {
|
|
39793
|
+
const known = holders.get(pid) ?? id;
|
|
39794
|
+
if (world.part(known, pid)) return known;
|
|
39795
|
+
for (const other of world.ids()) if (world.part(other, pid)) {
|
|
39796
|
+
holders.set(pid, other);
|
|
39797
|
+
return other;
|
|
39798
|
+
}
|
|
39799
|
+
return null;
|
|
39800
|
+
};
|
|
39801
|
+
const at4 = new THREE.Vector3(), turn2 = new THREE.Quaternion();
|
|
39802
|
+
const inSpec = (objectId, x, y, z) => {
|
|
39803
|
+
const o = world.state(objectId);
|
|
39804
|
+
if (!o) return null;
|
|
39805
|
+
const r = o.rotation;
|
|
39806
|
+
return at4.set(x - o.position[0], y - o.position[1], z - o.position[2]).applyQuaternion(turn2.set(r[0], r[1], r[2], r[3]).invert());
|
|
39807
|
+
};
|
|
39808
|
+
const blocks = (x, z, radius, y0, y1) => {
|
|
39809
|
+
for (const part of structure.parts) {
|
|
39810
|
+
const holder = holderOf(part.id), state = holder ? world.part(holder, part.id) : null;
|
|
39811
|
+
if (!holder || !state || state.status !== "intact" && state.status !== "damaged" && state.status !== "collapsed") continue;
|
|
39812
|
+
const low = inSpec(holder, x, y0, z);
|
|
39813
|
+
if (!low) continue;
|
|
39814
|
+
const ly0 = low.y, high = inSpec(holder, x, y1, z), ly1 = high.y, lx = high.x, lz = high.z;
|
|
39815
|
+
if (part.y1 <= Math.min(ly0, ly1) || part.y0 >= Math.max(ly0, ly1)) continue;
|
|
39816
|
+
const [u0, v0, u1, v1] = part.aabb, du = Math.max(u0 - lx, 0, lx - u1), dv = Math.max(v0 - lz, 0, lz - v1);
|
|
39817
|
+
if (du * du + dv * dv >= radius * radius) continue;
|
|
39818
|
+
const left = breach.standing(part.id);
|
|
39819
|
+
if (!left) return true;
|
|
39820
|
+
const s0 = (left.alongU ? lx : lz) - left.start;
|
|
39821
|
+
if (left.spans.some((c) => c.b > s0 - radius && c.a < s0 + radius && c.y1 > Math.min(ly0, ly1) && c.y0 < Math.max(ly0, ly1))) return true;
|
|
39822
|
+
}
|
|
39823
|
+
return false;
|
|
39824
|
+
};
|
|
39825
|
+
const owns = (objectId) => objectId === id || [...holders.values()].includes(objectId);
|
|
39674
39826
|
return { restore: () => breach.restore(), dispose: () => {
|
|
39675
39827
|
offFollow();
|
|
39676
39828
|
breach.restore();
|
|
39677
39829
|
breach.release();
|
|
39678
39830
|
}, update: () => {
|
|
39679
39831
|
breach.flush();
|
|
39680
|
-
} };
|
|
39832
|
+
}, blocks, owns };
|
|
39681
39833
|
};
|
|
39682
39834
|
D.piece = (id) => D.active ? D.world.part(D.id, id) : null;
|
|
39683
39835
|
D.state = () => D.active ? D.world.state(D.id) : null;
|
|
@@ -70535,6 +70687,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
70535
70687
|
catalog: () => [.../* @__PURE__ */ new Set([...Object.keys(explosions), ...Object.keys(aliases)])]
|
|
70536
70688
|
};
|
|
70537
70689
|
}
|
|
70690
|
+
var DEGREES = 180 / Math.PI;
|
|
70538
70691
|
|
|
70539
70692
|
// ../game-vfx-three/dist/chunk-HJXLYDNY.js
|
|
70540
70693
|
var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
|
|
@@ -72050,6 +72203,42 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
72050
72203
|
}
|
|
72051
72204
|
var LIGHT_BUDGET = EVENT_BUDGET.blastLights + EVENT_BUDGET.fireLights;
|
|
72052
72205
|
|
|
72206
|
+
// ../game-vfx-three/dist/index.js
|
|
72207
|
+
var NOISE = `float wHash(vec2 p){return fract(sin(dot(p,vec2(12.9898,78.233)))*43758.5453);}
|
|
72208
|
+
float wNoise(vec2 p){vec2 i=floor(p);vec2 f=fract(p);f=f*f*(3.-2.*f);return mix(mix(wHash(i),wHash(i+vec2(1.,0.)),f.x),mix(wHash(i+vec2(0.,1.)),wHash(i+vec2(1.,1.)),f.x),f.y);}`;
|
|
72209
|
+
var OUTPUT = `
|
|
72210
|
+
#include <tonemapping_fragment>
|
|
72211
|
+
#include <colorspace_fragment>`;
|
|
72212
|
+
var WATER_SURFACE_FRAGMENT = `uniform vec3 uFoam;varying vec2 vU;varying vec3 vD;${NOISE}
|
|
72213
|
+
void main(){float r=length(vU);if(r>1.)discard;float a=atan(vU.y,vU.x);float kind=vD.y;float s=vD.z;float m;
|
|
72214
|
+
if(kind>2.5){float n=wNoise(vU*7.+s*13.)*.6+wNoise(vU*19.-s*7.)*.4;m=smoothstep(1.,.55,r)*smoothstep(.25,.6,n);}
|
|
72215
|
+
else{float w=kind>1.5?.16:kind>.5?.05:.09;float band=smoothstep(1.,1.-w,r)*smoothstep(1.-w*3.,1.-w,r);float broken=kind>.5?1.:.65+.35*wNoise(vec2(a*5.+s*20.,s));m=band*broken;}
|
|
72216
|
+
float alpha=m*vD.x;if(alpha<.004)discard;gl_FragColor=vec4(uFoam,alpha);${OUTPUT}
|
|
72217
|
+
}`;
|
|
72218
|
+
var WATER_SPRITE_FRAGMENT = `uniform vec3 uFoam;uniform vec3 uDeep;varying vec2 vU;varying vec3 vD;${NOISE}
|
|
72219
|
+
void main(){float r=length(vU);if(r>1.)discard;float kind=vD.y;float m;vec3 c=uFoam;
|
|
72220
|
+
if(kind>1.5){m=exp(-r*r*3.)*(.75+.25*wNoise(vU*3.+vD.z*9.));}
|
|
72221
|
+
else if(kind>.5){m=smoothstep(.55,.85,r)*smoothstep(1.,.88,r)+.25*smoothstep(.5,.2,length(vU-vec2(-.3,.3)));c=mix(uDeep,uFoam,.8);}
|
|
72222
|
+
else{m=smoothstep(1.,.6,r);c=mix(uDeep,uFoam,.55+.45*smoothstep(.2,.8,1.-length(vU-vec2(-.3,.35))));}
|
|
72223
|
+
float alpha=m*vD.x;if(alpha<.004)discard;gl_FragColor=vec4(c,alpha);${OUTPUT}
|
|
72224
|
+
}`;
|
|
72225
|
+
var WATER_COLUMN_VERTEX = `attribute vec4 aP;attribute vec4 aD;attribute vec2 aK;varying float vY;varying float vA;varying vec2 vK;varying float vF;${NOISE}
|
|
72226
|
+
void main(){vY=position.y;float ang=atan(position.z,position.x);vK=aK;
|
|
72227
|
+
float dome=aK.x;float s=aK.y;float h=position.y;
|
|
72228
|
+
float jag=.8+.4*wNoise(vec2(ang*3.+s*17.,h*4.+s));
|
|
72229
|
+
float flare=dome>.5?1.:(.55+.9*h*h)*jag;
|
|
72230
|
+
vec3 p=vec3(position.x*aP.w*flare,position.y*aD.x,position.z*aP.w*flare);
|
|
72231
|
+
p.x+=aD.z*aD.x*h*h;p.z+=aD.w*aD.x*h*h;
|
|
72232
|
+
vec3 w=aP.xyz+p;vec3 n=normalize(vec3(position.x,dome>.5?position.y:.25,position.z));
|
|
72233
|
+
vec3 v=normalize(cameraPosition-w);vF=abs(dot(n,v));
|
|
72234
|
+
vA=aD.y;gl_Position=projectionMatrix*viewMatrix*vec4(w,1.);}`;
|
|
72235
|
+
var WATER_COLUMN_FRAGMENT = `uniform vec3 uFoam;uniform vec3 uDeep;varying float vY;varying float vA;varying vec2 vK;varying float vF;${NOISE}
|
|
72236
|
+
void main(){float dome=vK.x;float s=vK.y;
|
|
72237
|
+
float streak=wNoise(vec2(gl_FragCoord.x*.05+s*31.,vY*6.+s));
|
|
72238
|
+
float body=dome>.5?mix(.95,.5,vY)*(.6+.4*(1.-vF)):(1.-smoothstep(.55,1.,vY))*(.45+.55*streak)*(.55+.45*(1.-vF*.6));
|
|
72239
|
+
vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)discard;gl_FragColor=vec4(c,alpha);${OUTPUT}
|
|
72240
|
+
}`;
|
|
72241
|
+
|
|
72053
72242
|
// src/fx/effects.ts
|
|
72054
72243
|
var FLASH_BY_CASE = { shell: 1.6, big: 2.6, tiny: 0.5, pistol: 0.8, rifle: 1.2 };
|
|
72055
72244
|
var VIEWMODEL_EFFECT_IDS = { flash: "viewmodel_muzzle_flash", smoke: "weapon_smoke_puff", backblast: "launcher_backblast", flameJet: "flame_jet" };
|