@adatechnology/game-vehicles 0.6.17 → 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 +112 -7
- package/dist/index.global.js +574 -133
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +461 -133
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -895,7 +895,7 @@ function boxTriangle(geo, ti, t) {
|
|
|
895
895
|
ti.boxes[j + 3 + k] = Math.max(P[a + k], P[b + k], P[c + k]);
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
|
-
function advance(geo, ti, deadline) {
|
|
898
|
+
function advance(geo, ti, deadline, clock) {
|
|
899
899
|
const total = blockCount(ti.triangles);
|
|
900
900
|
while (ti.builtBlocks < total) {
|
|
901
901
|
const block = ti.builtBlocks;
|
|
@@ -903,7 +903,7 @@ function advance(geo, ti, deadline) {
|
|
|
903
903
|
for (let t = block * TRI_BLOCK; t < t1; t++) boxTriangle(geo, ti, t);
|
|
904
904
|
boxBlock(ti, block);
|
|
905
905
|
ti.builtBlocks++;
|
|
906
|
-
if (deadline !== Infinity &&
|
|
906
|
+
if (deadline !== Infinity && clock() >= deadline) break;
|
|
907
907
|
}
|
|
908
908
|
return ti.builtBlocks === total;
|
|
909
909
|
}
|
|
@@ -927,14 +927,14 @@ function triIndexOf(geo) {
|
|
|
927
927
|
if (!supports(geo)) return void 0;
|
|
928
928
|
let ti = cache.get(geo);
|
|
929
929
|
if (!ti || !isCurrent(geo, ti)) ti = start(geo);
|
|
930
|
-
advance(geo, ti, Infinity);
|
|
930
|
+
advance(geo, ti, Infinity, performance.now.bind(performance));
|
|
931
931
|
return ti;
|
|
932
932
|
}
|
|
933
|
-
function warmTriIndex(geo, deadline) {
|
|
933
|
+
function warmTriIndex(geo, deadline, clock = performance.now.bind(performance)) {
|
|
934
934
|
if (!supports(geo)) return true;
|
|
935
935
|
let ti = cache.get(geo);
|
|
936
936
|
if (!ti || !isCurrent(geo, ti)) ti = start(geo);
|
|
937
|
-
return advance(geo, ti, deadline);
|
|
937
|
+
return advance(geo, ti, deadline, clock);
|
|
938
938
|
}
|
|
939
939
|
function storeTriIndex(geo, boxes) {
|
|
940
940
|
const ti = start(geo);
|
|
@@ -978,7 +978,7 @@ function rayIndexOf(geo) {
|
|
|
978
978
|
if (shared && isCurrent(geo, shared) && shared.builtBlocks === blockCount(shared.triangles)) return shared;
|
|
979
979
|
let ti = rayCache.get(geo);
|
|
980
980
|
if (!ti || !isCurrent(geo, ti)) ti = start(geo, rayCache);
|
|
981
|
-
advance(geo, ti, Infinity);
|
|
981
|
+
advance(geo, ti, Infinity, performance.now.bind(performance));
|
|
982
982
|
return ti;
|
|
983
983
|
}
|
|
984
984
|
var BLOCK_SLACK = 1e-6;
|
|
@@ -1271,9 +1271,9 @@ function installGeometry(kit) {
|
|
|
1271
1271
|
const cs = Math.cos(deg * PI / 180);
|
|
1272
1272
|
let phase = 0;
|
|
1273
1273
|
let at = 0;
|
|
1274
|
-
function hashSlice(deadline) {
|
|
1274
|
+
function hashSlice(deadline, clock) {
|
|
1275
1275
|
for (; at < n; at++) {
|
|
1276
|
-
if ((at & 1023) === 0 &&
|
|
1276
|
+
if ((at & 1023) === 0 && clock() > deadline) return false;
|
|
1277
1277
|
const x = Math.round(P[3 * at] * 2e3) | 0;
|
|
1278
1278
|
const y = Math.round(P[3 * at + 1] * 2e3) | 0;
|
|
1279
1279
|
const z = Math.round(P[3 * at + 2] * 2e3) | 0;
|
|
@@ -1302,9 +1302,9 @@ function installGeometry(kit) {
|
|
|
1302
1302
|
members = new Int32Array(n);
|
|
1303
1303
|
for (let i = 0; i < n; i++) members[fill[groupOf[i]]++] = i / 3 | 0;
|
|
1304
1304
|
}
|
|
1305
|
-
function smoothSlice(deadline) {
|
|
1305
|
+
function smoothSlice(deadline, clock) {
|
|
1306
1306
|
for (; at < n; at++) {
|
|
1307
|
-
if ((at & 1023) === 0 &&
|
|
1307
|
+
if ((at & 1023) === 0 && clock() > deadline) return false;
|
|
1308
1308
|
const fi = (at / 3 | 0) * 3;
|
|
1309
1309
|
const g = groupOf[at];
|
|
1310
1310
|
let sx = 0;
|
|
@@ -1330,16 +1330,16 @@ function installGeometry(kit) {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
return true;
|
|
1332
1332
|
}
|
|
1333
|
-
function step(deadline) {
|
|
1333
|
+
function step(deadline, clock = performance.now.bind(performance)) {
|
|
1334
1334
|
if (latestCrease.get(geo) !== token) return true;
|
|
1335
1335
|
if (phase === 0) {
|
|
1336
|
-
if (!hashSlice(deadline)) return false;
|
|
1336
|
+
if (!hashSlice(deadline, clock)) return false;
|
|
1337
1337
|
gather();
|
|
1338
1338
|
phase = 1;
|
|
1339
1339
|
at = 0;
|
|
1340
1340
|
}
|
|
1341
1341
|
if (phase === 1) {
|
|
1342
|
-
const done = smoothSlice(deadline);
|
|
1342
|
+
const done = smoothSlice(deadline, clock);
|
|
1343
1343
|
if (deadline !== Infinity) normal.needsUpdate = true;
|
|
1344
1344
|
if (!done) return false;
|
|
1345
1345
|
phase = 2;
|
|
@@ -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);
|
|
@@ -6140,15 +6211,32 @@ function installExplosion(kit) {
|
|
|
6140
6211
|
const m = c.meta;
|
|
6141
6212
|
return new V3(m.front - 0.6, (m.clearance || 0.3) + 0.3, 0);
|
|
6142
6213
|
}
|
|
6214
|
+
function worldPointOf(c, local) {
|
|
6215
|
+
c.vehicle.updateWorldMatrix(true, false);
|
|
6216
|
+
const wp = local.clone().applyMatrix4(c.vehicle.matrixWorld);
|
|
6217
|
+
return [wp.x, wp.y, wp.z];
|
|
6218
|
+
}
|
|
6219
|
+
function startVehicleFire(c, local, radius, life) {
|
|
6220
|
+
const effects = kit.effects?.();
|
|
6221
|
+
if (!effects) return false;
|
|
6222
|
+
const handle = effects.play({ effect: "volumetric_fire", point: worldPointOf(c, local), values: { radius, life } });
|
|
6223
|
+
if (handle != null) {
|
|
6224
|
+
c.vfxHandles = c.vfxHandles || [];
|
|
6225
|
+
c.vfxHandles.push(handle);
|
|
6226
|
+
}
|
|
6227
|
+
return true;
|
|
6228
|
+
}
|
|
6143
6229
|
kit.explode = function(c, o) {
|
|
6144
6230
|
o = o || {};
|
|
6145
6231
|
if (c.blast || c.exploded) return false;
|
|
6146
6232
|
const fuse = o.now ? 0 : o.delay != null ? o.delay : 3 + c.rand() * 5;
|
|
6147
|
-
c.blast = { phase: "fire", t: 0, T: fuse };
|
|
6233
|
+
c.blast = { phase: "fire", t: 0, T: fuse, skipBlastEffect: !!o.skipBlastEffect };
|
|
6148
6234
|
if (fuse > 0) {
|
|
6149
6235
|
const ep = enginePos(c);
|
|
6150
|
-
|
|
6151
|
-
|
|
6236
|
+
if (!startVehicleFire(c, ep.clone().add(new V3(0, 0.25, 0)), 0.55, fuse + 2)) {
|
|
6237
|
+
kit.addEmitter(c, ep.clone().add(new V3(0, 0.25, 0)), "fire", { rate: 10, s: 0.9 });
|
|
6238
|
+
kit.addEmitter(c, ep.clone().add(new V3(0, 0.6, 0)), "black", { rate: 6, s: 1.2 });
|
|
6239
|
+
}
|
|
6152
6240
|
I.hurtEngine(c, 0.1);
|
|
6153
6241
|
}
|
|
6154
6242
|
if (c.hood) c.hood.target = 0;
|
|
@@ -6166,8 +6254,10 @@ function installExplosion(kit) {
|
|
|
6166
6254
|
return p.kind === "fuel_tank";
|
|
6167
6255
|
});
|
|
6168
6256
|
const tp = tk ? tk.pos.clone() : enginePos(c);
|
|
6169
|
-
|
|
6170
|
-
|
|
6257
|
+
if (!startVehicleFire(c, tp.clone().setY(Math.max(0.15, tp.y)), 0.65, 25)) {
|
|
6258
|
+
kit.addEmitter(c, tp.clone().setY(Math.max(0.15, tp.y)), "fire", { rate: 12, s: 1.1 });
|
|
6259
|
+
kit.addEmitter(c, tp.clone().setY(tp.y + 0.8), "black", { rate: 5, s: 1.4 });
|
|
6260
|
+
}
|
|
6171
6261
|
return "fire";
|
|
6172
6262
|
}
|
|
6173
6263
|
return null;
|
|
@@ -6274,42 +6364,51 @@ function installExplosion(kit) {
|
|
|
6274
6364
|
c.emitters = c.emitters.filter(function(e) {
|
|
6275
6365
|
return e.kind !== "exhaust";
|
|
6276
6366
|
});
|
|
6277
|
-
const
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6367
|
+
const effects = kit.effects?.();
|
|
6368
|
+
if (effects) {
|
|
6369
|
+
if (!B.skipBlastEffect) {
|
|
6370
|
+
c.effects.updateWorldMatrix(true, false);
|
|
6371
|
+
const worldCen = cen.clone().applyMatrix4(c.effects.matrixWorld);
|
|
6372
|
+
effects.play({ effect: big ? "fuel_station_tank" : "car_fuel_tank", point: [worldCen.x, worldCen.y, worldCen.z], values: {} });
|
|
6373
|
+
}
|
|
6374
|
+
} else {
|
|
6375
|
+
const fl = new THREE.Sprite(
|
|
6376
|
+
new THREE.SpriteMaterial({
|
|
6377
|
+
map: I.glowTexture(),
|
|
6378
|
+
color: 16767392,
|
|
6379
|
+
blending: THREE.AdditiveBlending,
|
|
6380
|
+
transparent: true,
|
|
6381
|
+
depthWrite: false,
|
|
6382
|
+
fog: false
|
|
6383
|
+
})
|
|
6384
|
+
);
|
|
6385
|
+
fl.raycast = function() {
|
|
6386
|
+
};
|
|
6387
|
+
fl.position.copy(cen);
|
|
6388
|
+
fl.scale.setScalar(0.1);
|
|
6389
|
+
c.effects.add(fl);
|
|
6390
|
+
B.flash = fl;
|
|
6391
|
+
const sw = new THREE.Mesh(new THREE.RingGeometry(0.8, 1, 64), boomMat("#ffcf8a", 0.6, true));
|
|
6392
|
+
sw.rotation.x = -PI / 2;
|
|
6393
|
+
sw.position.set(cen.x, 0.07, cen.z);
|
|
6394
|
+
c.effects.add(sw);
|
|
6395
|
+
B.shock = sw;
|
|
6396
|
+
const k = big ? 1.8 : 1;
|
|
6397
|
+
for (let i = 0; i < (big ? 70 : 46); i++) {
|
|
6398
|
+
const d = new V3(c.rand() - 0.5, c.rand() * 0.9, c.rand() - 0.5).normalize();
|
|
6399
|
+
kit.spawn(c, "fire", cen.clone().addScaledVector(d, 0.3), d.multiplyScalar((2.5 + c.rand() * 4) * k), {
|
|
6400
|
+
s: (1 + c.rand() * 1.4) * k,
|
|
6401
|
+
life: 0.8 + c.rand() * 0.7
|
|
6402
|
+
});
|
|
6403
|
+
}
|
|
6404
|
+
for (let j = 0; j < (big ? 30 : 18); j++) {
|
|
6405
|
+
const d2 = new V3(c.rand() - 0.5, 0.4 + c.rand(), c.rand() - 0.5).normalize();
|
|
6406
|
+
kit.spawn(c, "smoke", cen.clone().addScaledVector(d2, 0.6), d2.multiplyScalar(1.5 + c.rand() * 2), {
|
|
6407
|
+
variant: "black",
|
|
6408
|
+
s: (1.4 + c.rand()) * k,
|
|
6409
|
+
life: 4 + c.rand() * 2
|
|
6410
|
+
});
|
|
6411
|
+
}
|
|
6313
6412
|
}
|
|
6314
6413
|
I.burst(c, "spark", cen, 40, { speed: 7, spread: 1.6 });
|
|
6315
6414
|
I.burst(c, "scrap", cen, 14, {
|
|
@@ -6322,7 +6421,7 @@ function installExplosion(kit) {
|
|
|
6322
6421
|
const G = gm2.userData.glass;
|
|
6323
6422
|
if (!G || G.broken || !gm2.visible || !gm2.parent) return;
|
|
6324
6423
|
if (G.type === "laminated") {
|
|
6325
|
-
for (let
|
|
6424
|
+
for (let k = 0; k < 3; k++) I.crackGlass(c, gm2, I.glassPt ? I.glassPt(c, gm2, c.rand) : gm2.position.clone(), 1.2);
|
|
6326
6425
|
return;
|
|
6327
6426
|
}
|
|
6328
6427
|
I.shatterGlass(c, gm2, 1.4, new V3(0, 1, 0));
|
|
@@ -6348,14 +6447,19 @@ function installExplosion(kit) {
|
|
|
6348
6447
|
c.emitters.forEach(function(e) {
|
|
6349
6448
|
if (e.kind === "fire") e.rate = Math.min(e.rate, 7);
|
|
6350
6449
|
});
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6450
|
+
if (effects) {
|
|
6451
|
+
startVehicleFire(c, ep.clone().add(new V3(0, 0.15, 0)), 0.55, 30);
|
|
6452
|
+
startVehicleFire(c, new V3(((m.front || 1) + (m.rear || -1)) / 2, (m.clearance || 0.3) + 0.35, 0), 0.45, 25);
|
|
6453
|
+
} else {
|
|
6454
|
+
kit.addEmitter(c, ep.clone().add(new V3(0, 0.15, 0)), "fire", { rate: 8, s: 0.8 });
|
|
6455
|
+
kit.addEmitter(c, new V3(((m.front || 1) + (m.rear || -1)) / 2, (m.clearance || 0.3) + 0.35, 0), "fire", { rate: 6, s: 0.7 });
|
|
6456
|
+
kit.addEmitter(c, ep.clone().add(new V3(0, 0.9, 0)), "black", { rate: 4, s: 1.4 });
|
|
6457
|
+
}
|
|
6354
6458
|
c.parts.forEach(function(p) {
|
|
6355
6459
|
if (p.kind === "glass" || p.kind === "headlight" || p.kind === "taillight" || p.kind === "hood") p.done = true;
|
|
6356
6460
|
});
|
|
6357
6461
|
c.log.push({ kind: "explosion", label: kit.t(big ? "blast.tank_explosion" : "blast.explosion") });
|
|
6358
|
-
if (big) bigBoomFx(c);
|
|
6462
|
+
if (big && !effects) bigBoomFx(c);
|
|
6359
6463
|
}
|
|
6360
6464
|
function tickBoom(c, dt) {
|
|
6361
6465
|
const B = c.blast;
|
|
@@ -8785,7 +8889,7 @@ function installDamageParts(kit) {
|
|
|
8785
8889
|
}
|
|
8786
8890
|
if (b >= 3) {
|
|
8787
8891
|
I.hurtEngine(c, b === 4 ? 0.05 : 0.25);
|
|
8788
|
-
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) });
|
|
8789
8893
|
if (land) I.puddle(c, "oil", p.clone().setY(Math.max(0.2, m.clearance || 0.3)), b === 4 ? 0.9 : 0.6);
|
|
8790
8894
|
}
|
|
8791
8895
|
if (b === 4) kit.addEmitter(c, p.clone().add(new V3(0, 0.15, 0)), "fire", { rate: 7, s: 0.7 });
|
|
@@ -11150,6 +11254,11 @@ function createVehicleKit(options) {
|
|
|
11150
11254
|
return c;
|
|
11151
11255
|
}
|
|
11152
11256
|
kit.dispose = function(c) {
|
|
11257
|
+
if (Array.isArray(c.vfxHandles) && c.vfxHandles.length > 0) {
|
|
11258
|
+
const effects = kit.effects?.();
|
|
11259
|
+
for (const handle of c.vfxHandles) effects?.stop?.(handle);
|
|
11260
|
+
c.vfxHandles = [];
|
|
11261
|
+
}
|
|
11153
11262
|
const shared = Object.values(I.PARTICLE_GEOMETRIES);
|
|
11154
11263
|
c.root.traverse(function(o) {
|
|
11155
11264
|
if (o.isSprite) {
|
|
@@ -11271,7 +11380,7 @@ function armourLevelOf(meta, option) {
|
|
|
11271
11380
|
}
|
|
11272
11381
|
|
|
11273
11382
|
// src/destructible/impl.ts
|
|
11274
|
-
import { ignitionChance, resolveIgnitionRules, sparkTargetFactor } from "@adatechnology/game-contracts";
|
|
11383
|
+
import { chargeFireball, DEFAULT_BLAST_IMPULSE, fireballDose, waveWork, ignitionChance, ignitionDose, resolveIgnitionRules, sparkTargetFactor } from "@adatechnology/game-contracts";
|
|
11275
11384
|
|
|
11276
11385
|
// src/destructible/model.ts
|
|
11277
11386
|
var JOINT_RULES = {
|
|
@@ -11888,6 +11997,9 @@ function buildVehicleModel(kit, c, options = {}) {
|
|
|
11888
11997
|
return { parts, joints, hub: hubId, hitch };
|
|
11889
11998
|
}
|
|
11890
11999
|
|
|
12000
|
+
// src/destructible/visual.ts
|
|
12001
|
+
import { DEFERRED_QUEUE_ID, drainDetached } from "@adatechnology/game-contracts";
|
|
12002
|
+
|
|
11891
12003
|
// src/destructible/subdivide-near.ts
|
|
11892
12004
|
var SUBDIVIDE_DEPTH = 12;
|
|
11893
12005
|
function subdivideNear(THREE, params) {
|
|
@@ -12102,6 +12214,7 @@ function isDoorSeam(three, params) {
|
|
|
12102
12214
|
|
|
12103
12215
|
// src/destructible/visual.ts
|
|
12104
12216
|
var HOLE_DECAL_SCALE = 2.4;
|
|
12217
|
+
var HOLE_BATCH_CAPACITY = 64;
|
|
12105
12218
|
var DOOR_DEPTH = 0.07;
|
|
12106
12219
|
var DOOR_SKIN_DEPTH = 0.09;
|
|
12107
12220
|
var DOOR_FLOOR_DEPTH = 0.2;
|
|
@@ -12253,7 +12366,25 @@ var VehicleVisuals = class {
|
|
|
12253
12366
|
__publicField(this, "holdFrame", -1);
|
|
12254
12367
|
/** Normal smoothing still running, by mesh: a mesh cut again gets a new task and the old one is dropped. */
|
|
12255
12368
|
__publicField(this, "smoothing", /* @__PURE__ */ new Map());
|
|
12369
|
+
/** The bullet holes of one carrier and material, drawn as one instanced batch each (a door full of holes still draws as one). */
|
|
12370
|
+
__publicField(this, "holes", /* @__PURE__ */ new Map());
|
|
12256
12371
|
__publicField(this, "hood");
|
|
12372
|
+
/** What `pump` drains when no shared queue owns the smoothing: the same steps, timed by `drainDetached`. */
|
|
12373
|
+
__publicField(this, "pumpQueue", {
|
|
12374
|
+
id: DEFERRED_QUEUE_ID.VEHICLE_CREASE,
|
|
12375
|
+
pending: () => this.smoothing.size + (this.warming ? 1 : 0),
|
|
12376
|
+
run: (deadline, clock) => {
|
|
12377
|
+
let ran = 0;
|
|
12378
|
+
for (const [msh, task] of this.smoothing) {
|
|
12379
|
+
if (msh.geometry !== task.geo || task.step(deadline, clock)) this.smoothing.delete(msh);
|
|
12380
|
+
ran++;
|
|
12381
|
+
if (clock() >= deadline) return ran;
|
|
12382
|
+
}
|
|
12383
|
+
this.warmIndexes(deadline, clock);
|
|
12384
|
+
return ran + 1;
|
|
12385
|
+
},
|
|
12386
|
+
flush: () => this.finishAll()
|
|
12387
|
+
});
|
|
12257
12388
|
;
|
|
12258
12389
|
c.smoothLater = (mesh) => this.smoothLater(mesh);
|
|
12259
12390
|
this.kit = kit;
|
|
@@ -12356,7 +12487,7 @@ var VehicleVisuals = class {
|
|
|
12356
12487
|
if (!z) return;
|
|
12357
12488
|
const B = z.box;
|
|
12358
12489
|
const THREE = this.THREE;
|
|
12359
|
-
const
|
|
12490
|
+
const lining = this.I.makeMaterial(DOOR_CARD_COLOR, { roughness: 0.85 });
|
|
12360
12491
|
const grid = (a0, a1, b0, b1) => {
|
|
12361
12492
|
const out = [];
|
|
12362
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]);
|
|
@@ -12371,7 +12502,7 @@ var VehicleVisuals = class {
|
|
|
12371
12502
|
const hingeFront = z.hinge !== "rear";
|
|
12372
12503
|
const hx = hingeFront ? B.x1 - 0.03 : B.x0 + 0.03;
|
|
12373
12504
|
const cy = (B.y0 + B.y1) / 2;
|
|
12374
|
-
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);
|
|
12375
12506
|
recess.userData.noFollow = true;
|
|
12376
12507
|
const piv = new THREE.Group();
|
|
12377
12508
|
piv.name = p.id;
|
|
@@ -12388,7 +12519,7 @@ var VehicleVisuals = class {
|
|
|
12388
12519
|
if (sk == null) return;
|
|
12389
12520
|
const wy = B.y1 - B.y0 - 0.1;
|
|
12390
12521
|
const wz = B.z1 - B.z0 - 0.1;
|
|
12391
|
-
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);
|
|
12392
12523
|
recess.userData.noFollow = true;
|
|
12393
12524
|
const piv = new THREE.Group();
|
|
12394
12525
|
piv.name = p.id;
|
|
@@ -12412,16 +12543,16 @@ var VehicleVisuals = class {
|
|
|
12412
12543
|
if (busy) return;
|
|
12413
12544
|
const r = piv.rotation;
|
|
12414
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;
|
|
12415
|
-
if (open &&
|
|
12546
|
+
if (open && piv.parent === this.c.vehicle && !this.skins.has(id)) {
|
|
12416
12547
|
busy = true;
|
|
12417
12548
|
try {
|
|
12418
|
-
this.skins.set(id, this.takeSkin(id, piv));
|
|
12549
|
+
this.skins.set(id, this.takeSkin(id, piv, this.gone.has(id)));
|
|
12419
12550
|
} finally {
|
|
12420
12551
|
busy = false;
|
|
12421
12552
|
}
|
|
12422
12553
|
}
|
|
12423
12554
|
panel.visible = open && !this.skins.get(id);
|
|
12424
|
-
recess.visible = open && !this.skins.get(id);
|
|
12555
|
+
recess.visible = open && !this.skins.get(id) && !this.gone.has(id);
|
|
12425
12556
|
if (open) this.openNow.add(id);
|
|
12426
12557
|
else this.openNow.delete(id);
|
|
12427
12558
|
this.seams.forEach((doors, seam) => {
|
|
@@ -12447,7 +12578,7 @@ var VehicleVisuals = class {
|
|
|
12447
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
|
|
12448
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.
|
|
12449
12580
|
*/
|
|
12450
|
-
takeSkin(id, piv) {
|
|
12581
|
+
takeSkin(id, piv, torn = false) {
|
|
12451
12582
|
const p = this.byId.get(id);
|
|
12452
12583
|
const z = p && this.zone(p);
|
|
12453
12584
|
if (!p || !z) return false;
|
|
@@ -12467,7 +12598,8 @@ var VehicleVisuals = class {
|
|
|
12467
12598
|
this.doorTops.set(id, top);
|
|
12468
12599
|
const rect = [B.x0 + 0.03, B.x1 - 0.03, B.y0 + Math.min(0.08, (B.y1 - B.y0) * 0.1), top];
|
|
12469
12600
|
const pcs = I.cutPanel(this.c, z, rect, true, dirty, { anyN: true }).map((x) => x.mesh).filter((m) => !!m);
|
|
12470
|
-
this.
|
|
12601
|
+
if (torn) this.mendLater(dirty);
|
|
12602
|
+
else this.mend(dirty);
|
|
12471
12603
|
if (pcs.length) {
|
|
12472
12604
|
leaveDeepSkinOnBody(this.THREE, pcs, { toVehicle: inv, side: z.side < 0 ? -1 : 1, depth: DOOR_SKIN_DEPTH });
|
|
12473
12605
|
const panes = I.windowsOver(this.c, z, inv);
|
|
@@ -13182,19 +13314,44 @@ var VehicleVisuals = class {
|
|
|
13182
13314
|
const pane = part?.role === "glass" ? this.panesOf(part).find((g) => g.visible) : void 0;
|
|
13183
13315
|
if (part?.role === "glass" && (!pane || pane.userData.glass?.broken)) return;
|
|
13184
13316
|
const radius = Math.max(6e-3, diameter / 2) * HOLE_DECAL_SCALE;
|
|
13185
|
-
const m = new THREE.Mesh(holeDiscGeometry(THREE), holeMaterial(this.kit, part?.material ?? "steel"));
|
|
13186
|
-
m.scale.set(radius, radius, 1);
|
|
13187
13317
|
const n = new THREE.Vector3(...normal);
|
|
13188
|
-
m.position.set(...point).addScaledVector(n, 3e-3);
|
|
13189
|
-
this.c.vehicle.add(m);
|
|
13190
|
-
m.lookAt(this.c.vehicle.localToWorld(m.position.clone().add(n)));
|
|
13191
|
-
m.userData.decal = true;
|
|
13192
|
-
m.userData.noFollow = true;
|
|
13193
|
-
m.renderOrder = 3;
|
|
13194
|
-
m.raycast = () => {
|
|
13195
|
-
};
|
|
13196
13318
|
const carrier = (part && (this.plates.get(part.id) ?? (part.id === this.hood?.id ? this.c.hood?.piv : void 0))) ?? (pane && pane.parent !== this.c.vehicle ? pane.parent : null);
|
|
13197
|
-
|
|
13319
|
+
const parent = carrier ?? this.c.vehicle;
|
|
13320
|
+
const material = holeMaterial(this.kit, part?.material ?? "steel");
|
|
13321
|
+
const key = `${parent.uuid}|${material.uuid}`;
|
|
13322
|
+
let batches = this.holes.get(key);
|
|
13323
|
+
let batch = batches?.[batches.length - 1];
|
|
13324
|
+
if (!batch || batch.count >= HOLE_BATCH_CAPACITY) {
|
|
13325
|
+
batch = new THREE.InstancedMesh(holeDiscGeometry(THREE), material, HOLE_BATCH_CAPACITY);
|
|
13326
|
+
batch.count = 0;
|
|
13327
|
+
batch.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
|
|
13328
|
+
batch.castShadow = false;
|
|
13329
|
+
batch.receiveShadow = false;
|
|
13330
|
+
batch.userData.decal = true;
|
|
13331
|
+
batch.userData.noFollow = true;
|
|
13332
|
+
batch.renderOrder = 3;
|
|
13333
|
+
batch.raycast = () => {
|
|
13334
|
+
};
|
|
13335
|
+
batch.frustumCulled = false;
|
|
13336
|
+
parent.add(batch);
|
|
13337
|
+
if (!batches) {
|
|
13338
|
+
batches = [];
|
|
13339
|
+
this.holes.set(key, batches);
|
|
13340
|
+
}
|
|
13341
|
+
batches.push(batch);
|
|
13342
|
+
}
|
|
13343
|
+
const at = this.c.vehicle.localToWorld(new THREE.Vector3(...point).addScaledVector(n, 3e-3));
|
|
13344
|
+
const toward = this.c.vehicle.localToWorld(new THREE.Vector3(...point).addScaledVector(n, 1.003));
|
|
13345
|
+
const pose = new THREE.Object3D();
|
|
13346
|
+
pose.position.copy(at);
|
|
13347
|
+
pose.scale.set(radius, radius, 1);
|
|
13348
|
+
pose.lookAt(toward);
|
|
13349
|
+
pose.updateMatrix();
|
|
13350
|
+
parent.updateWorldMatrix(true, false);
|
|
13351
|
+
const instance = new THREE.Matrix4().copy(parent.matrixWorld).invert().multiply(pose.matrix);
|
|
13352
|
+
batch.setMatrixAt(batch.count, instance);
|
|
13353
|
+
batch.count += 1;
|
|
13354
|
+
batch.instanceMatrix.needsUpdate = true;
|
|
13198
13355
|
}
|
|
13199
13356
|
/** The door or lid a hinge group stands for. */
|
|
13200
13357
|
/** The part a separately drawn piece stands for (a mirror on the door, a battery under the hood), so a shot at it lands on that part. */
|
|
@@ -13347,12 +13504,7 @@ var VehicleVisuals = class {
|
|
|
13347
13504
|
}
|
|
13348
13505
|
if (this.queued) return;
|
|
13349
13506
|
if (!this.smoothing.size && !this.warming) return;
|
|
13350
|
-
|
|
13351
|
-
for (const [msh, task] of this.smoothing) {
|
|
13352
|
-
if (msh.geometry !== task.geo || task.step(deadline)) this.smoothing.delete(msh);
|
|
13353
|
-
if (performance.now() >= deadline) return;
|
|
13354
|
-
}
|
|
13355
|
-
this.warmIndexes(deadline);
|
|
13507
|
+
drainDetached(this.pumpQueue, budgetMs);
|
|
13356
13508
|
}
|
|
13357
13509
|
setQueued(isQueued) {
|
|
13358
13510
|
this.queued = isQueued;
|
|
@@ -13368,24 +13520,24 @@ var VehicleVisuals = class {
|
|
|
13368
13520
|
return this.smoothing.size + (this.warming ? 1 : 0);
|
|
13369
13521
|
}
|
|
13370
13522
|
/** One slice of the pending work, for the shared queue. */
|
|
13371
|
-
runStep(deadline) {
|
|
13523
|
+
runStep(deadline, clock) {
|
|
13372
13524
|
const next = this.smoothing.entries().next();
|
|
13373
13525
|
if (!next.done) {
|
|
13374
13526
|
const [msh, task] = next.value;
|
|
13375
|
-
if (msh.geometry !== task.geo || task.step(deadline)) this.smoothing.delete(msh);
|
|
13527
|
+
if (msh.geometry !== task.geo || task.step(deadline, clock)) this.smoothing.delete(msh);
|
|
13376
13528
|
return true;
|
|
13377
13529
|
}
|
|
13378
13530
|
if (!this.warming) return false;
|
|
13379
|
-
this.warmIndexes(deadline);
|
|
13531
|
+
this.warmIndexes(deadline, clock);
|
|
13380
13532
|
return true;
|
|
13381
13533
|
}
|
|
13382
13534
|
finishAll() {
|
|
13383
13535
|
while (this.runStep(Infinity)) ;
|
|
13384
13536
|
}
|
|
13385
13537
|
/** Measures the triangles of the heavy body meshes once, a slice per frame, so the first panel torn off finds them ready (see `triIndexOf`). */
|
|
13386
|
-
warmIndexes(deadline) {
|
|
13538
|
+
warmIndexes(deadline, clock) {
|
|
13387
13539
|
if (!this.warming) return;
|
|
13388
|
-
this.warming = this.warming.filter((msh) => !warmTriIndex(msh.geometry, deadline));
|
|
13540
|
+
this.warming = this.warming.filter((msh) => !warmTriIndex(msh.geometry, deadline, clock));
|
|
13389
13541
|
if (!this.warming.length) this.warming = null;
|
|
13390
13542
|
}
|
|
13391
13543
|
/** Moves the panel of a lost zone out of the body (the kit's torn-off look). */
|
|
@@ -13398,13 +13550,16 @@ var VehicleVisuals = class {
|
|
|
13398
13550
|
else this.I.panelBand(this.c, z, 4, dirty);
|
|
13399
13551
|
} catch {
|
|
13400
13552
|
}
|
|
13553
|
+
this.mendLater(dirty);
|
|
13554
|
+
this.gone.add(p.id);
|
|
13555
|
+
}
|
|
13556
|
+
mendLater(dirty) {
|
|
13401
13557
|
dirty.forEach((msh) => {
|
|
13402
13558
|
const g = msh.geometry;
|
|
13403
13559
|
if (g.userData.crease || !g.index) this.smoothLater(msh);
|
|
13404
13560
|
else g.computeVertexNormals();
|
|
13405
13561
|
this.I.refreshBounds(g);
|
|
13406
13562
|
});
|
|
13407
|
-
this.gone.add(p.id);
|
|
13408
13563
|
}
|
|
13409
13564
|
// ---- parts coming off --------------------------------------------------------------------------------------------------------------------
|
|
13410
13565
|
outward(p, away) {
|
|
@@ -13637,9 +13792,12 @@ var ROLE_RESIST = {
|
|
|
13637
13792
|
rim: 4
|
|
13638
13793
|
};
|
|
13639
13794
|
var BLUNT = { steel: 0.8, aluminium: 1, glass: 1.5, plastic: 1.2, rubber: 0.3 };
|
|
13795
|
+
var SHIELDED_REACH = 0.25;
|
|
13796
|
+
var DENSITY = { steel: 7850, aluminium: 2700, glass: 2500, plastic: 1100, rubber: 1100, wood_hard: 750, fabric: 400 };
|
|
13640
13797
|
var SHIELDED = /* @__PURE__ */ new Set(["engine", "gearbox", "frame", "radiator", "fuel_tank", "oil_pan", "battery", "alternator", "brakes", "steering", "shocks"]);
|
|
13641
13798
|
var AMBIENT = 20;
|
|
13642
13799
|
var FLAME = 700;
|
|
13800
|
+
var FIREBALL_NOTICE = 0.05;
|
|
13643
13801
|
var STEEL_MM = { panel: 0.8, door: 1.6, hood: 0.8, lid: 0.8, roof: 0.8, fender: 0.8, pillar: 2, frame: 4, rim: 3, engine: 40, gearbox: 25, fuel_tank: 1, radiator: 1, battery: 2, brakes: 10, steering: 8, shocks: 6, oil_pan: 2, alternator: 4, hitch: 8, other: 2 };
|
|
13644
13802
|
var ARMOUR_STEEL_MM = { IIIA: 4, III: 7 };
|
|
13645
13803
|
var SOFT_LEAD = 0.8;
|
|
@@ -13662,6 +13820,8 @@ var TYRE_FLAT_SAG = 0.24;
|
|
|
13662
13820
|
var TYRE_FLAT_AIR = 0.2;
|
|
13663
13821
|
var BRAKE_FLUID_NEEDED = 0.6;
|
|
13664
13822
|
var BRAKE_NO_FLUID = 0.15;
|
|
13823
|
+
var ENGINE_SMOKE_FROM = 0.85;
|
|
13824
|
+
var ENGINE_OIL_SMOKE_RATE = 4;
|
|
13665
13825
|
var ENGINE_WORKING_C = 90;
|
|
13666
13826
|
var ENGINE_SETTLE_S = 30;
|
|
13667
13827
|
var ENGINE_HEATING = 0.5;
|
|
@@ -13895,8 +14055,9 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
13895
14055
|
for (const j of js) if (!j.open && (j.def.a === d.id || j.def.b === d.id)) openJoint(j, "part_lost", out);
|
|
13896
14056
|
recomputeGroups();
|
|
13897
14057
|
};
|
|
13898
|
-
const damage = (p,
|
|
13899
|
-
if (p.lost || !(
|
|
14058
|
+
const damage = (p, hitAmount, dtype, source, out, cause, pieces = 1) => {
|
|
14059
|
+
if (p.lost || !(hitAmount > 0)) return;
|
|
14060
|
+
const amount = pieces > 1 ? Math.min(hitAmount * pieces, Math.max(hitAmount, p.hp)) : hitAmount;
|
|
13900
14061
|
const before = p.hp;
|
|
13901
14062
|
const crumples = dtype === "blunt" && CRUMPLES.has(p.def.role) && (p.def.material === "steel" || p.def.material === "aluminium");
|
|
13902
14063
|
const punctures = dtype === "ballistic" && p.def.role === "tyre";
|
|
@@ -13904,6 +14065,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
13904
14065
|
out.push(ev({ type: "damage", part: p.def.id, amount: r2(before - p.hp), hp: r2(p.hp), damageType: dtype, ...source ? { source } : {} }));
|
|
13905
14066
|
if (!punctures) wear(p, amount, out);
|
|
13906
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);
|
|
13907
14069
|
if (p.hp <= 0) lose(p, "broken", out, cause);
|
|
13908
14070
|
else if (p.def.role === "light") vis?.crackLight(p.def, dtype === "ballistic");
|
|
13909
14071
|
if (p.def.role === "tyre" && !p.flat && p.hp < p.def.hp * 0.6 && !p.lost) {
|
|
@@ -13988,6 +14150,10 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
13988
14150
|
const out3 = dirToWorld(new V3(dirLocal.x * 0.5, dirLocal.y * 0.5 - 0.6, dirLocal.z * 0.5));
|
|
13989
14151
|
out.push(ev({ type: "leak", part: d.id, fluid, point: toWorld(holePoint), direction: r3(out3), rate: r2(rate), pressurized: !!d.contains.pressurized }));
|
|
13990
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
|
+
};
|
|
13991
14157
|
const centreOf = (d) => new V3(d.box.center[0], d.box.center[1], d.box.center[2]);
|
|
13992
14158
|
const ignite = (p, out) => {
|
|
13993
14159
|
if (p.burning || p.lost) return;
|
|
@@ -13997,22 +14163,37 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
13997
14163
|
if (!vis) return;
|
|
13998
14164
|
const cen = centreOf(d);
|
|
13999
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 });
|
|
14000
|
-
|
|
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 });
|
|
14001
14168
|
if (d.role === "fuel_tank" || d.role === "engine") {
|
|
14002
14169
|
const l = leaks.get("fuel_tank");
|
|
14003
14170
|
if (l?.pud && l.fluid === "fuel") I.igniteFuel(c, l.pud);
|
|
14004
14171
|
}
|
|
14005
14172
|
};
|
|
14006
|
-
const burningBlast = (centreLocal, radius, energy, source, out) => {
|
|
14173
|
+
const burningBlast = (centreLocal, radius, energy, source, out, tnt = energy * DEFAULT_BLAST_IMPULSE.tntPerJoule) => {
|
|
14174
|
+
let tank = 0;
|
|
14007
14175
|
for (const d of model.parts) {
|
|
14008
14176
|
const p = ps.get(d.id);
|
|
14009
14177
|
if (p.lost) continue;
|
|
14010
14178
|
const dist = distToBox(d, centreLocal);
|
|
14011
14179
|
if (dist > radius) continue;
|
|
14012
|
-
const
|
|
14013
|
-
|
|
14014
|
-
damage(p,
|
|
14015
|
-
}
|
|
14180
|
+
const work = waveOn(d, centreLocal, dist, tnt);
|
|
14181
|
+
if (d.role === "fuel_tank") tank = work;
|
|
14182
|
+
damage(p, work * (BLUNT[d.material] ?? 1), "explosive", source, out);
|
|
14183
|
+
}
|
|
14184
|
+
return tank;
|
|
14185
|
+
};
|
|
14186
|
+
const waveOn = (d, centreLocal, dist, tnt) => {
|
|
14187
|
+
const [sx, sy, sz] = d.box.size;
|
|
14188
|
+
const toward = new V3(centreLocal.x - d.box.center[0], centreLocal.y - d.box.center[1], centreLocal.z - d.box.center[2]);
|
|
14189
|
+
const length = toward.length();
|
|
14190
|
+
if (length > 1e-6) toward.multiplyScalar(1 / length);
|
|
14191
|
+
else toward.set(0, 1, 0);
|
|
14192
|
+
const area = Math.abs(toward.x) * sy * sz + Math.abs(toward.y) * sx * sz + Math.abs(toward.z) * sx * sy;
|
|
14193
|
+
const face = Math.max(sx * sy, sx * sz, sy * sz, 1e-6);
|
|
14194
|
+
const thickness = Math.min(Math.min(sx, sy, sz), d.mass / ((DENSITY[d.material] ?? 1e3) * face));
|
|
14195
|
+
const wave = waveWork({ tnt, distance: dist, reach: SHIELDED.has(d.role) ? SHIELDED_REACH : 1, area, mass: Math.max(d.mass, 0.05), thickness });
|
|
14196
|
+
return wave.energy + wave.shock;
|
|
14016
14197
|
};
|
|
14017
14198
|
const explode = (tank, source, out) => {
|
|
14018
14199
|
if (exploded) return;
|
|
@@ -14022,7 +14203,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14022
14203
|
out.push(ev({ type: "explode", part: d.id, point: toWorld(d.box.center), energy: spec.energy, radius: spec.radius, ..."effect" in spec && spec.effect !== void 0 ? { effect: spec.effect } : {} }));
|
|
14023
14204
|
tank.liters = 0;
|
|
14024
14205
|
leaks.delete(d.id);
|
|
14025
|
-
if (vis) kit.explode(c, { delay: 0.6 });
|
|
14206
|
+
if (vis) kit.explode(c, { delay: 0.6, skipBlastEffect: true });
|
|
14026
14207
|
else c.blast = c.blast ?? { phase: "fire", t: 0, T: 0.6 };
|
|
14027
14208
|
lose(tank, "broken", out);
|
|
14028
14209
|
burningBlast(centreOf(d), spec.radius, spec.energy, source, out);
|
|
@@ -14116,6 +14297,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14116
14297
|
const d = p.def;
|
|
14117
14298
|
const E = h.energy ?? 0;
|
|
14118
14299
|
const cal = h.caliber ?? 9;
|
|
14300
|
+
const pieces = h.pieces ?? 1;
|
|
14119
14301
|
const dir = dirToLocal(h.direction ?? [0, 0, -1]).normalize();
|
|
14120
14302
|
const n = h.normal ? dirToLocal(h.normal).normalize() : normalOf(d, v);
|
|
14121
14303
|
const res = resist(d, p);
|
|
@@ -14126,7 +14308,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14126
14308
|
if (metal && !through && cosInc < 0.3 && E > 40) {
|
|
14127
14309
|
const refl = dir.clone().addScaledVector(n, -2 * dir.dot(n));
|
|
14128
14310
|
out.push(ev({ type: "ricochet", part: d.id, point: worldPoint, direction: r3(dirToWorld(refl)), energy: r2(E * 0.4) }));
|
|
14129
|
-
damage(p, E * 0.05, "ballistic", h.source, out, worldPoint);
|
|
14311
|
+
damage(p, E * 0.05, "ballistic", h.source, out, worldPoint, pieces);
|
|
14130
14312
|
vis?.spark([v.x, v.y, v.z], [refl.x, refl.y, refl.z], 6);
|
|
14131
14313
|
return;
|
|
14132
14314
|
}
|
|
@@ -14157,13 +14339,13 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14157
14339
|
const crack = { point: r3(fromVehicle(v, M)), normal: r3(fromVehicle(n, new THREE.Matrix4().extractRotation(M))), length: r2(0.15 + force * 0.35), rays: 6 + Math.round(force * 6) };
|
|
14158
14340
|
p.cracks.push(crack);
|
|
14159
14341
|
out.push(ev({ type: "crack", part: d.id, crack, worldPoint }));
|
|
14160
|
-
damage(p, E * (armourLevel && !through ? armourLevel.glassTakes : 0.5), "ballistic", h.source, out, worldPoint);
|
|
14161
|
-
} else damage(p, laminated ? E * 0.5 : p.hp, "ballistic", h.source, out, worldPoint);
|
|
14342
|
+
damage(p, E * (armourLevel && !through ? armourLevel.glassTakes : 0.5), "ballistic", h.source, out, worldPoint, pieces);
|
|
14343
|
+
} else damage(p, laminated ? E * 0.5 : p.hp, "ballistic", h.source, out, worldPoint, laminated ? pieces : 1);
|
|
14162
14344
|
break;
|
|
14163
14345
|
}
|
|
14164
14346
|
case "rubber": {
|
|
14165
14347
|
push(through);
|
|
14166
|
-
damage(p, E * 0.4, "ballistic", h.source, out, worldPoint);
|
|
14348
|
+
damage(p, E * 0.4, "ballistic", h.source, out, worldPoint, pieces);
|
|
14167
14349
|
if (through && !p.lost && !p.flat) {
|
|
14168
14350
|
if (E >= TYRE_BURST_JOULES || cal >= TYRE_BURST_CALIBER) deflate(p, 1);
|
|
14169
14351
|
else p.airLoss += TYRE_LEAK_PER_MM2 * Math.PI * (cal / 2) ** 2;
|
|
@@ -14180,7 +14362,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14180
14362
|
vis?.spark([v.x, v.y, v.z], [dir.x, dir.y, dir.z], through ? 4 : 8);
|
|
14181
14363
|
let amount = through ? E * 0.6 : E * 0.25;
|
|
14182
14364
|
if (through && (d.role === "battery" || d.role === "alternator")) amount = Math.max(amount, p.hp * 0.65);
|
|
14183
|
-
damage(p, amount, "ballistic", h.source, out, worldPoint);
|
|
14365
|
+
damage(p, amount, "ballistic", h.source, out, worldPoint, pieces);
|
|
14184
14366
|
if (through && d.role === "fuel_tank") rollIgnition(p, h, metal, out);
|
|
14185
14367
|
}
|
|
14186
14368
|
}
|
|
@@ -14251,12 +14433,12 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14251
14433
|
const nearest = Math.min(...model.parts.map((d) => distToBox(d, v)));
|
|
14252
14434
|
if (nearest > radius) return;
|
|
14253
14435
|
if (vis && E >= 3e3) kit.impact(c, v.clone().addScaledVector(dir, -0.1).setY(clamp(v.y, 0.3, 1.2)), dir, clamp(0.4 + E / 6e4, 0.4, 1.4), { noStain: true });
|
|
14254
|
-
burningBlast(v, radius, E, h.source, out);
|
|
14436
|
+
const tankWork = burningBlast(v, radius, E, h.source, out, h.tnt);
|
|
14255
14437
|
const tank = [...ps.values()].find((q) => q.def.role === "fuel_tank" && !q.lost);
|
|
14256
14438
|
if (tank && !exploded) {
|
|
14257
14439
|
const dist = distToBox(tank.def, v);
|
|
14258
14440
|
if (dist <= radius) {
|
|
14259
|
-
const verdict = kit.blastDamage(c,
|
|
14441
|
+
const verdict = kit.blastDamage(c, tankWork);
|
|
14260
14442
|
if (verdict === "explosion") explode(tank, h.source, out);
|
|
14261
14443
|
else if (verdict === "fire") {
|
|
14262
14444
|
light(tank, out);
|
|
@@ -14264,7 +14446,14 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14264
14446
|
}
|
|
14265
14447
|
}
|
|
14266
14448
|
}
|
|
14267
|
-
|
|
14449
|
+
const fireball = h.fireball ?? chargeFireball(E * DEFAULT_BLAST_IMPULSE.tntPerJoule);
|
|
14450
|
+
for (const d of model.parts) {
|
|
14451
|
+
const p = ps.get(d.id);
|
|
14452
|
+
if (p.lost || !d.ignitionC) continue;
|
|
14453
|
+
const needed = ignitionDose(d.ignitionC, AMBIENT);
|
|
14454
|
+
const share = Math.min(1, fireballDose(fireball, distToBox(d, v)) / needed);
|
|
14455
|
+
if (share >= FIREBALL_NOTICE) p.temp = Math.max(p.temp, AMBIENT + (d.ignitionC + 1 - AMBIENT) * share);
|
|
14456
|
+
}
|
|
14268
14457
|
};
|
|
14269
14458
|
const fireHit = (h, out) => {
|
|
14270
14459
|
sync();
|
|
@@ -14660,6 +14849,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14660
14849
|
joints: js.map((j) => [j.def.id, j.hp, j.progress, j.open, j.by ?? null])
|
|
14661
14850
|
}),
|
|
14662
14851
|
partName: (pid) => ps.get(pid)?.def.name ?? pid,
|
|
14852
|
+
objectsOf: (pid) => vis?.objectsOf(pid) ?? [],
|
|
14663
14853
|
status: computeStatus,
|
|
14664
14854
|
animations: () => createVehicleClips(model, vis, kit, c),
|
|
14665
14855
|
crumple: (point, direction, depth) => {
|
|
@@ -14705,7 +14895,7 @@ function createVehicleDestructible(kit, vehicleCtx, options = {}) {
|
|
|
14705
14895
|
if (oil < OIL_NEEDED) engine.hp = Math.max(0, engine.hp - engine.def.hp * OIL_WEAR * work * seconds * ((OIL_NEEDED - oil) / OIL_NEEDED));
|
|
14706
14896
|
if (engineHeat >= ENGINE_STEAM_C && vis && !steaming) {
|
|
14707
14897
|
steaming = true;
|
|
14708
|
-
|
|
14898
|
+
smokeFromBay(engine, "white", 8);
|
|
14709
14899
|
}
|
|
14710
14900
|
if (engineHeat >= ENGINE_SEIZE_C || engine.hp <= engine.def.hp * ENGINE_SEIZE_HP) {
|
|
14711
14901
|
seized = true;
|
|
@@ -14755,14 +14945,14 @@ function buildVehicleItem(kit, key, options = {}) {
|
|
|
14755
14945
|
}
|
|
14756
14946
|
|
|
14757
14947
|
// src/destructible/crease-queue.ts
|
|
14758
|
-
import { DEFERRED_QUEUE_ID } from "@adatechnology/game-contracts";
|
|
14948
|
+
import { DEFERRED_QUEUE_ID as DEFERRED_QUEUE_ID2 } from "@adatechnology/game-contracts";
|
|
14759
14949
|
function createCreaseQueue() {
|
|
14760
14950
|
const tracked = [];
|
|
14761
14951
|
let cursor = 0;
|
|
14762
14952
|
let lastFrame;
|
|
14763
14953
|
let attached = false;
|
|
14764
14954
|
const deferred = {
|
|
14765
|
-
id:
|
|
14955
|
+
id: DEFERRED_QUEUE_ID2.VEHICLE_CREASE,
|
|
14766
14956
|
pending(frame) {
|
|
14767
14957
|
lastFrame = frame;
|
|
14768
14958
|
let units = 0;
|
|
@@ -14776,7 +14966,7 @@ function createCreaseQueue() {
|
|
|
14776
14966
|
if (ran > 0 && clock() >= deadline) break;
|
|
14777
14967
|
const work = tracked[cursor % tracked.length];
|
|
14778
14968
|
cursor = (cursor + 1) % tracked.length;
|
|
14779
|
-
if (work.pendingUnits(lastFrame) > 0 && work.runStep(deadline)) {
|
|
14969
|
+
if (work.pendingUnits(lastFrame) > 0 && work.runStep(deadline, clock)) {
|
|
14780
14970
|
ran++;
|
|
14781
14971
|
skipped = 0;
|
|
14782
14972
|
} else skipped++;
|
|
@@ -14921,19 +15111,153 @@ function cabinEnclosure(source, options = {}) {
|
|
|
14921
15111
|
leak
|
|
14922
15112
|
};
|
|
14923
15113
|
}
|
|
15114
|
+
|
|
15115
|
+
// src/data/cabin.json
|
|
15116
|
+
var cabin_default = {
|
|
15117
|
+
source: "Spec 012 (R6, T0.2) \u2014 SAE J1100 interior packaging & ISO 7250-1 / NASA-STD-3000 adult anthropometry (1.80 m seated height = 0.936 m, buttock-knee = 0.612 m, shoulder = 0.468 m)",
|
|
15118
|
+
entryDuckFactor: 0.44,
|
|
15119
|
+
categories: {
|
|
15120
|
+
passenger_car: {
|
|
15121
|
+
frontHeadroomMetres: 0.95,
|
|
15122
|
+
rearHeadroomMetres: 0.9,
|
|
15123
|
+
frontLegroomMetres: 0.62,
|
|
15124
|
+
widthMetres: 0.52,
|
|
15125
|
+
door: { widthMetres: 0.65, heightMetres: 0.8 }
|
|
15126
|
+
},
|
|
15127
|
+
suv_pickup: {
|
|
15128
|
+
frontHeadroomMetres: 0.98,
|
|
15129
|
+
rearHeadroomMetres: 0.93,
|
|
15130
|
+
frontLegroomMetres: 0.64,
|
|
15131
|
+
widthMetres: 0.54,
|
|
15132
|
+
door: { widthMetres: 0.7, heightMetres: 0.82 }
|
|
15133
|
+
},
|
|
15134
|
+
van: {
|
|
15135
|
+
frontHeadroomMetres: 1.05,
|
|
15136
|
+
rearHeadroomMetres: 1.05,
|
|
15137
|
+
frontLegroomMetres: 0.65,
|
|
15138
|
+
widthMetres: 0.54,
|
|
15139
|
+
door: { widthMetres: 0.75, heightMetres: 0.95 }
|
|
15140
|
+
},
|
|
15141
|
+
truck: {
|
|
15142
|
+
frontHeadroomMetres: 1,
|
|
15143
|
+
rearHeadroomMetres: 1,
|
|
15144
|
+
frontLegroomMetres: 0.62,
|
|
15145
|
+
widthMetres: 0.52,
|
|
15146
|
+
door: { widthMetres: 0.65, heightMetres: 0.85 }
|
|
15147
|
+
},
|
|
15148
|
+
bus: {
|
|
15149
|
+
frontHeadroomMetres: 1.2,
|
|
15150
|
+
rearHeadroomMetres: 1.2,
|
|
15151
|
+
frontLegroomMetres: 0.62,
|
|
15152
|
+
widthMetres: 0.5,
|
|
15153
|
+
door: { widthMetres: 0.7, heightMetres: 1.75 }
|
|
15154
|
+
},
|
|
15155
|
+
agricultural: {
|
|
15156
|
+
frontHeadroomMetres: 1.05,
|
|
15157
|
+
rearHeadroomMetres: null,
|
|
15158
|
+
frontLegroomMetres: 0.62,
|
|
15159
|
+
widthMetres: 0.52,
|
|
15160
|
+
door: { widthMetres: 0.65, heightMetres: 0.9 }
|
|
15161
|
+
},
|
|
15162
|
+
military_light: {
|
|
15163
|
+
frontHeadroomMetres: 0.95,
|
|
15164
|
+
rearHeadroomMetres: 0.92,
|
|
15165
|
+
frontLegroomMetres: 0.62,
|
|
15166
|
+
widthMetres: 0.5,
|
|
15167
|
+
door: { widthMetres: 0.6, heightMetres: 0.8 }
|
|
15168
|
+
},
|
|
15169
|
+
military_armored: {
|
|
15170
|
+
frontHeadroomMetres: 0.88,
|
|
15171
|
+
rearHeadroomMetres: 0.88,
|
|
15172
|
+
frontLegroomMetres: 0.58,
|
|
15173
|
+
widthMetres: 0.46,
|
|
15174
|
+
door: { widthMetres: 0.5, heightMetres: 0.55 }
|
|
15175
|
+
},
|
|
15176
|
+
open_vehicle: {
|
|
15177
|
+
frontHeadroomMetres: null,
|
|
15178
|
+
rearHeadroomMetres: null,
|
|
15179
|
+
frontLegroomMetres: null,
|
|
15180
|
+
widthMetres: null,
|
|
15181
|
+
door: null
|
|
15182
|
+
},
|
|
15183
|
+
boat_cabin: {
|
|
15184
|
+
frontHeadroomMetres: 1.05,
|
|
15185
|
+
rearHeadroomMetres: 1.05,
|
|
15186
|
+
frontLegroomMetres: 0.62,
|
|
15187
|
+
widthMetres: 0.52,
|
|
15188
|
+
door: { widthMetres: 0.6, heightMetres: 0.9 }
|
|
15189
|
+
},
|
|
15190
|
+
aircraft_enclosed: {
|
|
15191
|
+
frontHeadroomMetres: 0.95,
|
|
15192
|
+
rearHeadroomMetres: 0.92,
|
|
15193
|
+
frontLegroomMetres: 0.62,
|
|
15194
|
+
widthMetres: 0.48,
|
|
15195
|
+
door: { widthMetres: 0.55, heightMetres: 0.8 }
|
|
15196
|
+
}
|
|
15197
|
+
}
|
|
15198
|
+
};
|
|
15199
|
+
|
|
15200
|
+
// src/cabin.ts
|
|
15201
|
+
var CABIN_CATEGORIES = [
|
|
15202
|
+
"passenger_car",
|
|
15203
|
+
"suv_pickup",
|
|
15204
|
+
"van",
|
|
15205
|
+
"truck",
|
|
15206
|
+
"bus",
|
|
15207
|
+
"agricultural",
|
|
15208
|
+
"military_light",
|
|
15209
|
+
"military_armored",
|
|
15210
|
+
"open_vehicle",
|
|
15211
|
+
"boat_cabin",
|
|
15212
|
+
"aircraft_enclosed"
|
|
15213
|
+
];
|
|
15214
|
+
var toClearance = (value) => value === null ? Number.POSITIVE_INFINITY : value;
|
|
15215
|
+
var toCabinMinimum = (category, raw) => {
|
|
15216
|
+
if (category === "open_vehicle") {
|
|
15217
|
+
return {
|
|
15218
|
+
frontHeadroomMetres: Number.POSITIVE_INFINITY,
|
|
15219
|
+
rearHeadroomMetres: Number.POSITIVE_INFINITY,
|
|
15220
|
+
frontLegroomMetres: Number.POSITIVE_INFINITY,
|
|
15221
|
+
widthMetres: Number.POSITIVE_INFINITY,
|
|
15222
|
+
door: void 0
|
|
15223
|
+
};
|
|
15224
|
+
}
|
|
15225
|
+
return {
|
|
15226
|
+
frontHeadroomMetres: toClearance(raw.frontHeadroomMetres),
|
|
15227
|
+
rearHeadroomMetres: raw.rearHeadroomMetres === null ? void 0 : raw.rearHeadroomMetres,
|
|
15228
|
+
frontLegroomMetres: toClearance(raw.frontLegroomMetres),
|
|
15229
|
+
widthMetres: toClearance(raw.widthMetres),
|
|
15230
|
+
door: raw.door === null ? void 0 : { widthMetres: raw.door.widthMetres, heightMetres: raw.door.heightMetres }
|
|
15231
|
+
};
|
|
15232
|
+
};
|
|
15233
|
+
var CABIN_SOURCE = cabin_default.source;
|
|
15234
|
+
var ENTRY_DUCK_FACTOR = cabin_default.entryDuckFactor;
|
|
15235
|
+
var CABIN_MINIMUMS = Object.fromEntries(
|
|
15236
|
+
CABIN_CATEGORIES.map((category) => [category, toCabinMinimum(category, cabin_default.categories[category])])
|
|
15237
|
+
);
|
|
15238
|
+
var cabinMinimumOf = (category) => CABIN_MINIMUMS[category];
|
|
14924
15239
|
export {
|
|
14925
15240
|
ARMOUR_LEVELS,
|
|
15241
|
+
CABIN_CATEGORIES,
|
|
14926
15242
|
CABIN_LEAK,
|
|
15243
|
+
CABIN_MINIMUMS,
|
|
15244
|
+
CABIN_SOURCE,
|
|
14927
15245
|
CRASH_RULES,
|
|
15246
|
+
ENTRY_DUCK_FACTOR,
|
|
14928
15247
|
JOINT_RULES,
|
|
14929
15248
|
LEGACY_STATES,
|
|
14930
15249
|
LEGACY_ZONE_IDS,
|
|
15250
|
+
PLUME_PUFFS,
|
|
14931
15251
|
SEED_SALTS,
|
|
15252
|
+
SMOKE_LOOKS,
|
|
15253
|
+
SMOKE_WIND,
|
|
15254
|
+
SmokeCause,
|
|
14932
15255
|
armourLevelOf,
|
|
14933
15256
|
buildVehicleItem,
|
|
14934
15257
|
buildVehicleModel,
|
|
14935
15258
|
cabinBoxOf,
|
|
14936
15259
|
cabinEnclosure,
|
|
15260
|
+
cabinMinimumOf,
|
|
14937
15261
|
clamp,
|
|
14938
15262
|
crackedGlassMaterial,
|
|
14939
15263
|
crashDeltaV,
|
|
@@ -14945,6 +15269,7 @@ export {
|
|
|
14945
15269
|
createVehicleKit,
|
|
14946
15270
|
defaultDamageableKinds,
|
|
14947
15271
|
defaultLodSettings,
|
|
15272
|
+
engineBayVent,
|
|
14948
15273
|
format,
|
|
14949
15274
|
hash,
|
|
14950
15275
|
legacyGlassId,
|
|
@@ -14955,6 +15280,9 @@ export {
|
|
|
14955
15280
|
registerLocale,
|
|
14956
15281
|
resolveStrings,
|
|
14957
15282
|
rng,
|
|
15283
|
+
smokeCauseOfEmitter,
|
|
15284
|
+
smokePuff,
|
|
15285
|
+
smokeRate,
|
|
14958
15286
|
smooth,
|
|
14959
15287
|
strHash,
|
|
14960
15288
|
strayLampsOf,
|