@adatechnology/game-weather-three 0.5.15 → 0.5.16

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.
@@ -1995,66 +1995,58 @@ var GameWeatherThree = (() => {
1995
1995
  ])
1996
1996
  ]
1997
1997
  };
1998
+ var DEBRIS_EFFECT_FAMILIES = ["wood", "masonry", "glass", "metal", "soft", "soil"];
1999
+ var DEBRIS_COLOR_VARIABLE = "debrisColor";
2000
+ var DUST_COLOR_VARIABLE = "dustColor";
2001
+ var FAMILIES = {
2002
+ wood: { debris: 8017200, dust: 10127986, piece: [0.015, 0.015, 0.1], spin: 6, cloud: 0.5, sparks: false, glints: false },
2003
+ masonry: { debris: 10197652, dust: 11052187, piece: [0.035, 0.028, 0.035], spin: 4, cloud: 1, sparks: false, glints: false },
2004
+ glass: { debris: 11061464, dust: 12572386, piece: [0.04, 4e-3, 0.04], spin: 14, cloud: 0.25, sparks: false, glints: true },
2005
+ metal: { debris: 9080726, dust: 9078138, piece: [0.04, 6e-3, 0.03], spin: 8, cloud: 0.15, sparks: true, glints: false },
2006
+ soft: { debris: 10130568, dust: 11578014, piece: [0.025, 4e-3, 0.02], spin: 6, cloud: 0.3, sparks: false, glints: false },
2007
+ soil: { debris: 8022613, dust: 9075298, piece: [0.03, 0.025, 0.03], spin: 3, cloud: 1, sparks: false, glints: false }
2008
+ };
2009
+ var ORIGIN = [0, 0, 0];
1998
2010
  var FACING4 = [0, 0, 1];
1999
2011
  var UP11 = [0, 1, 0];
2000
- var ORIGIN = [0, 0, 0];
2001
- var FORWARD4 = [0, 0, -1];
2002
- var IMPACT_MATERIALS = ["concrete", "metal", "wood", "glass", "flesh", "water"];
2003
- var impactEffect = (material) => ({
2004
- id: `impact_${material}`,
2005
- pageId: `event:impact_${material}`,
2006
- team: "weapons",
2007
- budget: { particles: 40, decals: 1 },
2008
- loop: 2,
2009
- timeline: [call2("impact", material, ORIGIN, FACING4, 1, 0)]
2010
- });
2011
- var muzzleEffect = (weapon) => ({
2012
- id: `muzzle_${weapon}`,
2013
- pageId: `event:muzzle_${weapon}`,
2014
- team: "weapons",
2015
- budget: { particles: 60, lights: 1 },
2016
- loop: 2.4,
2017
- timeline: [call2("muzzle", weapon, ORIGIN, FORWARD4)]
2018
- });
2019
- var casingEffect = (id, type) => ({
2020
- id,
2021
- pageId: `event:${id}`,
2022
- team: "weapons",
2023
- budget: { debris: 1 },
2024
- loop: 2,
2025
- timeline: [call2("casing", ORIGIN, type)]
2026
- });
2027
- var EVENT_EFFECTS = [
2028
- ...IMPACT_MATERIALS.map(impactEffect),
2029
- ...["glock", "ak", "r870", "barrett"].map(muzzleEffect),
2030
- casingEffect("casing_brass", ""),
2031
- casingEffect("casing_shell", "shell"),
2032
- casingEffect("casing_50", "50"),
2033
- {
2034
- // door_stages (W856-871): the dust a blow shakes loose from the frame and the splinters.
2035
- id: "stage_crack",
2036
- pageId: "event:stage_crack",
2012
+ var grow = (piece, factor) => [piece[0] * factor, piece[1] * factor, piece[2] * factor];
2013
+ var debrisTone = (look) => or(variable(DEBRIS_COLOR_VARIABLE), look.debris);
2014
+ var dustTone = (look) => or(variable(DUST_COLOR_VARIABLE), look.dust);
2015
+ var sparks = (look, count) => look.sparks ? [call2("spark_at", ORIGIN, FACING4, count, 0.9)] : [];
2016
+ 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 })] : [];
2017
+ function stageCrack(family) {
2018
+ const look = FAMILIES[family];
2019
+ 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 })];
2020
+ return {
2021
+ id: `stage_crack_${family}`,
2022
+ pageId: `event:stage_crack_${family}`,
2037
2023
  team: "destruction",
2038
- budget: { particles: 12, debris: 5 },
2024
+ budget: { particles: 16, debris: 6 },
2039
2025
  loop: 2,
2040
2026
  timeline: [
2041
- burst("normal", 12, { p: ORIGIN, box: [0.6, 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: 8024934, a: 0.45, g: 0.4 }),
2042
- repeat(scaled(2), debris({ p: [rnd(-0.5, 0.5), rnd(0, 1.6), 0], dir: [0, 0.287, 0.958], cone: 0.6, sp: [1, 2.5], size: [0.015, 0.015, 0.1], c: 8017200, life: 12 }))
2027
+ ...dust,
2028
+ ...sparks(look, 8),
2029
+ ...glints(look, 4),
2030
+ 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 }))
2043
2031
  ]
