@adatechnology/game-vehicles 0.6.18 → 0.6.19
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.d.ts +68 -1
- package/dist/index.global.js +123 -32
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +123 -32
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4308,6 +4308,51 @@ function installWheels(kit) {
|
|
|
4308
4308
|
// src/particles.ts
|
|
4309
4309
|
import { warnOnce } from "@adatechnology/game-contracts";
|
|
4310
4310
|
|
|
4311
|
+
// src/engine-smoke.ts
|
|
4312
|
+
var SmokeCause = { STEAM: "steam", OIL: "oil", FIRE: "fire" };
|
|
4313
|
+
var SMOKE_LOOKS = {
|
|
4314
|
+
[SmokeCause.STEAM]: { color: 14870248, alpha: 0.18 },
|
|
4315
|
+
[SmokeCause.OIL]: { color: 11120306, alpha: 0.2 },
|
|
4316
|
+
[SmokeCause.FIRE]: { color: 2302756, alpha: 0.3 }
|
|
4317
|
+
};
|
|
4318
|
+
var CAUSE_OF_EMITTER = { white: SmokeCause.STEAM, oil: SmokeCause.OIL, black: SmokeCause.FIRE };
|
|
4319
|
+
var smokeCauseOfEmitter = (kind) => CAUSE_OF_EMITTER[kind];
|
|
4320
|
+
var RATE_AT_NO_DAMAGE = 0.25;
|
|
4321
|
+
var RATE_AT_WRECK = 1;
|
|
4322
|
+
function smokeRate(baseRate, damage) {
|
|
4323
|
+
const level = Math.min(1, Math.max(0, damage));
|
|
4324
|
+
return baseRate * (RATE_AT_NO_DAMAGE + (RATE_AT_WRECK - RATE_AT_NO_DAMAGE) * level);
|
|
4325
|
+
}
|
|
4326
|
+
var PLUME_PUFFS = 3;
|
|
4327
|
+
var SMOKE_WIND = [-0.45, 0, 0.16];
|
|
4328
|
+
var LIFT = { [SmokeCause.STEAM]: 0.5, [SmokeCause.OIL]: 0.45, [SmokeCause.FIRE]: 0.6 };
|
|
4329
|
+
var DRAG = 0.4;
|
|
4330
|
+
var VENT_CLEARANCE = 0.08;
|
|
4331
|
+
var VENT_SPREAD = 0.18;
|
|
4332
|
+
var jitter = (random, span) => (random() - 0.5) * 2 * span;
|
|
4333
|
+
function smokePuff(params) {
|
|
4334
|
+
const { cause, scale, random } = params;
|
|
4335
|
+
const wind = params.wind ?? SMOKE_WIND;
|
|
4336
|
+
const look = SMOKE_LOOKS[cause];
|
|
4337
|
+
const isFire = cause === SmokeCause.FIRE;
|
|
4338
|
+
return {
|
|
4339
|
+
offset: [jitter(random, VENT_SPREAD * scale), random() * 0.05, jitter(random, VENT_SPREAD * scale)],
|
|
4340
|
+
velocity: [wind[0] + jitter(random, 0.22), 0.55 + random() * 0.5, wind[2] + jitter(random, 0.22)],
|
|
4341
|
+
size: (isFire ? 0.2 : 0.14) * scale * (0.8 + random() * 0.4),
|
|
4342
|
+
growth: (isFire ? 6 : 5) + random() * 2,
|
|
4343
|
+
life: (isFire ? 3.4 : 2.6) + random() * 1.2,
|
|
4344
|
+
color: look.color,
|
|
4345
|
+
alpha: look.alpha * (0.8 + random() * 0.4),
|
|
4346
|
+
lift: LIFT[cause],
|
|
4347
|
+
drag: DRAG
|
|
4348
|
+
};
|
|
4349
|
+
}
|
|
4350
|
+
function engineBayVent(box) {
|
|
4351
|
+
const [cx, cy, cz] = box.center;
|
|
4352
|
+
const [sx, sy] = box.size;
|
|
4353
|
+
return [cx + sx * 0.15, cy + sy / 2 + VENT_CLEARANCE, cz];
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4311
4356
|
// src/routed-particles.ts
|
|
4312
4357
|
var ROUTED_PARTICLE_TYPES = { smoke: "particle_puff", dust: "particle_puff", fire: "particle_glow" };
|
|
4313
4358
|
var PUFF_LOOKS = {
|
|
@@ -4327,7 +4372,7 @@ function routedParticleRequest(input) {
|
|
|
4327
4372
|
const life = input.life ?? LIFE[type] ?? 99;
|
|
4328
4373
|
const size = (input.size ?? 1) * (input.grow ?? 1);
|
|
4329
4374
|
const isFire = type === "fire";
|
|
4330
|
-
const growth = isFire ? 1 : (SMOKE_START_SCALE + 1.5 * (1 - Math.exp(-life * 1.1)) + life * 0.12) / SMOKE_START_SCALE;
|
|
4375
|
+
const growth = input.growth ?? (isFire ? 1 : (SMOKE_START_SCALE + 1.5 * (1 - Math.exp(-life * 1.1)) + life * 0.12) / SMOKE_START_SCALE);
|
|
4331
4376
|
return {
|
|
4332
4377
|
effect: ROUTED_PARTICLE_TYPES[type],
|
|
4333
4378
|
point: input.position,
|
|
@@ -4336,12 +4381,12 @@ function routedParticleRequest(input) {
|
|
|
4336
4381
|
vy: input.velocity[1],
|
|
4337
4382
|
vz: input.velocity[2],
|
|
4338
4383
|
life,
|
|
4339
|
-
size: isFire ? size * 0.85 : size * SMOKE_START_SCALE,
|
|
4384
|
+
size: input.growth !== void 0 ? size : isFire ? size * 0.85 : size * SMOKE_START_SCALE,
|
|
4340
4385
|
grow: growth,
|
|
4341
4386
|
color: input.color ?? (isFire ? FIRE_COLOR : look[0]),
|
|
4342
4387
|
alpha: input.alpha ?? look[1],
|
|
4343
|
-
gravity: isFire ? 0 : type === "dust" ? 0 : -0.08,
|
|
4344
|
-
drag: type === "dust" ? 2.5 : isFire ? 1.5 : 0.9
|
|
4388
|
+
gravity: input.gravity ?? (isFire ? 0 : type === "dust" ? 0 : -0.08),
|
|
4389
|
+
drag: input.drag ?? (type === "dust" ? 2.5 : isFire ? 1.5 : 0.9)
|
|
4345
4390
|
}
|
|
4346
4391
|
};
|
|
4347
4392
|
}
|
|
@@ -4494,7 +4539,10 @@ function installParticles(kit) {
|
|
|
4494
4539
|
...o.op != null ? { alpha: o.op } : {},
|
|
4495
4540
|
...o.s ? { size: o.s } : {},
|
|
4496
4541
|
...o.life ? { life: o.life } : {},
|
|
4497
|
-
...o.grow ? { grow: o.grow } : {}
|
|
4542
|
+
...o.grow ? { grow: o.grow } : {},
|
|
4543
|
+
...o.growth ? { growth: o.growth } : {},
|
|
4544
|
+
...o.lift != null ? { gravity: -o.lift } : {},
|
|
4545
|
+
...o.drag != null ? { drag: o.drag } : {}
|
|
4498
4546
|
})
|
|
4499
4547
|
);
|
|
4500
4548
|
return null;
|
|
@@ -4549,7 +4597,8 @@ function installParticles(kit) {
|
|
|
4549
4597
|
r: o.r || 0.01,
|
|
4550
4598
|
spin: (c.rand() - 0.5) * 1.2,
|
|
4551
4599
|
ph: c.rand() * 6.28,
|
|
4552
|
-
grow: o.grow || 1
|
|
4600
|
+
grow: o.grow || 1,
|
|
4601
|
+
growth: o.growth || 0
|
|
4553
4602
|
};
|
|
4554
4603
|
c.particles.push(P);
|
|
4555
4604
|
return P;
|
|
@@ -4590,7 +4639,7 @@ function installParticles(kit) {
|
|
|
4590
4639
|
m.position.addScaledVector(P.v, dt);
|
|
4591
4640
|
m.position.x += Math.sin(P.age * 1.7 + P.ph) * 0.08 * dt;
|
|
4592
4641
|
m.position.z += Math.cos(P.age * 1.3 + P.ph) * 0.08 * dt;
|
|
4593
|
-
const gs = P.s0 * P.grow * (0.18 + 1.5 * (1 - Math.exp(-P.age * 1.1)) + P.age * 0.12);
|
|
4642
|
+
const gs = P.growth ? P.s0 * (1 + (P.growth - 1) * t) : P.s0 * P.grow * (0.18 + 1.5 * (1 - Math.exp(-P.age * 1.1)) + P.age * 0.12);
|
|
4594
4643
|
m.scale.set(gs, gs, 1);
|
|
4595
4644
|
m.material.rotation += P.spin * dt;
|
|
4596
4645
|
m.material.opacity = P.op * Math.min(1, P.age / 0.3);
|
|
@@ -4666,7 +4715,8 @@ function installParticles(kit) {
|
|
|
4666
4715
|
acc: 0,
|
|
4667
4716
|
s: o.s || 1,
|
|
4668
4717
|
dir: o.dir || null,
|
|
4669
|
-
gap: 0
|
|
4718
|
+
gap: 0,
|
|
4719
|
+
...o.damage ? { damage: o.damage } : {}
|
|
4670
4720
|
};
|
|
4671
4721
|
c.emitters.push(e);
|
|
4672
4722
|
return e;
|
|
@@ -4678,7 +4728,31 @@ function installParticles(kit) {
|
|
|
4678
4728
|
return ["#141414", 0.66];
|
|
4679
4729
|
}
|
|
4680
4730
|
kit.exhaustLook = exhaustLook;
|
|
4731
|
+
function spawnSmokePuff(c, cause, scale, vent) {
|
|
4732
|
+
for (let k = 0; k < PLUME_PUFFS; k++) {
|
|
4733
|
+
const puff = smokePuff({ cause, scale, random: c.rand });
|
|
4734
|
+
const at = vent.clone().add(c.dirToEffects(new V3(puff.offset[0], puff.offset[1], puff.offset[2])));
|
|
4735
|
+
kit.spawn(c, "smoke", at, new V3(puff.velocity[0], puff.velocity[1], puff.velocity[2]), {
|
|
4736
|
+
col: puff.color,
|
|
4737
|
+
op: puff.alpha,
|
|
4738
|
+
s: puff.size,
|
|
4739
|
+
life: puff.life,
|
|
4740
|
+
growth: puff.growth,
|
|
4741
|
+
lift: puff.lift,
|
|
4742
|
+
drag: puff.drag
|
|
4743
|
+
});
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
function spawnOwnSmokePuff(c, e, p) {
|
|
4747
|
+
const black = e.kind === "black" || e.kind === "oil";
|
|
4748
|
+
kit.spawn(c, "smoke", p, new V3((c.rand() - 0.5) * 0.2, black ? 0.9 + c.rand() * 0.3 : 1.1 + c.rand() * 0.3, (c.rand() - 0.5) * 0.2), {
|
|
4749
|
+
variant: black ? "black" : "steam",
|
|
4750
|
+
s: (black ? 0.75 : 0.6) * e.s * (0.8 + c.rand() * 0.4),
|
|
4751
|
+
life: black ? 3.2 : 2
|
|
4752
|
+
});
|
|
4753
|
+
}
|
|
4681
4754
|
function tickEmit(c, dt) {
|
|
4755
|
+
const plume = !!kit.effects?.();
|
|
4682
4756
|
c.emitters.forEach(function(e) {
|
|
4683
4757
|
if (e.kind === "exhaust") {
|
|
4684
4758
|
const h = c.engineHealth == null ? 1 : c.engineHealth;
|
|
@@ -4689,7 +4763,7 @@ function installParticles(kit) {
|
|
|
4689
4763
|
if (e.gap > 0) return;
|
|
4690
4764
|
}
|
|
4691
4765
|
}
|
|
4692
|
-
e.acc += e.rate * dt;
|
|
4766
|
+
e.acc += (plume && e.damage ? smokeRate(e.rate, e.damage()) : e.rate) * dt;
|
|
4693
4767
|
while (e.acc >= 1) {
|
|
4694
4768
|
e.acc -= 1;
|
|
4695
4769
|
const p = e.world ? e.p.clone() : c.toEffects(e.p);
|
|
@@ -4702,8 +4776,10 @@ function installParticles(kit) {
|
|
|
4702
4776
|
s: (0.45 + c.rand() * 0.45) * e.s,
|
|
4703
4777
|
life: 0.55 + c.rand() * 0.35
|
|
4704
4778
|
});
|
|
4705
|
-
if (c.rand() < 0.45)
|
|
4706
|
-
|
|
4779
|
+
if (c.rand() < 0.45) {
|
|
4780
|
+
if (plume) spawnSmokePuff(c, SmokeCause.FIRE, e.s, p.clone().add(new V3(0, 0.5 * e.s, 0)));
|
|
4781
|
+
else kit.spawn(c, "smoke", p.clone().add(new V3(0, 0.7 * e.s, 0)), new V3(0, 1, 0), { variant: "black", s: 0.9 * e.s, life: 3.2 });
|
|
4782
|
+
}
|
|
4707
4783
|
if (c.rand() < 0.15)
|
|
4708
4784
|
kit.spawn(
|
|
4709
4785
|
c,
|
|
@@ -4722,14 +4798,9 @@ function installParticles(kit) {
|
|
|
4722
4798
|
life: 1.4 + c.rand() * 0.5
|
|
4723
4799
|
});
|
|
4724
4800
|
} else {
|
|
4725
|
-
const
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
"smoke",
|
|
4729
|
-
p,
|
|
4730
|
-
new V3((c.rand() - 0.5) * 0.2, preta ? 0.9 + c.rand() * 0.3 : 1.1 + c.rand() * 0.3, (c.rand() - 0.5) * 0.2),
|
|
4731
|
-
{ variant: preta ? "black" : "steam", s: (preta ? 0.75 : 0.6) * e.s * (0.8 + c.rand() * 0.4), life: preta ? 3.2 : 2 }
|
|
4732
|
-
);
|
|
4801
|
+
const cause = smokeCauseOfEmitter(e.kind);
|
|
4802
|
+
if (cause && plume) spawnSmokePuff(c, cause, e.s, p);
|
|
4803
|
+
else spawnOwnSmokePuff(c, e, p);
|
|
4733
4804
|
}
|
|
4734
4805
|
}
|
|
4735
4806
|
});
|
|
@@ -5704,7 +5775,7 @@ function installImpact(kit) {
|
|
|
5704
5775
|
kit.addEmitter(c, pt.pos.clone().add(new V3(-0.1, 0.25, 0)), "white");
|
|
5705
5776
|
hurtEngine(c, 0.6);
|
|
5706
5777
|
} else if (k === "engine") {
|
|
5707
|
-
kit.addEmitter(c, pt.pos.clone().add(new V3(0, 0.3, 0)), "
|
|
5778
|
+
kit.addEmitter(c, pt.pos.clone().add(new V3(0, 0.3, 0)), "oil", { rate: 6, damage: () => 1 - (c.engineHealth ?? 1) });
|
|
5708
5779
|
hurtEngine(c, force > 1.1 ? 0.1 : 0.3);
|
|
5709
5780
|
if (c.hood && force > 0.5 && !c.hood.noLatch) {
|
|
5710
5781
|
c.hood.latch = Math.max(c.hood.latch, 0.15);
|
|
@@ -8818,7 +8889,7 @@ function installDamageParts(kit) {
|
|
|
8818
8889
|
}
|
|
8819
8890
|
if (b >= 3) {
|
|
8820
8891
|
I.hurtEngine(c, b === 4 ? 0.05 : 0.25);
|
|
8821
|
-
kit.addEmitter(c, p.clone().add(new V3(0, 0.3, 0)), "
|
|
8892
|
+
kit.addEmitter(c, p.clone().add(new V3(0, 0.3, 0)), "oil", { rate: b === 4 ? 6 : 4, damage: () => 1 - (c.engineHealth ?? 1) });
|
|
8822
8893
|
if (land) I.puddle(c, "oil", p.clone().setY(Math.max(0.2, m.clearance || 0.3)), b === 4 ? 0.9 : 0.6);
|
|
8823
8894
|
}
|
|
8824
8895
|
if (b === 4) kit.addEmitter(c, p.clone().add(new V3(0, 0.15, 0)), "fire", { rate: 7, s: 0.7 });
|
|
@@ -12416,7 +12487,7 @@ var VehicleVisuals = class {
|
|
|
12416
12487
|
if (!z) return;
|
|
12417
12488
|
const B = z.box;
|
|
12418
12489
|
const THREE = this.THREE;
|
|
12419
|
-
const
|
|
12490
|
+
const lining = this.I.makeMaterial(DOOR_CARD_COLOR, { roughness: 0.85 });
|
|
12420
12491
|
const grid = (a0, a1, b0, b1) => {
|
|
12421
12492
|
const out = [];
|
|
12422
12493
|
for (const fa of [0.25, 0.5, 0.75]) for (const fb of [0.3, 0.7]) out.push([a0 + (a1 - a0) * fa, b0 + (b1 - b0) * fb]);
|
|
@@ -12431,7 +12502,7 @@ var VehicleVisuals = class {
|
|
|
12431
12502
|
const hingeFront = z.hinge !== "rear";
|
|
12432
12503
|
const hx = hingeFront ? B.x1 - 0.03 : B.x0 + 0.03;
|
|
12433
12504
|
const cy = (B.y0 + B.y1) / 2;
|
|
12434
|
-
const recess = this.box(len - 0.04, hgt - 0.04, 0.01,
|
|
12505
|
+
const recess = this.box(len - 0.04, hgt - 0.04, 0.01, lining, (B.x0 + B.x1) / 2, cy, sk + s * 4e-3);
|
|
12435
12506
|
recess.userData.noFollow = true;
|
|
12436
12507
|
const piv = new THREE.Group();
|
|
12437
12508
|
piv.name = p.id;
|
|
@@ -12448,7 +12519,7 @@ var VehicleVisuals = class {
|
|
|
12448
12519
|
if (sk == null) return;
|
|
12449
12520
|
const wy = B.y1 - B.y0 - 0.1;
|
|
12450
12521
|
const wz = B.z1 - B.z0 - 0.1;
|
|
12451
|
-
const recess = this.box(0.01, wy - 0.04, wz - 0.04,
|
|
12522
|
+
const recess = this.box(0.01, wy - 0.04, wz - 0.04, lining, sk + 4e-3, (B.y0 + B.y1) / 2, 0);
|
|
12452
12523
|
recess.userData.noFollow = true;
|
|
12453
12524
|
const piv = new THREE.Group();
|
|
12454
12525
|
piv.name = p.id;
|
|
@@ -12472,16 +12543,16 @@ var VehicleVisuals = class {
|
|
|
12472
12543
|
if (busy) return;
|
|
12473
12544
|
const r = piv.rotation;
|
|
12474
12545
|
const open = Math.abs(r.x) + Math.abs(r.y) + Math.abs(r.z) > 1e-3 || this.gone.has(id) || piv.parent !== this.c.vehicle;
|
|
12475
|
-
if (open &&
|
|
12546
|
+
if (open && piv.parent === this.c.vehicle && !this.skins.has(id)) {
|
|
12476
12547
|
busy = true;
|
|
12477
12548
|
try {
|
|
12478
|
-
this.skins.set(id, this.takeSkin(id, piv));
|
|
12549
|
+
this.skins.set(id, this.takeSkin(id, piv, this.gone.has(id)));
|
|
12479
12550
|
} finally {
|
|
12480
12551
|
busy = false;
|
|
12481
12552
|
}
|
|
12482
12553
|
}
|
|
12483
12554
|
panel.visible = open && !this.skins.get(id);
|
|
12484
|
-
recess.visible = open && !this.skins.get(id);
|
|
12555
|
+
recess.visible = open && !this.skins.get(id) && !this.gone.has(id);
|
|
12485
12556
|
if (open) this.openNow.add(id);
|
|
12486
12557
|
else this.openNow.delete(id);
|
|
12487
12558
|
this.seams.forEach((doors, seam) => {
|
|
@@ -12507,7 +12578,7 @@ var VehicleVisuals = class {
|
|
|
12507
12578
|
* Cuts the skin of a door or lid zone out of the body (as the damage's hanging door does) and hangs it, with the thin parts on it (trim, handle) and, for a door, the side
|
|
12508
12579
|
* window over it, on the hinge. Done with the hinge closed, so every piece keeps its place; answers whether there was skin to take.
|
|
12509
12580
|
*/
|
|
12510
|
-
takeSkin(id, piv) {
|
|
12581
|
+
takeSkin(id, piv, torn = false) {
|
|
12511
12582
|
const p = this.byId.get(id);
|
|
12512
12583
|
const z = p && this.zone(p);
|
|
12513
12584
|
if (!p || !z) return false;
|
|
@@ -12527,7 +12598,8 @@ var VehicleVisuals = class {
|
|
|
12527
12598
|
this.doorTops.set(id, top);
|
|
12528
12599
|
const rect = [B.x0 + 0.03, B.x1 - 0.03, B.y0 + Math.min(0.08, (B.y1 - B.y0) * 0.1), top];
|
|
12529
12600
|
const pcs = I.cutPanel(this.c, z, rect, true, dirty, { anyN: true }).map((x) => x.mesh).filter((m) => !!m);
|
|
12530
|
-
this.
|
|
12601
|
+
if (torn) this.mendLater(dirty);
|
|
12602
|
+
else this.mend(dirty);
|
|
12531
12603
|
if (pcs.length) {
|
|
12532
12604
|
leaveDeepSkinOnBody(this.THREE, pcs, { toVehicle: inv, side: z.side < 0 ? -1 : 1, depth: DOOR_SKIN_DEPTH });
|
|
12533
12605
|
const panes = I.windowsOver(this.c, z, inv);
|
|
@@ -13478,13 +13550,16 @@ var VehicleVisuals = class {
|
|
|
13478
13550
|
else this.I.panelBand(this.c, z, 4, dirty);
|
|
13479
13551
|
} catch {
|
|
13480
13552
|
}
|
|
13553
|
+
this.mendLater(dirty);
|
|
13554
|
+
this.gone.add(p.id);
|
|
13555
|
+
}
|
|
13556
|
+
mendLater(dirty) {
|
|
13481
13557
|
dirty.forEach((msh) => {
|
|
13482
13558
|
const g = msh.geometry;
|
|
13483
13559
|
if (g.userData.crease || !g.index) this.smoothLater(msh);
|
|
13484
13560
|
else g.computeVertexNormals();
|
|
13485
13561
|
this.I.refreshBounds(g);
|
|
13486
13562
|
});
|
|
13487
|
-
this.gone.add(p.id);
|
|
13488
13563
|
}
|
|
13489
13564
|
// ---- parts coming off --------------------------------------------------------------------------------------------------------------------
|
|
13490
13565
|
outward(p, away) {
|
|
@@ -13745,6 +13820,8 @@ var TYRE_FLAT_SAG = 0.24;
|
|
|
13745
13820
|
var TYRE_FLAT_AIR = 0.2;
|
|
13746
13821
|
var BRAKE_FLUID_NEEDED = 0.6;
|
|
13747
13822
|
var BRAKE_NO_FLUID = 0.15;
|
|
13823
|
+
var ENGINE_SMOKE_FROM = 0.85;
|
|
13824
|
+
var ENGINE_OIL_SMOKE_RATE = 4;
|
|
13748
13825
|
var ENGINE_WORKING_C = 90;
|
|
13749
13826
|
var ENGINE_SETTLE_S = 30;
|
|
13750
13827
|
var ENGINE_HEATING = 0.5;
|
|
@@ -13988,6 +14065,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
13988
14065
|
out.push(ev({ type: "damage", part: p.def.id, amount: r2(before - p.hp), hp: r2(p.hp), damageType: dtype, ...source ? { source } : {} }));
|
|
13989
14066
|
if (!punctures) wear(p, amount, out);
|
|
13990
14067
|
syncZone(p);
|
|
14068
|
+
if (vis && p.def.role === "engine" && p.hp < p.def.hp * ENGINE_SMOKE_FROM) smokeFromBay(p, "oil", ENGINE_OIL_SMOKE_RATE);
|
|
13991
14069
|
if (p.hp <= 0) lose(p, "broken", out, cause);
|
|
13992
14070
|
else if (p.def.role === "light") vis?.crackLight(p.def, dtype === "ballistic");
|
|
13993
14071
|
if (p.def.role === "tyre" && !p.flat && p.hp < p.def.hp * 0.6 && !p.lost) {
|
|
@@ -14072,6 +14150,10 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14072
14150
|
const out3 = dirToWorld(new V3(dirLocal.x * 0.5, dirLocal.y * 0.5 - 0.6, dirLocal.z * 0.5));
|
|
14073
14151
|
out.push(ev({ type: "leak", part: d.id, fluid, point: toWorld(holePoint), direction: r3(out3), rate: r2(rate), pressurized: !!d.contains.pressurized }));
|
|
14074
14152
|
};
|
|
14153
|
+
const smokeFromBay = (p, kind, rate) => {
|
|
14154
|
+
const [x, y, z] = engineBayVent(p.def.box);
|
|
14155
|
+
kit.addEmitter(c, new V3(x, y, z), kind, { rate, damage: () => 1 - p.hp / p.def.hp });
|
|
14156
|
+
};
|
|
14075
14157
|
const centreOf = (d) => new V3(d.box.center[0], d.box.center[1], d.box.center[2]);
|
|
14076
14158
|
const ignite = (p, out) => {
|
|
14077
14159
|
if (p.burning || p.lost) return;
|
|
@@ -14081,7 +14163,8 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14081
14163
|
if (!vis) return;
|
|
14082
14164
|
const cen = centreOf(d);
|
|
14083
14165
|
kit.addEmitter(c, cen.clone().add(new V3(0, 0.1, 0)), "fire", { rate: d.role === "tyre" ? 7 : 10, s: d.role === "tyre" ? 0.6 : 0.9 });
|
|
14084
|
-
|
|
14166
|
+
if (d.role === "engine") smokeFromBay(p, "black", 5);
|
|
14167
|
+
else kit.addEmitter(c, cen.clone().add(new V3(0, 0.6, 0)), "black", { rate: 4, s: 1.1 });
|
|
14085
14168
|
if (d.role === "fuel_tank" || d.role === "engine") {
|
|
14086
14169
|
const l = leaks.get("fuel_tank");
|
|
14087
14170
|
if (l?.pud && l.fluid === "fuel") I.igniteFuel(c, l.pud);
|
|
@@ -14812,7 +14895,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14812
14895
|
if (oil < OIL_NEEDED) engine.hp = Math.max(0, engine.hp - engine.def.hp * OIL_WEAR * work * seconds * ((OIL_NEEDED - oil) / OIL_NEEDED));
|
|
14813
14896
|
if (engineHeat >= ENGINE_STEAM_C && vis && !steaming) {
|
|
14814
14897
|
steaming = true;
|
|
14815
|
-
|
|
14898
|
+
smokeFromBay(engine, "white", 8);
|
|
14816
14899
|
}
|
|
14817
14900
|
if (engineHeat >= ENGINE_SEIZE_C || engine.hp <= engine.def.hp * ENGINE_SEIZE_HP) {
|
|
14818
14901
|
seized = true;
|
|
@@ -15164,7 +15247,11 @@ export {
|
|
|
15164
15247
|
JOINT_RULES,
|
|
15165
15248
|
LEGACY_STATES,
|
|
15166
15249
|
LEGACY_ZONE_IDS,
|
|
15250
|
+
PLUME_PUFFS,
|
|
15167
15251
|
SEED_SALTS,
|
|
15252
|
+
SMOKE_LOOKS,
|
|
15253
|
+
SMOKE_WIND,
|
|
15254
|
+
SmokeCause,
|
|
15168
15255
|
armourLevelOf,
|
|
15169
15256
|
buildVehicleItem,
|
|
15170
15257
|
buildVehicleModel,
|
|
@@ -15182,6 +15269,7 @@ export {
|
|
|
15182
15269
|
createVehicleKit,
|
|
15183
15270
|
defaultDamageableKinds,
|
|
15184
15271
|
defaultLodSettings,
|
|
15272
|
+
engineBayVent,
|
|
15185
15273
|
format,
|
|
15186
15274
|
hash,
|
|
15187
15275
|
legacyGlassId,
|
|
@@ -15192,6 +15280,9 @@ export {
|
|
|
15192
15280
|
registerLocale,
|
|
15193
15281
|
resolveStrings,
|
|
15194
15282
|
rng,
|
|
15283
|
+
smokeCauseOfEmitter,
|
|
15284
|
+
smokePuff,
|
|
15285
|
+
smokeRate,
|
|
15195
15286
|
smooth,
|
|
15196
15287
|
strHash,
|
|
15197
15288
|
strayLampsOf,
|