@adatechnology/game-floorplan-structure 1.3.0 → 1.3.1
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 +16 -5
- package/dist/index.global.js.map +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -4217,6 +4217,7 @@ var GameFloorplanStructure = (() => {
|
|
|
4217
4217
|
},
|
|
4218
4218
|
hitDebris: "chips",
|
|
4219
4219
|
breakDebris: "dust",
|
|
4220
|
+
visual: { innerColor: 10197652 },
|
|
4220
4221
|
thermal: {
|
|
4221
4222
|
conductivity: 0.15,
|
|
4222
4223
|
heatCapacity: 2.5
|
|
@@ -4247,6 +4248,7 @@ var GameFloorplanStructure = (() => {
|
|
|
4247
4248
|
],
|
|
4248
4249
|
hitDebris: "chips",
|
|
4249
4250
|
breakDebris: "dust",
|
|
4251
|
+
visual: { innerColor: 12085567 },
|
|
4250
4252
|
thermal: {
|
|
4251
4253
|
conductivity: 0.15,
|
|
4252
4254
|
heatCapacity: 2.5
|
|
@@ -4277,6 +4279,7 @@ var GameFloorplanStructure = (() => {
|
|
|
4277
4279
|
],
|
|
4278
4280
|
hitDebris: "dust",
|
|
4279
4281
|
breakDebris: "dust",
|
|
4282
|
+
visual: { innerColor: 14999507 },
|
|
4280
4283
|
thermal: {
|
|
4281
4284
|
conductivity: 0.1,
|
|
4282
4285
|
heatCapacity: 1.5
|
|
@@ -4302,6 +4305,7 @@ var GameFloorplanStructure = (() => {
|
|
|
4302
4305
|
],
|
|
4303
4306
|
hitDebris: "chips",
|
|
4304
4307
|
breakDebris: "dust",
|
|
4308
|
+
visual: { innerColor: 9407364 },
|
|
4305
4309
|
thermal: {
|
|
4306
4310
|
conductivity: 0.2,
|
|
4307
4311
|
heatCapacity: 2.5
|
|
@@ -5059,6 +5063,7 @@ var GameFloorplanStructure = (() => {
|
|
|
5059
5063
|
var CHIP_ENERGY = 200;
|
|
5060
5064
|
var CHIP_SPLASH = 0.5;
|
|
5061
5065
|
var BAR_BOW = 0.08;
|
|
5066
|
+
var BULLET_JOINT_SPAN = 0.3;
|
|
5062
5067
|
var CUT_SLICE = 1;
|
|
5063
5068
|
var cutFactorOf = (shape) => clamp22(Math.max(...shapeDims(shape)) / CUT_SLICE, 1, 50);
|
|
5064
5069
|
var clamp22 = (v, a, b) => Math.max(a, Math.min(b, v));
|
|
@@ -6185,7 +6190,7 @@ var GameFloorplanStructure = (() => {
|
|
|
6185
6190
|
emit({ ...base(o, src), type: "crack", part: p.spec.id, crack, worldPoint: wp });
|
|
6186
6191
|
setStage(o, p, 1, {}, src);
|
|
6187
6192
|
};
|
|
6188
|
-
const debris = (o, p, kind, point, normal, count, speed, src) => emit({ ...base(o, src), type: "debris", part: p.spec.id, kind, point, normal, count, speed });
|
|
6193
|
+
const debris = (o, p, kind, point, normal, count, speed, src, material) => emit({ ...base(o, src), type: "debris", part: p.spec.id, kind, point, normal, count, speed, ...material && material !== p.spec.material ? { material } : {} });
|
|
6189
6194
|
const holeRate = (hole, pressurized) => (pressurized ? 0.5 : 0.1) * (hole.diameter / 9e-3);
|
|
6190
6195
|
const detachEvents = (o, opened, by, src) => {
|
|
6191
6196
|
for (const j of opened) emit({ ...base(o, src), type: "detach", joint: j.spec.id, parts: [j.spec.a, j.spec.b], by, groups: o.st.groups.map((g) => [...g]) });
|
|
@@ -6226,7 +6231,13 @@ var GameFloorplanStructure = (() => {
|
|
|
6226
6231
|
const small = pa.dims[0] * pa.dims[1] * pa.dims[2] <= pb.dims[0] * pb.dims[1] * pb.dims[2] ? pa : pb;
|
|
6227
6232
|
return Math.max(0.06, 0.5 * Math.min(small.dims[0], small.dims[1], small.dims[2]));
|
|
6228
6233
|
};
|
|
6229
|
-
const
|
|
6234
|
+
const jointLength = (o, j) => {
|
|
6235
|
+
const A = partWorldAabb(o, o.parts[j.ia]), B = partWorldAabb(o, o.parts[j.ib]);
|
|
6236
|
+
let len = 0;
|
|
6237
|
+
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]));
|
|
6238
|
+
return len;
|
|
6239
|
+
};
|
|
6240
|
+
const wearJoints = (o, p, amount, near, radius = 0.06, src, split = false, span) => {
|
|
6230
6241
|
if (amount <= 0) return;
|
|
6231
6242
|
const mine = (o.byPart.get(p.spec.id) ?? []).filter((j) => !j.st.open);
|
|
6232
6243
|
if (split && mine.length) amount /= mine.length;
|
|
@@ -6234,7 +6245,7 @@ var GameFloorplanStructure = (() => {
|
|
|
6234
6245
|
if (j.st.open) continue;
|
|
6235
6246
|
if (j.spec.kind === "rebar" && (isReinforced(o.parts[j.ia].spec) || isReinforced(o.parts[j.ib].spec))) continue;
|
|
6236
6247
|
if (near && jointReach(o, j, near) > Math.max(radius, jointReachLimit(o, j))) continue;
|
|
6237
|
-
j.st.hp -= amount;
|
|
6248
|
+
j.st.hp -= span === void 0 ? amount : amount * Math.min(1, span / Math.max(jointLength(o, j), 1e-6));
|
|
6238
6249
|
if (j.st.hp <= 0) {
|
|
6239
6250
|
j.st.hp = 0;
|
|
6240
6251
|
j.st.open = true;
|
|
@@ -6263,7 +6274,7 @@ var GameFloorplanStructure = (() => {
|
|
|
6263
6274
|
if (spalls.length > MAX_SPALLS) spalls.shift();
|
|
6264
6275
|
markDamaged(p);
|
|
6265
6276
|
emit({ ...base(o, src), type: "spall", part: p.spec.id, layer: layer.index, point: wp, area: Math.PI * radius * radius });
|
|
6266
|
-
debris(o, p, layer.mat.hitDebris, wp, normal, 5, 2, src);
|
|
6277
|
+
debris(o, p, layer.mat.hitDebris, wp, normal, 5, 2, src, layer.mat.id);
|
|
6267
6278
|
setStage(o, p, 1, {}, src);
|
|
6268
6279
|
};
|
|
6269
6280
|
const crater = (o, p, wp, normal, radius, src) => {
|
|
@@ -6750,7 +6761,7 @@ var GameFloorplanStructure = (() => {
|
|
|
6750
6761
|
if (mat.fracture !== "shatter") addHole(o, p, entry2, n, caliber / 1e3, false, void 0, src);
|
|
6751
6762
|
} else addHole(o, p, entry2, n, caliber / 1e3, false, void 0, src);
|
|
6752
6763
|
debris(o, p, mat.hitDebris, entry2, n, clamp22(Math.round(E / 60) + 2, 2, 14), clamp22(Math.sqrt(E) / 6, 1, 8), src);
|
|
6753
|
-
wearJoints(o, p, (penetrated ? thr : E) * 0.02, void 0, 0, src, true);
|
|
6764
|
+
wearJoints(o, p, (penetrated ? thr : E) * 0.02, void 0, 0, src, true, BULLET_JOINT_SPAN);
|
|
6754
6765
|
const absorbed = penetrated && mat.ductility >= 0.5 && mat.fracture !== "tear" ? Math.min(E, thr) : E;
|
|
6755
6766
|
const dmg = applyDamage(o, p, absorbed * DMG_PER_J * scale, "ballistic", entry2, d, absorbed * 0.1, 12, src);
|
|
6756
6767
|
if (!isLost(p)) tearAt(o, p, "ballistic", entry2, penetrated ? exitPoint : void 0, d, E, caliber / 1e3, src);
|