@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.js
CHANGED
|
@@ -2604,22 +2604,22 @@ var SHOPFRONT_GLASS = {
|
|
|
2604
2604
|
};
|
|
2605
2605
|
|
|
2606
2606
|
// src/effects/vector-math.ts
|
|
2607
|
-
function normalized(
|
|
2608
|
-
const length = Math.sqrt(
|
|
2607
|
+
function normalized(vector2) {
|
|
2608
|
+
const length = Math.sqrt(vector2[0] * vector2[0] + vector2[1] * vector2[1] + vector2[2] * vector2[2]) || 1;
|
|
2609
2609
|
const inverse = 1 / length;
|
|
2610
|
-
return [
|
|
2610
|
+
return [vector2[0] * inverse, vector2[1] * inverse, vector2[2] * inverse];
|
|
2611
2611
|
}
|
|
2612
|
-
function plus(
|
|
2613
|
-
return [
|
|
2612
|
+
function plus(vector2, x, y, z) {
|
|
2613
|
+
return [vector2[0] + x, vector2[1] + y, vector2[2] + z];
|
|
2614
2614
|
}
|
|
2615
|
-
function scaledBy(
|
|
2616
|
-
return [
|
|
2615
|
+
function scaledBy(vector2, factor) {
|
|
2616
|
+
return [vector2[0] * factor, vector2[1] * factor, vector2[2] * factor];
|
|
2617
2617
|
}
|
|
2618
|
-
function plusScaled(
|
|
2619
|
-
return [
|
|
2618
|
+
function plusScaled(vector2, direction, factor) {
|
|
2619
|
+
return [vector2[0] + direction[0] * factor, vector2[1] + direction[1] * factor, vector2[2] + direction[2] * factor];
|
|
2620
2620
|
}
|
|
2621
|
-
function negated(
|
|
2622
|
-
return [-
|
|
2621
|
+
function negated(vector2) {
|
|
2622
|
+
return [-vector2[0], -vector2[1], -vector2[2]];
|
|
2623
2623
|
}
|
|
2624
2624
|
|
|
2625
2625
|
// src/effects/destruction/door-stages.ts
|
|
@@ -3988,10 +3988,35 @@ var VEHICLE_EFFECTS = [
|
|
|
3988
3988
|
aliasOf(FUEL_LEAK, "vehicle_leak_ignited", {})
|
|
3989
3989
|
];
|
|
3990
3990
|
|
|
3991
|
+
// src/effects/particles/single-particles.ts
|
|
3992
|
+
var vector = [variable("vx"), variable("vy"), variable("vz")];
|
|
3993
|
+
var range = (name) => [variable(name), variable(name)];
|
|
3994
|
+
var singleParticle = (id, system) => ({
|
|
3995
|
+
id,
|
|
3996
|
+
pageId: `particle:${id}`,
|
|
3997
|
+
team: "world",
|
|
3998
|
+
budget: { particles: 1, lights: 0 },
|
|
3999
|
+
loop: 1e-3,
|
|
4000
|
+
timeline: [
|
|
4001
|
+
spawn(system, {
|
|
4002
|
+
p: [0, 0, 0],
|
|
4003
|
+
v: vector,
|
|
4004
|
+
life: range("life"),
|
|
4005
|
+
size: range("size"),
|
|
4006
|
+
grow: variable("grow"),
|
|
4007
|
+
c0: variable("color"),
|
|
4008
|
+
a: variable("alpha"),
|
|
4009
|
+
g: variable("gravity"),
|
|
4010
|
+
drag: variable("drag")
|
|
4011
|
+
})
|
|
4012
|
+
]
|
|
4013
|
+
});
|
|
4014
|
+
var SINGLE_PARTICLE_EFFECTS = [singleParticle("particle_puff", "normal"), singleParticle("particle_glow", "add"), singleParticle("particle_streak", "streak")];
|
|
4015
|
+
|
|
3991
4016
|
// src/effects/catalog.ts
|
|
3992
4017
|
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];
|
|
3993
4018
|
var WORKSHOP_EFFECTS = Object.fromEntries(ALL_EFFECTS.map((effect) => [effect.id, effect]));
|
|
3994
|
-
var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS, ...VEHICLE_EFFECTS].map((effect) => [effect.id, effect])) };
|
|
4019
|
+
var GAME_EFFECTS = { ...WORKSHOP_EFFECTS, ...Object.fromEntries([...EVENT_EFFECTS, ...VIEWMODEL_EFFECTS, ...VEHICLE_EFFECTS, ...SINGLE_PARTICLE_EFFECTS].map((effect) => [effect.id, effect])) };
|
|
3995
4020
|
function patchEffects(base, changes) {
|
|
3996
4021
|
const result = { ...base };
|
|
3997
4022
|
for (const [id, change] of Object.entries(changes)) {
|
|
@@ -4700,8 +4725,8 @@ function resolve(value, context) {
|
|
|
4700
4725
|
var UP12 = [0, 1, 0];
|
|
4701
4726
|
var ZERO = [0, 0, 0];
|
|
4702
4727
|
var FULL_TURN_DRAWN = 6.283;
|
|
4703
|
-
function scaledSizes(
|
|
4704
|
-
return [
|
|
4728
|
+
function scaledSizes(range2, factor) {
|
|
4729
|
+
return [range2[0] * Math.sqrt(factor), range2[1] * Math.sqrt(factor)];
|
|
4705
4730
|
}
|
|
4706
4731
|
function fireEmit(engine, key, dt, centre, radius, factor, options = {}) {
|
|
4707
4732
|
const wind = options.wind ?? ZERO;
|
|
@@ -6601,9 +6626,9 @@ var SpriteKindSystem = class {
|
|
|
6601
6626
|
var TWO_PI_ROUNDED = 6.2832;
|
|
6602
6627
|
var WIDE_CONE = 3.1;
|
|
6603
6628
|
var UP13 = [0, 1, 0];
|
|
6604
|
-
function drawRange(random,
|
|
6605
|
-
if (Array.isArray(
|
|
6606
|
-
return
|
|
6629
|
+
function drawRange(random, range2) {
|
|
6630
|
+
if (Array.isArray(range2)) return random.between(range2[0], range2[1]);
|
|
6631
|
+
return range2 || 0;
|
|
6607
6632
|
}
|
|
6608
6633
|
function randomUnit(random, out) {
|
|
6609
6634
|
const up = random.next() * 2 - 1;
|
|
@@ -7387,13 +7412,13 @@ var WorkshopEngine = class {
|
|
|
7387
7412
|
return [origin[0] + cos2 * x + sin2 * z, origin[1] + point[1] - anchor[1], origin[2] - sin2 * x + cos2 * z];
|
|
7388
7413
|
}
|
|
7389
7414
|
/** A direction or velocity of the recipe's space in the world. */
|
|
7390
|
-
turn(
|
|
7415
|
+
turn(vector2) {
|
|
7391
7416
|
const placement = this.placement;
|
|
7392
|
-
if (!placement) return
|
|
7393
|
-
if (placement.orientation) return rotate(placement.orientation,
|
|
7417
|
+
if (!placement) return vector2;
|
|
7418
|
+
if (placement.orientation) return rotate(placement.orientation, vector2);
|
|
7394
7419
|
const cos2 = Math.cos(placement.yaw);
|
|
7395
7420
|
const sin2 = Math.sin(placement.yaw);
|
|
7396
|
-
return [cos2 *
|
|
7421
|
+
return [cos2 * vector2[0] + sin2 * vector2[2], vector2[1], -sin2 * vector2[0] + cos2 * vector2[2]];
|
|
7397
7422
|
}
|
|
7398
7423
|
placed(options) {
|
|
7399
7424
|
if (!this.placement) return options;
|
|
@@ -8602,10 +8627,10 @@ var START_TARGET = [0, 1, 0];
|
|
|
8602
8627
|
function subtract(a, b) {
|
|
8603
8628
|
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
8604
8629
|
}
|
|
8605
|
-
function unit(
|
|
8606
|
-
const length = Math.sqrt(
|
|
8630
|
+
function unit(vector2) {
|
|
8631
|
+
const length = Math.sqrt(vector2[0] * vector2[0] + vector2[1] * vector2[1] + vector2[2] * vector2[2]) || 1;
|
|
8607
8632
|
const inverse = 1 / length;
|
|
8608
|
-
return [
|
|
8633
|
+
return [vector2[0] * inverse, vector2[1] * inverse, vector2[2] * inverse];
|
|
8609
8634
|
}
|
|
8610
8635
|
function crossProduct(a, b) {
|
|
8611
8636
|
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]];
|