2044
- },
2045
- {
2046
- // block_wall (W872-886, 3.6 s): the ring of dust that rolls out when the wall gives way.
2047
- id: "breach_dust",
2048
- pageId: "event:breach_dust",
2032
+ };
2033
+ }
2034
+ function breachDust(family) {
2035
+ const look = FAMILIES[family];
2036
+ return {
2037
+ id: `breach_dust_${family}`,
2038
+ pageId: `event:breach_dust_${family}`,
2049
2039
  team: "destruction",
2050
2040
  budget: { particles: 90, debris: 16 },
2051
2041
  loop: 5,
2052
2042
  timeline: [
2053
2043
  screen({ add: { shake: 0.25 } }),
2054
- burst("normal", 30, { 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: 9078138, c1: 4867648, a: 0.45 }),
2055
- repeat(scaled(16), debris({ p: ORIGIN, box: [1.3, 0.8, 0.1], sp: [1, 3], size: [0.08, 0.07, 0.08], k: [0.5, 1.5], c: 7236195, life: 20 })),
2044
+ ...sparks(look, 14),
2045
+ ...glints(look, 20),
2046
+ 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 }),
2047
+ 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 })),
2056
2048
  repeat(
2057
- scaled(60),
2049
+ scaled(Math.round(60 * look.cloud)),
2058
2050
  spawn("normal", local("angle", rnd(0, 6.283), {
2059
2051
  p: [rnd(-1.4, 1.4), 0.2, rnd(-0.6, 0.4)],
2060
2052
  dir: vnorm([cos(variable("angle")), 0.3, sin(variable("angle"))]),
@@ -2064,27 +2056,30 @@ var GameWeatherThree = (() => {
2064
2056
  life: [2.5, 4.5],
2065
2057
  size: [0.6, 1],
2066
2058
  grow: 3,
2067
- c0: 8024680,
2059
+ c0: dustTone(look),
2068
2060
  c1: 4867648,
2069
2061
  a: 0.45,
2070
2062
  fi: 0.12
2071
2063
  }))
2072
2064
  )
2073
2065
  ]
2074
- },
2075
- {
2076
- // building_collapse (W872-886): the slab dropping in blocks and the cloud that rolls along the street.
2077
- id: "collapse_dust",
2078
- pageId: "event:collapse_dust",
2066
+ };
2067
+ }
2068
+ function collapseDust(family) {
2069
+ const look = FAMILIES[family];
2070
+ return {
2071
+ id: `collapse_dust_${family}`,
2072
+ pageId: `event:collapse_dust_${family}`,
2079
2073
  team: "destruction",
2080
2074
  budget: { particles: 350, debris: 26 },
2081
2075
  loop: 8,
2082
2076
  timeline: [
2083
2077
  screen({ add: { shake: 0.45 } }),
2084
- 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), 0.25, rnd(0.4, 0.8)], c: 7236195, spin: 3, life: 30, bounce: 0.1 })),
2085
- 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: [0.12, 0.1, 0.12], k: [0.5, 1.5], c: 6183508, life: 30 })),
2078
+ ...sparks(look, 20),
2079
+ 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 })),
2080
+ 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 })),
2086
2081
  repeat(
2087
- scaled(70),
2082
+ scaled(Math.round(70 * look.cloud)),
2088
2083
  spawn("normal", local("angle", rnd(-0.4, 3.5), {
2089
2084
  p: [rnd(-2, 2), 0.2, rnd(-0.5, 0.5)],
2090
2085
  dir: vnorm([mul(cos(variable("angle")), 0.6), 0.25, sin(variable("angle"))]),
@@ -2094,14 +2089,66 @@ var GameWeatherThree = (() => {
2094
2089
  life: [3, 6],
2095
2090
  size: [0.7, 1.2],
2096
2091
  grow: 3,
2097
- c0: 8024680,
2092
+ c0: dustTone(look),
2098
2093
  c1: 4867648,
2099
2094
  a: 0.5,
2100
2095
  fi: 0.12
2101
2096
  }))
2102
2097
  )
2103
2098
  ]
2104
- },
2099
+ };
2100
+ }
2101
+ var MASONRY = FAMILIES.masonry;
2102
+ var REBAR_EXPOSE = {
2103
+ id: "rebar_expose",
2104
+ pageId: "event:rebar_expose",
2105
+ team: "destruction",
2106
+ budget: { particles: 24, debris: 8 },
2107
+ loop: 2,
2108
+ timeline: [
2109
+ 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 })),
2110
+ 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 }),
2111
+ call2("rust_at", ORIGIN, 6)
2112
+ ]
2113
+ };
2114
+ var MATERIAL_EVENT_EFFECTS = [
2115
+ ...DEBRIS_EFFECT_FAMILIES.flatMap((family) => [stageCrack(family), breachDust(family), collapseDust(family)]),
2116
+ REBAR_EXPOSE
2117
+ ];
2118
+ var FACING5 = [0, 0, 1];
2119
+ var ORIGIN2 = [0, 0, 0];
2120
+ var FORWARD4 = [0, 0, -1];
2121
+ var IMPACT_MATERIALS = ["concrete", "metal", "wood", "glass", "flesh", "water"];
2122
+ var impactEffect = (material) => ({
2123
+ id: `impact_${material}`,
2124
+ pageId: `event:impact_${material}`,
2125
+ team: "weapons",
2126
+ budget: { particles: 40, decals: 1 },
2127
+ loop: 2,
2128
+ timeline: [call2("impact", material, ORIGIN2, FACING5, 1, 0)]
2129
+ });
2130
+ var muzzleEffect = (weapon) => ({
2131
+ id: `muzzle_${weapon}`,
2132
+ pageId: `event:muzzle_${weapon}`,
2133
+ team: "weapons",
2134
+ budget: { particles: 60, lights: 1 },
2135
+ loop: 2.4,
2136
+ timeline: [call2("muzzle", weapon, ORIGIN2, FORWARD4)]
2137
+ });
2138
+ var casingEffect = (id, type) => ({
2139
+ id,
2140
+ pageId: `event:${id}`,
2141
+ team: "weapons",
2142
+ budget: { debris: 1 },
2143
+ loop: 2,
2144
+ timeline: [call2("casing", ORIGIN2, type)]
2145
+ });
2146
+ var EVENT_EFFECTS = [
2147
+ ...IMPACT_MATERIALS.map(impactEffect),
2148
+ ...["glock", "ak", "r870", "barrett"].map(muzzleEffect),
2149
+ casingEffect("casing_brass", ""),
2150
+ casingEffect("casing_shell", "shell"),
2151
+ casingEffect("casing_50", "50"),
2105
2152
  {
2106
2153
  // shopfront_glass (W846-855): the pane coming down as shards, the flash of the glints and the pale dust.
2107
2154
  id: "glass_burst",
@@ -2113,21 +2160,13 @@ var GameWeatherThree = (() => {
2113
2160
  screen({ add: { shake: 0.08 } }),
2114
2161
  repeat(
2115
2162
  scaled(75),
2116
- debris({ p: ORIGIN, 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 })
2163
+ 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 })
2117
2164
  ),
2118
- burst("add", 30, { p: ORIGIN, 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 }),
2165
+ 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 }),
2119
2166
  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 })
