@adatechnology/game-test-room 0.35.0 → 0.35.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 +341 -166
- package/dist/index.global.js.map +1 -1
- package/package.json +6 -6
package/dist/index.global.js
CHANGED
|
@@ -1438,7 +1438,7 @@ var GameTestRoom = (() => {
|
|
|
1438
1438
|
lo1 = Math.min(lo1, cell.center[v] - cell.size[v] / 2);
|
|
1439
1439
|
}
|
|
1440
1440
|
let along4 = 1, up = 1;
|
|
1441
|
-
for (let
|
|
1441
|
+
for (let grow2 = 0; ; grow2++) {
|
|
1442
1442
|
const bins = /* @__PURE__ */ new Map();
|
|
1443
1443
|
for (const cell of cells) {
|
|
1444
1444
|
const key2 = `${Math.floor((cell.center[u] - lo0) / (along4 * unit[0]))}:${Math.floor((cell.center[v] - lo1) / (up * unit[1]))}`;
|
|
@@ -1452,7 +1452,7 @@ var GameTestRoom = (() => {
|
|
|
1452
1452
|
if (bins.size <= cap) {
|
|
1453
1453
|
return [...bins.values()].map(({ lo, hi }) => ({ center: [(lo[0] + hi[0]) / 2, (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2], size: [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]] }));
|
|
1454
1454
|
}
|
|
1455
|
-
if (
|
|
1455
|
+
if (grow2 % 2 === 0) up++;
|
|
1456
1456
|
else along4++;
|
|
1457
1457
|
}
|
|
1458
1458
|
};
|
|
@@ -3962,6 +3962,7 @@ var GameTestRoom = (() => {
|
|
|
3962
3962
|
var MEMBER_CRATER_CALIBRES = 3.4;
|
|
3963
3963
|
var MEMBER_CUT_LOSS = 0.9;
|
|
3964
3964
|
var MEMBER_UNIT_LOSS = 0.12;
|
|
3965
|
+
var JOINT_OPEN_SHARE = 0.6;
|
|
3965
3966
|
var BLAST_EDGE_WEAR = 0.6;
|
|
3966
3967
|
var RESIDUAL_CAPACITY = 0.15;
|
|
3967
3968
|
var SEVER_BAND = 0.1;
|
|
@@ -5892,6 +5893,25 @@ var GameTestRoom = (() => {
|
|
|
5892
5893
|
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]));
|
|
5893
5894
|
return len;
|
|
5894
5895
|
};
|
|
5896
|
+
const onFoundation = (o, j) => o.parts[j.ia].spec.structure?.role === "foundation" || o.parts[j.ib].spec.structure?.role === "foundation";
|
|
5897
|
+
const wornStretches = /* @__PURE__ */ new WeakMap();
|
|
5898
|
+
const wornShare = (o, j, point, span) => {
|
|
5899
|
+
const A = partWorldAabb(o, o.parts[j.ia]), B = partWorldAabb(o, o.parts[j.ib]);
|
|
5900
|
+
const lo = [0, 1, 2].map((k) => Math.max(A.min[k], B.min[k])), hi = [0, 1, 2].map((k) => Math.min(A.max[k], B.max[k]));
|
|
5901
|
+
const axis2 = [0, 1, 2].reduce((best, k) => hi[k] - lo[k] > hi[best] - lo[best] ? k : best, 0);
|
|
5902
|
+
const length3 = hi[axis2] - lo[axis2];
|
|
5903
|
+
if (length3 <= span) return 1;
|
|
5904
|
+
const at3 = clamp2(point[axis2], lo[axis2], hi[axis2]);
|
|
5905
|
+
const from = Math.max(lo[axis2], at3 - span / 2), to = Math.min(hi[axis2], at3 + span / 2);
|
|
5906
|
+
const worn = [...wornStretches.get(j) ?? [], [from, to]].sort((x, y) => x[0] - y[0]);
|
|
5907
|
+
wornStretches.set(j, worn);
|
|
5908
|
+
let covered = 0, end3 = -Infinity;
|
|
5909
|
+
for (const [a, b] of worn) {
|
|
5910
|
+
covered += Math.max(0, b - Math.max(a, end3));
|
|
5911
|
+
end3 = Math.max(end3, b);
|
|
5912
|
+
}
|
|
5913
|
+
return covered / length3;
|
|
5914
|
+
};
|
|
5895
5915
|
const isTrim = (p) => (p.spec.structure?.role ?? "none") === "none";
|
|
5896
5916
|
const wearJoints = (o, p, amount, near, radius = 0.06, src, split = false, span, blast3) => {
|
|
5897
5917
|
if (amount <= 0) return;
|
|
@@ -5903,6 +5923,7 @@ var GameTestRoom = (() => {
|
|
|
5903
5923
|
if (near && jointReach(o, j, near) > Math.max(radius, jointReachLimit(o, j))) continue;
|
|
5904
5924
|
if (blast3 && (isTrim(o.parts[j.ia]) || isTrim(o.parts[j.ib])) && jointReach(o, j, blast3.point) > Math.max(blast3.reach, jointReachLimit(o, j))) continue;
|
|
5905
5925
|
j.st.hp -= span === void 0 ? amount : Math.min(amount, j.st.maxHp) * Math.min(1, span / Math.max(jointLength(o, j), 1e-6));
|
|
5926
|
+
if (j.st.hp <= 0 && blast3 && span !== void 0 && onFoundation(o, j) && wornShare(o, j, blast3.point, span) < JOINT_OPEN_SHARE) j.st.hp = Math.min(j.st.maxHp, 1);
|
|
5906
5927
|
if (j.st.hp <= 0) {
|
|
5907
5928
|
j.st.hp = 0;
|
|
5908
5929
|
j.st.open = true;
|
|
@@ -8328,6 +8349,70 @@ var GameTestRoom = (() => {
|
|
|
8328
8349
|
}
|
|
8329
8350
|
};
|
|
8330
8351
|
var resolveStrings = (locale2) => locales[locale2 ?? "en"] ?? locales.en;
|
|
8352
|
+
var FAMILY_COLORS = {
|
|
8353
|
+
wood: { debris: 11569754, dust: 11901556 },
|
|
8354
|
+
masonry: { debris: 10197652, dust: 11052187 },
|
|
8355
|
+
glass: { debris: 11061464, dust: 12572386 },
|
|
8356
|
+
metal: { debris: 9080726, dust: void 0 },
|
|
8357
|
+
soft: { debris: 10130568, dust: void 0 },
|
|
8358
|
+
soil: { debris: 8022613, dust: 9075298 }
|
|
8359
|
+
};
|
|
8360
|
+
var MARKS = { wood: "splintered_hole", masonry: "crater", glass: "star_crack", metal: "dent", soft: "torn_hole", soil: "pit" };
|
|
8361
|
+
var IMPACTS = { wood: "wood", masonry: "concrete", glass: "glass", metal: "metal", soft: void 0, soil: void 0 };
|
|
8362
|
+
var FAMILY_DEBRIS = { wood: "splinters", masonry: "chips", glass: "shards", metal: "sparks", soil: "dust" };
|
|
8363
|
+
var STYLE_DEBRIS = { shatter: "shards", crumble: "chips", splinter: "splinters", tear: "fibers", snap: "chips", none: "sparks" };
|
|
8364
|
+
var FRACTURE_FAMILY = { none: "metal", shatter: "glass", splinter: "wood", crumble: "masonry", tear: "soft", snap: "soft" };
|
|
8365
|
+
function debrisFamily(def) {
|
|
8366
|
+
const tags = def?.tags ?? [];
|
|
8367
|
+
if (tags.includes("metal")) return "metal";
|
|
8368
|
+
if (tags.includes("glass") || def?.visual?.transparent) return "glass";
|
|
8369
|
+
if (tags.includes("wood") || def?.penetrationClass === "wood") return "wood";
|
|
8370
|
+
if (tags.includes("soil")) return "soil";
|
|
8371
|
+
if (tags.includes("masonry") || tags.includes("ceramic")) return "masonry";
|
|
8372
|
+
return FRACTURE_FAMILY[def?.fracture ?? "tear"];
|
|
8373
|
+
}
|
|
8374
|
+
function debrisColor(def, partColor) {
|
|
8375
|
+
const family = debrisFamily(def);
|
|
8376
|
+
if (def?.visual?.innerColor !== void 0) return def.visual.innerColor;
|
|
8377
|
+
if (def?.visual?.unitColor !== void 0) return def.visual.unitColor;
|
|
8378
|
+
if (partColor !== void 0 && family !== "metal" && family !== "glass") return partColor;
|
|
8379
|
+
return FAMILY_COLORS[family].debris;
|
|
8380
|
+
}
|
|
8381
|
+
function fragmentTone(def, face, partColor) {
|
|
8382
|
+
if (face.unit && def?.visual?.unitColor !== void 0) return def.visual.unitColor;
|
|
8383
|
+
if (face.inner && def?.visual?.innerColor !== void 0) return def.visual.innerColor;
|
|
8384
|
+
return partColor ?? FAMILY_COLORS[debrisFamily(def)].debris;
|
|
8385
|
+
}
|
|
8386
|
+
function dustColor(def, partColor) {
|
|
8387
|
+
const family = debrisFamily(def);
|
|
8388
|
+
const base = FAMILY_COLORS[family].dust;
|
|
8389
|
+
if (base === void 0) return void 0;
|
|
8390
|
+
if (family === "glass") return base;
|
|
8391
|
+
return mix(debrisColor(def, partColor), 14210252, 0.3);
|
|
8392
|
+
}
|
|
8393
|
+
function debrisKindOf(def, family, event, style) {
|
|
8394
|
+
if (event === "fracture") return STYLE_DEBRIS[style ?? def?.fracture ?? "crumble"];
|
|
8395
|
+
if (event === "shot") return def?.hitDebris ?? (family === "soft" ? "chips" : FAMILY_DEBRIS[family]);
|
|
8396
|
+
if (event === "stage2" || event === "stage3" || event === "explosion" || event === "collapse") return def?.breakDebris ?? "dust";
|
|
8397
|
+
if (family === "soft") return def?.hitDebris ?? "chips";
|
|
8398
|
+
return FAMILY_DEBRIS[family];
|
|
8399
|
+
}
|
|
8400
|
+
function debrisLook(def, event, options = {}) {
|
|
8401
|
+
const family = debrisFamily(def);
|
|
8402
|
+
return {
|
|
8403
|
+
family,
|
|
8404
|
+
debris: debrisKindOf(def, family, event, options.style),
|
|
8405
|
+
color: debrisColor(def, options.partColor),
|
|
8406
|
+
dust: dustColor(def, options.partColor),
|
|
8407
|
+
mark: MARKS[family],
|
|
8408
|
+
sparks: family === "metal",
|
|
8409
|
+
impact: IMPACTS[family]
|
|
8410
|
+
};
|
|
8411
|
+
}
|
|
8412
|
+
function mix(a, b, t) {
|
|
8413
|
+
const channel = (shift) => Math.round((a >> shift & 255) * (1 - t) + (b >> shift & 255) * t) << shift;
|
|
8414
|
+
return channel(16) | channel(8) | channel(0);
|
|
8415
|
+
}
|
|
8331
8416
|
|
|
8332
8417
|
// ../game-audio/dist/chunk-TXGRBRE6.js
|
|
8333
8418
|
var SFX_TIERS = { light: 0, medium: 0.34, heavy: 0.67 };
|
|
@@ -8641,10 +8726,10 @@ var GameTestRoom = (() => {
|
|
|
8641
8726
|
mix_profiles_default.map((profile) => [profile.id, profile])
|
|
8642
8727
|
);
|
|
8643
8728
|
var DEFAULT_MIX = "kit";
|
|
8644
|
-
function resolveMix(
|
|
8645
|
-
if (typeof
|
|
8646
|
-
const profile = profiles[
|
|
8647
|
-
if (!profile) throw new Error(`game-audio: unknown mix profile "${
|
|
8729
|
+
function resolveMix(mix2, profiles = MIX_PROFILES) {
|
|
8730
|
+
if (typeof mix2 !== "string") return mix2;
|
|
8731
|
+
const profile = profiles[mix2];
|
|
8732
|
+
if (!profile) throw new Error(`game-audio: unknown mix profile "${mix2}" (known: ${Object.keys(profiles).join(", ")})`);
|
|
8648
8733
|
return profile;
|
|
8649
8734
|
}
|
|
8650
8735
|
function busGain(setting) {
|
|
@@ -10292,15 +10377,15 @@ var GameTestRoom = (() => {
|
|
|
10292
10377
|
const breath = noiseSource(target, true);
|
|
10293
10378
|
const breathBand = filterNode(context, { type: "bandpass", frequency: { value: source.breath.frequency }, q: source.breath.q }, time);
|
|
10294
10379
|
const breathLevel = gainNode(context, source.breath.gain);
|
|
10295
|
-
const
|
|
10380
|
+
const mix2 = gainNode(context, source.mix);
|
|
10296
10381
|
for (const formant of formants) oscillator.connect(formant);
|
|
10297
10382
|
breath.connect(breathBand);
|
|
10298
10383
|
breathBand.connect(breathLevel);
|
|
10299
|
-
for (const formant of formants) formant.connect(
|
|
10300
|
-
breathLevel.connect(
|
|
10384
|
+
for (const formant of formants) formant.connect(mix2);
|
|
10385
|
+
breathLevel.connect(mix2);
|
|
10301
10386
|
const envelope2 = context.createGain();
|
|
10302
10387
|
applyEnvelope(envelope2.gain, layer3.envelope, time);
|
|
10303
|
-
|
|
10388
|
+
mix2.connect(envelope2);
|
|
10304
10389
|
envelope2.connect(outputStage2(plan, layer3, target));
|
|
10305
10390
|
const stop = end2(layer3, time);
|
|
10306
10391
|
oscillator.start(time);
|
|
@@ -10631,7 +10716,7 @@ var GameTestRoom = (() => {
|
|
|
10631
10716
|
const active = /* @__PURE__ */ new Map();
|
|
10632
10717
|
const loops = /* @__PURE__ */ new Set();
|
|
10633
10718
|
const named = /* @__PURE__ */ new Map();
|
|
10634
|
-
let
|
|
10719
|
+
let mix2 = resolveMix(options.mix ?? DEFAULT_MIX, options.profiles);
|
|
10635
10720
|
let context = null;
|
|
10636
10721
|
let chain = null;
|
|
10637
10722
|
let listener = DEFAULT_LISTENER;
|
|
@@ -10710,9 +10795,9 @@ var GameTestRoom = (() => {
|
|
|
10710
10795
|
const created = (options.createContext ?? globalContext)();
|
|
10711
10796
|
if (!created) return null;
|
|
10712
10797
|
context = created;
|
|
10713
|
-
chain = buildChain(created,
|
|
10714
|
-
if (
|
|
10715
|
-
for (const [bus, setting] of Object.entries(
|
|
10798
|
+
chain = buildChain(created, mix2, engineRandom);
|
|
10799
|
+
if (mix2.noise.create === "eager") noiseBuffer(shared2, created, mix2.noise.seconds);
|
|
10800
|
+
for (const [bus, setting] of Object.entries(mix2.buses ?? {})) {
|
|
10716
10801
|
busSettings.set(bus, { ...setting, ...busSettings.get(bus) });
|
|
10717
10802
|
}
|
|
10718
10803
|
for (const [bus, setting] of busSettings) {
|
|
@@ -10732,7 +10817,7 @@ var GameTestRoom = (() => {
|
|
|
10732
10817
|
const inputFor = (recipe2, playOptions, random) => ({
|
|
10733
10818
|
random,
|
|
10734
10819
|
listener,
|
|
10735
|
-
noiseSeconds:
|
|
10820
|
+
noiseSeconds: mix2.noise.seconds,
|
|
10736
10821
|
...options.distance ? { distanceMode: options.distance } : {},
|
|
10737
10822
|
...playOptions.volume === void 0 ? {} : { volume: playOptions.volume },
|
|
10738
10823
|
...playOptions.distance === void 0 ? {} : { distance: playOptions.distance },
|
|
@@ -10748,7 +10833,7 @@ var GameTestRoom = (() => {
|
|
|
10748
10833
|
context: audio,
|
|
10749
10834
|
output: route?.input ?? outputFor(plan.bus),
|
|
10750
10835
|
...route?.wet ?? chain?.wet ? { wet: route?.wet ?? chain?.wet } : {},
|
|
10751
|
-
noise: () => noiseBuffer(store, audio,
|
|
10836
|
+
noise: () => noiseBuffer(store, audio, mix2.noise.seconds),
|
|
10752
10837
|
time
|
|
10753
10838
|
});
|
|
10754
10839
|
const recipeBank = registry.bankOf(plan.id);
|
|
@@ -10918,7 +11003,7 @@ var GameTestRoom = (() => {
|
|
|
10918
11003
|
advance();
|
|
10919
11004
|
const voiceId = silent ? void 0 : admit(recipe2, level, distance22);
|
|
10920
11005
|
if (voiceId === null) return null;
|
|
10921
|
-
if (!silent && usesNoise(recipe2)) prepareNoise(store, audio,
|
|
11006
|
+
if (!silent && usesNoise(recipe2)) prepareNoise(store, audio, mix2.noise.seconds);
|
|
10922
11007
|
const plan = planSound(recipe2, inputFor(recipe2, playOptions, random));
|
|
10923
11008
|
return plan ? start(retunePlan(plan, rate), store, voiceId, playOptions.delay, fallbackOf, playOptions.urgent, recipe2.falloff?.model === "none" ? void 0 : playOptions.position) : null;
|
|
10924
11009
|
};
|
|
@@ -10939,8 +11024,8 @@ var GameTestRoom = (() => {
|
|
|
10939
11024
|
const loopHost = {
|
|
10940
11025
|
ready,
|
|
10941
11026
|
output: outputFor,
|
|
10942
|
-
prepareNoise: () => context && prepareNoise(shared2, context,
|
|
10943
|
-
noise: () => noiseBuffer(shared2, context,
|
|
11027
|
+
prepareNoise: () => context && prepareNoise(shared2, context, mix2.noise.seconds),
|
|
11028
|
+
noise: () => noiseBuffer(shared2, context, mix2.noise.seconds),
|
|
10944
11029
|
register: (loop) => void loops.add(loop),
|
|
10945
11030
|
unregister: (loop) => void loops.delete(loop),
|
|
10946
11031
|
listener: () => listener,
|
|
@@ -10993,7 +11078,7 @@ var GameTestRoom = (() => {
|
|
|
10993
11078
|
const recipe2 = { id: plan.id, bus: plan.bus, layers: [], sources: [], priority: plan.priority, ...plan.group ? { group: plan.group } : {} };
|
|
10994
11079
|
const voiceId = plan.silent ? void 0 : admit(recipe2, plan.level, plan.distance);
|
|
10995
11080
|
if (voiceId === null) return null;
|
|
10996
|
-
if (planUsesNoise(plan)) prepareNoise(shared2, audio,
|
|
11081
|
+
if (planUsesNoise(plan)) prepareNoise(shared2, audio, mix2.noise.seconds);
|
|
10997
11082
|
return start(plan, shared2, voiceId, playOptions.delay);
|
|
10998
11083
|
},
|
|
10999
11084
|
loop(id, loopOptions = {}) {
|
|
@@ -11039,12 +11124,12 @@ var GameTestRoom = (() => {
|
|
|
11039
11124
|
busNodes.get(id).gain.value = busGain(busSettings.get(id));
|
|
11040
11125
|
},
|
|
11041
11126
|
setMix(next) {
|
|
11042
|
-
const previous =
|
|
11043
|
-
|
|
11127
|
+
const previous = mix2;
|
|
11128
|
+
mix2 = resolveMix(next, options.profiles);
|
|
11044
11129
|
if (!context || !chain) return;
|
|
11045
11130
|
const old = chain;
|
|
11046
|
-
chain = buildChain(context,
|
|
11047
|
-
if (
|
|
11131
|
+
chain = buildChain(context, mix2, engineRandom);
|
|
11132
|
+
if (mix2.noise.seconds !== previous.noise.seconds) shared2.reset();
|
|
11048
11133
|
for (const node of busNodes.values()) {
|
|
11049
11134
|
node.disconnect();
|
|
11050
11135
|
node.connect(chain.master);
|
|
@@ -11053,7 +11138,7 @@ var GameTestRoom = (() => {
|
|
|
11053
11138
|
old.disconnect();
|
|
11054
11139
|
},
|
|
11055
11140
|
setMaster(gain) {
|
|
11056
|
-
|
|
11141
|
+
mix2 = { ...mix2, master: gain };
|
|
11057
11142
|
if (chain) chain.master.gain.value = gain;
|
|
11058
11143
|
},
|
|
11059
11144
|
unlock() {
|
|
@@ -11063,7 +11148,7 @@ var GameTestRoom = (() => {
|
|
|
11063
11148
|
warmUp() {
|
|
11064
11149
|
const audio = ready();
|
|
11065
11150
|
if (!audio) return false;
|
|
11066
|
-
noiseBuffer(shared2, audio,
|
|
11151
|
+
noiseBuffer(shared2, audio, mix2.noise.seconds);
|
|
11067
11152
|
return true;
|
|
11068
11153
|
},
|
|
11069
11154
|
level(bus) {
|
|
@@ -16240,66 +16325,58 @@ var GameTestRoom = (() => {
|
|
|
16240
16325
|
])
|
|
16241
16326
|
]
|
|
16242
16327
|
};
|
|
16328
|
+
var DEBRIS_EFFECT_FAMILIES = ["wood", "masonry", "glass", "metal", "soft", "soil"];
|
|
16329
|
+
var DEBRIS_COLOR_VARIABLE = "debrisColor";
|
|
16330
|
+
var DUST_COLOR_VARIABLE = "dustColor";
|
|
16331
|
+
var FAMILIES = {
|
|
16332
|
+
wood: { debris: 8017200, dust: 10127986, piece: [0.015, 0.015, 0.1], spin: 6, cloud: 0.5, sparks: false, glints: false },
|
|
16333
|
+
masonry: { debris: 10197652, dust: 11052187, piece: [0.035, 0.028, 0.035], spin: 4, cloud: 1, sparks: false, glints: false },
|
|
16334
|
+
glass: { debris: 11061464, dust: 12572386, piece: [0.04, 4e-3, 0.04], spin: 14, cloud: 0.25, sparks: false, glints: true },
|
|
16335
|
+
metal: { debris: 9080726, dust: 9078138, piece: [0.04, 6e-3, 0.03], spin: 8, cloud: 0.15, sparks: true, glints: false },
|
|
16336
|
+
soft: { debris: 10130568, dust: 11578014, piece: [0.025, 4e-3, 0.02], spin: 6, cloud: 0.3, sparks: false, glints: false },
|
|
16337
|
+
soil: { debris: 8022613, dust: 9075298, piece: [0.03, 0.025, 0.03], spin: 3, cloud: 1, sparks: false, glints: false }
|
|
16338
|
+
};
|
|
16339
|
+
var ORIGIN = [0, 0, 0];
|
|
16243
16340
|
var FACING4 = [0, 0, 1];
|
|
16244
16341
|
var UP11 = [0, 1, 0];
|
|
16245
|
-
var
|
|
16246
|
-
var
|
|
16247
|
-
var
|
|
16248
|
-
var
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
var muzzleEffect = (weapon) => ({
|
|
16257
|
-
id: `muzzle_${weapon}`,
|
|
16258
|
-
pageId: `event:muzzle_${weapon}`,
|
|
16259
|
-
team: "weapons",
|
|
16260
|
-
budget: { particles: 60, lights: 1 },
|
|
16261
|
-
loop: 2.4,
|
|
16262
|
-
timeline: [call2("muzzle", weapon, ORIGIN, FORWARD4)]
|
|
16263
|
-
});
|
|
16264
|
-
var casingEffect = (id, type) => ({
|
|
16265
|
-
id,
|
|
16266
|
-
pageId: `event:${id}`,
|
|
16267
|
-
team: "weapons",
|
|
16268
|
-
budget: { debris: 1 },
|
|
16269
|
-
loop: 2,
|
|
16270
|
-
timeline: [call2("casing", ORIGIN, type)]
|
|
16271
|
-
});
|
|
16272
|
-
var EVENT_EFFECTS = [
|
|
16273
|
-
...IMPACT_MATERIALS.map(impactEffect),
|
|
16274
|
-
...["glock", "ak", "r870", "barrett"].map(muzzleEffect),
|
|
16275
|
-
casingEffect("casing_brass", ""),
|
|
16276
|
-
casingEffect("casing_shell", "shell"),
|
|
16277
|
-
casingEffect("casing_50", "50"),
|
|
16278
|
-
{
|
|
16279
|
-
// door_stages (W856-871): the dust a blow shakes loose from the frame and the splinters.
|
|
16280
|
-
id: "stage_crack",
|
|
16281
|
-
pageId: "event:stage_crack",
|
|
16342
|
+
var grow = (piece, factor) => [piece[0] * factor, piece[1] * factor, piece[2] * factor];
|
|
16343
|
+
var debrisTone = (look) => or(variable(DEBRIS_COLOR_VARIABLE), look.debris);
|
|
16344
|
+
var dustTone = (look) => or(variable(DUST_COLOR_VARIABLE), look.dust);
|
|
16345
|
+
var sparks = (look, count) => look.sparks ? [call2("spark_at", ORIGIN, FACING4, count, 0.9)] : [];
|
|
16346
|
+
var glints = (look, count) => look.glints ? [burst("add", count, { p: ORIGIN, r: 0.2, size: [0.02, 0.05], life: [0.2, 0.5], c0: 16777215, a: 0.9, fi: 0.3 })] : [];
|
|
16347
|
+
function stageCrack(family) {
|
|
16348
|
+
const look = FAMILIES[family];
|
|
16349
|
+
const dust = look.sparks ? [] : [burst("normal", 12, { p: ORIGIN, box: [0.3, 0.05, 0.02], dir: [0, -0.287, 0.958], cone: 0.6, sp: [0.2, 0.8], drag: 1.5, life: [0.8, 1.4], size: [0.08, 0.16], grow: 3, c0: dustTone(look), a: 0.45, g: 0.4 })];
|
|
16350
|
+
return {
|
|
16351
|
+
id: `stage_crack_${family}`,
|
|
16352
|
+
pageId: `event:stage_crack_${family}`,
|
|
16282
16353
|
team: "destruction",
|
|
16283
|
-
budget: { particles:
|
|
16354
|
+
budget: { particles: 16, debris: 6 },
|
|
16284
16355
|
loop: 2,
|
|
16285
16356
|
timeline: [
|
|
16286
|
-
|
|
16287
|
-
|
|
16357
|
+
...dust,
|
|
16358
|
+
...sparks(look, 8),
|
|
16359
|
+
...glints(look, 4),
|
|
16360
|
+
repeat(scaled(look.sparks ? 1 : 4), debris({ p: ORIGIN, box: [0.15, 0.15, 0.02], dir: [0, 0.287, 0.958], cone: 0.6, sp: [1, 2.5], size: look.piece, k: [0.6, 1.4], spin: look.spin, c: debrisTone(look), life: 12 }))
|
|
16288
16361
|
]
|
|
16289
|
-
}
|
|
16290
|
-
|
|
16291
|
-
|
|
16292
|
-
|
|
16293
|
-
|
|
16362
|
+
};
|
|
16363
|
+
}
|
|
16364
|
+
function breachDust(family) {
|
|
16365
|
+
const look = FAMILIES[family];
|
|
16366
|
+
return {
|
|
16367
|
+
id: `breach_dust_${family}`,
|
|
16368
|
+
pageId: `event:breach_dust_${family}`,
|
|
16294
16369
|
team: "destruction",
|
|
16295
16370
|
budget: { particles: 90, debris: 16 },
|
|
16296
16371
|
loop: 5,
|
|
16297
16372
|
timeline: [
|
|
16298
16373
|
screen({ add: { shake: 0.25 } }),
|
|
16299
|
-
|
|
16300
|
-
|
|
16374
|
+
...sparks(look, 14),
|
|
16375
|
+
...glints(look, 20),
|
|
16376
|
+
burst("normal", Math.round(30 * look.cloud), { p: ORIGIN, box: [1.4, 0.8, 0.2], sp: [0.3, 1.2], drag: 1.5, life: [1.5, 2.6], size: [0.4, 0.7], grow: 3, c0: dustTone(look), c1: 4867648, a: 0.45 }),
|
|
16377
|
+
repeat(scaled(16), debris({ p: ORIGIN, box: [1.3, 0.8, 0.1], sp: [1, 3], size: grow(look.piece, 2.2), k: [0.5, 1.5], spin: look.spin, c: debrisTone(look), life: 20 })),
|
|
16301
16378
|
repeat(
|
|
16302
|
-
scaled(60),
|
|
16379
|
+
scaled(Math.round(60 * look.cloud)),
|
|
16303
16380
|
spawn("normal", local("angle", rnd(0, 6.283), {
|
|
16304
16381
|
p: [rnd(-1.4, 1.4), 0.2, rnd(-0.6, 0.4)],
|
|
16305
16382
|
dir: vnorm([cos(variable("angle")), 0.3, sin(variable("angle"))]),
|
|
@@ -16309,27 +16386,30 @@ var GameTestRoom = (() => {
|
|
|
16309
16386
|
life: [2.5, 4.5],
|
|
16310
16387
|
size: [0.6, 1],
|
|
16311
16388
|
grow: 3,
|
|
16312
|
-
c0:
|
|
16389
|
+
c0: dustTone(look),
|
|
16313
16390
|
c1: 4867648,
|
|
16314
16391
|
a: 0.45,
|
|
16315
16392
|
fi: 0.12
|
|
16316
16393
|
}))
|
|
16317
16394
|
)
|
|
16318
16395
|
]
|
|
16319
|
-
}
|
|
16320
|
-
|
|
16321
|
-
|
|
16322
|
-
|
|
16323
|
-
|
|
16396
|
+
};
|
|
16397
|
+
}
|
|
16398
|
+
function collapseDust(family) {
|
|
16399
|
+
const look = FAMILIES[family];
|
|
16400
|
+
return {
|
|
16401
|
+
id: `collapse_dust_${family}`,
|
|
16402
|
+
pageId: `event:collapse_dust_${family}`,
|
|
16324
16403
|
team: "destruction",
|
|
16325
16404
|
budget: { particles: 350, debris: 26 },
|
|
16326
16405
|
loop: 8,
|
|
16327
16406
|
timeline: [
|
|
16328
16407
|
screen({ add: { shake: 0.45 } }),
|
|
16329
|
-
|
|
16330
|
-
repeat(
|
|
16408
|
+
...sparks(look, 20),
|
|
16409
|
+
repeat(6, debris({ p: ORIGIN, box: [2, 0.05, 0.6], v: [rnd(-0.5, 0.5), rnd(-0.5, 0), rnd(0, 0.8)], sp: 0, size: [rnd(0.5, 1.1), look.piece[1] > 0.01 ? 0.25 : 0.03, rnd(0.4, 0.8)], c: debrisTone(look), spin: 3, life: 30, bounce: 0.1 })),
|
|
16410
|
+
repeat(scaled(20), debris({ p: ORIGIN, box: [2.1, 0.1, 0.7], v: [rnd(-1, 1), rnd(-1, 1), rnd(0, 1.5)], sp: 0, size: grow(look.piece, 3.4), k: [0.5, 1.5], spin: look.spin, c: debrisTone(look), life: 30 })),
|
|
16331
16411
|
repeat(
|
|
16332
|
-
scaled(70),
|
|
16412
|
+
scaled(Math.round(70 * look.cloud)),
|
|
16333
16413
|
spawn("normal", local("angle", rnd(-0.4, 3.5), {
|
|
16334
16414
|
p: [rnd(-2, 2), 0.2, rnd(-0.5, 0.5)],
|
|
16335
16415
|
dir: vnorm([mul(cos(variable("angle")), 0.6), 0.25, sin(variable("angle"))]),
|
|
@@ -16339,14 +16419,66 @@ var GameTestRoom = (() => {
|
|
|
16339
16419
|
life: [3, 6],
|
|
16340
16420
|
size: [0.7, 1.2],
|
|
16341
16421
|
grow: 3,
|
|
16342
|
-
c0:
|
|
16422
|
+
c0: dustTone(look),
|
|
16343
16423
|
c1: 4867648,
|
|
16344
16424
|
a: 0.5,
|
|
16345
16425
|
fi: 0.12
|
|
16346
16426
|
}))
|
|
16347
16427
|
)
|
|
16348
16428
|
]
|
|
16349
|
-
}
|
|
16429
|
+
};
|
|
16430
|
+
}
|
|
16431
|
+
var MASONRY = FAMILIES.masonry;
|
|
16432
|
+
var REBAR_EXPOSE = {
|
|
16433
|
+
id: "rebar_expose",
|
|
16434
|
+
pageId: "event:rebar_expose",
|
|
16435
|
+
team: "destruction",
|
|
16436
|
+
budget: { particles: 24, debris: 8 },
|
|
16437
|
+
loop: 2,
|
|
16438
|
+
timeline: [
|
|
16439
|
+
repeat(scaled(8), debris({ p: ORIGIN, dir: UP11, cone: 0.9, sp: [1, 3], size: MASONRY.piece, k: [0.6, 1.4], spin: MASONRY.spin, c: debrisTone(MASONRY), life: 20 })),
|
|
16440
|
+
burst("normal", 8, { p: ORIGIN, dir: UP11, cone: 0.8, sp: [0.3, 1.2], drag: 2, life: [0.8, 1.4], size: [0.08, 0.15], grow: 3, c0: dustTone(MASONRY), a: 0.4 }),
|
|
16441
|
+
call2("rust_at", ORIGIN, 6)
|
|
16442
|
+
]
|
|
16443
|
+
};
|
|
16444
|
+
var MATERIAL_EVENT_EFFECTS = [
|
|
16445
|
+
...DEBRIS_EFFECT_FAMILIES.flatMap((family) => [stageCrack(family), breachDust(family), collapseDust(family)]),
|
|
16446
|
+
REBAR_EXPOSE
|
|
16447
|
+
];
|
|
16448
|
+
var FACING5 = [0, 0, 1];
|
|
16449
|
+
var ORIGIN2 = [0, 0, 0];
|
|
16450
|
+
var FORWARD4 = [0, 0, -1];
|
|
16451
|
+
var IMPACT_MATERIALS = ["concrete", "metal", "wood", "glass", "flesh", "water"];
|
|
16452
|
+
var impactEffect = (material2) => ({
|
|
16453
|
+
id: `impact_${material2}`,
|
|
16454
|
+
pageId: `event:impact_${material2}`,
|
|
16455
|
+
team: "weapons",
|
|
16456
|
+
budget: { particles: 40, decals: 1 },
|
|
16457
|
+
loop: 2,
|
|
16458
|
+
timeline: [call2("impact", material2, ORIGIN2, FACING5, 1, 0)]
|
|
16459
|
+
});
|
|
16460
|
+
var muzzleEffect = (weapon) => ({
|
|
16461
|
+
id: `muzzle_${weapon}`,
|
|
16462
|
+
pageId: `event:muzzle_${weapon}`,
|
|
16463
|
+
team: "weapons",
|
|
16464
|
+
budget: { particles: 60, lights: 1 },
|
|
16465
|
+
loop: 2.4,
|
|
16466
|
+
timeline: [call2("muzzle", weapon, ORIGIN2, FORWARD4)]
|
|
16467
|
+
});
|
|
16468
|
+
var casingEffect = (id, type) => ({
|
|
16469
|
+
id,
|
|
16470
|
+
pageId: `event:${id}`,
|
|
16471
|
+
team: "weapons",
|
|
16472
|
+
budget: { debris: 1 },
|
|
16473
|
+
loop: 2,
|
|
16474
|
+
timeline: [call2("casing", ORIGIN2, type)]
|
|
16475
|
+
});
|
|
16476
|
+
var EVENT_EFFECTS = [
|
|
16477
|
+
...IMPACT_MATERIALS.map(impactEffect),
|
|
16478
|
+
...["glock", "ak", "r870", "barrett"].map(muzzleEffect),
|
|
16479
|
+
casingEffect("casing_brass", ""),
|
|
16480
|
+
casingEffect("casing_shell", "shell"),
|
|
16481
|
+
casingEffect("casing_50", "50"),
|
|
16350
16482
|
{
|
|
16351
16483
|
// shopfront_glass (W846-855): the pane coming down as shards, the flash of the glints and the pale dust.
|
|
16352
16484
|
id: "glass_burst",
|
|
@@ -16358,21 +16490,13 @@ var GameTestRoom = (() => {
|
|
|
16358
16490
|
screen({ add: { shake: 0.08 } }),
|
|
16359
16491
|
repeat(
|
|
16360
16492
|
scaled(75),
|
|
16361
|
-
debris({ p:
|
|
16493
|
+
debris({ p: ORIGIN2, box: [1.25, 0.85, 0.02], v: [rnd(-0.4, 0.4), rnd(-0.5, 0.8), rnd(0.6, 2)], sp: 0, size: [rnd(0.05, 0.18), 6e-3, rnd(0.05, 0.18)], c: 11061464, spin: 14, life: 30, bounce: 0.15 })
|
|
16362
16494
|
),
|
|
16363
|
-
burst("add", 30, { p:
|
|
16495
|
+
burst("add", 30, { p: ORIGIN2, box: [1.2, 0.8, 0.05], size: [0.02, 0.05], life: [0.2, 0.6], c0: 16777215, a: 0.9, fi: 0.3 }),
|
|
16364
16496
|
burst("normal", 20, { p: [0, -0.6, 0.1], box: [1.2, 0.5, 0.1], sp: [0.2, 0.6], drag: 2, life: [0.8, 1.4], size: [0.12, 0.2], grow: 3, c0: 12572386, a: 0.2 })
|
|
16365
16497
|
]
|
|
16366
16498
|
},
|
|
16367
|
-
|
|
16368
|
-
// The chips macro the page uses on wood (W849) plus rust (`rustAt`), for rebar laid bare in concrete.
|
|
16369
|
-
id: "rebar_expose",
|
|
16370
|
-
pageId: "event:rebar_expose",
|
|
16371
|
-
team: "destruction",
|
|
16372
|
-
budget: { particles: 20, debris: 8 },
|
|
16373
|
-
loop: 2,
|
|
16374
|
-
timeline: [call2("chips", ORIGIN, UP11, 8, 0.9), call2("rust_at", ORIGIN, 6)]
|
|
16375
|
-
}
|
|
16499
|
+
...MATERIAL_EVENT_EFFECTS
|
|
16376
16500
|
];
|
|
16377
16501
|
var PI = Math.PI;
|
|
16378
16502
|
var SMOKE = { color: 9079430, width: 10, height: 8, gravity: -0.08, drag: 2.2, growth: 2.1 };
|
|
@@ -16383,7 +16507,7 @@ var GameTestRoom = (() => {
|
|
|
16383
16507
|
var FLASH_OPACITY = 0.95;
|
|
16384
16508
|
var FLAME_COLORS = [16742946, 16760896, 13121050, 16773296];
|
|
16385
16509
|
var FLAME_ADDITIVE = 3;
|
|
16386
|
-
var
|
|
16510
|
+
var ORIGIN3 = [0, 0, 0];
|
|
16387
16511
|
var SIZE = variable("size");
|
|
16388
16512
|
var FLASH_SCALE = variable("flash");
|
|
16389
16513
|
var fallback = (name, defaultValue) => ite(ne(variable(name), void 0), variable(name), defaultValue);
|
|
@@ -16431,7 +16555,7 @@ var GameTestRoom = (() => {
|
|
|
16431
16555
|
grow: 2.2
|
|
16432
16556
|
})
|
|
16433
16557
|
];
|
|
16434
|
-
var flashPiece = (shape, radius, height, width, at3, rot, color) => mesh({ shape, r: radius, ...height === void 0 ? {} : { h: height }, seg: width, seg2: shape === "sphere" ? 8 : 1, p:
|
|
16558
|
+
var flashPiece = (shape, radius, height, width, at3, rot, color) => mesh({ shape, r: radius, ...height === void 0 ? {} : { h: height }, seg: width, seg2: shape === "sphere" ? 8 : 1, p: ORIGIN3, at: at3, rot, roll: variable("roll"), ramp: FLASH_RAMP, life: FLASH_SECONDS, c0: color, a: FLASH_OPACITY, add: true });
|
|
16435
16559
|
var MUZZLE_FLASH2 = {
|
|
16436
16560
|
id: "viewmodel_muzzle_flash",
|
|
16437
16561
|
pageId: "event:viewmodel_muzzle_flash",
|
|
@@ -16458,7 +16582,7 @@ var GameTestRoom = (() => {
|
|
|
16458
16582
|
repeat(4, append("angles", add(div(mul(INDEX, PI), 2), mul(rand(), 0.6)))),
|
|
16459
16583
|
set("roll", mul(rand(), PI)),
|
|
16460
16584
|
when(gt(FLASH_SCALE, 0), [
|
|
16461
|
-
flash(
|
|
16585
|
+
flash(ORIGIN3, 16756832, mul(4, SIZE, FLASH_SCALE), FLASH_SECONDS, mul(2, SIZE, FLASH_SCALE), true, true),
|
|
16462
16586
|
flashPiece("cone_open", mul(0.013, SIZE, FLASH_SCALE), mul(0.085, SIZE, FLASH_SCALE), 10, [mul(0.042, SIZE, FLASH_SCALE), 0, 0], [0, 0, -PI / 2], 16757575),
|
|
16463
16587
|
repeat(
|
|
16464
16588
|
4,
|
|
@@ -16478,7 +16602,7 @@ var GameTestRoom = (() => {
|
|
|
16478
16602
|
repeat(
|
|
16479
16603
|
variable("puffs"),
|
|
16480
16604
|
puff2(
|
|
16481
|
-
|
|
16605
|
+
ORIGIN3,
|
|
16482
16606
|
[add(variable("drift"), mul(rand(), variable("driftSpread"))), add(variable("rise"), mul(rand(), variable("riseSpread"))), mul(sub(rand(), 0.5), variable("sideSpread"))],
|
|
16483
16607
|
[0, 0, 0],
|
|
16484
16608
|
mul(variable("radius"), SIZE),
|
|
@@ -16495,7 +16619,7 @@ var GameTestRoom = (() => {
|
|
|
16495
16619
|
team: "weapons",
|
|
16496
16620
|
budget: { particles: 1 },
|
|
16497
16621
|
loop: 0.1,
|
|
16498
|
-
timeline: [puff2(
|
|
16622
|
+
timeline: [puff2(ORIGIN3, void 0, [variable("vx"), variable("vy"), variable("vz")], variable("radius"), variable("life"), variable("opacity"))]
|
|
16499
16623
|
};
|
|
16500
16624
|
var BACKBLAST = {
|
|
16501
16625
|
id: "launcher_backblast",
|
|
@@ -16504,8 +16628,8 @@ var GameTestRoom = (() => {
|
|
|
16504
16628
|
budget: { particles: 40 },
|
|
16505
16629
|
loop: 0.1,
|
|
16506
16630
|
timeline: [
|
|
16507
|
-
repeat(26, puff2(
|
|
16508
|
-
repeat(14, ...flameBit(
|
|
16631
|
+
repeat(26, puff2(ORIGIN3, [neg(add(1.5, mul(rand(), 3))), 0, 0], [wide(1.4), wide(0.8), wide(1.4)], add(0.03, mul(rand(), 0.03)), add(1.8, mul(rand(), 1.4)), 0.5)),
|
|
16632
|
+
repeat(14, ...flameBit(ORIGIN3, [neg(add(2, mul(rand(), 2))), 0, 0], [wide(1), wide(0.6), wide(1)], 0.02, 0.25))
|
|
16509
16633
|
]
|
|
16510
16634
|
};
|
|
16511
16635
|
var FLAME_JET = {
|
|
@@ -16624,7 +16748,7 @@ var GameTestRoom = (() => {
|
|
|
16624
16748
|
}
|
|
16625
16749
|
var COLUMNS = 6;
|
|
16626
16750
|
var ROWS = 5;
|
|
16627
|
-
var
|
|
16751
|
+
var ORIGIN4 = [-2.2, 0, 2.6];
|
|
16628
16752
|
var BLOCK_SIZE = [0.5, 0.44, 0.25];
|
|
16629
16753
|
var OBJECT_ID_DRAWS2 = 4;
|
|
16630
16754
|
var FLOOR22 = 0.13;
|
|
@@ -16667,7 +16791,7 @@ var GameTestRoom = (() => {
|
|
|
16667
16791
|
const chipScale = random.between(0.8, 1.3) * scale2;
|
|
16668
16792
|
for (let draw2 = 0; draw2 < OBJECT_ID_DRAWS2; draw2++) random.next();
|
|
16669
16793
|
best.holes.push({ x: offsetX, y: offsetY, scale: scale2, chipTurn, chipScale });
|
|
16670
|
-
impact(host.engine, "concrete", [
|
|
16794
|
+
impact(host.engine, "concrete", [ORIGIN4[0] + x, y, ORIGIN4[2] + 0.13], [0, 0, 1], 0.8);
|
|
16671
16795
|
} else if (action === "collapse") {
|
|
16672
16796
|
const { x, y } = args;
|
|
16673
16797
|
for (const block of blocks) {
|
|
@@ -16717,7 +16841,7 @@ var GameTestRoom = (() => {
|
|
|
16717
16841
|
}
|
|
16718
16842
|
};
|
|
16719
16843
|
}
|
|
16720
|
-
var
|
|
16844
|
+
var ORIGIN5 = [5.6, 0, 0.8];
|
|
16721
16845
|
var MAX_TILT = 0.25;
|
|
16722
16846
|
function createCarBehavior() {
|
|
16723
16847
|
let y = 0;
|
|
@@ -16750,7 +16874,7 @@ var GameTestRoom = (() => {
|
|
|
16750
16874
|
}
|
|
16751
16875
|
},
|
|
16752
16876
|
query(_host, name, args) {
|
|
16753
|
-
if (name === "position") return [
|
|
16877
|
+
if (name === "position") return [ORIGIN5[0], y, ORIGIN5[2]];
|
|
16754
16878
|
if (name === "point") {
|
|
16755
16879
|
const [x, py, z] = args;
|
|
16756
16880
|
const point = carPoint(x, py, z);
|
|
@@ -17622,7 +17746,7 @@ var GameTestRoom = (() => {
|
|
|
17622
17746
|
this.index = previous;
|
|
17623
17747
|
}
|
|
17624
17748
|
};
|
|
17625
|
-
var
|
|
17749
|
+
var ORIGIN6 = [0, 0, 0];
|
|
17626
17750
|
var DEFAULT_HEADING = [0, 0, -1];
|
|
17627
17751
|
var DEFAULT_MAX_INSTANCES = 48;
|
|
17628
17752
|
var ENDLESS_SECONDS = 60;
|
|
@@ -17699,7 +17823,7 @@ var GameTestRoom = (() => {
|
|
|
17699
17823
|
random: playOptions.seed !== void 0 ? streamOf(playOptions.seed) : void 0,
|
|
17700
17824
|
follow: playOptions.follow,
|
|
17701
17825
|
origin: point,
|
|
17702
|
-
anchor: def.anchor ??
|
|
17826
|
+
anchor: def.anchor ?? ORIGIN6,
|
|
17703
17827
|
yaw: yawOf(heading, playOptions.direction),
|
|
17704
17828
|
orientation: playOptions.orientation,
|
|
17705
17829
|
seconds: playOptions.seconds ?? (def.loop && def.loop > 0 ? def.loop : ENDLESS_SECONDS),
|
|
@@ -20345,9 +20469,9 @@ var GameTestRoom = (() => {
|
|
|
20345
20469
|
}
|
|
20346
20470
|
var event_effects_default = {
|
|
20347
20471
|
spall: "impact_{material}",
|
|
20348
|
-
stage: { "1": "
|
|
20472
|
+
stage: { "1": "stage_crack_{material}", "2": "breach_dust_{material}", "3": "collapse_dust_{material}" },
|
|
20349
20473
|
expose: "rebar_expose",
|
|
20350
|
-
collapse: "
|
|
20474
|
+
collapse: "collapse_dust_{material}",
|
|
20351
20475
|
explode: "explosion",
|
|
20352
20476
|
fracture: { glass: "glass_burst" }
|
|
20353
20477
|
};
|
|
@@ -20355,9 +20479,14 @@ var GameTestRoom = (() => {
|
|
|
20355
20479
|
function effectForEvent(event, map = EVENT_EFFECTS_MAP) {
|
|
20356
20480
|
const entry = map[event.kind];
|
|
20357
20481
|
if (entry === void 0) return void 0;
|
|
20358
|
-
if (typeof entry === "string") return
|
|
20482
|
+
if (typeof entry === "string") return withMaterial(entry, event.material);
|
|
20359
20483
|
const key2 = event.stage !== void 0 ? String(event.stage) : event.material;
|
|
20360
|
-
|
|
20484
|
+
const chosen = key2 === void 0 ? void 0 : entry[key2];
|
|
20485
|
+
return chosen === void 0 ? void 0 : withMaterial(chosen, event.material);
|
|
20486
|
+
}
|
|
20487
|
+
function withMaterial(entry, material2) {
|
|
20488
|
+
if (!entry.includes("{material}")) return entry;
|
|
20489
|
+
return material2 ? entry.replace("{material}", material2) : void 0;
|
|
20361
20490
|
}
|
|
20362
20491
|
var WATER_GRAVITY = 9.81;
|
|
20363
20492
|
var DROP_DRAG = 0.25;
|
|
@@ -23568,7 +23697,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
23568
23697
|
uTime: { value: 0 }
|
|
23569
23698
|
};
|
|
23570
23699
|
const puffs = createPuffLayer(THREE, pools.puffs, uniforms);
|
|
23571
|
-
const
|
|
23700
|
+
const sparks2 = createSparkLayer(THREE, pools.sparks);
|
|
23572
23701
|
const glows = createGlowLayer(THREE, pools.glows);
|
|
23573
23702
|
const rockGeometry = new THREE.DodecahedronGeometry(0.5, 0);
|
|
23574
23703
|
const plateGeometry = new THREE.BoxGeometry(1, 1, 1);
|
|
@@ -23577,7 +23706,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
23577
23706
|
const sprites = createSpriteLayer(THREE, world.sprites(), options.pointScale ?? 700);
|
|
23578
23707
|
const lights = createLightLayer(THREE, pools.lights, options.lightScale ?? Math.PI, options.lights);
|
|
23579
23708
|
const marks = createMarkLayer(THREE, { ground: pools.ground, ...world.hostGroundAt ? { heightAt: world.hostGroundAt } : {}, createCanvas: options.createCanvas, rockGeometry, plateGeometry, ...options.markLimits });
|
|
23580
|
-
root.add(puffs.mesh,
|
|
23709
|
+
root.add(puffs.mesh, sparks2.mesh, glows.mesh, chunks.rocks, chunks.plates, shocks.group, lights.group, sprites.additive, sprites.normal, marks.group);
|
|
23581
23710
|
const stopMarks = world.onMarks((event) => marks.handle(event));
|
|
23582
23711
|
const overlay = options.overlay ? createScreenOverlay(options.overlay) : void 0;
|
|
23583
23712
|
let drawCalls = 0;
|
|
@@ -23586,7 +23715,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
23586
23715
|
const layerOn = /* @__PURE__ */ new Map();
|
|
23587
23716
|
const layerObjects = () => ({
|
|
23588
23717
|
puffs: [puffs.mesh],
|
|
23589
|
-
sparks: [
|
|
23718
|
+
sparks: [sparks2.mesh],
|
|
23590
23719
|
glows: [glows.mesh],
|
|
23591
23720
|
debris: [chunks.rocks, chunks.plates],
|
|
23592
23721
|
shock: [shocks.group],
|
|
@@ -23614,7 +23743,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
23614
23743
|
}
|
|
23615
23744
|
function syncAll() {
|
|
23616
23745
|
lastDrawn.puffs = puffs.sync();
|
|
23617
|
-
lastDrawn.sparks =
|
|
23746
|
+
lastDrawn.sparks = sparks2.sync();
|
|
23618
23747
|
lastDrawn.glows = glows.sync();
|
|
23619
23748
|
lastDrawn.chunks = chunks.sync();
|
|
23620
23749
|
lastDrawn.shocks = shocks.sync();
|
|
@@ -23715,7 +23844,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
|
|
|
23715
23844
|
stopMarks();
|
|
23716
23845
|
overlay?.dispose();
|
|
23717
23846
|
workshopLayers?.dispose();
|
|
23718
|
-
for (const layer22 of [puffs,
|
|
23847
|
+
for (const layer22 of [puffs, sparks2, glows, chunks, shocks, lights, marks, sprites]) layer22.dispose();
|
|
23719
23848
|
rockGeometry.dispose();
|
|
23720
23849
|
plateGeometry.dispose();
|
|
23721
23850
|
options.scene.remove(root);
|
|
@@ -26155,6 +26284,46 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
26155
26284
|
const keys = [materialId, ...def?.tags ?? []].join(" ").toLowerCase();
|
|
26156
26285
|
return SURFACE_BY_KEY.find(([key2]) => key2.test(keys))?.[1];
|
|
26157
26286
|
}
|
|
26287
|
+
var HIT_POINT_SECONDS = 1;
|
|
26288
|
+
function familyPlay(def, partColor) {
|
|
26289
|
+
const dust = dustColor(def, partColor);
|
|
26290
|
+
return {
|
|
26291
|
+
material: debrisFamily(def),
|
|
26292
|
+
values: { [DEBRIS_COLOR_VARIABLE]: debrisColor(def, partColor), ...dust !== void 0 ? { [DUST_COLOR_VARIABLE]: dust } : {} }
|
|
26293
|
+
};
|
|
26294
|
+
}
|
|
26295
|
+
function pointOf(ev) {
|
|
26296
|
+
switch (ev.type) {
|
|
26297
|
+
case "hole":
|
|
26298
|
+
case "crack":
|
|
26299
|
+
return ev.worldPoint;
|
|
26300
|
+
case "spall":
|
|
26301
|
+
case "debris":
|
|
26302
|
+
return ev.point;
|
|
26303
|
+
case "chip":
|
|
26304
|
+
return ev.center;
|
|
26305
|
+
default:
|
|
26306
|
+
return void 0;
|
|
26307
|
+
}
|
|
26308
|
+
}
|
|
26309
|
+
var HitPoints = class {
|
|
26310
|
+
constructor() {
|
|
26311
|
+
__publicField3(this, "points", /* @__PURE__ */ new Map());
|
|
26312
|
+
}
|
|
26313
|
+
note(ev, time) {
|
|
26314
|
+
const point = pointOf(ev);
|
|
26315
|
+
if (!point || !("part" in ev)) return;
|
|
26316
|
+
this.points.set(`${ev.object}|${ev.part}`, { point, time });
|
|
26317
|
+
}
|
|
26318
|
+
/** The last hit on the part, if it was recent. */
|
|
26319
|
+
of(objectId, partId, time) {
|
|
26320
|
+
const hit = this.points.get(`${objectId}|${partId}`);
|
|
26321
|
+
return hit && time - hit.time <= HIT_POINT_SECONDS ? hit.point : void 0;
|
|
26322
|
+
}
|
|
26323
|
+
forget(objectId) {
|
|
26324
|
+
for (const key2 of this.points.keys()) if (key2.startsWith(`${objectId}|`)) this.points.delete(key2);
|
|
26325
|
+
}
|
|
26326
|
+
};
|
|
26158
26327
|
var STOPS = [
|
|
26159
26328
|
[450, 0],
|
|
26160
26329
|
[500, 2753536],
|
|
@@ -27418,7 +27587,6 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
27418
27587
|
var STEEL_DENSITY2 = 7850;
|
|
27419
27588
|
var CHIP_DECAL_EDGE = 0.05;
|
|
27420
27589
|
var WOOD_RIM = 1.5;
|
|
27421
|
-
var IMPACT_TAGS = ["metal", "glass", "wood"];
|
|
27422
27590
|
var GLOW_FROM_C = 430;
|
|
27423
27591
|
var MIN_DRAWN_CRACK_WIDTH = 4e-3;
|
|
27424
27592
|
var SETTLEMENT_CRACK_COLOR = 2827296;
|
|
@@ -27572,11 +27740,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
27572
27740
|
return impactKey(def);
|
|
27573
27741
|
}
|
|
27574
27742
|
}
|
|
27575
|
-
function fallbackColor(
|
|
27576
|
-
|
|
27577
|
-
if (def?.visual?.transparent) return 10473696;
|
|
27578
|
-
const h = hashString(id);
|
|
27579
|
-
return mixHex(7035464, 10130568, h % 100 / 100);
|
|
27743
|
+
function fallbackColor(def) {
|
|
27744
|
+
return debrisColor(def);
|
|
27580
27745
|
}
|
|
27581
27746
|
function materialsOf2(m) {
|
|
27582
27747
|
return Array.isArray(m) ? m : [m];
|
|
@@ -27638,6 +27803,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
27638
27803
|
__publicField3(this, "ground");
|
|
27639
27804
|
__publicField3(this, "pieceSys");
|
|
27640
27805
|
__publicField3(this, "cages");
|
|
27806
|
+
__publicField3(this, "hitPoints", new HitPoints());
|
|
27641
27807
|
__publicField3(this, "active", /* @__PURE__ */ new Map());
|
|
27642
27808
|
__publicField3(this, "fires", /* @__PURE__ */ new Map());
|
|
27643
27809
|
__publicField3(this, "primedBurning", /* @__PURE__ */ new Set());
|
|
@@ -27844,6 +28010,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
27844
28010
|
this.restore(objectId);
|
|
27845
28011
|
this.pieceSys.remove(objectId);
|
|
27846
28012
|
this.bounds.delete(objectId);
|
|
28013
|
+
this.hitPoints.forget(objectId);
|
|
27847
28014
|
}
|
|
27848
28015
|
// ----------------------------------------------------------------------------------------------------------------------------------
|
|
27849
28016
|
// Pieces
|
|
@@ -28300,6 +28467,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28300
28467
|
}
|
|
28301
28468
|
apply(ev) {
|
|
28302
28469
|
this.staticDirty.add(ev.object);
|
|
28470
|
+
this.hitPoints.note(ev, this.time);
|
|
28303
28471
|
if (ev.type === "fracture" || ev.type === "detach" || ev.type === "collapse" || ev.type === "burnout" || ev.type === "destroyed") this.broken.add(ev.object);
|
|
28304
28472
|
switch (ev.type) {
|
|
28305
28473
|
case "damage":
|
|
@@ -28347,7 +28515,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28347
28515
|
if (pv) this.settlement.finish(pv);
|
|
28348
28516
|
}
|
|
28349
28517
|
this.splitLoose(ev.object);
|
|
28350
|
-
if (!furniture || ev.mass >= COLLAPSE_CLOUD_KG) this.playEvent({ kind: "collapse" }, this.rootPoint(ev.object));
|
|
28518
|
+
if (!furniture || ev.mass >= COLLAPSE_CLOUD_KG) this.playEvent({ kind: "collapse" }, this.rootPoint(ev.object), this.partPlay(ev.object, ev.parts[0] ?? ""));
|
|
28351
28519
|
else this.vfx.burst("dust", this.rootPoint(ev.object), [0, 1, 0], clamp7(Math.round(ev.mass / 4), 4, 24), 0.8);
|
|
28352
28520
|
break;
|
|
28353
28521
|
}
|
|
@@ -28388,7 +28556,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28388
28556
|
else this.dropCage(ev.object, ev.part);
|
|
28389
28557
|
if (ev.bars.length > 0) {
|
|
28390
28558
|
const [a, b] = ev.bars[0];
|
|
28391
|
-
this.playEvent({ kind: "expose" }, [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[2] + b[2]) / 2]);
|
|
28559
|
+
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));
|
|
28392
28560
|
}
|
|
28393
28561
|
break;
|
|
28394
28562
|
case "extinguish": {
|
|
@@ -28428,7 +28596,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28428
28596
|
const b = this.bounds.get(ev.object);
|
|
28429
28597
|
const pv = b?.parts.get(ev.part);
|
|
28430
28598
|
const def = this.world.materials.get(ev.material);
|
|
28431
|
-
const color = (pv && this.partColor(pv, def)) ?? fallbackColor(
|
|
28599
|
+
const color = (pv && this.partColor(pv, def)) ?? fallbackColor(def);
|
|
28432
28600
|
let tag = this.homeTags.indexOf(ev.object) + 1;
|
|
28433
28601
|
if (tag === 0) tag = this.homeTags.push(ev.object);
|
|
28434
28602
|
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 });
|
|
@@ -28515,7 +28683,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28515
28683
|
const tint = this.visuals.vertexTint(mv);
|
|
28516
28684
|
return tint ? c.clone().multiply(tint).getHex() : c.getHex();
|
|
28517
28685
|
}
|
|
28518
|
-
return def ? fallbackColor(def
|
|
28686
|
+
return def ? fallbackColor(def) : null;
|
|
28519
28687
|
}
|
|
28520
28688
|
debrisOptions(kind, objectId, partId, material2) {
|
|
28521
28689
|
const pv = this.partVis(objectId, partId);
|
|
@@ -28570,22 +28738,23 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28570
28738
|
if (!b || !pv) return;
|
|
28571
28739
|
const def = this.world.materials.get(pv.material);
|
|
28572
28740
|
const n = this.worldDir(b, ev.hole.normal);
|
|
28741
|
+
const look = debrisLook(def, "shot");
|
|
28573
28742
|
const draw2 = (point, normal) => {
|
|
28574
28743
|
const wp = new this.THREE.Vector3(point[0], point[1], point[2]);
|
|
28575
28744
|
const mv = this.nearestMesh(pv, wp);
|
|
28576
28745
|
if (!mv) return;
|
|
28577
|
-
if (
|
|
28746
|
+
if (look.mark === "star_crack") {
|
|
28578
28747
|
const seed = hashNumbers(ev.time, point[0], point[1], point[2]);
|
|
28579
28748
|
this.visuals.addCrack(mv, wp, normal, 7, Math.max(0.05, ev.hole.diameter * 5), 15267071, seed);
|
|
28580
28749
|
} else {
|
|
28581
|
-
const fresh =
|
|
28750
|
+
const fresh = look.mark === "splintered_hole" ? def?.visual?.innerColor : void 0;
|
|
28582
28751
|
if (fresh !== void 0) this.visuals.addSpall(mv, wp, normal, Math.max(6e-3, ev.hole.diameter * WOOD_RIM), fresh);
|
|
28583
28752
|
this.visuals.addHole(mv, wp, normal, ev.hole.diameter);
|
|
28584
28753
|
}
|
|
28585
28754
|
};
|
|
28586
28755
|
draw2(ev.worldPoint, n);
|
|
28587
28756
|
if (ev.hole.through && ev.exitPoint) draw2(ev.exitPoint, n.clone().negate());
|
|
28588
|
-
if (
|
|
28757
|
+
if (look.sparks) this.vfx.burst("sparks", ev.worldPoint, [n.x, n.y, n.z], 6, 3.5);
|
|
28589
28758
|
if (ev.powder) {
|
|
28590
28759
|
const puff3 = { color: ev.powder.color, size: 0.6, life: 1.6, alpha: 1.3 };
|
|
28591
28760
|
this.vfx.burst("dust", ev.worldPoint, [n.x, n.y, n.z], this.low ? 5 : 10, 0.7, puff3);
|
|
@@ -28627,19 +28796,21 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28627
28796
|
const side = point[axis2] >= (box2.min[axis2] + box2.max[axis2]) / 2 ? 1 : -1;
|
|
28628
28797
|
return new this.THREE.Vector3(axis2 === "x" ? side : 0, axis2 === "y" ? side : 0, axis2 === "z" ? side : 0);
|
|
28629
28798
|
}
|
|
28630
|
-
/** The material an impact effect is chosen by: the tags of the material (`metal`, `glass`, `wood`), else stone and the like are `concrete`. */
|
|
28631
|
-
impactMaterial(def) {
|
|
28632
|
-
for (const tag of IMPACT_TAGS) if (def?.tags?.includes(tag)) return tag;
|
|
28633
|
-
return "concrete";
|
|
28634
|
-
}
|
|
28635
28799
|
/**
|
|
28636
28800
|
* Plays the effect the event map names for a destruction event (`data/event-effects.json` of `game-vfx`, or `RendererOptions.eventEffects`) at a point.
|
|
28637
|
-
* Answers whether one played, so the caller can
|
|
28801
|
+
* `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
|
|
28802
|
+
* leave out the burst it replaces.
|
|
28638
28803
|
*/
|
|
28639
|
-
playEvent(event, point) {
|
|
28640
|
-
const id = effectForEvent(event, this.o.eventEffects ?? EVENT_EFFECTS_MAP);
|
|
28804
|
+
playEvent(event, point, play) {
|
|
28805
|
+
const id = effectForEvent(play && event.material === void 0 ? { ...event, material: play.material } : event, this.o.eventEffects ?? EVENT_EFFECTS_MAP);
|
|
28641
28806
|
if (!id) return false;
|
|
28642
|
-
return this.vfx.play(id, point, { seed: hashNumbers(point[0], point[1], point[2], this.time) }) !== null;
|
|
28807
|
+
return this.vfx.play(id, point, { seed: hashNumbers(point[0], point[1], point[2], this.time), ...play ? { values: play.values } : {} }) !== null;
|
|
28808
|
+
}
|
|
28809
|
+
/** The family and colours of a part's material, for the effects of the event map. */
|
|
28810
|
+
partPlay(objectId, partId) {
|
|
28811
|
+
const pv = this.partVis(objectId, partId);
|
|
28812
|
+
const def = pv ? this.world.materials.get(pv.material) : void 0;
|
|
28813
|
+
return familyPlay(def, pv ? this.partColor(pv, def) ?? void 0 : void 0);
|
|
28643
28814
|
}
|
|
28644
28815
|
/** A coat came off: a patch in the colour of the core under it, below the bullet holes and cracks. */
|
|
28645
28816
|
onSpall(ev) {
|
|
@@ -28651,11 +28822,12 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28651
28822
|
const def = this.world.materials.get(pv.material);
|
|
28652
28823
|
const normal = this.faceNormal(mv, wp);
|
|
28653
28824
|
const core = def?.visual?.innerColor;
|
|
28654
|
-
|
|
28655
|
-
|
|
28825
|
+
const look = debrisLook(def, "spall", { partColor: this.partColor(pv, def) ?? void 0 });
|
|
28826
|
+
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 });
|
|
28827
|
+
else this.playEvent({ kind: "spall", material: look.impact }, ev.point);
|
|
28656
28828
|
if (core !== void 0) this.trickleFrom(ev.point, [normal.x, normal.y, normal.z], core, mv);
|
|
28657
28829
|
if (mv.mesh.userData.drawnSpalls?.includes(ev.part)) return;
|
|
28658
|
-
this.visuals.addSpall(mv, wp, normal, Math.sqrt(ev.area / Math.PI), core ?? fallbackColor(
|
|
28830
|
+
this.visuals.addSpall(mv, wp, normal, Math.sqrt(ev.area / Math.PI), core ?? fallbackColor(def));
|
|
28659
28831
|
}
|
|
28660
28832
|
/**
|
|
28661
28833
|
* 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
|
|
@@ -28698,17 +28870,18 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28698
28870
|
* (cutting the wall's faces) is not drawn yet: it needs the per-vertex binding of the house renderer.
|
|
28699
28871
|
*/
|
|
28700
28872
|
onStage(ev) {
|
|
28701
|
-
const played = this.playEvent({ kind: "stage", stage: ev.stage }, ev.opening?.center ?? this.rootPoint(ev.object));
|
|
28702
|
-
if (!ev.fragments || !ev.opening) return;
|
|
28703
28873
|
const pv = this.partVis(ev.object, ev.part);
|
|
28704
28874
|
const def = pv ? this.world.materials.get(pv.material) : void 0;
|
|
28705
|
-
const
|
|
28875
|
+
const at3 = ev.opening?.center ?? this.hitPoints.of(ev.object, ev.part, this.time) ?? this.rootPoint(ev.object);
|
|
28876
|
+
const played = this.playEvent({ kind: "stage", stage: ev.stage }, at3, this.partPlay(ev.object, ev.part));
|
|
28877
|
+
if (!ev.fragments || !ev.opening) return;
|
|
28878
|
+
const color = (pv ? this.partColor(pv, def) : null) ?? fallbackColor(def);
|
|
28706
28879
|
const maxAlive = this.low ? Math.floor(this.maxFragments / 2) : this.maxFragments;
|
|
28707
28880
|
const step = this.low ? 2 : 1;
|
|
28708
28881
|
for (let i = 0; i < ev.fragments.length; i += step) {
|
|
28709
28882
|
const fr = ev.fragments[i];
|
|
28710
28883
|
const fdef = this.world.materials.get(fr.material);
|
|
28711
|
-
this.fragments.spawn(fr, this.fragments.materialFor(fr.material, fdef === def || !fdef ? color : fallbackColor(
|
|
28884
|
+
this.fragments.spawn(fr, this.fragments.materialFor(fr.material, fdef === def || !fdef ? color : fallbackColor(fdef), false), ev.object, maxAlive);
|
|
28712
28885
|
}
|
|
28713
28886
|
if (!played) this.vfx.burst("dust", ev.opening.center, [0, 1, 0], 14, 1.2, { color });
|
|
28714
28887
|
this.impactSound(pv?.material ?? "", ev.opening.center, 0.8, ev.blow);
|
|
@@ -28721,11 +28894,11 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28721
28894
|
onChip(ev) {
|
|
28722
28895
|
const pv = this.partVis(ev.object, ev.part);
|
|
28723
28896
|
const def = pv ? this.world.materials.get(pv.material) : void 0;
|
|
28724
|
-
const color = (pv ? this.partColor(pv, def) : null) ?? fallbackColor(
|
|
28897
|
+
const color = (pv ? this.partColor(pv, def) : null) ?? fallbackColor(def);
|
|
28725
28898
|
const maxAlive = this.low ? Math.floor(this.maxFragments / 2) : this.maxFragments;
|
|
28726
28899
|
for (const fr of ev.fragments) {
|
|
28727
28900
|
const fdef = this.world.materials.get(fr.material);
|
|
28728
|
-
const tone3 =
|
|
28901
|
+
const tone3 = fragmentTone(fdef, fr, fdef === def ? color : fallbackColor(fdef));
|
|
28729
28902
|
this.fragments.spawn(fr, this.fragments.materialFor(fr.material, tone3, false), ev.object, maxAlive);
|
|
28730
28903
|
}
|
|
28731
28904
|
if (def?.visual?.innerColor !== void 0 || pv?.material === "concrete" || pv?.material === "brick") {
|
|
@@ -28749,7 +28922,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28749
28922
|
const pv = b?.parts.get(ev.part);
|
|
28750
28923
|
const matId = pv?.material || (ev.fragments[0]?.material ?? "");
|
|
28751
28924
|
const def = this.world.materials.get(matId);
|
|
28752
|
-
let color = fallbackColor(
|
|
28925
|
+
let color = fallbackColor(def);
|
|
28753
28926
|
let opacity = 0.5;
|
|
28754
28927
|
const transparent = def?.visual?.transparent === true;
|
|
28755
28928
|
if (pv) {
|
|
@@ -28763,23 +28936,25 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28763
28936
|
this.loosenIfFootless(ev.object);
|
|
28764
28937
|
const up = [0, 1, 0];
|
|
28765
28938
|
const sizeK = clamp7(ev.fragments.length / 10, 0.5, 2);
|
|
28939
|
+
const look = debrisLook(def, "fracture", { style: ev.style, partColor: color });
|
|
28940
|
+
const dust = look.dust !== void 0 ? { color: look.dust } : void 0;
|
|
28766
28941
|
switch (ev.style) {
|
|
28767
28942
|
case "shatter":
|
|
28768
28943
|
this.vfx.burst("shards", ev.point, up, 18 * sizeK, 3);
|
|
28769
28944
|
break;
|
|
28770
28945
|
case "crumble":
|
|
28771
|
-
this.vfx.burst("dust", ev.point, up, 16 * sizeK, 1.2,
|
|
28772
|
-
this.vfx.burst("chips", ev.point, up, 6, 3);
|
|
28946
|
+
this.vfx.burst("dust", ev.point, up, 16 * sizeK, 1.2, dust);
|
|
28947
|
+
this.vfx.burst(look.family === "glass" ? "shards" : "chips", ev.point, up, 6, 3, { color: look.color });
|
|
28773
28948
|
break;
|
|
28774
28949
|
case "splinter":
|
|
28775
|
-
this.vfx.burst("splinters", ev.point, up, 14 * sizeK, 3);
|
|
28776
|
-
this.vfx.burst("dust", ev.point, up, 5, 0.8,
|
|
28950
|
+
this.vfx.burst("splinters", ev.point, up, 14 * sizeK, 3, { color: look.color });
|
|
28951
|
+
this.vfx.burst("dust", ev.point, up, 5, 0.8, dust);
|
|
28777
28952
|
break;
|
|
28778
28953
|
case "tear":
|
|
28779
|
-
this.vfx.burst("fibers", ev.point, up, 12 * sizeK, 1.6, { color:
|
|
28954
|
+
this.vfx.burst("fibers", ev.point, up, 12 * sizeK, 1.6, { color: look.color });
|
|
28780
28955
|
break;
|
|
28781
28956
|
case "snap":
|
|
28782
|
-
this.vfx.burst("chips", ev.point, up, 8 * sizeK, 3);
|
|
28957
|
+
this.vfx.burst("chips", ev.point, up, 8 * sizeK, 3, { color: look.color });
|
|
28783
28958
|
break;
|
|
28784
28959
|
default:
|
|
28785
28960
|
this.vfx.burst("sparks", ev.point, up, 10, 4);
|
|
@@ -28797,7 +28972,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
28797
28972
|
}
|
|
28798
28973
|
const fr = ev.fragments[i];
|
|
28799
28974
|
const fdef = this.world.materials.get(fr.material);
|
|
28800
|
-
const tone3 =
|
|
28975
|
+
const tone3 = fragmentTone(fdef, fr, fdef === look.def || !fdef ? look.color : fallbackColor(fdef));
|
|
28801
28976
|
const mat = this.fragments.materialFor(fr.material, tone3, look.transparent || fdef?.visual?.transparent === true, look.opacity);
|
|
28802
28977
|
this.fragments.spawn(fr, mat, ev.object, maxAlive);
|
|
28803
28978
|
}
|
|
@@ -29320,7 +29495,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
29320
29495
|
const s = bb.getSize(new this.THREE.Vector3());
|
|
29321
29496
|
const footprint = Math.sqrt(Math.max(s.x * s.z, 1e-4));
|
|
29322
29497
|
if (reason === "melted") {
|
|
29323
|
-
this.ground.add("puddle", c.x, c.z, clamp7(footprint * 0.55, 0.05, 1), this.partColor(pv, def) ?? fallbackColor(
|
|
29498
|
+
this.ground.add("puddle", c.x, c.z, clamp7(footprint * 0.55, 0.05, 1), this.partColor(pv, def) ?? fallbackColor(def), objectId);
|
|
29324
29499
|
} else {
|
|
29325
29500
|
this.ground.add("ash", c.x, c.z, clamp7(footprint * 0.35, 0.04, 0.5), 1907224, objectId);
|
|
29326
29501
|
this.vfx.burst("ash", [c.x, bb.max.y, c.z], [0, 1, 0], 10, 0.8);
|
|
@@ -29483,8 +29658,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
29483
29658
|
}
|
|
29484
29659
|
ownedVfxParticles() {
|
|
29485
29660
|
if (!this.ownVfx) return 0;
|
|
29486
|
-
const { puffs, sparks, glows, chunks } = this.vfx.stats();
|
|
29487
|
-
return puffs +
|
|
29661
|
+
const { puffs, sparks: sparks2, glows, chunks } = this.vfx.stats();
|
|
29662
|
+
return puffs + sparks2 + glows + chunks;
|
|
29488
29663
|
}
|
|
29489
29664
|
warmUpProbes() {
|
|
29490
29665
|
this.releaseWarmProbes();
|
|
@@ -50983,8 +51158,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
50983
51158
|
const tau = (phase + k / n) % 1 * flight;
|
|
50984
51159
|
if (tau > tB) continue;
|
|
50985
51160
|
const p = sampleStream(state, gravity, tau);
|
|
50986
|
-
const
|
|
50987
|
-
this.dropAt(drops++, p[0], p[1], p[2], Math.max(2e-3, r0 * 1.8) * (0.4 + 0.6 *
|
|
51161
|
+
const grow2 = Math.min(1, tau / (0.12 * flight + 0.02));
|
|
51162
|
+
this.dropAt(drops++, p[0], p[1], p[2], Math.max(2e-3, r0 * 1.8) * (0.4 + 0.6 * grow2));
|
|
50988
51163
|
}
|
|
50989
51164
|
} else if (tB - tA > 0.015) {
|
|
50990
51165
|
this.writeTube(state, gravity, tA, tB, r0, speed0);
|
|
@@ -59178,8 +59353,8 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
59178
59353
|
let seen = -1;
|
|
59179
59354
|
const place2 = (decal2) => {
|
|
59180
59355
|
const water = terrain.waterAt(decal2.x, decal2.z);
|
|
59181
|
-
const
|
|
59182
|
-
const size = decal2.radius * 2 *
|
|
59356
|
+
const grow2 = decal2.kind === "ripple" ? 0.5 + decal2.age / RIPPLE_SECONDS2 * 1.5 : 1;
|
|
59357
|
+
const size = decal2.radius * 2 * grow2;
|
|
59183
59358
|
rotation2.makeRotationY(decal2.angle);
|
|
59184
59359
|
scale2.makeScale(size * KIND_ASPECT[decal2.kind], 1, size);
|
|
59185
59360
|
matrix.multiplyMatrices(rotation2, scale2);
|
|
@@ -65385,8 +65560,8 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
65385
65560
|
if (time >= b.t) a = b;
|
|
65386
65561
|
else for (let i = 0; i < pts.length - 1; i++) if (time >= pts[i].t && time < pts[i + 1].t) [a, b] = [pts[i], pts[i + 1]];
|
|
65387
65562
|
const f = a === b || b.t <= a.t ? 0 : (time - a.t) / (b.t - a.t);
|
|
65388
|
-
const
|
|
65389
|
-
return { position:
|
|
65563
|
+
const mix2 = (x, y) => [x[0] + (y[0] - x[0]) * f, x[1] + (y[1] - x[1]) * f, x[2] + (y[2] - x[2]) * f];
|
|
65564
|
+
return { position: mix2(a.position, b.position), rotation: mix2(a.rotation, b.rotation) };
|
|
65390
65565
|
};
|
|
65391
65566
|
const applyClip = (pl) => {
|
|
65392
65567
|
for (const [id, obj] of pl.targets) {
|