@adatechnology/game-items-three 0.8.4 → 0.8.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 +176 -20
- package/dist/index.global.js.map +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -16109,6 +16109,58 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16109
16109
|
if (ductility >= 0.3) return 1;
|
|
16110
16110
|
return (1 + 4 * (0.3 - ductility) / 0.3) * Math.min(25, Math.max(1, (0.02 / Math.max(thickness, 1e-4)) ** 2));
|
|
16111
16111
|
};
|
|
16112
|
+
var SWEEP_BROAD_SLACK = 1e-3;
|
|
16113
|
+
var sweptBounds = (origins, direction, length) => {
|
|
16114
|
+
if (origins.length === 0 || !Number.isFinite(length)) return null;
|
|
16115
|
+
const min = [Infinity, Infinity, Infinity];
|
|
16116
|
+
const max = [-Infinity, -Infinity, -Infinity];
|
|
16117
|
+
for (const origin of origins) {
|
|
16118
|
+
for (let k = 0; k < 3; k++) {
|
|
16119
|
+
const end = origin[k] + direction[k] * length;
|
|
16120
|
+
min[k] = Math.min(min[k], origin[k], end);
|
|
16121
|
+
max[k] = Math.max(max[k], origin[k], end);
|
|
16122
|
+
}
|
|
16123
|
+
}
|
|
16124
|
+
for (let k = 0; k < 3; k++) {
|
|
16125
|
+
if (!Number.isFinite(min[k]) || !Number.isFinite(max[k])) return null;
|
|
16126
|
+
min[k] -= SWEEP_BROAD_SLACK;
|
|
16127
|
+
max[k] += SWEEP_BROAD_SLACK;
|
|
16128
|
+
}
|
|
16129
|
+
return { min, max };
|
|
16130
|
+
};
|
|
16131
|
+
var sphereTouchesBounds = (bounds, centre, radius) => {
|
|
16132
|
+
let distanceSquared = 0;
|
|
16133
|
+
for (let k = 0; k < 3; k++) {
|
|
16134
|
+
const below = bounds.min[k] - centre[k];
|
|
16135
|
+
const above = centre[k] - bounds.max[k];
|
|
16136
|
+
if (below > 0) distanceSquared += below * below;
|
|
16137
|
+
else if (above > 0) distanceSquared += above * above;
|
|
16138
|
+
}
|
|
16139
|
+
return distanceSquared <= radius * radius;
|
|
16140
|
+
};
|
|
16141
|
+
var boundsTouch = (a, b) => a.min[0] <= b.max[0] && a.max[0] >= b.min[0] && a.min[1] <= b.max[1] && a.max[1] >= b.min[1] && a.min[2] <= b.max[2] && a.max[2] >= b.min[2];
|
|
16142
|
+
var boundsInFrame = (bounds, position, rotation) => {
|
|
16143
|
+
const inverse = quat.conjugate(rotation);
|
|
16144
|
+
const centre = [(bounds.min[0] + bounds.max[0]) / 2 - position[0], (bounds.min[1] + bounds.max[1]) / 2 - position[1], (bounds.min[2] + bounds.max[2]) / 2 - position[2]];
|
|
16145
|
+
const size = [bounds.max[0] - bounds.min[0], bounds.max[1] - bounds.min[1], bounds.max[2] - bounds.min[2]];
|
|
16146
|
+
return aabbOf({ kind: "box", size }, rotateVec(inverse, centre), inverse);
|
|
16147
|
+
};
|
|
16148
|
+
var rayMissesBounds = (origin, direction, maxDistance, bounds) => {
|
|
16149
|
+
let near = 0;
|
|
16150
|
+
let far = maxDistance;
|
|
16151
|
+
for (let k = 0; k < 3; k++) {
|
|
16152
|
+
if (direction[k] === 0) {
|
|
16153
|
+
if (origin[k] < bounds.min[k] || origin[k] > bounds.max[k]) return true;
|
|
16154
|
+
continue;
|
|
16155
|
+
}
|
|
16156
|
+
const a = (bounds.min[k] - origin[k]) / direction[k];
|
|
16157
|
+
const b = (bounds.max[k] - origin[k]) / direction[k];
|
|
16158
|
+
near = Math.max(near, Math.min(a, b));
|
|
16159
|
+
far = Math.min(far, Math.max(a, b));
|
|
16160
|
+
if (near > far) return true;
|
|
16161
|
+
}
|
|
16162
|
+
return false;
|
|
16163
|
+
};
|
|
16112
16164
|
var THIN_SHEET_DISHING = 5e-3;
|
|
16113
16165
|
var SWEEP_BACK = 0.01;
|
|
16114
16166
|
function sweepOrigins(box4, d, spacing) {
|
|
@@ -16293,6 +16345,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16293
16345
|
const ignitionRules = resolveIgnitionRules(options.ignition);
|
|
16294
16346
|
const breachBlastFactor = options.breach?.blastFactor ?? BREACH_BLAST_FACTOR;
|
|
16295
16347
|
const chipEnergy = options.breach?.chipEnergy ?? CHIP_ENERGY;
|
|
16348
|
+
const broadPhase = options.broadPhase ?? true;
|
|
16296
16349
|
const chainLinkCap = options.chainLinksPerUpdate !== void 0 && options.chainLinksPerUpdate >= 1 ? Math.floor(options.chainLinksPerUpdate) : Infinity;
|
|
16297
16350
|
const rng3 = createRng(options.seed ?? 1);
|
|
16298
16351
|
const rnd = () => rng3.next();
|
|
@@ -16398,6 +16451,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16398
16451
|
unsup: [],
|
|
16399
16452
|
anyAnchor: false,
|
|
16400
16453
|
order: ++orderCounter,
|
|
16454
|
+
loose: carry?.loose ?? false,
|
|
16401
16455
|
base: { pos: [pos[0], pos[1], pos[2]], rot: [rot[0], rot[1], rot[2], rot[3]] }
|
|
16402
16456
|
};
|
|
16403
16457
|
for (const ps of spec.parts) {
|
|
@@ -17885,17 +17939,90 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17885
17939
|
if (disc < 0) return true;
|
|
17886
17940
|
return -b - Math.sqrt(disc) > maxDist;
|
|
17887
17941
|
};
|
|
17888
|
-
const
|
|
17942
|
+
const worldCentres = /* @__PURE__ */ new WeakMap();
|
|
17943
|
+
const worldCentreOf = (o) => {
|
|
17944
|
+
const p = o.st.position, q = o.st.rotation, c = o.bc;
|
|
17945
|
+
const known = worldCentres.get(o);
|
|
17946
|
+
if (known) {
|
|
17947
|
+
const k = known.key;
|
|
17948
|
+
if (k[0] === p[0] && k[1] === p[1] && k[2] === p[2] && k[3] === q[0] && k[4] === q[1] && k[5] === q[2] && k[6] === q[3] && k[7] === c[0] && k[8] === c[1] && k[9] === c[2]) return known.centre;
|
|
17949
|
+
}
|
|
17950
|
+
const centre = toWorld(p, q, c);
|
|
17951
|
+
worldCentres.set(o, { key: [p[0], p[1], p[2], q[0], q[1], q[2], q[3], c[0], c[1], c[2]], centre });
|
|
17952
|
+
return centre;
|
|
17953
|
+
};
|
|
17954
|
+
const implPartBox = (im, ps) => {
|
|
17955
|
+
const ov = im.poses.get(ps.id);
|
|
17956
|
+
return aabbOf(ps.shape, toWorld(im.position, im.rotation, ov?.pos ?? ps.position), quat.mul(im.rotation, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0])));
|
|
17957
|
+
};
|
|
17958
|
+
const implBounds = /* @__PURE__ */ new WeakMap();
|
|
17959
|
+
const implBoundsOf = (im) => {
|
|
17960
|
+
const spec = im.impl.describe();
|
|
17961
|
+
const p = im.position, q = im.rotation;
|
|
17962
|
+
const known = implBounds.get(im);
|
|
17963
|
+
if (known && known.spec === spec) {
|
|
17964
|
+
const k = known.key;
|
|
17965
|
+
if (k[0] === p[0] && k[1] === p[1] && k[2] === p[2] && k[3] === q[0] && k[4] === q[1] && k[5] === q[2] && k[6] === q[3] && k[7] === im.posesVersion) return known.bounds;
|
|
17966
|
+
}
|
|
17967
|
+
const min = [Infinity, Infinity, Infinity];
|
|
17968
|
+
const max = [-Infinity, -Infinity, -Infinity];
|
|
17969
|
+
for (const ps of spec.parts) {
|
|
17970
|
+
const box4 = implPartBox(im, ps);
|
|
17971
|
+
for (let k = 0; k < 3; k++) {
|
|
17972
|
+
min[k] = Math.min(min[k], box4.min[k] - SWEEP_BROAD_SLACK);
|
|
17973
|
+
max[k] = Math.max(max[k], box4.max[k] + SWEEP_BROAD_SLACK);
|
|
17974
|
+
}
|
|
17975
|
+
}
|
|
17976
|
+
const bounds = { min, max };
|
|
17977
|
+
implBounds.set(im, { spec, key: [p[0], p[1], p[2], q[0], q[1], q[2], q[3], im.posesVersion], bounds });
|
|
17978
|
+
return bounds;
|
|
17979
|
+
};
|
|
17980
|
+
const sweepScope = (origins, d, length, ignore) => {
|
|
17981
|
+
const bounds = sweptBounds(origins, d, length);
|
|
17982
|
+
if (!bounds) return null;
|
|
17983
|
+
const scoped = [];
|
|
17984
|
+
const parts = /* @__PURE__ */ new Map();
|
|
17985
|
+
for (const o of objects.values()) {
|
|
17986
|
+
if (!sphereTouchesBounds(bounds, worldCentreOf(o), o.br + SWEEP_BROAD_SLACK)) continue;
|
|
17987
|
+
const local = boundsInFrame(bounds, o.st.position, o.st.rotation);
|
|
17988
|
+
const near = o.parts.filter((p) => !isLost(p) && !ignore.has(`${o.id}\0${p.spec.id}`) && sphereTouchesBounds(local, p.pos, p.bound + PART_BOUND_SLACK + SWEEP_BROAD_SLACK));
|
|
17989
|
+
if (near.length === 0) continue;
|
|
17990
|
+
scoped.push(o);
|
|
17991
|
+
parts.set(o, near);
|
|
17992
|
+
}
|
|
17993
|
+
const scopedImpls = [];
|
|
17994
|
+
const implParts2 = /* @__PURE__ */ new Map();
|
|
17995
|
+
for (const im of impls.values()) {
|
|
17996
|
+
if (!boundsTouch(bounds, implBoundsOf(im))) continue;
|
|
17997
|
+
const near = im.impl.describe().parts.filter((ps) => !ignore.has(`${im.impl.id}\0${ps.id}`) && boundsTouch(bounds, implPartBox(im, ps)));
|
|
17998
|
+
if (near.length === 0) continue;
|
|
17999
|
+
scopedImpls.push(im);
|
|
18000
|
+
implParts2.set(im, near);
|
|
18001
|
+
}
|
|
18002
|
+
return { objects: scoped, parts, impls: scopedImpls, implParts: implParts2 };
|
|
18003
|
+
};
|
|
18004
|
+
let sweepCounts = null;
|
|
18005
|
+
let lastSweep = { objectVisits: 0, partVisits: 0, shapeTests: 0, shapeTested: [] };
|
|
18006
|
+
const raycastInternal = (origin, dir, maxDist, ignore, worldOnly = false, precise = false, skip = {}, scope) => {
|
|
17889
18007
|
const d = vec.normalize(dir);
|
|
18008
|
+
const minRadius = skip.minObjectRadius ?? 0;
|
|
17890
18009
|
let best = null;
|
|
17891
|
-
|
|
17892
|
-
|
|
18010
|
+
const counts = sweepCounts;
|
|
18011
|
+
for (const o of scope ? scope.objects : objects.values()) {
|
|
18012
|
+
if (counts) counts.objectVisits++;
|
|
18013
|
+
if (skip.skipLoose && o.loose || o.br < minRadius) continue;
|
|
18014
|
+
if (raySphereMiss(origin, d, worldCentreOf(o), o.br, best ? Math.min(maxDist, best.distance) : maxDist)) continue;
|
|
17893
18015
|
const qi = quat.conjugate(o.st.rotation);
|
|
17894
18016
|
const lo = rotateVec(qi, vec.sub(origin, o.st.position));
|
|
17895
18017
|
const ld = rotateVec(qi, d);
|
|
17896
|
-
for (const p of o.parts) {
|
|
18018
|
+
for (const p of scope?.parts.get(o) ?? o.parts) {
|
|
18019
|
+
if (counts) counts.partVisits++;
|
|
17897
18020
|
if (isLost(p) || ignore?.has(`${o.id}\0${p.spec.id}`)) continue;
|
|
17898
18021
|
if (partSphereMiss(lo, ld, p, maxDist)) continue;
|
|
18022
|
+
if (counts) {
|
|
18023
|
+
counts.shapeTests++;
|
|
18024
|
+
counts.shapeTested.add(o.id);
|
|
18025
|
+
}
|
|
17899
18026
|
const r = rayPart(o, p, origin, d);
|
|
17900
18027
|
if (!r || r.t0 < 0 || r.t0 > maxDist) continue;
|
|
17901
18028
|
if (p.st.opening && insideOpening(o, p, objLocal(o, vec.madd(origin, d, r.t0)))) continue;
|
|
@@ -17904,10 +18031,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
17904
18031
|
if (!best || r.t0 < best.distance) best = { object: o.id, part: p.spec.id, point: vec.madd(origin, d, r.t0), normal: r.n, distance: r.t0, pathLen: r.t1 - r.t0 };
|
|
17905
18032
|
}
|
|
17906
18033
|
}
|
|
17907
|
-
for (const im of worldOnly ? [] : impls.values()) {
|
|
18034
|
+
for (const im of worldOnly ? [] : scope ? scope.impls : impls.values()) {
|
|
18035
|
+
if (counts) counts.objectVisits++;
|
|
18036
|
+
if (!scope && broadPhase && rayMissesBounds(origin, d, maxDist, implBoundsOf(im))) continue;
|
|
17908
18037
|
let boxHit = null;
|
|
17909
|
-
for (const ps of im.impl.describe().parts) {
|
|
18038
|
+
for (const ps of scope?.implParts.get(im) ?? im.impl.describe().parts) {
|
|
18039
|
+
if (counts) counts.partVisits++;
|
|
17910
18040
|
if (ignore?.has(`${im.impl.id}\0${ps.id}`)) continue;
|
|
18041
|
+
if (counts) {
|
|
18042
|
+
counts.shapeTests++;
|
|
18043
|
+
counts.shapeTested.add(im.impl.id);
|
|
18044
|
+
}
|
|
17911
18045
|
const ov = im.poses.get(ps.id);
|
|
17912
18046
|
const r = rayPartRaw(im.position, im.rotation, ps, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0]), origin, d, ov?.pos);
|
|
17913
18047
|
if (!r || r.t1 < 0 || r.t0 > maxDist) continue;
|
|
@@ -18115,6 +18249,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18115
18249
|
return covered / length;
|
|
18116
18250
|
};
|
|
18117
18251
|
const isTrim = (p) => (p.spec.structure?.role ?? "none") === "none";
|
|
18252
|
+
const fixesTrim = (o, j) => isTrim(o.parts[j.ia]) !== isTrim(o.parts[j.ib]);
|
|
18118
18253
|
const wearJoints = (o, p, amount, near, radius = 0.06, src, split = false, span, blast) => {
|
|
18119
18254
|
if (amount <= 0) return;
|
|
18120
18255
|
const mine = (o.byPart.get(p.spec.id) ?? []).filter((j) => !j.st.open);
|
|
@@ -18123,7 +18258,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
18123
18258
|
if (j.st.open) continue;
|
|
18124
18259
|
if (j.spec.kind === "rebar" && (isReinforced(o.parts[j.ia].spec) || isReinforced(o.parts[j.ib].spec))) continue;
|
|
18125
18260
|
if (near && jointReach(o, j, near) > Math.max(radius, jointReachLimit(o, j))) continue;
|
|
18126
|
-
if (blast && (
|
|
18261
|
+
if (blast && fixesTrim(o, j) && jointReach(o, j, blast.point) > Math.max(blast.reach, jointReachLimit(o, j))) continue;
|
|
18127
18262
|
j.st.hp -= span === void 0 ? amount : Math.min(amount, j.st.maxHp) * Math.min(1, span / Math.max(jointLength(o, j), 1e-6));
|
|
18128
18263
|
if (j.st.hp <= 0 && blast && span !== void 0 && onFoundation(o, j) && wornShare(o, j, blast.point, span) < JOINT_OPEN_SHARE) j.st.hp = Math.min(j.st.maxHp, 1);
|
|
18129
18264
|
if (j.st.hp <= 0) {
|
|
@@ -19858,7 +19993,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19858
19993
|
register(impl, opts = {}) {
|
|
19859
19994
|
const id = opts.id ?? impl.id;
|
|
19860
19995
|
if (taken(id)) throw new Error(`object "${id}" already exists`);
|
|
19861
|
-
impls.set(id, { impl, position: opts.position ?? [0, 0, 0], rotation: opts.rotation ?? [0, 0, 0, 1], poses: /* @__PURE__ */ new Map() });
|
|
19996
|
+
impls.set(id, { impl, position: opts.position ?? [0, 0, 0], rotation: opts.rotation ?? [0, 0, 0, 1], poses: /* @__PURE__ */ new Map(), posesVersion: 0 });
|
|
19862
19997
|
return id;
|
|
19863
19998
|
},
|
|
19864
19999
|
setPartPose(objectId, partId, position, rotation) {
|
|
@@ -19867,6 +20002,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19867
20002
|
if (im) {
|
|
19868
20003
|
im.impl.setPartPose?.(partId, position, rotation);
|
|
19869
20004
|
im.poses.set(partId, { pos: [position[0], position[1], position[2]], q });
|
|
20005
|
+
im.posesVersion++;
|
|
19870
20006
|
return;
|
|
19871
20007
|
}
|
|
19872
20008
|
const o = getObj(objectId);
|
|
@@ -19922,7 +20058,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19922
20058
|
const inNew = (pid) => moved.has(pid);
|
|
19923
20059
|
const inOld = (pid) => !moved.has(pid);
|
|
19924
20060
|
const pos = o.st.position, rot = o.st.rotation;
|
|
19925
|
-
const fresh = build(sub(inNew), nid, pos, rot, carryFor(inNew, (a, b) => inNew(a) && inNew(b)));
|
|
20061
|
+
const fresh = build(sub(inNew), nid, pos, rot, { ...carryFor(inNew, (a, b) => inNew(a) && inNew(b)), loose: true });
|
|
19926
20062
|
const restCarry = carryFor(inOld, (a, b) => !(inNew(a) && inNew(b)));
|
|
19927
20063
|
if (o.st.soil) restCarry.soil = o.st.soil;
|
|
19928
20064
|
if (o.soil?.sets.size) restCarry.soilSets = Object.fromEntries(o.soil.sets);
|
|
@@ -19994,8 +20130,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19994
20130
|
if (!(loss.radius > 0) || !(loss.depth > 0) || !Number.isFinite(loss.x) || !Number.isFinite(loss.z)) return;
|
|
19995
20131
|
pendingLosses.push({ ...loss });
|
|
19996
20132
|
},
|
|
19997
|
-
raycast(origin, direction, maxDistance = Infinity) {
|
|
19998
|
-
const r = raycastInternal(origin, direction, maxDistance, void 0, false, true);
|
|
20133
|
+
raycast(origin, direction, maxDistance = Infinity, options2) {
|
|
20134
|
+
const r = raycastInternal(origin, direction, maxDistance, void 0, false, true, options2);
|
|
19999
20135
|
return r ? { object: r.object, part: r.part, point: r.point, normal: r.normal, distance: r.distance } : null;
|
|
20000
20136
|
},
|
|
20001
20137
|
sweepBox(box4, direction, distance2, options2 = {}) {
|
|
@@ -20009,13 +20145,26 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20009
20145
|
else if (hosted) for (const p of hosted.impl.describe().parts) ignore.add(`${hosted.impl.id}\0${p.id}`);
|
|
20010
20146
|
}
|
|
20011
20147
|
let best = null;
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20148
|
+
const origins = sweepOrigins(box4, d, options2.spacing ?? 0.2);
|
|
20149
|
+
const length = distance2 + SWEEP_BACK;
|
|
20150
|
+
const scope = broadPhase ? sweepScope(origins, d, length, ignore) ?? void 0 : void 0;
|
|
20151
|
+
const counts = { objectVisits: 0, partVisits: 0, shapeTests: 0, shapeTested: /* @__PURE__ */ new Set() };
|
|
20152
|
+
sweepCounts = counts;
|
|
20153
|
+
try {
|
|
20154
|
+
for (const origin of origins) {
|
|
20155
|
+
const r = raycastInternal(origin, d, length, ignore.size > 0 ? ignore : void 0, false, false, {}, scope);
|
|
20156
|
+
if (!r || best && r.distance >= best.distance) continue;
|
|
20157
|
+
best = { object: r.object, part: r.part, point: r.point, normal: r.normal, distance: Math.max(0, r.distance - SWEEP_BACK) };
|
|
20158
|
+
}
|
|
20159
|
+
} finally {
|
|
20160
|
+
sweepCounts = null;
|
|
20161
|
+
lastSweep = { objectVisits: counts.objectVisits, partVisits: counts.partVisits, shapeTests: counts.shapeTests, shapeTested: [...counts.shapeTested] };
|
|
20016
20162
|
}
|
|
20017
20163
|
return best;
|
|
20018
20164
|
},
|
|
20165
|
+
sweepProbe() {
|
|
20166
|
+
return lastSweep;
|
|
20167
|
+
},
|
|
20019
20168
|
shoot(origin, direction, energy, caliber, source, round3) {
|
|
20020
20169
|
const extras = typeof round3 === "number" ? { piercing: round3 } : round3 ?? {};
|
|
20021
20170
|
return withCollapses(run(withBlow("ballistic", () => {
|
|
@@ -20248,7 +20397,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20248
20397
|
rng: rng3.state(),
|
|
20249
20398
|
counter,
|
|
20250
20399
|
objects: [...objects.values()].map((o) => {
|
|
20251
|
-
const runtime = { parts: {}, joints: {}, collapsed: [...o.collapsed], ...o.unanchored.size ? { unanchored: [...o.unanchored] } : {}, ...o.soil?.sets.size ? { soil: Object.fromEntries(o.soil.sets) } : {}, ...o.wind ? { wind: [o.wind.dyn.x, o.wind.dyn.v, o.wind.dyn.y, o.wind.dyn.w, o.wind.dyn.peak] } : {} };
|
|
20400
|
+
const runtime = { parts: {}, joints: {}, collapsed: [...o.collapsed], ...o.loose ? { loose: true } : {}, ...o.unanchored.size ? { unanchored: [...o.unanchored] } : {}, ...o.soil?.sets.size ? { soil: Object.fromEntries(o.soil.sets) } : {}, ...o.wind ? { wind: [o.wind.dyn.x, o.wind.dyn.v, o.wind.dyn.y, o.wind.dyn.w, o.wind.dyn.peak] } : {} };
|
|
20252
20401
|
for (const p of o.parts) runtime.parts[p.spec.id] = clone(p.rt);
|
|
20253
20402
|
for (const j of o.joints) runtime.joints[j.spec.id] = j.step;
|
|
20254
20403
|
return { id: o.id, spec: clone(o.spec), state: clone(o.st), runtime };
|
|
@@ -20271,7 +20420,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20271
20420
|
joints: new Map(state.joints.map((st) => [st.id, { st, step: e.runtime?.joints[st.id] ?? 0 }])),
|
|
20272
20421
|
collapsed: e.runtime?.collapsed,
|
|
20273
20422
|
...e.runtime?.unanchored ? { unanchored: e.runtime.unanchored } : {},
|
|
20274
|
-
...e.runtime?.wind ? { wind: e.runtime.wind } : {}
|
|
20423
|
+
...e.runtime?.wind ? { wind: e.runtime.wind } : {},
|
|
20424
|
+
...e.runtime?.loose ? { loose: true } : {}
|
|
20275
20425
|
};
|
|
20276
20426
|
let pos = state.position, rot = state.rotation;
|
|
20277
20427
|
if (state.soil) {
|
|
@@ -23609,7 +23759,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
23609
23759
|
}
|
|
23610
23760
|
var residentialTower = residentialTowerTemplate();
|
|
23611
23761
|
|
|
23612
|
-
// ../game-floorplan-three/dist/chunk-
|
|
23762
|
+
// ../game-floorplan-three/dist/chunk-XOLKY3ZJ.js
|
|
23613
23763
|
var __defProp3 = Object.defineProperty;
|
|
23614
23764
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp3(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
23615
23765
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -30821,9 +30971,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30821
30971
|
dropped.length = 0;
|
|
30822
30972
|
},
|
|
30823
30973
|
flush,
|
|
30824
|
-
/** Takes this house's painting out of the renderer's queue (the house goes away); `claim` puts it back. */
|
|
30974
|
+
/** Takes this house's painting out of the renderer's queue (the house goes away) and frees the unit shapes on the GPU; `claim` puts it back (three.js uploads the shapes again when drawn). */
|
|
30825
30975
|
release() {
|
|
30826
30976
|
paintQueues.delete(queue);
|
|
30977
|
+
unitGeometry.dispose();
|
|
30978
|
+
lumpShape?.dispose();
|
|
30827
30979
|
},
|
|
30828
30980
|
/** The painting of this house alone. */
|
|
30829
30981
|
deferredQueue: () => queue,
|
|
@@ -31090,6 +31242,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31090
31242
|
D.deactivate = () => {
|
|
31091
31243
|
if (off) off();
|
|
31092
31244
|
off = null;
|
|
31245
|
+
if (R && D.id && D.active) R.release?.(D.id);
|
|
31093
31246
|
D.restore();
|
|
31094
31247
|
if (R && D.id && D.active) R.unbind(D.id);
|
|
31095
31248
|
if (D.active && D.world.has(D.id)) D.world.remove(D.id);
|
|
@@ -31172,7 +31325,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
31172
31325
|
D.piece = (id) => D.active ? D.world.part(D.id, id) : null;
|
|
31173
31326
|
D.state = () => D.active ? D.world.state(D.id) : null;
|
|
31174
31327
|
D.reset = () => {
|
|
31175
|
-
if (D.active)
|
|
31328
|
+
if (D.active) {
|
|
31329
|
+
R?.releasePieces?.(D.id);
|
|
31330
|
+
D.world.reset(D.id);
|
|
31331
|
+
}
|
|
31176
31332
|
D.restore();
|
|
31177
31333
|
};
|
|
31178
31334
|
D.strike = (pid, point, type, amount, d) => {
|