2120
2167
  ]
2121
2168
  },
2122
- {
2123
- // The chips macro the page uses on wood (W849) plus rust (`rustAt`), for rebar laid bare in concrete.
2124
- id: "rebar_expose",
2125
- pageId: "event:rebar_expose",
2126
- team: "destruction",
2127
- budget: { particles: 20, debris: 8 },
2128
- loop: 2,
2129
- timeline: [call2("chips", ORIGIN, UP11, 8, 0.9), call2("rust_at", ORIGIN, 6)]
2130
- }
2169
+ ...MATERIAL_EVENT_EFFECTS
2131
2170
  ];
2132
2171
  var PI = Math.PI;
2133
2172
  var SMOKE = { color: 9079430, width: 10, height: 8, gravity: -0.08, drag: 2.2, growth: 2.1 };
@@ -2138,7 +2177,7 @@ var GameWeatherThree = (() => {
2138
2177
  var FLASH_OPACITY = 0.95;
2139
2178
  var FLAME_COLORS = [16742946, 16760896, 13121050, 16773296];
2140
2179
  var FLAME_ADDITIVE = 3;
2141
- var ORIGIN2 = [0, 0, 0];
2180
+ var ORIGIN3 = [0, 0, 0];
2142
2181
  var SIZE = variable("size");
2143
2182
  var FLASH_SCALE = variable("flash");
2144
2183
  var fallback = (name, defaultValue) => ite(ne(variable(name), void 0), variable(name), defaultValue);
@@ -2186,7 +2225,7 @@ var GameWeatherThree = (() => {
2186
2225
  grow: 2.2
2187
2226
  })
2188
2227
  ];
2189
- 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: ORIGIN2, at: at3, rot, roll: variable("roll"), ramp: FLASH_RAMP, life: FLASH_SECONDS, c0: color, a: FLASH_OPACITY, add: true });
2228
+ 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 });
2190
2229
  var MUZZLE_FLASH2 = {
2191
2230
  id: "viewmodel_muzzle_flash",
2192
2231
  pageId: "event:viewmodel_muzzle_flash",
@@ -2213,7 +2252,7 @@ var GameWeatherThree = (() => {
2213
2252
  repeat(4, append("angles", add(div(mul(INDEX, PI), 2), mul(rand(), 0.6)))),
2214
2253
  set("roll", mul(rand(), PI)),
2215
2254
  when(gt(FLASH_SCALE, 0), [
2216
- flash(ORIGIN2, 16756832, mul(4, SIZE, FLASH_SCALE), FLASH_SECONDS, mul(2, SIZE, FLASH_SCALE), true, true),
2255
+ flash(ORIGIN3, 16756832, mul(4, SIZE, FLASH_SCALE), FLASH_SECONDS, mul(2, SIZE, FLASH_SCALE), true, true),
2217
2256
  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),
2218
2257
  repeat(
2219
2258
  4,
@@ -2233,7 +2272,7 @@ var GameWeatherThree = (() => {
2233
2272
  repeat(
2234
2273
  variable("puffs"),
2235
2274
  puff2(
2236
- ORIGIN2,
2275
+ ORIGIN3,
2237
2276
  [add(variable("drift"), mul(rand(), variable("driftSpread"))), add(variable("rise"), mul(rand(), variable("riseSpread"))), mul(sub(rand(), 0.5), variable("sideSpread"))],
2238
2277
  [0, 0, 0],
2239
2278
  mul(variable("radius"), SIZE),
@@ -2250,7 +2289,7 @@ var GameWeatherThree = (() => {
2250
2289
  team: "weapons",
2251
2290
  budget: { particles: 1 },
2252
2291
  loop: 0.1,
2253
- timeline: [puff2(ORIGIN2, void 0, [variable("vx"), variable("vy"), variable("vz")], variable("radius"), variable("life"), variable("opacity"))]
2292
+ timeline: [puff2(ORIGIN3, void 0, [variable("vx"), variable("vy"), variable("vz")], variable("radius"), variable("life"), variable("opacity"))]
2254
2293
  };
2255
2294
  var BACKBLAST = {
2256
2295
  id: "launcher_backblast",
@@ -2259,8 +2298,8 @@ var GameWeatherThree = (() => {
2259
2298
  budget: { particles: 40 },
2260
2299
  loop: 0.1,
2261
2300
  timeline: [
2262
- repeat(26, puff2(ORIGIN2, [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)),
2263
- repeat(14, ...flameBit(ORIGIN2, [neg(add(2, mul(rand(), 2))), 0, 0], [wide(1), wide(0.6), wide(1)], 0.02, 0.25))
2301
+ 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)),
2302
+ repeat(14, ...flameBit(ORIGIN3, [neg(add(2, mul(rand(), 2))), 0, 0], [wide(1), wide(0.6), wide(1)], 0.02, 0.25))
2264
2303
  ]
2265
2304
  };
2266
2305
  var FLAME_JET = {