@adatechnology/game-vfx 0.13.0 → 0.15.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/README.md +6 -2
- package/dist/index.d.ts +60 -4
- package/dist/index.global.js +224 -105
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +224 -105
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -24,6 +24,9 @@ var GameVfx = (() => {
|
|
|
24
24
|
var index_exports = {};
|
|
25
25
|
__export(index_exports, {
|
|
26
26
|
AREA_CAP_GAME: () => AREA_CAP_GAME,
|
|
27
|
+
DEBRIS_COLOR_VARIABLE: () => DEBRIS_COLOR_VARIABLE,
|
|
28
|
+
DEBRIS_EFFECT_FAMILIES: () => DEBRIS_EFFECT_FAMILIES,
|
|
29
|
+
DUST_COLOR_VARIABLE: () => DUST_COLOR_VARIABLE,
|
|
27
30
|
EVENT_BUDGET: () => EVENT_BUDGET,
|
|
28
31
|
EVENT_EFFECTS: () => EVENT_EFFECTS,
|
|
29
32
|
EVENT_EFFECTS_MAP: () => EVENT_EFFECTS_MAP,
|
|
@@ -36,6 +39,7 @@ var GameVfx = (() => {
|
|
|
36
39
|
GAME_EFFECTS: () => GAME_EFFECTS,
|
|
37
40
|
LOD_GAME: () => LOD_GAME,
|
|
38
41
|
LOD_LAB: () => LOD_LAB,
|
|
42
|
+
MATERIAL_EVENT_EFFECTS: () => MATERIAL_EVENT_EFFECTS,
|
|
39
43
|
MeshPool: () => MeshPool,
|
|
40
44
|
OrderedPool: () => OrderedPool,
|
|
41
45
|
PROFILES: () => PROFILES,
|
|
@@ -69,6 +73,7 @@ var GameVfx = (() => {
|
|
|
69
73
|
createWorkshopBehaviors: () => createWorkshopBehaviors,
|
|
70
74
|
effectForEvent: () => effectForEvent,
|
|
71
75
|
estimateCost: () => estimateCost,
|
|
76
|
+
explosionEffectIds: () => explosionEffectIds,
|
|
72
77
|
hexToLinearRgb: () => hexToLinearRgb,
|
|
73
78
|
hexToRgb: () => hexToRgb,
|
|
74
79
|
inPuddle: () => inPuddle,
|
|
@@ -1131,6 +1136,9 @@ var GameVfx = (() => {
|
|
|
1131
1136
|
}
|
|
1132
1137
|
return result;
|
|
1133
1138
|
}
|
|
1139
|
+
function explosionEffectIds(explosions = EXPLOSIONS) {
|
|
1140
|
+
return Object.keys(explosions);
|
|
1141
|
+
}
|
|
1134
1142
|
|
|
1135
1143
|
// src/color.ts
|
|
1136
1144
|
var BYTE_MAX = 255;
|
|
@@ -1256,7 +1264,8 @@ var GameVfx = (() => {
|
|
|
1256
1264
|
trail: 0,
|
|
1257
1265
|
glow: null,
|
|
1258
1266
|
rng: placeholder,
|
|
1259
|
-
outColor: [0, 0, 0]
|
|
1267
|
+
outColor: [0, 0, 0],
|
|
1268
|
+
source: void 0
|
|
1260
1269
|
}),
|
|
1261
1270
|
freezeFollowingGlow
|
|
1262
1271
|
);
|
|
@@ -1362,7 +1371,8 @@ var GameVfx = (() => {
|
|
|
1362
1371
|
outY: 0,
|
|
1363
1372
|
outZ: 0,
|
|
1364
1373
|
outSize: 0,
|
|
1365
|
-
outIntensity: 0
|
|
1374
|
+
outIntensity: 0,
|
|
1375
|
+
source: void 0
|
|
1366
1376
|
}));
|
|
1367
1377
|
}
|
|
1368
1378
|
function spawnGlow(pool, init) {
|
|
@@ -1382,6 +1392,7 @@ var GameVfx = (() => {
|
|
|
1382
1392
|
glow.fx = init.fx ?? 0;
|
|
1383
1393
|
glow.fy = init.fy ?? 0;
|
|
1384
1394
|
glow.fz = init.fz ?? 0;
|
|
1395
|
+
glow.source = init.source;
|
|
1385
1396
|
return glow;
|
|
1386
1397
|
}
|
|
1387
1398
|
function ageOrKeep(glow, dt) {
|
|
@@ -1697,7 +1708,8 @@ var GameVfx = (() => {
|
|
|
1697
1708
|
rng: placeholder,
|
|
1698
1709
|
age: 0,
|
|
1699
1710
|
heat: 0,
|
|
1700
|
-
size: 0
|
|
1711
|
+
size: 0,
|
|
1712
|
+
source: void 0
|
|
1701
1713
|
}));
|
|
1702
1714
|
}
|
|
1703
1715
|
function spawnPuff(pool, random, init) {
|
|
@@ -1730,6 +1742,7 @@ var GameVfx = (() => {
|
|
|
1730
1742
|
puff3.age = 0;
|
|
1731
1743
|
puff3.heat = 0;
|
|
1732
1744
|
puff3.size = 0;
|
|
1745
|
+
puff3.source = init.source;
|
|
1733
1746
|
return puff3;
|
|
1734
1747
|
}
|
|
1735
1748
|
function ageOrKeep2(puff3, dt) {
|
|
@@ -1790,7 +1803,7 @@ var GameVfx = (() => {
|
|
|
1790
1803
|
var GROUND_LIFT = 0.02;
|
|
1791
1804
|
var BOUNCE_SLIDE = 0.55;
|
|
1792
1805
|
function createSparkPool(capacity) {
|
|
1793
|
-
return new OrderedPool(capacity, () => ({ x: 0, y: 0, z: 0, vx: 0, vy: 0, vz: 0, t: 0, life: 0.8, w: 0.04, st: 0.035, kind: 0, drag: 0.6, g: 9.8, bounce: 0.35, age: 0 }));
|
|
1806
|
+
return new OrderedPool(capacity, () => ({ x: 0, y: 0, z: 0, vx: 0, vy: 0, vz: 0, t: 0, life: 0.8, w: 0.04, st: 0.035, kind: 0, drag: 0.6, g: 9.8, bounce: 0.35, age: 0, source: void 0 }));
|
|
1794
1807
|
}
|
|
1795
1808
|
function spawnSpark(pool, init) {
|
|
1796
1809
|
const spark = pool.acquire();
|
|
@@ -1809,6 +1822,7 @@ var GameVfx = (() => {
|
|
|
1809
1822
|
spark.g = init.g ?? 9.8;
|
|
1810
1823
|
spark.bounce = init.bounce ?? 0.35;
|
|
1811
1824
|
spark.age = 0;
|
|
1825
|
+
spark.source = init.source;
|
|
1812
1826
|
return spark;
|
|
1813
1827
|
}
|
|
1814
1828
|
function ageOrKeep3(spark, dt) {
|
|
@@ -1844,22 +1858,26 @@ var GameVfx = (() => {
|
|
|
1844
1858
|
function addPuff(core, random, init) {
|
|
1845
1859
|
core.spawned.puffs++;
|
|
1846
1860
|
const puff3 = spawnPuff(core.puffs, random, init);
|
|
1861
|
+
puff3.source = init.source ?? core.source;
|
|
1847
1862
|
core.trace?.puff?.(puff3);
|
|
1848
1863
|
return puff3;
|
|
1849
1864
|
}
|
|
1850
1865
|
function addSpark(core, init) {
|
|
1851
1866
|
core.spawned.sparks++;
|
|
1852
1867
|
const spark = spawnSpark(core.sparks, init);
|
|
1868
|
+
spark.source = init.source ?? core.source;
|
|
1853
1869
|
core.trace?.spark?.(spark);
|
|
1854
1870
|
return spark;
|
|
1855
1871
|
}
|
|
1856
1872
|
function addGlow(core, init) {
|
|
1857
1873
|
const glow = spawnGlow(core.glows, init);
|
|
1874
|
+
glow.source = init.source ?? core.source;
|
|
1858
1875
|
core.trace?.glow?.(glow);
|
|
1859
1876
|
return glow;
|
|
1860
1877
|
}
|
|
1861
1878
|
function addChunk(core, random, init) {
|
|
1862
1879
|
const chunk = spawnChunk(core.chunks, random, init);
|
|
1880
|
+
chunk.source = core.source;
|
|
1863
1881
|
core.spawned.chunks++;
|
|
1864
1882
|
if (chunk.hot && core.layers.shrapnel) {
|
|
1865
1883
|
chunk.glow = addGlow(core, { follow: chunk, s: 0.35 + chunk.sx, i: 2.2, life: random.between(1, 2.2), color: HOT_GLOW_COLOR, curve: 1.5 });
|
|
@@ -1890,7 +1908,8 @@ var GameVfx = (() => {
|
|
|
1890
1908
|
fz: 0,
|
|
1891
1909
|
color: SMOKE_COLORS.black,
|
|
1892
1910
|
rng: placeholder,
|
|
1893
|
-
handle: 0
|
|
1911
|
+
handle: 0,
|
|
1912
|
+
source: void 0
|
|
1894
1913
|
}));
|
|
1895
1914
|
}
|
|
1896
1915
|
function spawnFire(pool, random, init, handle) {
|
|
@@ -1915,6 +1934,7 @@ var GameVfx = (() => {
|
|
|
1915
1934
|
fire.color = init.color ?? SMOKE_COLORS.black;
|
|
1916
1935
|
fire.rng = random;
|
|
1917
1936
|
fire.handle = handle;
|
|
1937
|
+
fire.source = init.source;
|
|
1918
1938
|
return fire;
|
|
1919
1939
|
}
|
|
1920
1940
|
function addFire(core, random, init, handle) {
|
|
@@ -1949,7 +1969,8 @@ var GameVfx = (() => {
|
|
|
1949
1969
|
buoy: 3.2,
|
|
1950
1970
|
color: fire.color,
|
|
1951
1971
|
kind: 0,
|
|
1952
|
-
wind: 0.4
|
|
1972
|
+
wind: 0.4,
|
|
1973
|
+
source: fire.source
|
|
1953
1974
|
});
|
|
1954
1975
|
}
|
|
1955
1976
|
}
|
|
@@ -1972,7 +1993,8 @@ var GameVfx = (() => {
|
|
|
1972
1993
|
drag: 0.6,
|
|
1973
1994
|
buoy: 0.55,
|
|
1974
1995
|
color: fire.color,
|
|
1975
|
-
kind: 0
|
|
1996
|
+
kind: 0,
|
|
1997
|
+
source: fire.source
|
|
1976
1998
|
});
|
|
1977
1999
|
}
|
|
1978
2000
|
}
|
|
@@ -1991,7 +2013,8 @@ var GameVfx = (() => {
|
|
|
1991
2013
|
st: 0.02,
|
|
1992
2014
|
kind: 4,
|
|
1993
2015
|
g: -0.6,
|
|
1994
|
-
drag: 1.2
|
|
2016
|
+
drag: 1.2,
|
|
2017
|
+
source: fire.source
|
|
1995
2018
|
});
|
|
1996
2019
|
}
|
|
1997
2020
|
function updateFires(core, dt) {
|
|
@@ -3770,67 +3793,59 @@ var GameVfx = (() => {
|
|
|
3770
3793
|
]
|
|
3771
3794
|
};
|
|
3772
3795
|
|
|
3773
|
-
// src/effects/events.ts
|
|
3796
|
+
// src/effects/material-events.ts
|
|
3797
|
+
var DEBRIS_EFFECT_FAMILIES = ["wood", "masonry", "glass", "metal", "soft", "soil"];
|
|
3798
|
+
var DEBRIS_COLOR_VARIABLE = "debrisColor";
|
|
3799
|
+
var DUST_COLOR_VARIABLE = "dustColor";
|
|
3800
|
+
var FAMILIES = {
|
|
3801
|
+
wood: { debris: 8017200, dust: 10127986, piece: [0.015, 0.015, 0.1], spin: 6, cloud: 0.5, sparks: false, glints: false },
|
|
3802
|
+
masonry: { debris: 10197652, dust: 11052187, piece: [0.035, 0.028, 0.035], spin: 4, cloud: 1, sparks: false, glints: false },
|
|
3803
|
+
glass: { debris: 11061464, dust: 12572386, piece: [0.04, 4e-3, 0.04], spin: 14, cloud: 0.25, sparks: false, glints: true },
|
|
3804
|
+
metal: { debris: 9080726, dust: 9078138, piece: [0.04, 6e-3, 0.03], spin: 8, cloud: 0.15, sparks: true, glints: false },
|
|
3805
|
+
soft: { debris: 10130568, dust: 11578014, piece: [0.025, 4e-3, 0.02], spin: 6, cloud: 0.3, sparks: false, glints: false },
|
|
3806
|
+
soil: { debris: 8022613, dust: 9075298, piece: [0.03, 0.025, 0.03], spin: 3, cloud: 1, sparks: false, glints: false }
|
|
3807
|
+
};
|
|
3808
|
+
var ORIGIN = [0, 0, 0];
|
|
3774
3809
|
var FACING4 = [0, 0, 1];
|
|
3775
3810
|
var UP11 = [0, 1, 0];
|
|
3776
|
-
var
|
|
3777
|
-
var
|
|
3778
|
-
var
|
|
3779
|
-
var
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
var muzzleEffect = (weapon) => ({
|
|
3788
|
-
id: `muzzle_${weapon}`,
|
|
3789
|
-
pageId: `event:muzzle_${weapon}`,
|
|
3790
|
-
team: "weapons",
|
|
3791
|
-
budget: { particles: 60, lights: 1 },
|
|
3792
|
-
loop: 2.4,
|
|
3793
|
-
timeline: [call2("muzzle", weapon, ORIGIN, FORWARD4)]
|
|
3794
|
-
});
|
|
3795
|
-
var casingEffect = (id, type) => ({
|
|
3796
|
-
id,
|
|
3797
|
-
pageId: `event:${id}`,
|
|
3798
|
-
team: "weapons",
|
|
3799
|
-
budget: { debris: 1 },
|
|
3800
|
-
loop: 2,
|
|
3801
|
-
timeline: [call2("casing", ORIGIN, type)]
|
|
3802
|
-
});
|
|
3803
|
-
var EVENT_EFFECTS = [
|
|
3804
|
-
...IMPACT_MATERIALS.map(impactEffect),
|
|
3805
|
-
...["glock", "ak", "r870", "barrett"].map(muzzleEffect),
|
|
3806
|
-
casingEffect("casing_brass", ""),
|
|
3807
|
-
casingEffect("casing_shell", "shell"),
|
|
3808
|
-
casingEffect("casing_50", "50"),
|
|
3809
|
-
{
|
|
3810
|
-
// door_stages (W856-871): the dust a blow shakes loose from the frame and the splinters.
|
|
3811
|
-
id: "stage_crack",
|
|
3812
|
-
pageId: "event:stage_crack",
|
|
3811
|
+
var grow = (piece, factor) => [piece[0] * factor, piece[1] * factor, piece[2] * factor];
|
|
3812
|
+
var debrisTone = (look) => or(variable(DEBRIS_COLOR_VARIABLE), look.debris);
|
|
3813
|
+
var dustTone = (look) => or(variable(DUST_COLOR_VARIABLE), look.dust);
|
|
3814
|
+
var sparks = (look, count) => look.sparks ? [call2("spark_at", ORIGIN, FACING4, count, 0.9)] : [];
|
|
3815
|
+
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 })] : [];
|
|
3816
|
+
function stageCrack(family) {
|
|
3817
|
+
const look = FAMILIES[family];
|
|
3818
|
+
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 })];
|
|
3819
|
+
return {
|
|
3820
|
+
id: `stage_crack_${family}`,
|
|
3821
|
+
pageId: `event:stage_crack_${family}`,
|
|
3813
3822
|
team: "destruction",
|
|
3814
|
-
budget: { particles:
|
|
3823
|
+
budget: { particles: 16, debris: 6 },
|
|
3815
3824
|
loop: 2,
|
|
3816
3825
|
timeline: [
|
|
3817
|
-
|
|
3818
|
-
|
|
3826
|
+
...dust,
|
|
3827
|
+
...sparks(look, 8),
|
|
3828
|
+
...glints(look, 4),
|
|
3829
|
+
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 }))
|
|
3819
3830
|
]
|
|
3820
|
-
}
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3831
|
+
};
|
|
3832
|
+
}
|
|
3833
|
+
function breachDust(family) {
|
|
3834
|
+
const look = FAMILIES[family];
|
|
3835
|
+
return {
|
|
3836
|
+
id: `breach_dust_${family}`,
|
|
3837
|
+
pageId: `event:breach_dust_${family}`,
|
|
3825
3838
|
team: "destruction",
|
|
3826
3839
|
budget: { particles: 90, debris: 16 },
|
|
3827
3840
|
loop: 5,
|
|
3828
3841
|
timeline: [
|
|
3829
3842
|
screen({ add: { shake: 0.25 } }),
|
|
3830
|
-
|
|
3831
|
-
|
|
3843
|
+
...sparks(look, 14),
|
|
3844
|
+
...glints(look, 20),
|
|
3845
|
+
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 }),
|
|
3846
|
+
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 })),
|
|
3832
3847
|
repeat(
|
|
3833
|
-
scaled(60),
|
|
3848
|
+
scaled(Math.round(60 * look.cloud)),
|
|
3834
3849
|
spawn("normal", local("angle", rnd(0, 6.283), {
|
|
3835
3850
|
p: [rnd(-1.4, 1.4), 0.2, rnd(-0.6, 0.4)],
|
|
3836
3851
|
dir: vnorm([cos(variable("angle")), 0.3, sin(variable("angle"))]),
|
|
@@ -3840,27 +3855,30 @@ var GameVfx = (() => {
|
|
|
3840
3855
|
life: [2.5, 4.5],
|
|
3841
3856
|
size: [0.6, 1],
|
|
3842
3857
|
grow: 3,
|
|
3843
|
-
c0:
|
|
3858
|
+
c0: dustTone(look),
|
|
3844
3859
|
c1: 4867648,
|
|
3845
3860
|
a: 0.45,
|
|
3846
3861
|
fi: 0.12
|
|
3847
3862
|
}))
|
|
3848
3863
|
)
|
|
3849
3864
|
]
|
|
3850
|
-
}
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3865
|
+
};
|
|
3866
|
+
}
|
|
3867
|
+
function collapseDust(family) {
|
|
3868
|
+
const look = FAMILIES[family];
|
|
3869
|
+
return {
|
|
3870
|
+
id: `collapse_dust_${family}`,
|
|
3871
|
+
pageId: `event:collapse_dust_${family}`,
|
|
3855
3872
|
team: "destruction",
|
|
3856
3873
|
budget: { particles: 350, debris: 26 },
|
|
3857
3874
|
loop: 8,
|
|
3858
3875
|
timeline: [
|
|
3859
3876
|
screen({ add: { shake: 0.45 } }),
|
|
3860
|
-
|
|
3861
|
-
repeat(
|
|
3877
|
+
...sparks(look, 20),
|
|
3878
|
+
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 })),
|
|
3879
|
+
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 })),
|
|
3862
3880
|
repeat(
|
|
3863
|
-
scaled(70),
|
|
3881
|
+
scaled(Math.round(70 * look.cloud)),
|
|
3864
3882
|
spawn("normal", local("angle", rnd(-0.4, 3.5), {
|
|
3865
3883
|
p: [rnd(-2, 2), 0.2, rnd(-0.5, 0.5)],
|
|
3866
3884
|
dir: vnorm([mul(cos(variable("angle")), 0.6), 0.25, sin(variable("angle"))]),
|
|
@@ -3870,14 +3888,68 @@ var GameVfx = (() => {
|
|
|
3870
3888
|
life: [3, 6],
|
|
3871
3889
|
size: [0.7, 1.2],
|
|
3872
3890
|
grow: 3,
|
|
3873
|
-
c0:
|
|
3891
|
+
c0: dustTone(look),
|
|
3874
3892
|
c1: 4867648,
|
|
3875
3893
|
a: 0.5,
|
|
3876
3894
|
fi: 0.12
|
|
3877
3895
|
}))
|
|
3878
3896
|
)
|
|
3879
3897
|
]
|
|
3880
|
-
}
|
|
3898
|
+
};
|
|
3899
|
+
}
|
|
3900
|
+
var MASONRY = FAMILIES.masonry;
|
|
3901
|
+
var REBAR_EXPOSE = {
|
|
3902
|
+
id: "rebar_expose",
|
|
3903
|
+
pageId: "event:rebar_expose",
|
|
3904
|
+
team: "destruction",
|
|
3905
|
+
budget: { particles: 24, debris: 8 },
|
|
3906
|
+
loop: 2,
|
|
3907
|
+
timeline: [
|
|
3908
|
+
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 })),
|
|
3909
|
+
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 }),
|
|
3910
|
+
call2("rust_at", ORIGIN, 6)
|
|
3911
|
+
]
|
|
3912
|
+
};
|
|
3913
|
+
var MATERIAL_EVENT_EFFECTS = [
|
|
3914
|
+
...DEBRIS_EFFECT_FAMILIES.flatMap((family) => [stageCrack(family), breachDust(family), collapseDust(family)]),
|
|
3915
|
+
REBAR_EXPOSE
|
|
3916
|
+
];
|
|
3917
|
+
|
|
3918
|
+
// src/effects/events.ts
|
|
3919
|
+
var FACING5 = [0, 0, 1];
|
|
3920
|
+
var ORIGIN2 = [0, 0, 0];
|
|
3921
|
+
var FORWARD4 = [0, 0, -1];
|
|
3922
|
+
var IMPACT_MATERIALS = ["concrete", "metal", "wood", "glass", "flesh", "water"];
|
|
3923
|
+
var impactEffect = (material) => ({
|
|
3924
|
+
id: `impact_${material}`,
|
|
3925
|
+
pageId: `event:impact_${material}`,
|
|
3926
|
+
team: "weapons",
|
|
3927
|
+
budget: { particles: 40, decals: 1 },
|
|
3928
|
+
loop: 2,
|
|
3929
|
+
timeline: [call2("impact", material, ORIGIN2, FACING5, 1, 0)]
|
|
3930
|
+
});
|
|
3931
|
+
var muzzleEffect = (weapon) => ({
|
|
3932
|
+
id: `muzzle_${weapon}`,
|
|
3933
|
+
pageId: `event:muzzle_${weapon}`,
|
|
3934
|
+
team: "weapons",
|
|
3935
|
+
budget: { particles: 60, lights: 1 },
|
|
3936
|
+
loop: 2.4,
|
|
3937
|
+
timeline: [call2("muzzle", weapon, ORIGIN2, FORWARD4)]
|
|
3938
|
+
});
|
|
3939
|
+
var casingEffect = (id, type) => ({
|
|
3940
|
+
id,
|
|
3941
|
+
pageId: `event:${id}`,
|
|
3942
|
+
team: "weapons",
|
|
3943
|
+
budget: { debris: 1 },
|
|
3944
|
+
loop: 2,
|
|
3945
|
+
timeline: [call2("casing", ORIGIN2, type)]
|
|
3946
|
+
});
|
|
3947
|
+
var EVENT_EFFECTS = [
|
|
3948
|
+
...IMPACT_MATERIALS.map(impactEffect),
|
|
3949
|
+
...["glock", "ak", "r870", "barrett"].map(muzzleEffect),
|
|
3950
|
+
casingEffect("casing_brass", ""),
|
|
3951
|
+
casingEffect("casing_shell", "shell"),
|
|
3952
|
+
casingEffect("casing_50", "50"),
|
|
3881
3953
|
{
|
|
3882
3954
|
// shopfront_glass (W846-855): the pane coming down as shards, the flash of the glints and the pale dust.
|
|
3883
3955
|
id: "glass_burst",
|
|
@@ -3889,21 +3961,13 @@ var GameVfx = (() => {
|
|
|
3889
3961
|
screen({ add: { shake: 0.08 } }),
|
|
3890
3962
|
repeat(
|
|
3891
3963
|
scaled(75),
|
|
3892
|
-
debris({ p:
|
|
3964
|
+
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 })
|
|
3893
3965
|
),
|
|
3894
|
-
burst("add", 30, { p:
|
|
3966
|
+
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 }),
|
|
3895
3967
|
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 })
|
|
3896
3968
|
]
|
|
3897
3969
|
},
|
|
3898
|
-
|
|
3899
|
-
// The chips macro the page uses on wood (W849) plus rust (`rustAt`), for rebar laid bare in concrete.
|
|
3900
|
-
id: "rebar_expose",
|
|
3901
|
-
pageId: "event:rebar_expose",
|
|
3902
|
-
team: "destruction",
|
|
3903
|
-
budget: { particles: 20, debris: 8 },
|
|
3904
|
-
loop: 2,
|
|
3905
|
-
timeline: [call2("chips", ORIGIN, UP11, 8, 0.9), call2("rust_at", ORIGIN, 6)]
|
|
3906
|
-
}
|
|
3970
|
+
...MATERIAL_EVENT_EFFECTS
|
|
3907
3971
|
];
|
|
3908
3972
|
|
|
3909
3973
|
// src/effects/weapons/viewmodel.ts
|
|
@@ -3916,7 +3980,7 @@ var GameVfx = (() => {
|
|
|
3916
3980
|
var FLASH_OPACITY = 0.95;
|
|
3917
3981
|
var FLAME_COLORS = [16742946, 16760896, 13121050, 16773296];
|
|
3918
3982
|
var FLAME_ADDITIVE = 3;
|
|
3919
|
-
var
|
|
3983
|
+
var ORIGIN3 = [0, 0, 0];
|
|
3920
3984
|
var SIZE = variable("size");
|
|
3921
3985
|
var FLASH_SCALE = variable("flash");
|
|
3922
3986
|
var fallback = (name, defaultValue) => ite(ne(variable(name), void 0), variable(name), defaultValue);
|
|
@@ -3964,7 +4028,7 @@ var GameVfx = (() => {
|
|
|
3964
4028
|
grow: 2.2
|
|
3965
4029
|
})
|
|
3966
4030
|
];
|
|
3967
|
-
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:
|
|
4031
|
+
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 });
|
|
3968
4032
|
var MUZZLE_FLASH2 = {
|
|
3969
4033
|
id: "viewmodel_muzzle_flash",
|
|
3970
4034
|
pageId: "event:viewmodel_muzzle_flash",
|
|
@@ -3991,7 +4055,7 @@ var GameVfx = (() => {
|
|
|
3991
4055
|
repeat(4, append("angles", add(div(mul(INDEX, PI), 2), mul(rand(), 0.6)))),
|
|
3992
4056
|
set("roll", mul(rand(), PI)),
|
|
3993
4057
|
when(gt(FLASH_SCALE, 0), [
|
|
3994
|
-
flash(
|
|
4058
|
+
flash(ORIGIN3, 16756832, mul(4, SIZE, FLASH_SCALE), FLASH_SECONDS, mul(2, SIZE, FLASH_SCALE), true, true),
|
|
3995
4059
|
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),
|
|
3996
4060
|
repeat(
|
|
3997
4061
|
4,
|
|
@@ -4011,7 +4075,7 @@ var GameVfx = (() => {
|
|
|
4011
4075
|
repeat(
|
|
4012
4076
|
variable("puffs"),
|
|
4013
4077
|
puff2(
|
|
4014
|
-
|
|
4078
|
+
ORIGIN3,
|
|
4015
4079
|
[add(variable("drift"), mul(rand(), variable("driftSpread"))), add(variable("rise"), mul(rand(), variable("riseSpread"))), mul(sub(rand(), 0.5), variable("sideSpread"))],
|
|
4016
4080
|
[0, 0, 0],
|
|
4017
4081
|
mul(variable("radius"), SIZE),
|
|
@@ -4028,7 +4092,7 @@ var GameVfx = (() => {
|
|
|
4028
4092
|
team: "weapons",
|
|
4029
4093
|
budget: { particles: 1 },
|
|
4030
4094
|
loop: 0.1,
|
|
4031
|
-
timeline: [puff2(
|
|
4095
|
+
timeline: [puff2(ORIGIN3, void 0, [variable("vx"), variable("vy"), variable("vz")], variable("radius"), variable("life"), variable("opacity"))]
|
|
4032
4096
|
};
|
|
4033
4097
|
var BACKBLAST = {
|
|
4034
4098
|
id: "launcher_backblast",
|
|
@@ -4037,8 +4101,8 @@ var GameVfx = (() => {
|
|
|
4037
4101
|
budget: { particles: 40 },
|
|
4038
4102
|
loop: 0.1,
|
|
4039
4103
|
timeline: [
|
|
4040
|
-
repeat(26, puff2(
|
|
4041
|
-
repeat(14, ...flameBit(
|
|
4104
|
+
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)),
|
|
4105
|
+
repeat(14, ...flameBit(ORIGIN3, [neg(add(2, mul(rand(), 2))), 0, 0], [wide(1), wide(0.6), wide(1)], 0.02, 0.25))
|
|
4042
4106
|
]
|
|
4043
4107
|
};
|
|
4044
4108
|
var FLAME_JET = {
|
|
@@ -4177,7 +4241,7 @@ var GameVfx = (() => {
|
|
|
4177
4241
|
// src/effects/behaviors/blocks.ts
|
|
4178
4242
|
var COLUMNS = 6;
|
|
4179
4243
|
var ROWS = 5;
|
|
4180
|
-
var
|
|
4244
|
+
var ORIGIN4 = [-2.2, 0, 2.6];
|
|
4181
4245
|
var BLOCK_SIZE = [0.5, 0.44, 0.25];
|
|
4182
4246
|
var OBJECT_ID_DRAWS2 = 4;
|
|
4183
4247
|
var FLOOR2 = 0.13;
|
|
@@ -4220,7 +4284,7 @@ var GameVfx = (() => {
|
|
|
4220
4284
|
const chipScale = random.between(0.8, 1.3) * scale;
|
|
4221
4285
|
for (let draw = 0; draw < OBJECT_ID_DRAWS2; draw++) random.next();
|
|
4222
4286
|
best.holes.push({ x: offsetX, y: offsetY, scale, chipTurn, chipScale });
|
|
4223
|
-
impact(host.engine, "concrete", [
|
|
4287
|
+
impact(host.engine, "concrete", [ORIGIN4[0] + x, y, ORIGIN4[2] + 0.13], [0, 0, 1], 0.8);
|
|
4224
4288
|
} else if (action === "collapse") {
|
|
4225
4289
|
const { x, y } = args;
|
|
4226
4290
|
for (const block of blocks) {
|
|
@@ -4272,7 +4336,7 @@ var GameVfx = (() => {
|
|
|
4272
4336
|
}
|
|
4273
4337
|
|
|
4274
4338
|
// src/effects/behaviors/car.ts
|
|
4275
|
-
var
|
|
4339
|
+
var ORIGIN5 = [5.6, 0, 0.8];
|
|
4276
4340
|
var MAX_TILT = 0.25;
|
|
4277
4341
|
function createCarBehavior() {
|
|
4278
4342
|
let y = 0;
|
|
@@ -4305,7 +4369,7 @@ var GameVfx = (() => {
|
|
|
4305
4369
|
}
|
|
4306
4370
|
},
|
|
4307
4371
|
query(_host, name, args) {
|
|
4308
|
-
if (name === "position") return [
|
|
4372
|
+
if (name === "position") return [ORIGIN5[0], y, ORIGIN5[2]];
|
|
4309
4373
|
if (name === "point") {
|
|
4310
4374
|
const [x, py, z] = args;
|
|
4311
4375
|
const point = carPoint(x, py, z);
|
|
@@ -5210,7 +5274,7 @@ var GameVfx = (() => {
|
|
|
5210
5274
|
};
|
|
5211
5275
|
|
|
5212
5276
|
// src/effects/player.ts
|
|
5213
|
-
var
|
|
5277
|
+
var ORIGIN6 = [0, 0, 0];
|
|
5214
5278
|
var DEFAULT_HEADING = [0, 0, -1];
|
|
5215
5279
|
var DEFAULT_MAX_INSTANCES = 48;
|
|
5216
5280
|
var ENDLESS_SECONDS = 60;
|
|
@@ -5287,7 +5351,7 @@ var GameVfx = (() => {
|
|
|
5287
5351
|
random: playOptions.seed !== void 0 ? streamOf(playOptions.seed) : void 0,
|
|
5288
5352
|
follow: playOptions.follow,
|
|
5289
5353
|
origin: point,
|
|
5290
|
-
anchor: def.anchor ??
|
|
5354
|
+
anchor: def.anchor ?? ORIGIN6,
|
|
5291
5355
|
yaw: yawOf(heading, playOptions.direction),
|
|
5292
5356
|
orientation: playOptions.orientation,
|
|
5293
5357
|
seconds: playOptions.seconds ?? (def.loop && def.loop > 0 ? def.loop : ENDLESS_SECONDS),
|
|
@@ -6055,10 +6119,11 @@ var GameVfx = (() => {
|
|
|
6055
6119
|
st: 0.05,
|
|
6056
6120
|
kind: 0,
|
|
6057
6121
|
g: 0,
|
|
6058
|
-
drag: 1
|
|
6122
|
+
drag: 1,
|
|
6123
|
+
source: chunk.source
|
|
6059
6124
|
});
|
|
6060
6125
|
if (random.next() < 0.25) {
|
|
6061
|
-
addPuff(core, random, { x: chunk.x, y: chunk.y, z: chunk.z, s0: 0.04, s1: 0.14 + chunk.sx * 0.3, sg: 0.15, life: random.between(1, 1.6), drag: 2, buoy: 0.6, color: SMOKE_COLORS.grey, kind: 0 });
|
|
6126
|
+
addPuff(core, random, { x: chunk.x, y: chunk.y, z: chunk.z, s0: 0.04, s1: 0.14 + chunk.sx * 0.3, sg: 0.15, life: random.between(1, 1.6), drag: 2, buoy: 0.6, color: SMOKE_COLORS.grey, kind: 0, source: chunk.source });
|
|
6062
6127
|
}
|
|
6063
6128
|
}
|
|
6064
6129
|
function updateChunks(core, dt) {
|
|
@@ -6118,10 +6183,11 @@ var GameVfx = (() => {
|
|
|
6118
6183
|
};
|
|
6119
6184
|
}
|
|
6120
6185
|
var SpriteKindPool = class {
|
|
6121
|
-
constructor(capacity, defs, owners) {
|
|
6186
|
+
constructor(capacity, defs, owners, sources = { ids: /* @__PURE__ */ new Map(), next: 0 }) {
|
|
6122
6187
|
__publicField(this, "capacity", capacity);
|
|
6123
6188
|
__publicField(this, "defs", defs);
|
|
6124
6189
|
__publicField(this, "owners", owners);
|
|
6190
|
+
__publicField(this, "sources", sources);
|
|
6125
6191
|
__publicField(this, "live", 0);
|
|
6126
6192
|
/** Records from the start the renderer draws (the highest live index + 1). */
|
|
6127
6193
|
__publicField(this, "drawCount", 0);
|
|
@@ -6141,6 +6207,7 @@ var GameVfx = (() => {
|
|
|
6141
6207
|
__publicField(this, "alphaMul");
|
|
6142
6208
|
__publicField(this, "tag");
|
|
6143
6209
|
__publicField(this, "owner");
|
|
6210
|
+
__publicField(this, "source");
|
|
6144
6211
|
__publicField(this, "colorHex");
|
|
6145
6212
|
__publicField(this, "rgbStart");
|
|
6146
6213
|
__publicField(this, "rgbEnd");
|
|
@@ -6162,6 +6229,7 @@ var GameVfx = (() => {
|
|
|
6162
6229
|
this.alphaMul = new Float32Array(n);
|
|
6163
6230
|
this.tag = new Int32Array(n);
|
|
6164
6231
|
this.owner = new Int32Array(n);
|
|
6232
|
+
this.source = new Int32Array(n);
|
|
6165
6233
|
this.colorHex = new Int32Array(n);
|
|
6166
6234
|
this.rgbStart = new Float32Array(n * 3);
|
|
6167
6235
|
this.rgbEnd = new Float32Array(n * 3);
|
|
@@ -6188,6 +6256,7 @@ var GameVfx = (() => {
|
|
|
6188
6256
|
this.alphaMul[i] = options?.alpha ?? 1;
|
|
6189
6257
|
this.tag[i] = options?.tag ?? 0;
|
|
6190
6258
|
this.owner[i] = options?.owner === void 0 ? -1 : this.ownerIndex(options.owner);
|
|
6259
|
+
this.source[i] = options?.source === void 0 ? -1 : this.sourceIndex(options.source);
|
|
6191
6260
|
this.colorHex[i] = options?.color ?? -1;
|
|
6192
6261
|
this.rgbStart.set(rgb(options?.color ?? def.c0), i * 3);
|
|
6193
6262
|
this.rgbEnd.set(rgb(options?.color ?? def.c1), i * 3);
|
|
@@ -6202,6 +6271,26 @@ var GameVfx = (() => {
|
|
|
6202
6271
|
if (index < 0) index = this.owners.push(name) - 1;
|
|
6203
6272
|
return index;
|
|
6204
6273
|
}
|
|
6274
|
+
sourceIndex(name) {
|
|
6275
|
+
let index = this.sources.ids.get(name);
|
|
6276
|
+
if (index === void 0) {
|
|
6277
|
+
index = this.sources.next++;
|
|
6278
|
+
this.sources.ids.set(name, index);
|
|
6279
|
+
}
|
|
6280
|
+
return index;
|
|
6281
|
+
}
|
|
6282
|
+
/** Kills the live sprites made for `source`; returns how many went. */
|
|
6283
|
+
clearSource(source) {
|
|
6284
|
+
const index = this.sources.ids.get(source);
|
|
6285
|
+
if (index === void 0) return 0;
|
|
6286
|
+
let killed = 0;
|
|
6287
|
+
for (let i = 0; i < this.high; i++) {
|
|
6288
|
+
if (!this.alive[i] || this.source[i] !== index) continue;
|
|
6289
|
+
this.kill(i);
|
|
6290
|
+
killed++;
|
|
6291
|
+
}
|
|
6292
|
+
return killed;
|
|
6293
|
+
}
|
|
6205
6294
|
kill(i) {
|
|
6206
6295
|
if (!this.alive[i]) return;
|
|
6207
6296
|
this.alive[i] = 0;
|
|
@@ -6661,14 +6750,15 @@ var GameVfx = (() => {
|
|
|
6661
6750
|
__publicField(this, "defs");
|
|
6662
6751
|
__publicField(this, "index", /* @__PURE__ */ new Map());
|
|
6663
6752
|
__publicField(this, "owners", []);
|
|
6753
|
+
__publicField(this, "sources", { ids: /* @__PURE__ */ new Map(), next: 0 });
|
|
6664
6754
|
__publicField(this, "listeners", /* @__PURE__ */ new Map());
|
|
6665
6755
|
const kinds = options.kinds ?? SPRITE_KINDS;
|
|
6666
6756
|
this.ids = Object.keys(kinds);
|
|
6667
6757
|
this.defs = this.ids.map((id) => kinds[id]);
|
|
6668
6758
|
this.ids.forEach((id, at3) => this.index.set(id, at3));
|
|
6669
6759
|
const additiveCapacity = Math.floor(options.capacity * 0.4);
|
|
6670
|
-
this.additive = new SpriteKindPool(additiveCapacity, this.defs, this.owners);
|
|
6671
|
-
this.normal = new SpriteKindPool(options.capacity - additiveCapacity, this.defs, this.owners);
|
|
6760
|
+
this.additive = new SpriteKindPool(additiveCapacity, this.defs, this.owners, this.sources);
|
|
6761
|
+
this.normal = new SpriteKindPool(options.capacity - additiveCapacity, this.defs, this.owners, this.sources);
|
|
6672
6762
|
this.random = spriteRandom(options.seed);
|
|
6673
6763
|
}
|
|
6674
6764
|
get capacity() {
|
|
@@ -6742,9 +6832,16 @@ var GameVfx = (() => {
|
|
|
6742
6832
|
if (this.additive.live > 0 || this.additive.drawCount > 0) this.additive.update(dt, host);
|
|
6743
6833
|
if (this.normal.live > 0 || this.normal.drawCount > 0) this.normal.update(dt, host);
|
|
6744
6834
|
}
|
|
6835
|
+
/** Kills the live sprites made for `source` (`SpriteSpawnOptions.source`); returns how many went. */
|
|
6836
|
+
clearSource(source) {
|
|
6837
|
+
const killed = this.additive.clearSource(source) + this.normal.clearSource(source);
|
|
6838
|
+
this.sources.ids.delete(source);
|
|
6839
|
+
return killed;
|
|
6840
|
+
}
|
|
6745
6841
|
clear() {
|
|
6746
6842
|
this.additive.clear();
|
|
6747
6843
|
this.normal.clear();
|
|
6844
|
+
this.sources.ids.clear();
|
|
6748
6845
|
}
|
|
6749
6846
|
};
|
|
6750
6847
|
|
|
@@ -7797,7 +7894,8 @@ var GameVfx = (() => {
|
|
|
7797
7894
|
groundAt,
|
|
7798
7895
|
...options.marklessAt ? { marklessAt: options.marklessAt } : {},
|
|
7799
7896
|
...options.cratersAt ? { cratersAt: options.cratersAt } : {},
|
|
7800
|
-
emit: (request) => options.onRequest?.(request)
|
|
7897
|
+
emit: (request) => options.onRequest?.(request),
|
|
7898
|
+
source: void 0
|
|
7801
7899
|
};
|
|
7802
7900
|
function definitionOf(id) {
|
|
7803
7901
|
return explosions[id] ?? explosions[aliases[id] ?? ""];
|
|
@@ -7808,7 +7906,13 @@ var GameVfx = (() => {
|
|
|
7808
7906
|
return streamFor(seed ?? Math.imul(handles.events, AUTO_SEED) + (options.seed ?? 0));
|
|
7809
7907
|
}
|
|
7810
7908
|
function detonate(def, point, call3) {
|
|
7811
|
-
|
|
7909
|
+
const outer = core.source;
|
|
7910
|
+
core.source = call3.source;
|
|
7911
|
+
try {
|
|
7912
|
+
composeExplosion(core, def, { x: point[0], y: point[1], z: point[2], direction: call3.direction, random: call3.random, handle: call3.handle });
|
|
7913
|
+
} finally {
|
|
7914
|
+
core.source = outer;
|
|
7915
|
+
}
|
|
7812
7916
|
}
|
|
7813
7917
|
let engine;
|
|
7814
7918
|
let player;
|
|
@@ -7849,8 +7953,9 @@ var GameVfx = (() => {
|
|
|
7849
7953
|
const handle = ++handles.next;
|
|
7850
7954
|
const direction = explosionOptions.direction && { x: explosionOptions.direction[0], y: explosionOptions.direction[1], z: explosionOptions.direction[2] };
|
|
7851
7955
|
const random = streamOf(explosionOptions.seed);
|
|
7852
|
-
|
|
7853
|
-
|
|
7956
|
+
const source = explosionOptions.source;
|
|
7957
|
+
if (explosionOptions.delay) core.schedule.at(core.clock.time + explosionOptions.delay, () => detonate(def, point, { direction, random, handle, source }));
|
|
7958
|
+
else detonate(def, point, { direction, random, handle, source });
|
|
7854
7959
|
return handle;
|
|
7855
7960
|
},
|
|
7856
7961
|
fire(fireOptions) {
|
|
@@ -7892,6 +7997,15 @@ var GameVfx = (() => {
|
|
|
7892
7997
|
const fires = core.fires;
|
|
7893
7998
|
for (let index = fires.items.length - 1; index >= 0; index--) if (fires.items[index].handle === handle) fires.removeAt(index);
|
|
7894
7999
|
},
|
|
8000
|
+
clearSource(source) {
|
|
8001
|
+
const keep = (record, gone) => record.source !== gone;
|
|
8002
|
+
const drop = (pool) => {
|
|
8003
|
+
const before = pool.count;
|
|
8004
|
+
pool.compact(keep, source);
|
|
8005
|
+
return before - pool.count;
|
|
8006
|
+
};
|
|
8007
|
+
return drop(core.fires) + drop(core.puffs) + drop(core.sparks) + drop(core.chunks) + drop(core.glows) + spriteSystem.clearSource(source);
|
|
8008
|
+
},
|
|
7895
8009
|
setLayer(layer, on) {
|
|
7896
8010
|
layers[layer] = on;
|
|
7897
8011
|
},
|
|
@@ -7986,9 +8100,9 @@ var GameVfx = (() => {
|
|
|
7986
8100
|
// src/data/event-effects.json
|
|
7987
8101
|
var event_effects_default = {
|
|
7988
8102
|
spall: "impact_{material}",
|
|
7989
|
-
stage: { "1": "
|
|
8103
|
+
stage: { "1": "stage_crack_{material}", "2": "breach_dust_{material}", "3": "collapse_dust_{material}" },
|
|
7990
8104
|
expose: "rebar_expose",
|
|
7991
|
-
collapse: "
|
|
8105
|
+
collapse: "collapse_dust_{material}",
|
|
7992
8106
|
explode: "explosion",
|
|
7993
8107
|
fracture: { glass: "glass_burst" }
|
|
7994
8108
|
};
|
|
@@ -7998,9 +8112,14 @@ var GameVfx = (() => {
|
|
|
7998
8112
|
function effectForEvent(event, map = EVENT_EFFECTS_MAP) {
|
|
7999
8113
|
const entry = map[event.kind];
|
|
8000
8114
|
if (entry === void 0) return void 0;
|
|
8001
|
-
if (typeof entry === "string") return
|
|
8115
|
+
if (typeof entry === "string") return withMaterial(entry, event.material);
|
|
8002
8116
|
const key = event.stage !== void 0 ? String(event.stage) : event.material;
|
|
8003
|
-
|
|
8117
|
+
const chosen = key === void 0 ? void 0 : entry[key];
|
|
8118
|
+
return chosen === void 0 ? void 0 : withMaterial(chosen, event.material);
|
|
8119
|
+
}
|
|
8120
|
+
function withMaterial(entry, material) {
|
|
8121
|
+
if (!entry.includes("{material}")) return entry;
|
|
8122
|
+
return material ? entry.replace("{material}", material) : void 0;
|
|
8004
8123
|
}
|
|
8005
8124
|
|
|
8006
8125
|
// src/locales/en.ts
|