@adatechnology/game-urban 0.3.1 → 0.3.3
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 +44 -10
- package/dist/index.global.js.map +1 -1
- package/package.json +3 -3
package/dist/index.global.js
CHANGED
|
@@ -99,6 +99,7 @@ var GameUrban = (() => {
|
|
|
99
99
|
var createLightBudget = createLightAllowance;
|
|
100
100
|
|
|
101
101
|
// ../game-contracts/dist/index.js
|
|
102
|
+
var DEFAULT_BLAST_IMPULSE = { bodyArea: 0.7, lift: 0.15, minSpeed: 0.3, tntPerJoule: 0.24 / 2e5 };
|
|
102
103
|
var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
|
|
103
104
|
var DEFERRED_QUEUE_ID = {
|
|
104
105
|
DESTRUCTION_EVENTS: "destruction.events",
|
|
@@ -9209,6 +9210,18 @@ var GameUrban = (() => {
|
|
|
9209
9210
|
}
|
|
9210
9211
|
);
|
|
9211
9212
|
}
|
|
9213
|
+
var WIPER_SWEEP = 1.5;
|
|
9214
|
+
function tagWiper(params) {
|
|
9215
|
+
var _a;
|
|
9216
|
+
const tag = { arm: params.index, sweep: WIPER_SWEEP, spindle: [params.spindle.x, params.spindle.y, params.spindle.z], axis: [params.normal.x, params.normal.y, params.normal.z] };
|
|
9217
|
+
(_a = params.context).wipers ?? (_a.wipers = []);
|
|
9218
|
+
for (const part of params.parts) params.context.wipers.push({ part, tag });
|
|
9219
|
+
}
|
|
9220
|
+
function markSunroof(pane2, slide) {
|
|
9221
|
+
pane2.name = "sunroof";
|
|
9222
|
+
pane2.userData.sunroof = { slide };
|
|
9223
|
+
return pane2;
|
|
9224
|
+
}
|
|
9212
9225
|
function installCarsExtra(fx) {
|
|
9213
9226
|
const kit = fx.kit;
|
|
9214
9227
|
const THREE = kit.THREE;
|
|
@@ -9705,7 +9718,7 @@ var GameUrban = (() => {
|
|
|
9705
9718
|
off: 3e-3,
|
|
9706
9719
|
nv: 4
|
|
9707
9720
|
});
|
|
9708
|
-
skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
|
|
9721
|
+
const reflector = skin(c, Gd, o.refl || REFL, { u0: pu, u1: 1 - pu, yb, yt, off: 6e-3, nv: 4 });
|
|
9709
9722
|
(o.proj || []).forEach(function(q) {
|
|
9710
9723
|
const r = sh(q[0]), y = (r[0] + r[1]) / 2 + (q[1] || 0), s = Gd.at(q[0], y), rad = q[2] || Math.min(0.034, (r[1] - r[0]) * 0.4);
|
|
9711
9724
|
const cup = onSurf(c.cylinder(rad * 1.35, rad * 1.2, 0.012, LH, 0, 0, 0), s, 8e-3);
|
|
@@ -9736,7 +9749,7 @@ var GameUrban = (() => {
|
|
|
9736
9749
|
lens.push(ln);
|
|
9737
9750
|
if (!inner2.length) inner2.push(ln);
|
|
9738
9751
|
const cs = Gd.at(0.5, (rg[0] + rg[1]) / 2).p;
|
|
9739
|
-
regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs);
|
|
9752
|
+
Object.assign(regLight(c, "headlight", o.label || (sd > 0 ? trl("labels.right_headlight") : trl("labels.left_headlight")), inner2, lens, cs), { reflector: [reflector] });
|
|
9740
9753
|
return Gd;
|
|
9741
9754
|
};
|
|
9742
9755
|
K.tail = function(sd, o) {
|
|
@@ -10122,12 +10135,18 @@ var GameUrban = (() => {
|
|
|
10122
10135
|
(s.wiper === 1 ? [[0.12, 0.66, -0.5]] : [
|
|
10123
10136
|
[-0.3, 0.42, -0.36],
|
|
10124
10137
|
[0.2, 0.42, -0.36]
|
|
10125
|
-
]).forEach(function(q) {
|
|
10138
|
+
]).forEach(function(q, index) {
|
|
10126
10139
|
const p0 = new V3(gh.fb, gh.belt, q[0]).addScaledVector(wd, 0.07).addScaledVector(wn, 0.035), p1 = p0.clone().addScaledVector(wd, q[1] * 0.42);
|
|
10127
10140
|
p1.z += q[2];
|
|
10128
|
-
c.rod(p0, p1, 9e-3, MT.trim);
|
|
10129
|
-
c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
|
|
10141
|
+
const blade = c.rod(p0, p1, 9e-3, MT.trim);
|
|
10142
|
+
const cap = c.cylinder(0.018, 0.018, 0.03, MT.trim, p0.x, p0.y, p0.z);
|
|
10143
|
+
tagWiper({ context: c, parts: [blade, cap], spindle: p0, normal: wn, index });
|
|
10130
10144
|
});
|
|
10145
|
+
if (s.sunroof) {
|
|
10146
|
+
const sx = gh.rt + (gh.ft - gh.rt) * 0.62, sl = 0.62, sw = 2 * (halfAt(gh.Wg, T, gh.roof) - 0.24), sy = roofAt(gh, sx), tilt = Math.atan2(roofAt(gh, sx + 0.3) - roofAt(gh, sx - 0.3), 0.6);
|
|
10147
|
+
c.roundBox(sl, 8e-3, sw, 0.01, PLASTIC, sx, sy + 4e-3, 0, { rot: [0, 0, tilt] }).castShadow = false;
|
|
10148
|
+
markSunroof(c.roundBox(sl + 0.03, 0.012, sw + 0.03, 0.01, MT.tint, sx, sy + 0.013, 0, { rot: [0, 0, tilt] }), sl * 0.85);
|
|
10149
|
+
}
|
|
10131
10150
|
if (s.fin !== false)
|
|
10132
10151
|
c.sphere(0.1, s.roofCol ? c.paint(s.roofCol) : GLOSS, gh.rt + 0.2, roofAt(gh, gh.rt + 0.2) + 0.045, 0, 1, 0.45, 0.28, {
|
|
10133
10152
|
tl: PI / 2
|
|
@@ -10259,7 +10278,9 @@ var GameUrban = (() => {
|
|
|
10259
10278
|
function fogLamp(c, s, r) {
|
|
10260
10279
|
onSurf(c.cylinder(r * 1.4, r * 1.4, 0.014, LH, 0, 0, 0), s, 6e-3).castShadow = false;
|
|
10261
10280
|
onSurf(c.cylinder(r, r, 0.012, REFL, 0, 0, 0), s, 0.012).castShadow = false;
|
|
10262
|
-
onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016)
|
|
10281
|
+
const bulb = onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016);
|
|
10282
|
+
bulb.castShadow = false;
|
|
10283
|
+
(c.fogBulbs ?? (c.fogBulbs = [])).push(bulb);
|
|
10263
10284
|
}
|
|
10264
10285
|
function crease(c, I, sd, pts, o) {
|
|
10265
10286
|
o = o || {};
|
|
@@ -11101,6 +11122,7 @@ var GameUrban = (() => {
|
|
|
11101
11122
|
function(c) {
|
|
11102
11123
|
const hex = "#8c2b2b";
|
|
11103
11124
|
car(c, {
|
|
11125
|
+
sunroof: fx.hasSunroof("turbo_hatch"),
|
|
11104
11126
|
W: 1.751,
|
|
11105
11127
|
col: hex,
|
|
11106
11128
|
shelf: 0.42,
|
|
@@ -11378,6 +11400,7 @@ var GameUrban = (() => {
|
|
|
11378
11400
|
function(c) {
|
|
11379
11401
|
const hex = "#5a5f66";
|
|
11380
11402
|
car(c, {
|
|
11403
|
+
sunroof: fx.hasSunroof("fastback_sedan"),
|
|
11381
11404
|
W: 1.799,
|
|
11382
11405
|
col: hex,
|
|
11383
11406
|
bottomY: 0.2,
|
|
@@ -11672,6 +11695,8 @@ var GameUrban = (() => {
|
|
|
11672
11695
|
fx.register(
|
|
11673
11696
|
{
|
|
11674
11697
|
key: "classic_six_sedan",
|
|
11698
|
+
// glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
|
|
11699
|
+
headlightLens: "glass",
|
|
11675
11700
|
group: "cars",
|
|
11676
11701
|
name: trl("vehicles.classic_six_sedan.name"),
|
|
11677
11702
|
inspired: trl("vehicles.classic_six_sedan.inspired"),
|
|
@@ -19127,8 +19152,11 @@ var GameUrban = (() => {
|
|
|
19127
19152
|
);
|
|
19128
19153
|
});
|
|
19129
19154
|
const wy = gh.belt + 0.06, wx = gh.fb - 0.03;
|
|
19130
|
-
[-0.3, 0.2].forEach(function(z) {
|
|
19131
|
-
|
|
19155
|
+
[-0.3, 0.2].forEach(function(z, index) {
|
|
19156
|
+
const spindle = new V3(wx + 0.02, wy, z + 0.02);
|
|
19157
|
+
const blade = c.rod(spindle, new V3(wx - 0.13, wy + 0.13, z - 0.36), 9e-3, MT.trim);
|
|
19158
|
+
const along = new V3(gh.ft - gh.fb, gh.roof - gh.belt, 0).normalize();
|
|
19159
|
+
tagWiper({ context: c, parts: [blade], spindle, normal: new V3(along.y, -along.x, 0), index });
|
|
19132
19160
|
});
|
|
19133
19161
|
if (s.fin !== false)
|
|
19134
19162
|
c.sphere(0.1, s.roofCol ? c.paint(s.roofCol) : GLOSS, gh.rt + 0.2, roofAt(gh, gh.rt + 0.2) + 0.045, 0, 1, 0.45, 0.28, {
|
|
@@ -19261,7 +19289,9 @@ var GameUrban = (() => {
|
|
|
19261
19289
|
function fogLamp(c, s, r) {
|
|
19262
19290
|
onSurf(c.cylinder(r * 1.4, r * 1.4, 0.014, LH, 0, 0, 0), s, 6e-3).castShadow = false;
|
|
19263
19291
|
onSurf(c.cylinder(r, r, 0.012, REFL, 0, 0, 0), s, 0.012).castShadow = false;
|
|
19264
|
-
onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016)
|
|
19292
|
+
const bulb = onSurf(c.sphere(r * 0.45, MT.head, 0, 0, 0, 1, 0.5, 1), s, 0.016);
|
|
19293
|
+
bulb.castShadow = false;
|
|
19294
|
+
(c.fogBulbs ?? (c.fogBulbs = [])).push(bulb);
|
|
19265
19295
|
}
|
|
19266
19296
|
function crease(c, I, sd, pts, o) {
|
|
19267
19297
|
o = o || {};
|
|
@@ -22202,6 +22232,8 @@ var GameUrban = (() => {
|
|
|
22202
22232
|
fx.register(
|
|
22203
22233
|
{
|
|
22204
22234
|
key: "beetle",
|
|
22235
|
+
// glass headlight lenses, as on cars of its time: they shatter (a modern car's are polycarbonate)
|
|
22236
|
+
headlightLens: "glass",
|
|
22205
22237
|
group: "cars",
|
|
22206
22238
|
name: trl("vehicles.beetle.name"),
|
|
22207
22239
|
inspired: trl("vehicles.beetle.inspired"),
|
|
@@ -26470,7 +26502,7 @@ var GameUrban = (() => {
|
|
|
26470
26502
|
const x = kit.profX(s.lower, s.bottomY + 0.14, true) + 0.09;
|
|
26471
26503
|
[1, -1].forEach(function(sd) {
|
|
26472
26504
|
c.roundBox(0.04, r * 2.6, r * 3.2, 0.015, MT.housing, x, y, sd * z);
|
|
26473
|
-
kit.headlight(c, {
|
|
26505
|
+
const lamp = kit.headlight(c, {
|
|
26474
26506
|
style: "round",
|
|
26475
26507
|
x: x + 0.01,
|
|
26476
26508
|
y,
|
|
@@ -26482,6 +26514,7 @@ var GameUrban = (() => {
|
|
|
26482
26514
|
label: sd > 0 ? trl("labels.right_fog_light") : trl("labels.left_fog_light"),
|
|
26483
26515
|
reach: 0.5
|
|
26484
26516
|
});
|
|
26517
|
+
lamp.fog = true;
|
|
26485
26518
|
});
|
|
26486
26519
|
}
|
|
26487
26520
|
function roofBars(c, z, h, r) {
|
|
@@ -31402,6 +31435,7 @@ var GameUrban = (() => {
|
|
|
31402
31435
|
shared,
|
|
31403
31436
|
t,
|
|
31404
31437
|
label: (key) => ({ key, label: t("labels." + key) }),
|
|
31438
|
+
hasSunroof: (key) => !!options.sunroofs?.includes(key),
|
|
31405
31439
|
register(spec, build) {
|
|
31406
31440
|
if (!groups.has(spec.group) || only && !only.has(spec.key) || skip.has(spec.key)) return;
|
|
31407
31441
|
kit.register({ ...spec, seedKey: legacyVehicleSeeds[spec.key] }, build);
|