@adatechnology/game-weather-three 0.2.0 → 0.2.2

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.
@@ -1658,6 +1658,17 @@ var GameWeatherThree = (() => {
1658
1658
  ])
1659
1659
  ]
1660
1660
  };
1661
+ var FUEL_LEAK_ONLY = {
1662
+ id: "fuel_leak_only",
1663
+ pageId: "vazamento",
1664
+ team: "vehicles",
1665
+ budget: { particles: 200, lights: 0 },
1666
+ loop: 11,
1667
+ view: FUEL_LEAK.view,
1668
+ setup: FUEL_LEAK.setup,
1669
+ timeline: [decal(POOL[0], 0, POOL[2], 2.2, 2040368, { grow: 3, life: 60, ar: 0.6, fluid: "oil" })],
1670
+ tick: [emit("drip", "normal", 12, { p: TANK, box: [0.05, 0, 0.05], sp: 0, life: 1, size: 0.03, c0: 5921402, a: 0.9, g: 9.8, fi: 0, gnd: 1 })]
1671
+ };
1661
1672
  var CAR_EXPLOSION = {
1662
1673
  id: "car_explosion",
1663
1674
  pageId: "explosao",
@@ -2011,6 +2022,8 @@ var GameWeatherThree = (() => {
2011
2022
  ];
2012
2023
  var PI = Math.PI;
2013
2024
  var SMOKE = { color: 9079430, width: 10, height: 8, gravity: -0.08, drag: 2.2, growth: 2.1 };
2025
+ var DEFAULT_SMOKE = { puffs: 2, radius: 0.01, opacity: 0.14, life: 0.7, drift: 0.2, rise: 0.06, growth: 2.1, flash: 1 };
2026
+ var DEFAULT_SPREAD = { drift: 0.1, rise: 0.04, side: 0.06 };
2014
2027
  var FLASH_SECONDS = 0.055;
2015
2028
  var FLASH_RAMP = [0.6, 0.9];
2016
2029
  var FLASH_OPACITY = 0.95;
@@ -2018,8 +2031,10 @@ var GameWeatherThree = (() => {
2018
2031
  var FLAME_ADDITIVE = 3;
2019
2032
  var ORIGIN2 = [0, 0, 0];
2020
2033
  var SIZE = variable("size");
2034
+ var FLASH_SCALE = variable("flash");
2035
+ var fallback = (name, defaultValue) => ite(ne(variable(name), void 0), variable(name), defaultValue);
2021
2036
  var wide = (width) => mul(sub(rand(), 0.5), width);
2022
- var puff2 = (point, velocity, world, radius, life, opacity) => mesh({
2037
+ var puff2 = (point, velocity, world, radius, life, opacity, growth = SMOKE.growth) => mesh({
2023
2038
  shape: "sphere",
2024
2039
  p: point,
2025
2040
  v: velocity,
@@ -2034,7 +2049,7 @@ var GameWeatherThree = (() => {
2034
2049
  lit: true,
2035
2050
  g: SMOKE.gravity,
2036
2051
  drag: SMOKE.drag,
2037
- grow: SMOKE.growth
2052
+ grow: growth
2038
2053
  });
2039
2054
  var flameBit = (point, velocity, world, radius, life) => [
2040
2055
  set("bitPoint", point),
@@ -2067,37 +2082,55 @@ var GameWeatherThree = (() => {
2067
2082
  id: "viewmodel_muzzle_flash",
2068
2083
  pageId: "event:viewmodel_muzzle_flash",
2069
2084
  team: "weapons",
2070
- budget: { particles: 12, lights: 1 },
2085
+ budget: { particles: 14, lights: 1 },
2071
2086
  loop: 0.1,
2087
+ setup: [
2088
+ set("size", fallback("size", 1)),
2089
+ set("puffs", fallback("puffs", DEFAULT_SMOKE.puffs)),
2090
+ set("radius", fallback("radius", DEFAULT_SMOKE.radius)),
2091
+ set("opacity", fallback("opacity", DEFAULT_SMOKE.opacity)),
2092
+ set("life", fallback("life", DEFAULT_SMOKE.life)),
2093
+ set("drift", fallback("drift", DEFAULT_SMOKE.drift)),
2094
+ set("rise", fallback("rise", DEFAULT_SMOKE.rise)),
2095
+ set("growth", fallback("growth", DEFAULT_SMOKE.growth)),
2096
+ set("flash", fallback("flash", DEFAULT_SMOKE.flash)),
2097
+ set("driftSpread", fallback("driftSpread", DEFAULT_SPREAD.drift)),
2098
+ set("riseSpread", fallback("riseSpread", DEFAULT_SPREAD.rise)),
2099
+ set("sideSpread", fallback("sideSpread", DEFAULT_SPREAD.side)),
2100
+ set("lifeSpread", ite(ne(variable("lifeSpread"), void 0), variable("lifeSpread"), mul(variable("life"), 0.3)))
2101
+ ],
2072
2102
  timeline: [
2073
2103
  set("angles", []),
2074
2104
  repeat(4, append("angles", add(div(mul(INDEX, PI), 2), mul(rand(), 0.6)))),
2075
2105
  set("roll", mul(rand(), PI)),
2076
- flash(ORIGIN2, 16756832, mul(4, SIZE), FLASH_SECONDS, mul(2, SIZE), true, true),
2077
- flashPiece("cone_open", mul(0.013, SIZE), mul(0.085, SIZE), 10, [mul(0.042, SIZE), 0, 0], [0, 0, -PI / 2], 16757575),
2078
- repeat(
2079
- 4,
2080
- set("angle", pick(variable("angles"), INDEX)),
2081
- flashPiece(
2082
- "cone",
2083
- mul(5e-3, SIZE),
2084
- mul(0.04, SIZE),
2085
- 6,
2086
- [mul(0.012, SIZE), mul(cos(variable("angle")), 0.016, SIZE), mul(sin(variable("angle")), 0.016, SIZE)],
2087
- [variable("angle"), 0, -PI / 2],
2088
- 16757575
2089
- )
2090
- ),
2091
- flashPiece("sphere", mul(0.016, SIZE), void 0, 12, [mul(8e-3, SIZE), 0, 0], [0, 0, 0], 16773568),
2106
+ when(gt(FLASH_SCALE, 0), [
2107
+ flash(ORIGIN2, 16756832, mul(4, SIZE, FLASH_SCALE), FLASH_SECONDS, mul(2, SIZE, FLASH_SCALE), true, true),
2108
+ 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),
2109
+ repeat(
2110
+ 4,
2111
+ set("angle", pick(variable("angles"), INDEX)),
2112
+ flashPiece(
2113
+ "cone",
2114
+ mul(5e-3, SIZE, FLASH_SCALE),
2115
+ mul(0.04, SIZE, FLASH_SCALE),
2116
+ 6,
2117
+ [mul(0.012, SIZE, FLASH_SCALE), mul(cos(variable("angle")), 0.016, SIZE, FLASH_SCALE), mul(sin(variable("angle")), 0.016, SIZE, FLASH_SCALE)],
2118
+ [variable("angle"), 0, -PI / 2],
2119
+ 16757575
2120
+ )
2121
+ ),
2122
+ flashPiece("sphere", mul(0.016, SIZE, FLASH_SCALE), void 0, 12, [mul(8e-3, SIZE, FLASH_SCALE), 0, 0], [0, 0, 0], 16773568)
2123
+ ]),
2092
2124
  repeat(
2093
- 6,
2125
+ variable("puffs"),
2094
2126
  puff2(
2095
2127
  ORIGIN2,
2096
- [add(0.15, mul(rand(), 0.35)), add(0.03, mul(rand(), 0.12)), mul(sub(rand(), 0.5), 0.14)],
2128
+ [add(variable("drift"), mul(rand(), variable("driftSpread"))), add(variable("rise"), mul(rand(), variable("riseSpread"))), mul(sub(rand(), 0.5), variable("sideSpread"))],
2097
2129
  [0, 0, 0],
2098
- mul(0.013, SIZE),
2099
- add(1.3, mul(rand(), 0.6)),
2100
- 0.45
2130
+ mul(variable("radius"), SIZE),
2131
+ add(variable("life"), mul(rand(), variable("lifeSpread"))),
2132
+ variable("opacity"),
2133
+ variable("growth")
2101
2134
  )
2102
2135
  )
2103
2136
  ]
@@ -2145,9 +2178,20 @@ var GameWeatherThree = (() => {
2145
2178
  ]
2146
2179
  };
2147
2180
  var VIEWMODEL_EFFECTS = [MUZZLE_FLASH2, SMOKE_PUFF, BACKBLAST, FLAME_JET];
2181
+ var aliasOf = (base, id, changes) => ({ ...base, id, pageId: `vehicle:${id}`, anchor: CAR_ORIGIN2, ...changes });
2182
+ var VEHICLE_EFFECTS = [
2183
+ /** The engine on fire: `engine_smoke` at its worst condition (black smoke, flames in the hood, a light). */
2184
+ aliasOf(ENGINE_SMOKE, "vehicle_fire", { params: { id: "condition", options: ["100", "60", "30", "10"], default: 3 }, loop: 12 }),
2185
+ /** The exhaust of a car under way: `engine_smoke` in the best condition, for half a second so a moving car asks again. */
2186
+ aliasOf(ENGINE_SMOKE, "vehicle_exhaust", { params: { id: "condition", options: ["100", "60", "30", "10"], default: 0 }, loop: 0.5 }),
2187
+ /** A hole in the tank: the page's petrol leak without the fire and the blast (the pool and the drips). A normal bullet does only this. */
2188
+ aliasOf(FUEL_LEAK_ONLY, "vehicle_leak", {}),
2189
+ /** The leak caught fire (an incendiary or tracer round, a spark, a fire near): the page's whole sequence, the fire running along the pool to the tank and the blast. */
2190
+ aliasOf(FUEL_LEAK, "vehicle_leak_ignited", {})
2191
+ ];
2148
2192
  var ALL_EFFECTS = [BLOOD_HIT, HEADSHOT, DISMEMBER, BLOATER_CLOUD, SCREAMER_SHRIEK, CORPSE_DECAY, REANIMATION, EYES_IN_FOG, MUZZLE_FLASH, IMPACT_BY_MATERIAL, PENETRATION, CASINGS_AND_MAGAZINE, MOLOTOV, GRENADE, EXPLOSIVE_BARREL, SHOPFRONT_GLASS, DOOR_STAGES, BUILDING_COLLAPSE, BLOCK_WALL, METAL_DOOR_EFFECT, IRON_RAILING, WOODEN_FENCE, HIT_POINT_BREAKAGE, PRESSURE_CYLINDERS, BUILDING_FIRE, RAIN_AND_PUDDLES, FOG_AND_ASH, SCRAPING_SPARKS, ENGINE_SMOKE, FUEL_LEAK, CAR_EXPLOSION, WINDSHIELD, HEADLIGHTS_IN_RAIN, DAMAGE_AND_BITE, INFECTION_PHASES, PANIC, BLOATER_BLINDNESS, CAMPFIRE, COUGH_AND_BREATH];
2149
2193
  var WORKSHOP_EFFECTS = Object.fromEntries(ALL_EFFECTS.map((effect) => [effect.id, effect]));
2150
- var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS].map((effect) => [effect.id, effect])) };
2194
+ var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS, ...VEHICLE_EFFECTS].map((effect) => [effect.id, effect])) };
2151
2195
  var QUARTER_TURN2 = Math.PI / 2;
2152
2196
  var SCRATCH = createVec3();
2153
2197
  var QUARTER_TURN3 = Math.PI / 2;