@adatechnology/game-weapons-three 0.29.5 → 0.29.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 +3 -3
package/dist/index.global.js
CHANGED
|
@@ -25181,9 +25181,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25181
25181
|
var SURFACE_SAME = 5e-4;
|
|
25182
25182
|
var SEVER_ASPECT = 3;
|
|
25183
25183
|
var SEVER_BALLISTIC = 2;
|
|
25184
|
+
var SEVER_TRACK = 4;
|
|
25184
25185
|
var TEAR_JOULES = 150;
|
|
25185
25186
|
var STRIP_THICKNESS = 15e-4;
|
|
25186
|
-
var tears = 0;
|
|
25187
25187
|
var UNIT_FRAGMENT_FACTOR = 4;
|
|
25188
25188
|
var BREACH_GRID_CAP = 4096;
|
|
25189
25189
|
var MASONRY_CRUMBLE_SPEED = 0.6;
|
|
@@ -25354,6 +25354,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
25354
25354
|
const rnd2 = () => rng2.next();
|
|
25355
25355
|
let time = 0;
|
|
25356
25356
|
let counter = 0;
|
|
25357
|
+
let tears = 0;
|
|
25357
25358
|
const objects = /* @__PURE__ */ new Map();
|
|
25358
25359
|
const slots = /* @__PURE__ */ new Map();
|
|
25359
25360
|
let slotCounter = 0;
|
|
@@ -28762,13 +28763,21 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28762
28763
|
const order2 = [0, 1, 2].sort((a, b) => d[b] - d[a]);
|
|
28763
28764
|
return d[order2[0]] >= SEVER_ASPECT * d[order2[1]] && d[order2[0]] >= 3 * SEVER_BAND ? order2[0] : -1;
|
|
28764
28765
|
};
|
|
28766
|
+
const roundSection = (o, p, d, holeWidth, depth) => {
|
|
28767
|
+
const axis2 = severAxis(p);
|
|
28768
|
+
if (axis2 < 0) return 1;
|
|
28769
|
+
const local2 = rotateVec(quat.conjugate(partXf(o, p).q), d);
|
|
28770
|
+
const [a, b] = [0, 1, 2].filter((k) => k !== axis2);
|
|
28771
|
+
const across2 = Math.abs(local2[a]) >= Math.abs(local2[b]) ? p.dims[b] : p.dims[a];
|
|
28772
|
+
return Math.min(1, SEVER_TRACK * holeWidth / Math.max(across2, 1e-6)) * clamp2(depth, 0, 1);
|
|
28773
|
+
};
|
|
28765
28774
|
const bandOf = (o, p, axis2, origin) => {
|
|
28766
28775
|
const { c, q } = partXf(o, p);
|
|
28767
28776
|
const along2 = toLocal(c, q, origin)[axis2];
|
|
28768
28777
|
const L = p.dims[axis2];
|
|
28769
28778
|
return clamp2(Math.floor((along2 + L / 2) / SEVER_BAND), 0, Math.ceil(L / SEVER_BAND) - 1);
|
|
28770
28779
|
};
|
|
28771
|
-
const applyDamage = (o, p, amount, type, origin, dir, fragEnergy, cap, src, weight = 1) => {
|
|
28780
|
+
const applyDamage = (o, p, amount, type, origin, dir, fragEnergy, cap, src, weight = 1, section = 1) => {
|
|
28772
28781
|
var _a;
|
|
28773
28782
|
if (isLost(p) || amount <= 0) return 0;
|
|
28774
28783
|
const prev = p.st.hp;
|
|
@@ -28777,7 +28786,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28777
28786
|
if (axis2 >= 0 && p.st.hp > 0) {
|
|
28778
28787
|
const band = bandOf(o, p, axis2, origin);
|
|
28779
28788
|
const cuts = (_a = p.rt).cuts ?? (_a.cuts = {});
|
|
28780
|
-
cuts[band] = (cuts[band] ?? 0) + amount * (type === "ballistic" ? SEVER_BALLISTIC : 1);
|
|
28789
|
+
cuts[band] = (cuts[band] ?? 0) + amount * section * (type === "ballistic" ? SEVER_BALLISTIC : 1);
|
|
28781
28790
|
if (cuts[band] >= p.st.maxHp * SEVER_BAND / p.dims[axis2]) {
|
|
28782
28791
|
p.rt.cutAt = -p.dims[axis2] / 2 + (band + 0.5) * SEVER_BAND;
|
|
28783
28792
|
p.st.hp = 0;
|
|
@@ -28904,10 +28913,11 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28904
28913
|
const crackLen = clamp2(0.03 + ratio * 0.2, 0.03, 0.8);
|
|
28905
28914
|
let exitPoint;
|
|
28906
28915
|
let shellShare = 0;
|
|
28916
|
+
const holeWidth = caliber / 1e3 * (mat.ductility >= 0.3 ? 1 : 1.5);
|
|
28907
28917
|
if (penetrated) {
|
|
28908
28918
|
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
28919
|
exitPoint = vec.madd(entry2, d, exitDist);
|
|
28910
|
-
const hole = addHole(o, p, entry2, n,
|
|
28920
|
+
const hole = addHole(o, p, entry2, n, holeWidth, true, exitPoint, src);
|
|
28911
28921
|
shellShare = wearsShell(p, hole.diameter * 2);
|
|
28912
28922
|
if (p.layers.length > 0) spallOuter(o, p, exitPoint, -face, vec.scale(n, -1), Math.max(0.03, caliber / 1e3 * 4), src);
|
|
28913
28923
|
addBreach(o, p, entry2, Math.PI * (hole.diameter / 2) * (hole.diameter / 2), E, d, src);
|
|
@@ -28937,7 +28947,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
28937
28947
|
wearJoints(o, p, (penetrated ? thr : E) * 0.02 * weight, void 0, 0, src, true, BULLET_JOINT_SPAN);
|
|
28938
28948
|
const hollowTear = mat.fracture === "tear" && p.spec.fill !== void 0 && p.spec.fill < 0.5;
|
|
28939
28949
|
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);
|
|
28950
|
+
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
28951
|
if (shellShare > 0 && !isLost(p)) yieldShell(o, p, shellShare, entry2, d, src);
|
|
28942
28952
|
if (!isLost(p)) tearAt(o, p, "ballistic", entry2, penetrated ? exitPoint : void 0, d, E, caliber / 1e3, src);
|
|
28943
28953
|
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);
|
|
@@ -30661,6 +30671,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30661
30671
|
time,
|
|
30662
30672
|
rng: rng2.state(),
|
|
30663
30673
|
counter,
|
|
30674
|
+
...tears > 0 ? { tears } : {},
|
|
30664
30675
|
objects: [...objects.values()].map(serializeObject),
|
|
30665
30676
|
...impls.size ? { impls: [...impls.values()].map((im) => ({ id: im.impl.id, position: [...im.position], rotation: [...im.rotation], data: im.impl.serialize?.() })) } : {}
|
|
30666
30677
|
};
|
|
@@ -30685,6 +30696,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
30685
30696
|
time = snap.time;
|
|
30686
30697
|
rng2.set(snap.rng);
|
|
30687
30698
|
counter = snap.counter ?? 0;
|
|
30699
|
+
tears = snap.tears ?? 0;
|
|
30688
30700
|
for (const e of snap.objects) putObject(e.id, buildFromEntry(e, e.id));
|
|
30689
30701
|
for (const e of snap.impls ?? []) {
|
|
30690
30702
|
const im = impls.get(e.id);
|