@adatechnology/game-destruction 0.1.1 → 0.2.0
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 +4 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1408,6 +1408,8 @@ var fragility = (ductility, thickness) => {
|
|
|
1408
1408
|
var DMG_PER_J = 0.02;
|
|
1409
1409
|
var BLAST_COUPLING = 0.1;
|
|
1410
1410
|
var FLAMMABLE_FLUIDS = ["gas", "fuel"];
|
|
1411
|
+
var CUT_SLICE = 1;
|
|
1412
|
+
var cutFactorOf = (shape) => clamp2(Math.max(...shapeDims(shape)) / CUT_SLICE, 1, 50);
|
|
1411
1413
|
var clamp2 = (v, a, b) => Math.max(a, Math.min(b, v));
|
|
1412
1414
|
var isLost = (p) => p.st.status === "broken" || p.st.status === "melted" || p.st.status === "ashes";
|
|
1413
1415
|
var clone = (v) => structuredClone(v);
|
|
@@ -1560,6 +1562,7 @@ var createDestruction = (options = {}) => {
|
|
|
1560
1562
|
fuel0,
|
|
1561
1563
|
area: shapeArea(ps.shape),
|
|
1562
1564
|
thickness: partThickness(ps),
|
|
1565
|
+
cutFactor: cutFactorOf(ps.shape),
|
|
1563
1566
|
dims: shapeDims(ps.shape),
|
|
1564
1567
|
bound: shapeBound(ps.shape),
|
|
1565
1568
|
rt: c?.rt ?? { ...freshRuntime(), prevTemp: pst.temperature },
|
|
@@ -2081,7 +2084,7 @@ var createDestruction = (options = {}) => {
|
|
|
2081
2084
|
if (kind === "blunt") wearJoints(o, p, E * 0.3, void 0, 0, src);
|
|
2082
2085
|
else wearJoints(o, p, E * 0.3, point, 0.06, src);
|
|
2083
2086
|
const scale = mat.damageScale?.[kind] ?? 1;
|
|
2084
|
-
return applyDamage(o, p, Ec * DMG_PER_J * scale, kind, point, d, E * 0.1, 12, src);
|
|
2087
|
+
return applyDamage(o, p, Ec * DMG_PER_J * scale * (kind === "slash" ? p.cutFactor : 1), kind, point, d, E * 0.1, 12, src);
|
|
2085
2088
|
};
|
|
2086
2089
|
const blastObject = (o, point, energy, radius, src) => {
|
|
2087
2090
|
const start = cur.length;
|