@adatechnology/game-vfx 0.13.0 → 0.14.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 +18 -3
- package/dist/index.global.js +138 -88
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +138 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,8 +69,12 @@ flash stays on the muzzle the view turns), and the smoke it throws stays in the
|
|
|
69
69
|
`vfx.burst(kind, point, normal, count, speed?)` and `vfx.spawn(kind, point, velocity)` are the **sprite kinds** that destruction, fluids and weapons share
|
|
70
70
|
(debris, sparks, ash, steam, drips, leaks...: `data/sprite-kinds.json`, `patchSpriteKinds`), with `onLand(owner, ...)` to hear where a drop touched the ground.
|
|
71
71
|
|
|
72
|
-
`effectForEvent(event)` maps the destruction events to effects (`data/event-effects.json`): `spall` plays `impact_<material>`, the stages
|
|
73
|
-
`
|
|
72
|
+
`effectForEvent(event)` maps the destruction events to effects (`data/event-effects.json`): `spall` plays `impact_<material>`, the stages
|
|
73
|
+
`stage_crack_<family>`, `breach_dust_<family>` and `collapse_dust_<family>` (and a collapse `collapse_dust_<family>`), `expose` `rebar_expose` (concrete
|
|
74
|
+
chips and rust), a fracture of glass `glass_burst`; `muzzle_*` and `casing_*` are the weapon slices. The family is the `material` of the event
|
|
75
|
+
(`DEBRIS_EFFECT_FAMILIES`: `wood` splinters, `masonry` chips and dust, `glass` shards, `metal` sparks and no dust, `soft` flakes, `soil` clods and dust), and
|
|
76
|
+
the host draws them in the colour of the material that broke by passing `values: { debrisColor, dustColor }` to `play`. A stage with no family plays nothing.
|
|
77
|
+
`GAME_EFFECTS`
|
|
74
78
|
is the recipes plus these, what a world plays by default. Texts of every recipe (name, cost, when, look, budget, network) are in `locales` (`en`, `pt-BR`).
|
|
75
79
|
|
|
76
80
|
## Vehicle effects
|
package/dist/index.d.ts
CHANGED
|
@@ -1870,6 +1870,18 @@ declare function patchEffects(base: Readonly<Record<string, EffectDef>>, changes
|
|
|
1870
1870
|
*/
|
|
1871
1871
|
declare const EVENT_EFFECTS: readonly EffectDef[];
|
|
1872
1872
|
|
|
1873
|
+
/**
|
|
1874
|
+
* The families of material a destruction event plays its effect by (the `{material}` of the stage and collapse entries of `data/event-effects.json`): the
|
|
1875
|
+
* same names as `DebrisFamily` of `game-destruction`, kept as strings so this package does not depend on it.
|
|
1876
|
+
*/
|
|
1877
|
+
declare const DEBRIS_EFFECT_FAMILIES: readonly ["wood", "masonry", "glass", "metal", "soft", "soil"];
|
|
1878
|
+
type DebrisEffectFamily = (typeof DEBRIS_EFFECT_FAMILIES)[number];
|
|
1879
|
+
/** The variables a host sets (`PlayOptions.values`) to draw the debris and the dust in the colour of the material that broke. */
|
|
1880
|
+
declare const DEBRIS_COLOR_VARIABLE = "debrisColor";
|
|
1881
|
+
declare const DUST_COLOR_VARIABLE = "dustColor";
|
|
1882
|
+
/** The stage, breach and collapse effects of every family, and the rebar laid bare. */
|
|
1883
|
+
declare const MATERIAL_EVENT_EFFECTS: readonly EffectDef[];
|
|
1884
|
+
|
|
1873
1885
|
declare const VIEWMODEL_EFFECTS: readonly EffectDef[];
|
|
1874
1886
|
|
|
1875
1887
|
/** What a game event looks like to the map: the kind of event and the little that picks its effect. */
|
|
@@ -1878,14 +1890,17 @@ interface GameEvent {
|
|
|
1878
1890
|
readonly kind: string;
|
|
1879
1891
|
/** The stage of a `stage` event (1, 2 or 3). */
|
|
1880
1892
|
readonly stage?: number;
|
|
1881
|
-
/**
|
|
1893
|
+
/**
|
|
1894
|
+
* The material of a `spall` or `fracture` event; for a `stage`, `collapse` or `expose` event the family of the material that broke (`DEBRIS_EFFECT_FAMILIES`:
|
|
1895
|
+
* `wood`, `masonry`, `glass`, `metal`, `soft`, `soil`), so the stone dust of a breach is not raised by a wooden wall.
|
|
1896
|
+
*/
|
|
1882
1897
|
readonly material?: string;
|
|
1883
1898
|
}
|
|
1884
1899
|
type EventMap = Readonly<Record<string, string | Readonly<Record<string, string>>>>;
|
|
1885
1900
|
declare const EVENT_EFFECTS_MAP: EventMap;
|
|
1886
1901
|
/**
|
|
1887
1902
|
* The effect id that plays for an event (`undefined` when the map has none). A string entry may use `{material}`; an object entry is chosen by the event's
|
|
1888
|
-
* stage or material. A game passes its own map to add or change entries.
|
|
1903
|
+
* stage or material, and its value may use `{material}` too. A game passes its own map to add or change entries.
|
|
1889
1904
|
*/
|
|
1890
1905
|
declare function effectForEvent(event: GameEvent, map?: EventMap): string | undefined;
|
|
1891
1906
|
|
|
@@ -2379,4 +2394,4 @@ declare function resolveWaterShotProfile(profile: string | WaterShotProfile, tab
|
|
|
2379
2394
|
/** Changes a profile table without touching the kit's: `null` removes an entry, a partial entry is merged over the old one. */
|
|
2380
2395
|
declare function patchWaterShotProfiles(base: Readonly<Record<string, WaterShotProfile>>, changes: Readonly<Record<string, Partial<WaterShotProfile> | null>>): Record<string, WaterShotProfile>;
|
|
2381
2396
|
|
|
2382
|
-
export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Carrier, type Chunk, type ConfineResult, type Confiner, type CueRequest, type DebrisSpawn, type Decal, type DecalOptions, type DirtMark, EVENT_BUDGET, EVENT_EFFECTS, EVENT_EFFECTS_MAP, EXPLOSIONS, EXPLOSION_ALIASES, EffectCamera, type EffectDef, EffectInstance, type EffectPlayer, type EffectPlayerOptions, EffectRunner, type EffectRunnerOptions, type EffectStep, type EffectTexts, type EffectTrack, type EffectView, Enclosures, type ExplosionCall, type ExplosionDef, type ExplosionOptions, type Fire, type FireLight, type FireOptions, type FireSpec, type Follow, GAME_EFFECTS, type GameEvent, type Glow, type GroundField, type GroundFieldOptions, type InstanceDeps, type InstanceSetup, type KindPoolHost, LOD_GAME, LOD_LAB, type LandListener, type LensBlob, type LightGlow, type LightPool, type LodBands, type Mark, type MarkEvent, type MarkStore, type MeshParticle, MeshPool, type MeshShape, type MeshSpawn, type MushroomSpec, type MutableVec3, OrderedPool, PROFILES, type Placement, type PlayOptions, type PostProcess, type Puddle, type Puff, type Quaternion, RAIN_CAPACITY, RainField, type RandomStream, type Rgb, type Ring, type RockMark, SCRAPE_LIMIT, SMOKE_COLORS, SPRITE_KINDS, type Schedule, type ScorchMark, type ScrapeMark, type ScreenState, type SheetLabels, type Shock, type Spark, type SpriteGround, type SpriteKind, type SpriteKindDef, SpriteKindPool, SpriteKindSystem, type SpriteKindSystemOptions, type SpriteSpawn, type SpriteSpawnOptions, type SpriteSystem, VFX_LAYERS, VIEWMODEL_EFFECTS, type Vec3Like, type Vec3Tuple, type VfxEnclosure, type VfxEnclosureBox, type VfxLayer, type VfxLocale, type VfxOptions, type VfxPoolsView, type VfxProfile, type VfxProfileName, type VfxSideRequest, type VfxStats, type VfxStrings, type VfxTrace, type VfxWorld, WATER_BLASTS, WATER_BLAST_KINDS, WATER_LIMITS, WATER_SHOT_BY_CALIBER, WATER_SHOT_PROFILES, WORKSHOP_BEHAVIORS, WORKSHOP_EFFECTS, WORKSHOP_PUDDLES, type WaterBlastCharge, type WaterBlastKind, type WaterBlastKindId, type WaterBlastParams, type WaterBlastPlan, type WaterBubble, type WaterColumn, type WaterDrop, type WaterEffects, type WaterEffectsLimits, type WaterEffectsOptions, type WaterEffectsStats, type WaterFoam, type WaterMist, type WaterRing, type WaterRound, type WaterShotClass, type WaterShotParams, type WaterShotPlan, type WaterShotProfile, type WaterVec3, type WaterWave, type WaterWaveSample, type WorkshopContext, WorkshopEngine, type WorkshopOptions, type WorkshopTrace, colorOfChunk, composeExplosion, createAreaCap, createEffectPlayer, createGroundField, createSchedule, createScreenState, createVfx, createWaterEffects, createWorkshopBehaviors, effectForEvent, estimateCost, hexToLinearRgb, hexToRgb, inPuddle, lcg, lehmer, locales, lodScale, patchEffects, patchExplosions, patchSpriteKinds, patchWaterShotProfiles, planWaterBlast, planWaterShot, resolveStrings, resolveWaterBlast, resolveWaterShotProfile, slideAlong, streamFor, updateScreen, waterShotClassOf, workshopGround };
|
|
2397
|
+
export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Carrier, type Chunk, type ConfineResult, type Confiner, type CueRequest, DEBRIS_COLOR_VARIABLE, DEBRIS_EFFECT_FAMILIES, DUST_COLOR_VARIABLE, type DebrisEffectFamily, type DebrisSpawn, type Decal, type DecalOptions, type DirtMark, EVENT_BUDGET, EVENT_EFFECTS, EVENT_EFFECTS_MAP, EXPLOSIONS, EXPLOSION_ALIASES, EffectCamera, type EffectDef, EffectInstance, type EffectPlayer, type EffectPlayerOptions, EffectRunner, type EffectRunnerOptions, type EffectStep, type EffectTexts, type EffectTrack, type EffectView, Enclosures, type ExplosionCall, type ExplosionDef, type ExplosionOptions, type Fire, type FireLight, type FireOptions, type FireSpec, type Follow, GAME_EFFECTS, type GameEvent, type Glow, type GroundField, type GroundFieldOptions, type InstanceDeps, type InstanceSetup, type KindPoolHost, LOD_GAME, LOD_LAB, type LandListener, type LensBlob, type LightGlow, type LightPool, type LodBands, MATERIAL_EVENT_EFFECTS, type Mark, type MarkEvent, type MarkStore, type MeshParticle, MeshPool, type MeshShape, type MeshSpawn, type MushroomSpec, type MutableVec3, OrderedPool, PROFILES, type Placement, type PlayOptions, type PostProcess, type Puddle, type Puff, type Quaternion, RAIN_CAPACITY, RainField, type RandomStream, type Rgb, type Ring, type RockMark, SCRAPE_LIMIT, SMOKE_COLORS, SPRITE_KINDS, type Schedule, type ScorchMark, type ScrapeMark, type ScreenState, type SheetLabels, type Shock, type Spark, type SpriteGround, type SpriteKind, type SpriteKindDef, SpriteKindPool, SpriteKindSystem, type SpriteKindSystemOptions, type SpriteSpawn, type SpriteSpawnOptions, type SpriteSystem, VFX_LAYERS, VIEWMODEL_EFFECTS, type Vec3Like, type Vec3Tuple, type VfxEnclosure, type VfxEnclosureBox, type VfxLayer, type VfxLocale, type VfxOptions, type VfxPoolsView, type VfxProfile, type VfxProfileName, type VfxSideRequest, type VfxStats, type VfxStrings, type VfxTrace, type VfxWorld, WATER_BLASTS, WATER_BLAST_KINDS, WATER_LIMITS, WATER_SHOT_BY_CALIBER, WATER_SHOT_PROFILES, WORKSHOP_BEHAVIORS, WORKSHOP_EFFECTS, WORKSHOP_PUDDLES, type WaterBlastCharge, type WaterBlastKind, type WaterBlastKindId, type WaterBlastParams, type WaterBlastPlan, type WaterBubble, type WaterColumn, type WaterDrop, type WaterEffects, type WaterEffectsLimits, type WaterEffectsOptions, type WaterEffectsStats, type WaterFoam, type WaterMist, type WaterRing, type WaterRound, type WaterShotClass, type WaterShotParams, type WaterShotPlan, type WaterShotProfile, type WaterVec3, type WaterWave, type WaterWaveSample, type WorkshopContext, WorkshopEngine, type WorkshopOptions, type WorkshopTrace, colorOfChunk, composeExplosion, createAreaCap, createEffectPlayer, createGroundField, createSchedule, createScreenState, createVfx, createWaterEffects, createWorkshopBehaviors, effectForEvent, estimateCost, hexToLinearRgb, hexToRgb, inPuddle, lcg, lehmer, locales, lodScale, patchEffects, patchExplosions, patchSpriteKinds, patchWaterShotProfiles, planWaterBlast, planWaterShot, resolveStrings, resolveWaterBlast, resolveWaterShotProfile, slideAlong, streamFor, updateScreen, waterShotClassOf, workshopGround };
|
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,
|
|
@@ -3770,67 +3774,59 @@ var GameVfx = (() => {
|
|
|
3770
3774
|
]
|
|
3771
3775
|
};
|
|
3772
3776
|
|
|
3773
|
-
// src/effects/events.ts
|
|
3777
|
+
// src/effects/material-events.ts
|
|
3778
|
+
var DEBRIS_EFFECT_FAMILIES = ["wood", "masonry", "glass", "metal", "soft", "soil"];
|
|
3779
|
+
var DEBRIS_COLOR_VARIABLE = "debrisColor";
|
|
3780
|
+
var DUST_COLOR_VARIABLE = "dustColor";
|
|
3781
|
+
var FAMILIES = {
|
|
3782
|
+
wood: { debris: 8017200, dust: 10127986, piece: [0.015, 0.015, 0.1], spin: 6, cloud: 0.5, sparks: false, glints: false },
|
|
3783
|
+
masonry: { debris: 10197652, dust: 11052187, piece: [0.035, 0.028, 0.035], spin: 4, cloud: 1, sparks: false, glints: false },
|
|
3784
|
+
glass: { debris: 11061464, dust: 12572386, piece: [0.04, 4e-3, 0.04], spin: 14, cloud: 0.25, sparks: false, glints: true },
|
|
3785
|
+
metal: { debris: 9080726, dust: 9078138, piece: [0.04, 6e-3, 0.03], spin: 8, cloud: 0.15, sparks: true, glints: false },
|
|
3786
|
+
soft: { debris: 10130568, dust: 11578014, piece: [0.025, 4e-3, 0.02], spin: 6, cloud: 0.3, sparks: false, glints: false },
|
|
3787
|
+
soil: { debris: 8022613, dust: 9075298, piece: [0.03, 0.025, 0.03], spin: 3, cloud: 1, sparks: false, glints: false }
|
|
3788
|
+
};
|
|
3789
|
+
var ORIGIN = [0, 0, 0];
|
|
3774
3790
|
var FACING4 = [0, 0, 1];
|
|
3775
3791
|
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",
|
|
3792
|
+
var grow = (piece, factor) => [piece[0] * factor, piece[1] * factor, piece[2] * factor];
|
|
3793
|
+
var debrisTone = (look) => or(variable(DEBRIS_COLOR_VARIABLE), look.debris);
|
|
3794
|
+
var dustTone = (look) => or(variable(DUST_COLOR_VARIABLE), look.dust);
|
|
3795
|
+
var sparks = (look, count) => look.sparks ? [call2("spark_at", ORIGIN, FACING4, count, 0.9)] : [];
|
|
3796
|
+
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 })] : [];
|
|
3797
|
+
function stageCrack(family) {
|
|
3798
|
+
const look = FAMILIES[family];
|
|
3799
|
+
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 })];
|
|
3800
|
+
return {
|
|
3801
|
+
id: `stage_crack_${family}`,
|
|
3802
|
+
pageId: `event:stage_crack_${family}`,
|
|
3813
3803
|
team: "destruction",
|
|
3814
|
-
budget: { particles:
|
|
3804
|
+
budget: { particles: 16, debris: 6 },
|
|
3815
3805
|
loop: 2,
|
|
3816
3806
|
timeline: [
|
|
3817
|
-
|
|
3818
|
-
|
|
3807
|
+
...dust,
|
|
3808
|
+
...sparks(look, 8),
|
|
3809
|
+
...glints(look, 4),
|
|
3810
|
+
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
3811
|
]
|
|
3820
|
-
}
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3812
|
+
};
|
|
3813
|
+
}
|
|
3814
|
+
function breachDust(family) {
|
|
3815
|
+
const look = FAMILIES[family];
|
|
3816
|
+
return {
|
|
3817
|
+
id: `breach_dust_${family}`,
|
|
3818
|
+
pageId: `event:breach_dust_${family}`,
|
|
3825
3819
|
team: "destruction",
|
|
3826
3820
|
budget: { particles: 90, debris: 16 },
|
|
3827
3821
|
loop: 5,
|
|
3828
3822
|
timeline: [
|
|
3829
3823
|
screen({ add: { shake: 0.25 } }),
|
|
3830
|
-
|
|
3831
|
-
|
|
3824
|
+
...sparks(look, 14),
|
|
3825
|
+
...glints(look, 20),
|
|
3826
|
+
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 }),
|
|
3827
|
+
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
3828
|
repeat(
|
|
3833
|
-
scaled(60),
|
|
3829
|
+
scaled(Math.round(60 * look.cloud)),
|
|
3834
3830
|
spawn("normal", local("angle", rnd(0, 6.283), {
|
|
3835
3831
|
p: [rnd(-1.4, 1.4), 0.2, rnd(-0.6, 0.4)],
|
|
3836
3832
|
dir: vnorm([cos(variable("angle")), 0.3, sin(variable("angle"))]),
|
|
@@ -3840,27 +3836,30 @@ var GameVfx = (() => {
|
|
|
3840
3836
|
life: [2.5, 4.5],
|
|
3841
3837
|
size: [0.6, 1],
|
|
3842
3838
|
grow: 3,
|
|
3843
|
-
c0:
|
|
3839
|
+
c0: dustTone(look),
|
|
3844
3840
|
c1: 4867648,
|
|
3845
3841
|
a: 0.45,
|
|
3846
3842
|
fi: 0.12
|
|
3847
3843
|
}))
|
|
3848
3844
|
)
|
|
3849
3845
|
]
|
|
3850
|
-
}
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3846
|
+
};
|
|
3847
|
+
}
|
|
3848
|
+
function collapseDust(family) {
|
|
3849
|
+
const look = FAMILIES[family];
|
|
3850
|
+
return {
|
|
3851
|
+
id: `collapse_dust_${family}`,
|
|
3852
|
+
pageId: `event:collapse_dust_${family}`,
|
|
3855
3853
|
team: "destruction",
|
|
3856
3854
|
budget: { particles: 350, debris: 26 },
|
|
3857
3855
|
loop: 8,
|
|
3858
3856
|
timeline: [
|
|
3859
3857
|
screen({ add: { shake: 0.45 } }),
|
|
3860
|
-
|
|
3861
|
-
repeat(
|
|
3858
|
+
...sparks(look, 20),
|
|
3859
|
+
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 })),
|
|
3860
|
+
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
3861
|
repeat(
|
|
3863
|
-
scaled(70),
|
|
3862
|
+
scaled(Math.round(70 * look.cloud)),
|
|
3864
3863
|
spawn("normal", local("angle", rnd(-0.4, 3.5), {
|
|
3865
3864
|
p: [rnd(-2, 2), 0.2, rnd(-0.5, 0.5)],
|
|
3866
3865
|
dir: vnorm([mul(cos(variable("angle")), 0.6), 0.25, sin(variable("angle"))]),
|
|
@@ -3870,14 +3869,68 @@ var GameVfx = (() => {
|
|
|
3870
3869
|
life: [3, 6],
|
|
3871
3870
|
size: [0.7, 1.2],
|
|
3872
3871
|
grow: 3,
|
|
3873
|
-
c0:
|
|
3872
|
+
c0: dustTone(look),
|
|
3874
3873
|
c1: 4867648,
|
|
3875
3874
|
a: 0.5,
|
|
3876
3875
|
fi: 0.12
|
|
3877
3876
|
}))
|
|
3878
3877
|
)
|
|
3879
3878
|
]
|
|
3880
|
-
}
|
|
3879
|
+
};
|
|
3880
|
+
}
|
|
3881
|
+
var MASONRY = FAMILIES.masonry;
|
|
3882
|
+
var REBAR_EXPOSE = {
|
|
3883
|
+
id: "rebar_expose",
|
|
3884
|
+
pageId: "event:rebar_expose",
|
|
3885
|
+
team: "destruction",
|
|
3886
|
+
budget: { particles: 24, debris: 8 },
|
|
3887
|
+
loop: 2,
|
|
3888
|
+
timeline: [
|
|
3889
|
+
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 })),
|
|
3890
|
+
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 }),
|
|
3891
|
+
call2("rust_at", ORIGIN, 6)
|
|
3892
|
+
]
|
|
3893
|
+
};
|
|
3894
|
+
var MATERIAL_EVENT_EFFECTS = [
|
|
3895
|
+
...DEBRIS_EFFECT_FAMILIES.flatMap((family) => [stageCrack(family), breachDust(family), collapseDust(family)]),
|
|
3896
|
+
REBAR_EXPOSE
|
|
3897
|
+
];
|
|
3898
|
+
|
|
3899
|
+
// src/effects/events.ts
|
|
3900
|
+
var FACING5 = [0, 0, 1];
|
|
3901
|
+
var ORIGIN2 = [0, 0, 0];
|
|
3902
|
+
var FORWARD4 = [0, 0, -1];
|
|
3903
|
+
var IMPACT_MATERIALS = ["concrete", "metal", "wood", "glass", "flesh", "water"];
|
|
3904
|
+
var impactEffect = (material) => ({
|
|
3905
|
+
id: `impact_${material}`,
|
|
3906
|
+
pageId: `event:impact_${material}`,
|
|
3907
|
+
team: "weapons",
|
|
3908
|
+
budget: { particles: 40, decals: 1 },
|
|
3909
|
+
loop: 2,
|
|
3910
|
+
timeline: [call2("impact", material, ORIGIN2, FACING5, 1, 0)]
|
|
3911
|
+
});
|
|
3912
|
+
var muzzleEffect = (weapon) => ({
|
|
3913
|
+
id: `muzzle_${weapon}`,
|
|
3914
|
+
pageId: `event:muzzle_${weapon}`,
|
|
3915
|
+
team: "weapons",
|
|
3916
|
+
budget: { particles: 60, lights: 1 },
|
|
3917
|
+
loop: 2.4,
|
|
3918
|
+
timeline: [call2("muzzle", weapon, ORIGIN2, FORWARD4)]
|
|
3919
|
+
});
|
|
3920
|
+
var casingEffect = (id, type) => ({
|
|
3921
|
+
id,
|
|
3922
|
+
pageId: `event:${id}`,
|
|
3923
|
+
team: "weapons",
|
|
3924
|
+
budget: { debris: 1 },
|
|
3925
|
+
loop: 2,
|
|
3926
|
+
timeline: [call2("casing", ORIGIN2, type)]
|
|
3927
|
+
});
|
|
3928
|
+
var EVENT_EFFECTS = [
|
|
3929
|
+
...IMPACT_MATERIALS.map(impactEffect),
|
|
3930
|
+
...["glock", "ak", "r870", "barrett"].map(muzzleEffect),
|
|
3931
|
+
casingEffect("casing_brass", ""),
|
|
3932
|
+
casingEffect("casing_shell", "shell"),
|
|
3933
|
+
casingEffect("casing_50", "50"),
|
|
3881
3934
|
{
|
|
3882
3935
|
// shopfront_glass (W846-855): the pane coming down as shards, the flash of the glints and the pale dust.
|
|
3883
3936
|
id: "glass_burst",
|
|
@@ -3889,21 +3942,13 @@ var GameVfx = (() => {
|
|
|
3889
3942
|
screen({ add: { shake: 0.08 } }),
|
|
3890
3943
|
repeat(
|
|
3891
3944
|
scaled(75),
|
|
3892
|
-
debris({ p:
|
|
3945
|
+
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
3946
|
),
|
|
3894
|
-
burst("add", 30, { p:
|
|
3947
|
+
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
3948
|
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
3949
|
]
|
|
3897
3950
|
},
|
|
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
|
-
}
|
|
3951
|
+
...MATERIAL_EVENT_EFFECTS
|
|
3907
3952
|
];
|
|
3908
3953
|
|
|
3909
3954
|
// src/effects/weapons/viewmodel.ts
|
|
@@ -3916,7 +3961,7 @@ var GameVfx = (() => {
|
|
|
3916
3961
|
var FLASH_OPACITY = 0.95;
|
|
3917
3962
|
var FLAME_COLORS = [16742946, 16760896, 13121050, 16773296];
|
|
3918
3963
|
var FLAME_ADDITIVE = 3;
|
|
3919
|
-
var
|
|
3964
|
+
var ORIGIN3 = [0, 0, 0];
|
|
3920
3965
|
var SIZE = variable("size");
|
|
3921
3966
|
var FLASH_SCALE = variable("flash");
|
|
3922
3967
|
var fallback = (name, defaultValue) => ite(ne(variable(name), void 0), variable(name), defaultValue);
|
|
@@ -3964,7 +4009,7 @@ var GameVfx = (() => {
|
|
|
3964
4009
|
grow: 2.2
|
|
3965
4010
|
})
|
|
3966
4011
|
];
|
|
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:
|
|
4012
|
+
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
4013
|
var MUZZLE_FLASH2 = {
|
|
3969
4014
|
id: "viewmodel_muzzle_flash",
|
|
3970
4015
|
pageId: "event:viewmodel_muzzle_flash",
|
|
@@ -3991,7 +4036,7 @@ var GameVfx = (() => {
|
|
|
3991
4036
|
repeat(4, append("angles", add(div(mul(INDEX, PI), 2), mul(rand(), 0.6)))),
|
|
3992
4037
|
set("roll", mul(rand(), PI)),
|
|
3993
4038
|
when(gt(FLASH_SCALE, 0), [
|
|
3994
|
-
flash(
|
|
4039
|
+
flash(ORIGIN3, 16756832, mul(4, SIZE, FLASH_SCALE), FLASH_SECONDS, mul(2, SIZE, FLASH_SCALE), true, true),
|
|
3995
4040
|
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
4041
|
repeat(
|
|
3997
4042
|
4,
|
|
@@ -4011,7 +4056,7 @@ var GameVfx = (() => {
|
|
|
4011
4056
|
repeat(
|
|
4012
4057
|
variable("puffs"),
|
|
4013
4058
|
puff2(
|
|
4014
|
-
|
|
4059
|
+
ORIGIN3,
|
|
4015
4060
|
[add(variable("drift"), mul(rand(), variable("driftSpread"))), add(variable("rise"), mul(rand(), variable("riseSpread"))), mul(sub(rand(), 0.5), variable("sideSpread"))],
|
|
4016
4061
|
[0, 0, 0],
|
|
4017
4062
|
mul(variable("radius"), SIZE),
|
|
@@ -4028,7 +4073,7 @@ var GameVfx = (() => {
|
|
|
4028
4073
|
team: "weapons",
|
|
4029
4074
|
budget: { particles: 1 },
|
|
4030
4075
|
loop: 0.1,
|
|
4031
|
-
timeline: [puff2(
|
|
4076
|
+
timeline: [puff2(ORIGIN3, void 0, [variable("vx"), variable("vy"), variable("vz")], variable("radius"), variable("life"), variable("opacity"))]
|
|
4032
4077
|
};
|
|
4033
4078
|
var BACKBLAST = {
|
|
4034
4079
|
id: "launcher_backblast",
|
|
@@ -4037,8 +4082,8 @@ var GameVfx = (() => {
|
|
|
4037
4082
|
budget: { particles: 40 },
|
|
4038
4083
|
loop: 0.1,
|
|
4039
4084
|
timeline: [
|
|
4040
|
-
repeat(26, puff2(
|
|
4041
|
-
repeat(14, ...flameBit(
|
|
4085
|
+
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)),
|
|
4086
|
+
repeat(14, ...flameBit(ORIGIN3, [neg(add(2, mul(rand(), 2))), 0, 0], [wide(1), wide(0.6), wide(1)], 0.02, 0.25))
|
|
4042
4087
|
]
|
|
4043
4088
|
};
|
|
4044
4089
|
var FLAME_JET = {
|
|
@@ -4177,7 +4222,7 @@ var GameVfx = (() => {
|
|
|
4177
4222
|
// src/effects/behaviors/blocks.ts
|
|
4178
4223
|
var COLUMNS = 6;
|
|
4179
4224
|
var ROWS = 5;
|
|
4180
|
-
var
|
|
4225
|
+
var ORIGIN4 = [-2.2, 0, 2.6];
|
|
4181
4226
|
var BLOCK_SIZE = [0.5, 0.44, 0.25];
|
|
4182
4227
|
var OBJECT_ID_DRAWS2 = 4;
|
|
4183
4228
|
var FLOOR2 = 0.13;
|
|
@@ -4220,7 +4265,7 @@ var GameVfx = (() => {
|
|
|
4220
4265
|
const chipScale = random.between(0.8, 1.3) * scale;
|
|
4221
4266
|
for (let draw = 0; draw < OBJECT_ID_DRAWS2; draw++) random.next();
|
|
4222
4267
|
best.holes.push({ x: offsetX, y: offsetY, scale, chipTurn, chipScale });
|
|
4223
|
-
impact(host.engine, "concrete", [
|
|
4268
|
+
impact(host.engine, "concrete", [ORIGIN4[0] + x, y, ORIGIN4[2] + 0.13], [0, 0, 1], 0.8);
|
|
4224
4269
|
} else if (action === "collapse") {
|
|
4225
4270
|
const { x, y } = args;
|
|
4226
4271
|
for (const block of blocks) {
|
|
@@ -4272,7 +4317,7 @@ var GameVfx = (() => {
|
|
|
4272
4317
|
}
|
|
4273
4318
|
|
|
4274
4319
|
// src/effects/behaviors/car.ts
|
|
4275
|
-
var
|
|
4320
|
+
var ORIGIN5 = [5.6, 0, 0.8];
|
|
4276
4321
|
var MAX_TILT = 0.25;
|
|
4277
4322
|
function createCarBehavior() {
|
|
4278
4323
|
let y = 0;
|
|
@@ -4305,7 +4350,7 @@ var GameVfx = (() => {
|
|
|
4305
4350
|
}
|
|
4306
4351
|
},
|
|
4307
4352
|
query(_host, name, args) {
|
|
4308
|
-
if (name === "position") return [
|
|
4353
|
+
if (name === "position") return [ORIGIN5[0], y, ORIGIN5[2]];
|
|
4309
4354
|
if (name === "point") {
|
|
4310
4355
|
const [x, py, z] = args;
|
|
4311
4356
|
const point = carPoint(x, py, z);
|
|
@@ -5210,7 +5255,7 @@ var GameVfx = (() => {
|
|
|
5210
5255
|
};
|
|
5211
5256
|
|
|
5212
5257
|
// src/effects/player.ts
|
|
5213
|
-
var
|
|
5258
|
+
var ORIGIN6 = [0, 0, 0];
|
|
5214
5259
|
var DEFAULT_HEADING = [0, 0, -1];
|
|
5215
5260
|
var DEFAULT_MAX_INSTANCES = 48;
|
|
5216
5261
|
var ENDLESS_SECONDS = 60;
|
|
@@ -5287,7 +5332,7 @@ var GameVfx = (() => {
|
|
|
5287
5332
|
random: playOptions.seed !== void 0 ? streamOf(playOptions.seed) : void 0,
|
|
5288
5333
|
follow: playOptions.follow,
|
|
5289
5334
|
origin: point,
|
|
5290
|
-
anchor: def.anchor ??
|
|
5335
|
+
anchor: def.anchor ?? ORIGIN6,
|
|
5291
5336
|
yaw: yawOf(heading, playOptions.direction),
|
|
5292
5337
|
orientation: playOptions.orientation,
|
|
5293
5338
|
seconds: playOptions.seconds ?? (def.loop && def.loop > 0 ? def.loop : ENDLESS_SECONDS),
|
|
@@ -7986,9 +8031,9 @@ var GameVfx = (() => {
|
|
|
7986
8031
|
// src/data/event-effects.json
|
|
7987
8032
|
var event_effects_default = {
|
|
7988
8033
|
spall: "impact_{material}",
|
|
7989
|
-
stage: { "1": "
|
|
8034
|
+
stage: { "1": "stage_crack_{material}", "2": "breach_dust_{material}", "3": "collapse_dust_{material}" },
|
|
7990
8035
|
expose: "rebar_expose",
|
|
7991
|
-
collapse: "
|
|
8036
|
+
collapse: "collapse_dust_{material}",
|
|
7992
8037
|
explode: "explosion",
|
|
7993
8038
|
fracture: { glass: "glass_burst" }
|
|
7994
8039
|
};
|
|
@@ -7998,9 +8043,14 @@ var GameVfx = (() => {
|
|
|
7998
8043
|
function effectForEvent(event, map = EVENT_EFFECTS_MAP) {
|
|
7999
8044
|
const entry = map[event.kind];
|
|
8000
8045
|
if (entry === void 0) return void 0;
|
|
8001
|
-
if (typeof entry === "string") return
|
|
8046
|
+
if (typeof entry === "string") return withMaterial(entry, event.material);
|
|
8002
8047
|
const key = event.stage !== void 0 ? String(event.stage) : event.material;
|
|
8003
|
-
|
|
8048
|
+
const chosen = key === void 0 ? void 0 : entry[key];
|
|
8049
|
+
return chosen === void 0 ? void 0 : withMaterial(chosen, event.material);
|
|
8050
|
+
}
|
|
8051
|
+
function withMaterial(entry, material) {
|
|
8052
|
+
if (!entry.includes("{material}")) return entry;
|
|
8053
|
+
return material ? entry.replace("{material}", material) : void 0;
|
|
8004
8054
|
}
|
|
8005
8055
|
|
|
8006
8056
|
// src/locales/en.ts
|