@adatechnology/game-vfx 0.6.0 → 0.7.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/dist/index.global.js +49 -24
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -2681,22 +2681,22 @@ var GameVfx = (() => {
|
|
|
2681
2681
|
};
|
|
2682
2682
|
|
|
2683
2683
|
// src/effects/vector-math.ts
|
|
2684
|
-
function normalized(
|
|
2685
|
-
const length = Math.sqrt(
|
|
2684
|
+
function normalized(vector2) {
|
|
2685
|
+
const length = Math.sqrt(vector2[0] * vector2[0] + vector2[1] * vector2[1] + vector2[2] * vector2[2]) || 1;
|
|
2686
2686
|
const inverse = 1 / length;
|
|
2687
|
-
return [
|
|
2687
|
+
return [vector2[0] * inverse, vector2[1] * inverse, vector2[2] * inverse];
|
|
2688
2688
|
}
|
|
2689
|
-
function plus(
|
|
2690
|
-
return [
|
|
2689
|
+
function plus(vector2, x, y, z) {
|
|
2690
|
+
return [vector2[0] + x, vector2[1] + y, vector2[2] + z];
|
|
2691
2691
|
}
|
|
2692
|
-
function scaledBy(
|
|
2693
|
-
return [
|
|
2692
|
+
function scaledBy(vector2, factor) {
|
|
2693
|
+
return [vector2[0] * factor, vector2[1] * factor, vector2[2] * factor];
|
|
2694
2694
|
}
|
|
2695
|
-
function plusScaled(
|
|
2696
|
-
return [
|
|
2695
|
+
function plusScaled(vector2, direction, factor) {
|
|
2696
|
+
return [vector2[0] + direction[0] * factor, vector2[1] + direction[1] * factor, vector2[2] + direction[2] * factor];
|
|
2697
2697
|
}
|
|
2698
|
-
function negated(
|
|
2699
|
-
return [-
|
|
2698
|
+
function negated(vector2) {
|
|
2699
|
+
return [-vector2[0], -vector2[1], -vector2[2]];
|
|
2700
2700
|
}
|
|
2701
2701
|
|
|
2702
2702
|
// src/effects/destruction/door-stages.ts
|
|
@@ -4065,10 +4065,35 @@ var GameVfx = (() => {
|
|
|
4065
4065
|
aliasOf(FUEL_LEAK, "vehicle_leak_ignited", {})
|
|
4066
4066
|
];
|
|
4067
4067
|
|
|
4068
|
+
// src/effects/particles/single-particles.ts
|
|
4069
|
+
var vector = [variable("vx"), variable("vy"), variable("vz")];
|
|
4070
|
+
var range = (name) => [variable(name), variable(name)];
|
|
4071
|
+
var singleParticle = (id, system) => ({
|
|
4072
|
+
id,
|
|
4073
|
+
pageId: `particle:${id}`,
|
|
4074
|
+
team: "world",
|
|
4075
|
+
budget: { particles: 1, lights: 0 },
|
|
4076
|
+
loop: 1e-3,
|
|
4077
|
+
timeline: [
|
|
4078
|
+
spawn(system, {
|
|
4079
|
+
p: [0, 0, 0],
|
|
4080
|
+
v: vector,
|
|
4081
|
+
life: range("life"),
|
|
4082
|
+
size: range("size"),
|
|
4083
|
+
grow: variable("grow"),
|
|
4084
|
+
c0: variable("color"),
|
|
4085
|
+
a: variable("alpha"),
|
|
4086
|
+
g: variable("gravity"),
|
|
4087
|
+
drag: variable("drag")
|
|
4088
|
+
})
|
|
4089
|
+
]
|
|
4090
|
+
});
|
|
4091
|
+
var SINGLE_PARTICLE_EFFECTS = [singleParticle("particle_puff", "normal"), singleParticle("particle_glow", "add"), singleParticle("particle_streak", "streak")];
|
|
4092
|
+
|
|
4068
4093
|
// src/effects/catalog.ts
|
|
4069
4094
|
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];
|
|
4070
4095
|
var WORKSHOP_EFFECTS = Object.fromEntries(ALL_EFFECTS.map((effect) => [effect.id, effect]));
|
|
4071
|
-
var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS, ...VEHICLE_EFFECTS].map((effect) => [effect.id, effect])) };
|
|
4096
|
+
var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS, ...VEHICLE_EFFECTS, ...SINGLE_PARTICLE_EFFECTS].map((effect) => [effect.id, effect])) };
|
|
4072
4097
|
function patchEffects(base, changes) {
|
|
4073
4098
|
const result = { ...base };
|
|
4074
4099
|
for (const [id, change] of Object.entries(changes)) {
|
|
@@ -4777,8 +4802,8 @@ var GameVfx = (() => {
|
|
|
4777
4802
|
var UP12 = [0, 1, 0];
|
|
4778
4803
|
var ZERO = [0, 0, 0];
|
|
4779
4804
|
var FULL_TURN_DRAWN = 6.283;
|
|
4780
|
-
function scaledSizes(
|
|
4781
|
-
return [
|
|
4805
|
+
function scaledSizes(range2, factor) {
|
|
4806
|
+
return [range2[0] * Math.sqrt(factor), range2[1] * Math.sqrt(factor)];
|
|
4782
4807
|
}
|
|
4783
4808
|
function fireEmit(engine, key, dt, centre, radius, factor, options = {}) {
|
|
4784
4809
|
const wind = options.wind ?? ZERO;
|
|
@@ -6678,9 +6703,9 @@ var GameVfx = (() => {
|
|
|
6678
6703
|
var TWO_PI_ROUNDED = 6.2832;
|
|
6679
6704
|
var WIDE_CONE = 3.1;
|
|
6680
6705
|
var UP13 = [0, 1, 0];
|
|
6681
|
-
function drawRange(random,
|
|
6682
|
-
if (Array.isArray(
|
|
6683
|
-
return
|
|
6706
|
+
function drawRange(random, range2) {
|
|
6707
|
+
if (Array.isArray(range2)) return random.between(range2[0], range2[1]);
|
|
6708
|
+
return range2 || 0;
|
|
6684
6709
|
}
|
|
6685
6710
|
function randomUnit(random, out) {
|
|
6686
6711
|
const up = random.next() * 2 - 1;
|
|
@@ -7464,13 +7489,13 @@ var GameVfx = (() => {
|
|
|
7464
7489
|
return [origin[0] + cos2 * x + sin2 * z, origin[1] + point[1] - anchor[1], origin[2] - sin2 * x + cos2 * z];
|
|
7465
7490
|
}
|
|
7466
7491
|
/** A direction or velocity of the recipe's space in the world. */
|
|
7467
|
-
turn(
|
|
7492
|
+
turn(vector2) {
|
|
7468
7493
|
const placement = this.placement;
|
|
7469
|
-
if (!placement) return
|
|
7470
|
-
if (placement.orientation) return rotate(placement.orientation,
|
|
7494
|
+
if (!placement) return vector2;
|
|
7495
|
+
if (placement.orientation) return rotate(placement.orientation, vector2);
|
|
7471
7496
|
const cos2 = Math.cos(placement.yaw);
|
|
7472
7497
|
const sin2 = Math.sin(placement.yaw);
|
|
7473
|
-
return [cos2 *
|
|
7498
|
+
return [cos2 * vector2[0] + sin2 * vector2[2], vector2[1], -sin2 * vector2[0] + cos2 * vector2[2]];
|
|
7474
7499
|
}
|
|
7475
7500
|
placed(options) {
|
|
7476
7501
|
if (!this.placement) return options;
|
|
@@ -8679,10 +8704,10 @@ var GameVfx = (() => {
|
|
|
8679
8704
|
function subtract(a, b) {
|
|
8680
8705
|
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
8681
8706
|
}
|
|
8682
|
-
function unit(
|
|
8683
|
-
const length = Math.sqrt(
|
|
8707
|
+
function unit(vector2) {
|
|
8708
|
+
const length = Math.sqrt(vector2[0] * vector2[0] + vector2[1] * vector2[1] + vector2[2] * vector2[2]) || 1;
|
|
8684
8709
|
const inverse = 1 / length;
|
|
8685
|
-
return [
|
|
8710
|
+
return [vector2[0] * inverse, vector2[1] * inverse, vector2[2] * inverse];
|
|
8686
8711
|
}
|
|
8687
8712
|
function crossProduct(a, b) {
|
|
8688
8713
|
return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|