@adatechnology/game-destruction-three 0.24.1 → 0.24.3
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 +329 -134
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +93 -40
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -540,6 +540,7 @@ var FragmentSystem = class {
|
|
|
540
540
|
rouse(f) {
|
|
541
541
|
f.asleep = false;
|
|
542
542
|
f.rest = 0;
|
|
543
|
+
f.floor = null;
|
|
543
544
|
f.mesh.matrixAutoUpdate = true;
|
|
544
545
|
}
|
|
545
546
|
/** What lies inside the disc looks at the ground again: it was dug or heaped under it. */
|
|
@@ -585,6 +586,7 @@ var FragmentSystem = class {
|
|
|
585
586
|
if (!f.asleep || f.dying) continue;
|
|
586
587
|
const e = this.m.makeRotationFromQuaternion(f.mesh.quaternion).elements;
|
|
587
588
|
const ext = Math.abs(e[1]) * f.half.x + Math.abs(e[5]) * f.half.y + Math.abs(e[9]) * f.half.z;
|
|
589
|
+
f.floor = null;
|
|
588
590
|
if (f.mesh.position.y - ext > this.floorUnder(f) + SUPPORT_GAP) this.rouse(f);
|
|
589
591
|
}
|
|
590
592
|
}
|
|
@@ -2297,6 +2299,51 @@ function surfaceOf(materialId, def) {
|
|
|
2297
2299
|
|
|
2298
2300
|
// src/renderer.ts
|
|
2299
2301
|
import { kitOriginOf } from "@adatechnology/game-contracts";
|
|
2302
|
+
import { debrisColor as debrisColor2, debrisLook, fragmentTone } from "@adatechnology/game-destruction";
|
|
2303
|
+
|
|
2304
|
+
// src/debris-events.ts
|
|
2305
|
+
import { debrisColor, debrisFamily, dustColor } from "@adatechnology/game-destruction";
|
|
2306
|
+
import { DEBRIS_COLOR_VARIABLE, DUST_COLOR_VARIABLE } from "@adatechnology/game-vfx";
|
|
2307
|
+
var HIT_POINT_SECONDS = 1;
|
|
2308
|
+
function familyPlay(def, partColor) {
|
|
2309
|
+
const dust = dustColor(def, partColor);
|
|
2310
|
+
return {
|
|
2311
|
+
material: debrisFamily(def),
|
|
2312
|
+
values: { [DEBRIS_COLOR_VARIABLE]: debrisColor(def, partColor), ...dust !== void 0 ? { [DUST_COLOR_VARIABLE]: dust } : {} }
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
function pointOf(ev) {
|
|
2316
|
+
switch (ev.type) {
|
|
2317
|
+
case "hole":
|
|
2318
|
+
case "crack":
|
|
2319
|
+
return ev.worldPoint;
|
|
2320
|
+
case "spall":
|
|
2321
|
+
case "debris":
|
|
2322
|
+
return ev.point;
|
|
2323
|
+
case "chip":
|
|
2324
|
+
return ev.center;
|
|
2325
|
+
default:
|
|
2326
|
+
return void 0;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
var HitPoints = class {
|
|
2330
|
+
constructor() {
|
|
2331
|
+
__publicField(this, "points", /* @__PURE__ */ new Map());
|
|
2332
|
+
}
|
|
2333
|
+
note(ev, time) {
|
|
2334
|
+
const point = pointOf(ev);
|
|
2335
|
+
if (!point || !("part" in ev)) return;
|
|
2336
|
+
this.points.set(`${ev.object}|${ev.part}`, { point, time });
|
|
2337
|
+
}
|
|
2338
|
+
/** The last hit on the part, if it was recent. */
|
|
2339
|
+
of(objectId, partId, time) {
|
|
2340
|
+
const hit = this.points.get(`${objectId}|${partId}`);
|
|
2341
|
+
return hit && time - hit.time <= HIT_POINT_SECONDS ? hit.point : void 0;
|
|
2342
|
+
}
|
|
2343
|
+
forget(objectId) {
|
|
2344
|
+
for (const key of this.points.keys()) if (key.startsWith(`${objectId}|`)) this.points.delete(key);
|
|
2345
|
+
}
|
|
2346
|
+
};
|
|
2300
2347
|
|
|
2301
2348
|
// src/heat.ts
|
|
2302
2349
|
var STOPS = [
|
|
@@ -3576,7 +3623,6 @@ var REBAR_COLOR = 7628380;
|
|
|
3576
3623
|
var STEEL_DENSITY = 7850;
|
|
3577
3624
|
var CHIP_DECAL_EDGE = 0.05;
|
|
3578
3625
|
var WOOD_RIM = 1.5;
|
|
3579
|
-
var IMPACT_TAGS = ["metal", "glass", "wood"];
|
|
3580
3626
|
var GLOW_FROM_C = 430;
|
|
3581
3627
|
var MIN_DRAWN_CRACK_WIDTH = 4e-3;
|
|
3582
3628
|
var SETTLEMENT_CRACK_COLOR = 2827296;
|
|
@@ -3730,11 +3776,8 @@ function fractureKey(def, style) {
|
|
|
3730
3776
|
return impactKey(def);
|
|
3731
3777
|
}
|
|
3732
3778
|
}
|
|
3733
|
-
function fallbackColor(
|
|
3734
|
-
|
|
3735
|
-
if (def?.visual?.transparent) return 10473696;
|
|
3736
|
-
const h = hashString(id);
|
|
3737
|
-
return mixHex(7035464, 10130568, h % 100 / 100);
|
|
3779
|
+
function fallbackColor(def) {
|
|
3780
|
+
return debrisColor2(def);
|
|
3738
3781
|
}
|
|
3739
3782
|
function materialsOf2(m) {
|
|
3740
3783
|
return Array.isArray(m) ? m : [m];
|
|
@@ -3808,6 +3851,7 @@ var Renderer = class {
|
|
|
3808
3851
|
__publicField(this, "ground");
|
|
3809
3852
|
__publicField(this, "pieceSys");
|
|
3810
3853
|
__publicField(this, "cages");
|
|
3854
|
+
__publicField(this, "hitPoints", new HitPoints());
|
|
3811
3855
|
__publicField(this, "active", /* @__PURE__ */ new Map());
|
|
3812
3856
|
__publicField(this, "fires", /* @__PURE__ */ new Map());
|
|
3813
3857
|
/** Primed parts burning in the effects world until they go off: their burn loop ends when they are put out. */
|
|
@@ -4019,6 +4063,7 @@ var Renderer = class {
|
|
|
4019
4063
|
this.restore(objectId);
|
|
4020
4064
|
this.pieceSys.remove(objectId);
|
|
4021
4065
|
this.bounds.delete(objectId);
|
|
4066
|
+
this.hitPoints.forget(objectId);
|
|
4022
4067
|
}
|
|
4023
4068
|
// ----------------------------------------------------------------------------------------------------------------------------------
|
|
4024
4069
|
// Pieces
|
|
@@ -4475,6 +4520,7 @@ var Renderer = class {
|
|
|
4475
4520
|
}
|
|
4476
4521
|
apply(ev) {
|
|
4477
4522
|
this.staticDirty.add(ev.object);
|
|
4523
|
+
this.hitPoints.note(ev, this.time);
|
|
4478
4524
|
if (ev.type === "fracture" || ev.type === "detach" || ev.type === "collapse" || ev.type === "burnout" || ev.type === "destroyed") this.broken.add(ev.object);
|
|
4479
4525
|
switch (ev.type) {
|
|
4480
4526
|
case "damage":
|
|
@@ -4522,7 +4568,7 @@ var Renderer = class {
|
|
|
4522
4568
|
if (pv) this.settlement.finish(pv);
|
|
4523
4569
|
}
|
|
4524
4570
|
this.splitLoose(ev.object);
|
|
4525
|
-
if (!furniture || ev.mass >= COLLAPSE_CLOUD_KG) this.playEvent({ kind: "collapse" }, this.rootPoint(ev.object));
|
|
4571
|
+
if (!furniture || ev.mass >= COLLAPSE_CLOUD_KG) this.playEvent({ kind: "collapse" }, this.rootPoint(ev.object), this.partPlay(ev.object, ev.parts[0] ?? ""));
|
|
4526
4572
|
else this.vfx.burst("dust", this.rootPoint(ev.object), [0, 1, 0], clamp(Math.round(ev.mass / 4), 4, 24), 0.8);
|
|
4527
4573
|
break;
|
|
4528
4574
|
}
|
|
@@ -4563,7 +4609,7 @@ var Renderer = class {
|
|
|
4563
4609
|
else this.dropCage(ev.object, ev.part);
|
|
4564
4610
|
if (ev.bars.length > 0) {
|
|
4565
4611
|
const [a, b] = ev.bars[0];
|
|
4566
|
-
this.playEvent({ kind: "expose" }, [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2]);
|
|
4612
|
+
this.playEvent({ kind: "expose" }, [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2], this.partPlay(ev.object, ev.part));
|
|
4567
4613
|
}
|
|
4568
4614
|
break;
|
|
4569
4615
|
case "extinguish": {
|
|
@@ -4603,7 +4649,7 @@ var Renderer = class {
|
|
|
4603
4649
|
const b = this.bounds.get(ev.object);
|
|
4604
4650
|
const pv = b?.parts.get(ev.part);
|
|
4605
4651
|
const def = this.world.materials.get(ev.material);
|
|
4606
|
-
const color = (pv && this.partColor(pv, def)) ?? fallbackColor(
|
|
4652
|
+
const color = (pv && this.partColor(pv, def)) ?? fallbackColor(def);
|
|
4607
4653
|
let tag = this.homeTags.indexOf(ev.object) + 1;
|
|
4608
4654
|
if (tag === 0) tag = this.homeTags.push(ev.object);
|
|
4609
4655
|
this.vfx.spawn("drips", ev.point, [(this.rng() - 0.5) * 0.1, -0.1, (this.rng() - 0.5) * 0.1], { color, tag, owner: this.owner });
|
|
@@ -4690,7 +4736,7 @@ var Renderer = class {
|
|
|
4690
4736
|
const tint = this.visuals.vertexTint(mv);
|
|
4691
4737
|
return tint ? c.clone().multiply(tint).getHex() : c.getHex();
|
|
4692
4738
|
}
|
|
4693
|
-
return def ? fallbackColor(def
|
|
4739
|
+
return def ? fallbackColor(def) : null;
|
|
4694
4740
|
}
|
|
4695
4741
|
debrisOptions(kind, objectId, partId, material) {
|
|
4696
4742
|
const pv = this.partVis(objectId, partId);
|
|
@@ -4745,22 +4791,23 @@ var Renderer = class {
|
|
|
4745
4791
|
if (!b || !pv) return;
|
|
4746
4792
|
const def = this.world.materials.get(pv.material);
|
|
4747
4793
|
const n = this.worldDir(b, ev.hole.normal);
|
|
4794
|
+
const look = debrisLook(def, "shot");
|
|
4748
4795
|
const draw = (point, normal) => {
|
|
4749
4796
|
const wp = new this.THREE.Vector3(point[0], point[1], point[2]);
|
|
4750
4797
|
const mv = this.nearestMesh(pv, wp);
|
|
4751
4798
|
if (!mv) return;
|
|
4752
|
-
if (
|
|
4799
|
+
if (look.mark === "star_crack") {
|
|
4753
4800
|
const seed = hashNumbers(ev.time, point[0], point[1], point[2]);
|
|
4754
4801
|
this.visuals.addCrack(mv, wp, normal, 7, Math.max(0.05, ev.hole.diameter * 5), 15267071, seed);
|
|
4755
4802
|
} else {
|
|
4756
|
-
const fresh =
|
|
4803
|
+
const fresh = look.mark === "splintered_hole" ? def?.visual?.innerColor : void 0;
|
|
4757
4804
|
if (fresh !== void 0) this.visuals.addSpall(mv, wp, normal, Math.max(6e-3, ev.hole.diameter * WOOD_RIM), fresh);
|
|
4758
4805
|
this.visuals.addHole(mv, wp, normal, ev.hole.diameter);
|
|
4759
4806
|
}
|
|
4760
4807
|
};
|
|
4761
4808
|
draw(ev.worldPoint, n);
|
|
4762
4809
|
if (ev.hole.through && ev.exitPoint) draw(ev.exitPoint, n.clone().negate());
|
|
4763
|
-
if (
|
|
4810
|
+
if (look.sparks) this.vfx.burst("sparks", ev.worldPoint, [n.x, n.y, n.z], 6, 3.5);
|
|
4764
4811
|
if (ev.powder) {
|
|
4765
4812
|
const puff = { color: ev.powder.color, size: 0.6, life: 1.6, alpha: 1.3 };
|
|
4766
4813
|
this.vfx.burst("dust", ev.worldPoint, [n.x, n.y, n.z], this.low ? 5 : 10, 0.7, puff);
|
|
@@ -4802,19 +4849,21 @@ var Renderer = class {
|
|
|
4802
4849
|
const side = point[axis] >= (box.min[axis] + box.max[axis]) / 2 ? 1 : -1;
|
|
4803
4850
|
return new this.THREE.Vector3(axis === "x" ? side : 0, axis === "y" ? side : 0, axis === "z" ? side : 0);
|
|
4804
4851
|
}
|
|
4805
|
-
/** The material an impact effect is chosen by: the tags of the material (`metal`, `glass`, `wood`), else stone and the like are `concrete`. */
|
|
4806
|
-
impactMaterial(def) {
|
|
4807
|
-
for (const tag of IMPACT_TAGS) if (def?.tags?.includes(tag)) return tag;
|
|
4808
|
-
return "concrete";
|
|
4809
|
-
}
|
|
4810
4852
|
/**
|
|
4811
4853
|
* Plays the effect the event map names for a destruction event (`data/event-effects.json` of `game-vfx`, or `RendererOptions.eventEffects`) at a point.
|
|
4812
|
-
* Answers whether one played, so the caller can
|
|
4854
|
+
* `play` gives the family of the material (the map's `{material}`) and the colours of its debris and dust. Answers whether one played, so the caller can
|
|
4855
|
+
* leave out the burst it replaces.
|
|
4813
4856
|
*/
|
|
4814
|
-
playEvent(event, point) {
|
|
4815
|
-
const id = effectForEvent(event, this.o.eventEffects ?? EVENT_EFFECTS_MAP);
|
|
4857
|
+
playEvent(event, point, play) {
|
|
4858
|
+
const id = effectForEvent(play && event.material === void 0 ? { ...event, material: play.material } : event, this.o.eventEffects ?? EVENT_EFFECTS_MAP);
|
|
4816
4859
|
if (!id) return false;
|
|
4817
|
-
return this.vfx.play(id, point, { seed: hashNumbers(point[0], point[1], point[2], this.time) }) !== null;
|
|
4860
|
+
return this.vfx.play(id, point, { seed: hashNumbers(point[0], point[1], point[2], this.time), ...play ? { values: play.values } : {} }) !== null;
|
|
4861
|
+
}
|
|
4862
|
+
/** The family and colours of a part's material, for the effects of the event map. */
|
|
4863
|
+
partPlay(objectId, partId) {
|
|
4864
|
+
const pv = this.partVis(objectId, partId);
|
|
4865
|
+
const def = pv ? this.world.materials.get(pv.material) : void 0;
|
|
4866
|
+
return familyPlay(def, pv ? this.partColor(pv, def) ?? void 0 : void 0);
|
|
4818
4867
|
}
|
|
4819
4868
|
/** A coat came off: a patch in the colour of the core under it, below the bullet holes and cracks. */
|
|
4820
4869
|
onSpall(ev) {
|
|
@@ -4826,11 +4875,12 @@ var Renderer = class {
|
|
|
4826
4875
|
const def = this.world.materials.get(pv.material);
|
|
4827
4876
|
const normal = this.faceNormal(mv, wp);
|
|
4828
4877
|
const core = def?.visual?.innerColor;
|
|
4829
|
-
|
|
4830
|
-
|
|
4878
|
+
const look = debrisLook(def, "spall", { partColor: this.partColor(pv, def) ?? void 0 });
|
|
4879
|
+
if (core !== void 0 || look.impact === void 0) this.vfx.burst(look.debris, ev.point, [normal.x, normal.y, normal.z], 5, 2.5, { color: look.color });
|
|
4880
|
+
else this.playEvent({ kind: "spall", material: look.impact }, ev.point);
|
|
4831
4881
|
if (core !== void 0) this.trickleFrom(ev.point, [normal.x, normal.y, normal.z], core, mv);
|
|
4832
4882
|
if (mv.mesh.userData.drawnSpalls?.includes(ev.part)) return;
|
|
4833
|
-
this.visuals.addSpall(mv, wp, normal, Math.sqrt(ev.area / Math.PI), core ?? fallbackColor(
|
|
4883
|
+
this.visuals.addSpall(mv, wp, normal, Math.sqrt(ev.area / Math.PI), core ?? fallbackColor(def));
|
|
4834
4884
|
}
|
|
4835
4885
|
/**
|
|
4836
4886
|
* Grit and dust go on falling from where a blow broke a hard face (masonry, concrete, wood) for `TRICKLE_SECONDS`, a pinch at a time and less and
|
|
@@ -4873,17 +4923,18 @@ var Renderer = class {
|
|
|
4873
4923
|
* (cutting the wall's faces) is not drawn yet: it needs the per-vertex binding of the house renderer.
|
|
4874
4924
|
*/
|
|
4875
4925
|
onStage(ev) {
|
|
4876
|
-
const played = this.playEvent({ kind: "stage", stage: ev.stage }, ev.opening?.center ?? this.rootPoint(ev.object));
|
|
4877
|
-
if (!ev.fragments || !ev.opening) return;
|
|
4878
4926
|
const pv = this.partVis(ev.object, ev.part);
|
|
4879
4927
|
const def = pv ? this.world.materials.get(pv.material) : void 0;
|
|
4880
|
-
const
|
|
4928
|
+
const at = ev.opening?.center ?? this.hitPoints.of(ev.object, ev.part, this.time) ?? this.rootPoint(ev.object);
|
|
4929
|
+
const played = this.playEvent({ kind: "stage", stage: ev.stage }, at, this.partPlay(ev.object, ev.part));
|
|
4930
|
+
if (!ev.fragments || !ev.opening) return;
|
|
4931
|
+
const color = (pv ? this.partColor(pv, def) : null) ?? fallbackColor(def);
|
|
4881
4932
|
const maxAlive = this.low ? Math.floor(this.maxFragments / 2) : this.maxFragments;
|
|
4882
4933
|
const step = this.low ? 2 : 1;
|
|
4883
4934
|
for (let i = 0; i < ev.fragments.length; i += step) {
|
|
4884
4935
|
const fr = ev.fragments[i];
|
|
4885
4936
|
const fdef = this.world.materials.get(fr.material);
|
|
4886
|
-
this.fragments.spawn(fr, this.fragments.materialFor(fr.material, fdef === def || !fdef ? color : fallbackColor(
|
|
4937
|
+
this.fragments.spawn(fr, this.fragments.materialFor(fr.material, fdef === def || !fdef ? color : fallbackColor(fdef), false), ev.object, maxAlive);
|
|
4887
4938
|
}
|
|
4888
4939
|
if (!played) this.vfx.burst("dust", ev.opening.center, [0, 1, 0], 14, 1.2, { color });
|
|
4889
4940
|
this.impactSound(pv?.material ?? "", ev.opening.center, 0.8, ev.blow);
|
|
@@ -4896,11 +4947,11 @@ var Renderer = class {
|
|
|
4896
4947
|
onChip(ev) {
|
|
4897
4948
|
const pv = this.partVis(ev.object, ev.part);
|
|
4898
4949
|
const def = pv ? this.world.materials.get(pv.material) : void 0;
|
|
4899
|
-
const color = (pv ? this.partColor(pv, def) : null) ?? fallbackColor(
|
|
4950
|
+
const color = (pv ? this.partColor(pv, def) : null) ?? fallbackColor(def);
|
|
4900
4951
|
const maxAlive = this.low ? Math.floor(this.maxFragments / 2) : this.maxFragments;
|
|
4901
4952
|
for (const fr of ev.fragments) {
|
|
4902
4953
|
const fdef = this.world.materials.get(fr.material);
|
|
4903
|
-
const tone3 =
|
|
4954
|
+
const tone3 = fragmentTone(fdef, fr, fdef === def ? color : fallbackColor(fdef));
|
|
4904
4955
|
this.fragments.spawn(fr, this.fragments.materialFor(fr.material, tone3, false), ev.object, maxAlive);
|
|
4905
4956
|
}
|
|
4906
4957
|
if (def?.visual?.innerColor !== void 0 || pv?.material === "concrete" || pv?.material === "brick") {
|
|
@@ -4924,7 +4975,7 @@ var Renderer = class {
|
|
|
4924
4975
|
const pv = b?.parts.get(ev.part);
|
|
4925
4976
|
const matId = pv?.material || (ev.fragments[0]?.material ?? "");
|
|
4926
4977
|
const def = this.world.materials.get(matId);
|
|
4927
|
-
let color = fallbackColor(
|
|
4978
|
+
let color = fallbackColor(def);
|
|
4928
4979
|
let opacity = 0.5;
|
|
4929
4980
|
const transparent = def?.visual?.transparent === true;
|
|
4930
4981
|
if (pv) {
|
|
@@ -4938,23 +4989,25 @@ var Renderer = class {
|
|
|
4938
4989
|
this.loosenIfFootless(ev.object);
|
|
4939
4990
|
const up = [0, 1, 0];
|
|
4940
4991
|
const sizeK = clamp(ev.fragments.length / 10, 0.5, 2);
|
|
4992
|
+
const look = debrisLook(def, "fracture", { style: ev.style, partColor: color });
|
|
4993
|
+
const dust = look.dust !== void 0 ? { color: look.dust } : void 0;
|
|
4941
4994
|
switch (ev.style) {
|
|
4942
4995
|
case "shatter":
|
|
4943
4996
|
this.vfx.burst("shards", ev.point, up, 18 * sizeK, 3);
|
|
4944
4997
|
break;
|
|
4945
4998
|
case "crumble":
|
|
4946
|
-
this.vfx.burst("dust", ev.point, up, 16 * sizeK, 1.2,
|
|
4947
|
-
this.vfx.burst("chips", ev.point, up, 6, 3);
|
|
4999
|
+
this.vfx.burst("dust", ev.point, up, 16 * sizeK, 1.2, dust);
|
|
5000
|
+
this.vfx.burst(look.family === "glass" ? "shards" : "chips", ev.point, up, 6, 3, { color: look.color });
|
|
4948
5001
|
break;
|
|
4949
5002
|
case "splinter":
|
|
4950
|
-
this.vfx.burst("splinters", ev.point, up, 14 * sizeK, 3);
|
|
4951
|
-
this.vfx.burst("dust", ev.point, up, 5, 0.8,
|
|
5003
|
+
this.vfx.burst("splinters", ev.point, up, 14 * sizeK, 3, { color: look.color });
|
|
5004
|
+
this.vfx.burst("dust", ev.point, up, 5, 0.8, dust);
|
|
4952
5005
|
break;
|
|
4953
5006
|
case "tear":
|
|
4954
|
-
this.vfx.burst("fibers", ev.point, up, 12 * sizeK, 1.6, { color:
|
|
5007
|
+
this.vfx.burst("fibers", ev.point, up, 12 * sizeK, 1.6, { color: look.color });
|
|
4955
5008
|
break;
|
|
4956
5009
|
case "snap":
|
|
4957
|
-
this.vfx.burst("chips", ev.point, up, 8 * sizeK, 3);
|
|
5010
|
+
this.vfx.burst("chips", ev.point, up, 8 * sizeK, 3, { color: look.color });
|
|
4958
5011
|
break;
|
|
4959
5012
|
default:
|
|
4960
5013
|
this.vfx.burst("sparks", ev.point, up, 10, 4);
|
|
@@ -4972,7 +5025,7 @@ var Renderer = class {
|
|
|
4972
5025
|
}
|
|
4973
5026
|
const fr = ev.fragments[i];
|
|
4974
5027
|
const fdef = this.world.materials.get(fr.material);
|
|
4975
|
-
const tone3 =
|
|
5028
|
+
const tone3 = fragmentTone(fdef, fr, fdef === look.def || !fdef ? look.color : fallbackColor(fdef));
|
|
4976
5029
|
const mat = this.fragments.materialFor(fr.material, tone3, look.transparent || fdef?.visual?.transparent === true, look.opacity);
|
|
4977
5030
|
this.fragments.spawn(fr, mat, ev.object, maxAlive);
|
|
4978
5031
|
}
|
|
@@ -5495,7 +5548,7 @@ var Renderer = class {
|
|
|
5495
5548
|
const s = bb.getSize(new this.THREE.Vector3());
|
|
5496
5549
|
const footprint = Math.sqrt(Math.max(s.x * s.z, 1e-4));
|
|
5497
5550
|
if (reason === "melted") {
|
|
5498
|
-
this.ground.add("puddle", c.x, c.z, clamp(footprint * 0.55, 0.05, 1), this.partColor(pv, def) ?? fallbackColor(
|
|
5551
|
+
this.ground.add("puddle", c.x, c.z, clamp(footprint * 0.55, 0.05, 1), this.partColor(pv, def) ?? fallbackColor(def), objectId);
|
|
5499
5552
|
} else {
|
|
5500
5553
|
this.ground.add("ash", c.x, c.z, clamp(footprint * 0.35, 0.04, 0.5), 1907224, objectId);
|
|
5501
5554
|
this.vfx.burst("ash", [c.x, bb.max.y, c.z], [0, 1, 0], 10, 0.8);
|