@adatechnology/game-items-three 0.11.5 → 0.11.6
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 +17 -5
- package/dist/index.global.js.map +1 -1
- package/package.json +7 -7
package/dist/index.global.js
CHANGED
|
@@ -16417,9 +16417,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16417
16417
|
var SURFACE_SAME = 5e-4;
|
|
16418
16418
|
var SEVER_ASPECT = 3;
|
|
16419
16419
|
var SEVER_BALLISTIC = 2;
|
|
16420
|
+
var SEVER_TRACK = 4;
|
|
16420
16421
|
var TEAR_JOULES = 150;
|
|
16421
16422
|
var STRIP_THICKNESS = 15e-4;
|
|
16422
|
-
var tears = 0;
|
|
16423
16423
|
var UNIT_FRAGMENT_FACTOR = 4;
|
|
16424
16424
|
var BREACH_GRID_CAP = 4096;
|
|
16425
16425
|
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
@@ -16590,6 +16590,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
16590
16590
|
const rnd = () => rng3.next();
|
|
16591
16591
|
let time = 0;
|
|
16592
16592
|
let counter = 0;
|
|
16593
|
+
let tears = 0;
|
|
16593
16594
|
const objects = /* @__PURE__ */ new Map();
|
|
16594
16595
|
const slots = /* @__PURE__ */ new Map();
|
|
16595
16596
|
let slotCounter = 0;
|
|
@@ -19998,13 +19999,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
19998
19999
|
const order2 = [0, 1, 2].sort((a, b) => d[b] - d[a]);
|
|
19999
20000
|
return d[order2[0]] >= SEVER_ASPECT * d[order2[1]] && d[order2[0]] >= 3 * SEVER_BAND ? order2[0] : -1;
|
|
20000
20001
|
};
|
|
20002
|
+
const roundSection = (o, p, d, holeWidth, depth) => {
|
|
20003
|
+
const axis = severAxis(p);
|
|
20004
|
+
if (axis < 0) return 1;
|
|
20005
|
+
const local = rotateVec(quat.conjugate(partXf(o, p).q), d);
|
|
20006
|
+
const [a, b] = [0, 1, 2].filter((k) => k !== axis);
|
|
20007
|
+
const across2 = Math.abs(local[a]) >= Math.abs(local[b]) ? p.dims[b] : p.dims[a];
|
|
20008
|
+
return Math.min(1, SEVER_TRACK * holeWidth / Math.max(across2, 1e-6)) * clamp2(depth, 0, 1);
|
|
20009
|
+
};
|
|
20001
20010
|
const bandOf = (o, p, axis, origin) => {
|
|
20002
20011
|
const { c, q } = partXf(o, p);
|
|
20003
20012
|
const along2 = toLocal(c, q, origin)[axis];
|
|
20004
20013
|
const L = p.dims[axis];
|
|
20005
20014
|
return clamp2(Math.floor((along2 + L / 2) / SEVER_BAND), 0, Math.ceil(L / SEVER_BAND) - 1);
|
|
20006
20015
|
};
|
|
20007
|
-
const applyDamage = (o, p, amount, type, origin, dir, fragEnergy, cap, src, weight = 1) => {
|
|
20016
|
+
const applyDamage = (o, p, amount, type, origin, dir, fragEnergy, cap, src, weight = 1, section = 1) => {
|
|
20008
20017
|
var _a;
|
|
20009
20018
|
if (isLost(p) || amount <= 0) return 0;
|
|
20010
20019
|
const prev = p.st.hp;
|
|
@@ -20013,7 +20022,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20013
20022
|
if (axis >= 0 && p.st.hp > 0) {
|
|
20014
20023
|
const band = bandOf(o, p, axis, origin);
|
|
20015
20024
|
const cuts = (_a = p.rt).cuts ?? (_a.cuts = {});
|
|
20016
|
-
cuts[band] = (cuts[band] ?? 0) + amount * (type === "ballistic" ? SEVER_BALLISTIC : 1);
|
|
20025
|
+
cuts[band] = (cuts[band] ?? 0) + amount * section * (type === "ballistic" ? SEVER_BALLISTIC : 1);
|
|
20017
20026
|
if (cuts[band] >= p.st.maxHp * SEVER_BAND / p.dims[axis]) {
|
|
20018
20027
|
p.rt.cutAt = -p.dims[axis] / 2 + (band + 0.5) * SEVER_BAND;
|
|
20019
20028
|
p.st.hp = 0;
|
|
@@ -20140,10 +20149,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20140
20149
|
const crackLen = clamp2(0.03 + ratio * 0.2, 0.03, 0.8);
|
|
20141
20150
|
let exitPoint;
|
|
20142
20151
|
let shellShare = 0;
|
|
20152
|
+
const holeWidth = caliber / 1e3 * (mat.ductility >= 0.3 ? 1 : 1.5);
|
|
20143
20153
|
if (penetrated) {
|
|
20144
20154
|
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);
|
|
20145
20155
|
exitPoint = vec.madd(entry2, d, exitDist);
|
|
20146
|
-
const hole = addHole(o, p, entry2, n,
|
|
20156
|
+
const hole = addHole(o, p, entry2, n, holeWidth, true, exitPoint, src);
|
|
20147
20157
|
shellShare = wearsShell(p, hole.diameter * 2);
|
|
20148
20158
|
if (p.layers.length > 0) spallOuter(o, p, exitPoint, -face, vec.scale(n, -1), Math.max(0.03, caliber / 1e3 * 4), src);
|
|
20149
20159
|
addBreach(o, p, entry2, Math.PI * (hole.diameter / 2) * (hole.diameter / 2), E, d, src);
|
|
@@ -20173,7 +20183,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
20173
20183
|
wearJoints(o, p, (penetrated ? thr : E) * 0.02 * weight, void 0, 0, src, true, BULLET_JOINT_SPAN);
|
|
20174
20184
|
const hollowTear = mat.fracture === "tear" && p.spec.fill !== void 0 && p.spec.fill < 0.5;
|
|
20175
20185
|
const absorbed = penetrated && (mat.ductility >= 0.5 && mat.fracture !== "tear" || hollowTear || mat.cellular === true) ? Math.min(E, thr) : E;
|
|
20176
|
-
const dmg = applyDamage(o, p, absorbed * DMG_PER_J * scale, "ballistic", entry2, d, absorbed * 0.1, 12, src, weight);
|
|
20186
|
+
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));
|
|
20177
20187
|
if (shellShare > 0 && !isLost(p)) yieldShell(o, p, shellShare, entry2, d, src);
|
|
20178
20188
|
if (!isLost(p)) tearAt(o, p, "ballistic", entry2, penetrated ? exitPoint : void 0, d, E, caliber / 1e3, src);
|
|
20179
20189
|
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);
|
|
@@ -21897,6 +21907,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21897
21907
|
time,
|
|
21898
21908
|
rng: rng3.state(),
|
|
21899
21909
|
counter,
|
|
21910
|
+
...tears > 0 ? { tears } : {},
|
|
21900
21911
|
objects: [...objects.values()].map(serializeObject),
|
|
21901
21912
|
...impls.size ? { impls: [...impls.values()].map((im) => ({ id: im.impl.id, position: [...im.position], rotation: [...im.rotation], data: im.impl.serialize?.() })) } : {}
|
|
21902
21913
|
};
|
|
@@ -21921,6 +21932,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
21921
21932
|
time = snap.time;
|
|
21922
21933
|
rng3.set(snap.rng);
|
|
21923
21934
|
counter = snap.counter ?? 0;
|
|
21935
|
+
tears = snap.tears ?? 0;
|
|
21924
21936
|
for (const e of snap.objects) putObject(e.id, buildFromEntry(e, e.id));
|
|
21925
21937
|
for (const e of snap.impls ?? []) {
|
|
21926
21938
|
const im = impls.get(e.id);
|