@adatechnology/game-items-three 0.11.8 → 0.13.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/{chunk-64JEKMFT.js → chunk-FCEKW7F6.js} +658 -442
- package/dist/chunk-FCEKW7F6.js.map +1 -0
- package/dist/index.d.ts +53 -4
- package/dist/index.global.js +1955 -1006
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-D2tqWTG4.d.ts → testing-DbKHUIwv.d.ts} +8 -2
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +16 -16
- package/dist/chunk-64JEKMFT.js.map +0 -1
|
@@ -342,6 +342,264 @@ function tagMakeupParts(root, modelId) {
|
|
|
342
342
|
});
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
+
// src/shapes.ts
|
|
346
|
+
var SHAPES = [
|
|
347
|
+
"can",
|
|
348
|
+
"bag",
|
|
349
|
+
"box",
|
|
350
|
+
"bottle",
|
|
351
|
+
"tool",
|
|
352
|
+
"roll",
|
|
353
|
+
"dish",
|
|
354
|
+
"cloth",
|
|
355
|
+
"shoe",
|
|
356
|
+
"jar",
|
|
357
|
+
"paper",
|
|
358
|
+
"fruit",
|
|
359
|
+
"cup",
|
|
360
|
+
"tube",
|
|
361
|
+
"blade",
|
|
362
|
+
"long_tool",
|
|
363
|
+
"garment",
|
|
364
|
+
"backpack",
|
|
365
|
+
"jerrycan",
|
|
366
|
+
"tank",
|
|
367
|
+
"book",
|
|
368
|
+
"key",
|
|
369
|
+
"battery",
|
|
370
|
+
"plank",
|
|
371
|
+
"device"
|
|
372
|
+
];
|
|
373
|
+
var DEFAULT_COLOR = 9080724;
|
|
374
|
+
var PI = Math.PI;
|
|
375
|
+
function shade(color, factor) {
|
|
376
|
+
const channel = (shift) => Math.max(0, Math.min(255, Math.round((color >> shift & 255) * factor)));
|
|
377
|
+
return channel(16) << 16 | channel(8) << 8 | channel(0);
|
|
378
|
+
}
|
|
379
|
+
var PROUD = 2e-3;
|
|
380
|
+
var seg = (c, n) => Math.max(5, Math.round(n * c.detail));
|
|
381
|
+
function canonicalFrame(size) {
|
|
382
|
+
const [w, h, d] = size;
|
|
383
|
+
if (h >= w && h >= d) return { axis: 1, L: h, a: w, b: d };
|
|
384
|
+
if (d >= w && d >= h) return { axis: 2, L: d, a: h, b: w };
|
|
385
|
+
return { axis: 0, L: w, a: h, b: d };
|
|
386
|
+
}
|
|
387
|
+
function orient(c, group, axis) {
|
|
388
|
+
if (axis === 0) return group;
|
|
389
|
+
const holder = c.k.G(group);
|
|
390
|
+
if (axis === 1) holder.rotation.z = PI / 2;
|
|
391
|
+
else holder.rotation.y = -PI / 2;
|
|
392
|
+
return holder;
|
|
393
|
+
}
|
|
394
|
+
var alongLong = (draw) => (c) => {
|
|
395
|
+
const { axis, L, a, b } = canonicalFrame([c.w, c.h, c.d]);
|
|
396
|
+
return orient(c, draw(c, L, a, b), axis);
|
|
397
|
+
};
|
|
398
|
+
var across = (c, group) => {
|
|
399
|
+
group.scale.set(c.w, 1, c.d);
|
|
400
|
+
return c.k.G(group);
|
|
401
|
+
};
|
|
402
|
+
var can = (c) => {
|
|
403
|
+
const { k, h } = c;
|
|
404
|
+
const body = k.metal(9277590);
|
|
405
|
+
const r = 0.5 - PROUD / Math.min(c.w, c.d);
|
|
406
|
+
return across(c, k.G(k.mesh(k.cyl(r, r, h * 0.94, seg(c, 14)), body), k.mesh(k.cyl(0.5, 0.5, h * 0.5, seg(c, 14)), k.food(c.color)), k.mesh(k.cyl(0.5, 0.5, h * 0.03, seg(c, 14)), body, [0, h * 0.485, 0]), k.mesh(k.cyl(0.5, 0.5, h * 0.03, seg(c, 14)), body, [0, -h * 0.485, 0])));
|
|
407
|
+
};
|
|
408
|
+
var bottle = (c) => {
|
|
409
|
+
const { k, h } = c;
|
|
410
|
+
const r = 0.5;
|
|
411
|
+
const profile = [[0, -h / 2], [r, -h / 2], [r, h * 0.12], [r * 0.45, h * 0.3], [r * 0.4, h * 0.4], [0, h * 0.4]];
|
|
412
|
+
return across(c, k.G(k.mesh(k.lathe(profile, seg(c, 14)), k.glass(c.color, 0.6)), k.mesh(k.cyl(r * 0.42, r * 0.42, h * 0.1, seg(c, 10)), k.plastic(shade(c.color, 0.5)), [0, h * 0.45, 0])));
|
|
413
|
+
};
|
|
414
|
+
var jar = (c) => {
|
|
415
|
+
const { k, h } = c;
|
|
416
|
+
return across(c, k.G(k.mesh(k.cyl(0.5, 0.5, h * 0.82, seg(c, 14)), k.glass(c.color, 0.55), [0, -h * 0.09, 0]), k.mesh(k.cyl(0.5, 0.5, h * 0.18, seg(c, 14)), k.metal(12095802), [0, h * 0.41, 0])));
|
|
417
|
+
};
|
|
418
|
+
var bag = (c) => {
|
|
419
|
+
const { k, w, h, d } = c;
|
|
420
|
+
return k.G(k.mesh(k.bx(w, h * 0.88, d - 2 * PROUD), k.paper(c.color), [0, -h * 0.06, 0]), k.mesh(k.bx(w * 1, h * 0.12, d * 0.5), k.paper(shade(c.color, 0.85)), [0, h * 0.44, 0]), k.mesh(k.bx(w * 0.7, h * 0.3, d), k.paper(shade(c.color, 1.2)), [0, 0, 0]));
|
|
421
|
+
};
|
|
422
|
+
var box = (c) => {
|
|
423
|
+
const { k, w, h, d } = c;
|
|
424
|
+
return k.G(k.mesh(k.bx(w - 2 * PROUD, h - PROUD, d - 2 * PROUD), k.paper(c.color), [0, -PROUD / 2, 0]), k.mesh(k.bx(w, h * 0.12, d), k.paper(shade(c.color, 0.8)), [0, h * 0.44, 0]), k.mesh(k.bx(w * 0.62, h * 0.4, d), k.paper(shade(c.color, 1.25)), [0, -h * 0.02, 0]));
|
|
425
|
+
};
|
|
426
|
+
var cloth = (c) => {
|
|
427
|
+
const { k, w, h, d } = c;
|
|
428
|
+
const material = k.cloth(c.color);
|
|
429
|
+
return k.G(k.mesh(k.bx(w, h * 0.55, d), material, [0, -h * 0.225, 0]), k.mesh(k.bx(w * 0.96, h * 0.45, d * 0.96), k.cloth(shade(c.color, 0.9)), [0, h * 0.275, 0]));
|
|
430
|
+
};
|
|
431
|
+
var paper = (c) => {
|
|
432
|
+
const { k, w, h, d } = c;
|
|
433
|
+
const sheet = k.paper(c.color);
|
|
434
|
+
return k.G(k.mesh(k.bx(w, h / 3, d), sheet, [0, -h / 3, 0]), k.mesh(k.bx(w * 0.98, h / 3, d * 0.98), k.paper(shade(c.color, 0.95)), [0, 0, 0]), k.mesh(k.bx(w, h / 3, d), sheet, [0, h / 3, 0]));
|
|
435
|
+
};
|
|
436
|
+
var fruit = (c) => {
|
|
437
|
+
const { k, w, h, d } = c;
|
|
438
|
+
const sphere = new k.T.SphereGeometry(0.5, seg(c, 12), seg(c, 8));
|
|
439
|
+
return k.G(k.mesh(sphere, k.food(c.color), [0, -h * 0.04, 0], [0, 0, 0], [w, h * 0.92, d]), k.mesh(k.cyl(h * 0.02, h * 0.02, h * 0.1, 6), k.wood(5913122), [0, h * 0.45, 0]));
|
|
440
|
+
};
|
|
441
|
+
var dish = (c) => {
|
|
442
|
+
const { k, w, h, d } = c;
|
|
443
|
+
return k.G(k.mesh(k.cyl(0.5, 0.35, h, seg(c, 16)), k.plastic(c.color), [0, 0, 0], [0, 0, 0], [w, 1, d]));
|
|
444
|
+
};
|
|
445
|
+
var CUP_FLOOR_SHARE = 0.06;
|
|
446
|
+
var cup = (c) => {
|
|
447
|
+
const { k, w, h, d } = c;
|
|
448
|
+
const floor = -h / 2 + h * CUP_FLOOR_SHARE;
|
|
449
|
+
const profile = [[0, -h / 2], [0.38, -h / 2], [0.5, h / 2], [0.44, h / 2], [0.33, floor], [0, floor]];
|
|
450
|
+
return k.G(k.mesh(k.lathe(profile, seg(c, 14)), k.plastic(c.color), [0, 0, 0], [0, 0, 0], [w, 1, d]));
|
|
451
|
+
};
|
|
452
|
+
var tube = (c) => {
|
|
453
|
+
const { k, h } = c;
|
|
454
|
+
const material = k.plastic(c.color);
|
|
455
|
+
return across(c, k.G(k.mesh(k.cyl(0.5, 0.42, h * 0.86, seg(c, 12)), material, [0, -h * 0.04, 0]), k.mesh(k.cyl(0.35, 0.35, h * 0.12, seg(c, 12)), k.plastic(shade(c.color, 0.6)), [0, h * 0.44, 0]), k.mesh(k.bx(1, h * 0.06, 0.25), material, [0, -h * 0.47, 0])));
|
|
456
|
+
};
|
|
457
|
+
var roll = (c) => {
|
|
458
|
+
const { k, w, h, d } = c;
|
|
459
|
+
const body = k.G(k.mesh(k.cyl(0.5, 0.5, 1, seg(c, 18)), k.paper(c.color)), k.mesh(k.cyl(0.18, 0.18, 0.98, seg(c, 12)), k.paper(11902328)));
|
|
460
|
+
if (h <= w && h <= d) body.scale.set(w, h, d);
|
|
461
|
+
else if (w <= d) {
|
|
462
|
+
body.rotation.z = PI / 2;
|
|
463
|
+
body.scale.set(h, w, d);
|
|
464
|
+
} else {
|
|
465
|
+
body.rotation.x = PI / 2;
|
|
466
|
+
body.scale.set(w, d, h);
|
|
467
|
+
}
|
|
468
|
+
return k.G(body);
|
|
469
|
+
};
|
|
470
|
+
var shoe = (c) => {
|
|
471
|
+
const { k, w, h, d } = c;
|
|
472
|
+
const upper = k.cloth(c.color);
|
|
473
|
+
return k.G(k.mesh(k.bx(w, h * 0.22, d), k.plastic(2237727), [0, -h * 0.39, 0]), k.mesh(k.bx(w * 0.42, h * 0.78, d * 0.96), upper, [-w * 0.29, h * 0.11, 0]), k.mesh(k.bx(w * 0.5, h * 0.5, d * 0.96), upper, [w * 0.25, -h * 0.03, 0]));
|
|
474
|
+
};
|
|
475
|
+
var tool = alongLong((c, L, a, b) => {
|
|
476
|
+
const { k } = c;
|
|
477
|
+
const radius = Math.max(4e-3, Math.min(a, b) / 2);
|
|
478
|
+
return k.G(k.mesh(k.cyl(radius, radius, L * 0.74, seg(c, 10)), k.wood(9069628), [-L * 0.13, 0, 0], [0, 0, PI / 2]), k.mesh(k.bx(L * 0.26, a, b), k.metal(shade(c.color, 1)), [L * 0.37, 0, 0]));
|
|
479
|
+
});
|
|
480
|
+
var longTool = alongLong((c, L, a, b) => {
|
|
481
|
+
const { k } = c;
|
|
482
|
+
const radius = Math.max(4e-3, Math.min(a, b) / 2) * 0.55;
|
|
483
|
+
return k.G(k.mesh(k.cyl(radius, radius, L * 0.94, seg(c, 10)), k.wood(10122312), [0, 0, 0], [0, 0, PI / 2]), k.mesh(k.bx(L * 0.12, a, b), k.metal(c.color), [L * 0.44, 0, 0]));
|
|
484
|
+
});
|
|
485
|
+
var blade = alongLong((c, L, a, b) => {
|
|
486
|
+
const { k } = c;
|
|
487
|
+
const edge = Math.min(2e-4, b * 0.05);
|
|
488
|
+
const steel = k.extrude([[0, 0], [L * 0.66, 0], [L * 0.68, a * 0.4], [0, a]], Math.max(5e-4, b * 0.4 - 2 * edge), edge);
|
|
489
|
+
return k.G(k.mesh(steel, k.metal(11120048), [-L * 0.18, -a / 2, -b * 0.2 + edge]), k.mesh(k.bx(L * 0.34, a * 0.6, b), k.wood(3877408), [-L * 0.33, 0, 0]));
|
|
490
|
+
});
|
|
491
|
+
var garment = (c) => {
|
|
492
|
+
const { k, w, h, d } = c;
|
|
493
|
+
const material = k.cloth(c.color);
|
|
494
|
+
return k.G(k.mesh(k.bx(w * 0.56, h, d), material), k.mesh(k.bx(w * 0.22, h * 0.42, d * 0.9), material, [-w * 0.39, h * 0.29, 0]), k.mesh(k.bx(w * 0.22, h * 0.42, d * 0.9), material, [w * 0.39, h * 0.29, 0]));
|
|
495
|
+
};
|
|
496
|
+
var backpack = (c) => {
|
|
497
|
+
const { k, w, h, d } = c;
|
|
498
|
+
const material = k.cloth(c.color);
|
|
499
|
+
const dome = new k.T.SphereGeometry(0.5, seg(c, 12), seg(c, 6), 0, PI * 2, 0, PI / 2);
|
|
500
|
+
const strap = k.cloth(shade(c.color, 0.6));
|
|
501
|
+
return k.G(k.mesh(k.bx(w, h * 0.78, d * 0.68), material, [0, -h * 0.11, -d * 0.14]), k.mesh(dome, material, [0, h * 0.28, -d * 0.14], [0, 0, 0], [w, h * 0.44, d * 0.68]), k.mesh(k.bx(w * 0.7, h * 0.4, d * 0.3), k.cloth(shade(c.color, 0.75)), [0, -h * 0.18, d * 0.35]), k.mesh(k.bx(w * 0.1, h * 0.7, d * 0.04), strap, [-w * 0.25, -h * 0.05, -d * 0.48]), k.mesh(k.bx(w * 0.1, h * 0.7, d * 0.04), strap, [w * 0.25, -h * 0.05, -d * 0.48]));
|
|
502
|
+
};
|
|
503
|
+
var jerrycan = (c) => {
|
|
504
|
+
const { k, w, h, d } = c;
|
|
505
|
+
const material = k.plastic(c.color);
|
|
506
|
+
return k.G(k.mesh(k.bx(w, h * 0.86, d), material, [0, -h * 0.07, 0]), k.mesh(k.bx(w * 0.4, h * 0.1, d * 0.5), material, [-w * 0.2, h * 0.45, 0]), k.mesh(k.cyl(d * 0.14, d * 0.18, h * 0.12, seg(c, 10)), k.plastic(14263361), [w * 0.3, h * 0.44, 0]));
|
|
507
|
+
};
|
|
508
|
+
var tank = (c) => {
|
|
509
|
+
const { k, h } = c;
|
|
510
|
+
const r = 0.5;
|
|
511
|
+
const profile = [[0, -h / 2], [r * 0.9, -h / 2], [r, -h * 0.4], [r, h * 0.22], [r * 0.6, h * 0.36], [r * 0.2, h * 0.4], [0, h * 0.4]];
|
|
512
|
+
const metal = k.metal(c.color);
|
|
513
|
+
return across(c, k.G(k.mesh(k.lathe(profile, seg(c, 14)), metal), k.mesh(k.cyl(r * 0.62, r * 0.62, h * 0.05, seg(c, 14)), metal, [0, h * 0.3, 0]), k.mesh(k.cyl(r * 0.18, r * 0.18, h * 0.12, seg(c, 8)), k.metal(12095802), [0, h * 0.44, 0])));
|
|
514
|
+
};
|
|
515
|
+
var book = (c) => {
|
|
516
|
+
const { k, w, h, d } = c;
|
|
517
|
+
const cover = k.paper(c.color);
|
|
518
|
+
return k.G(k.mesh(k.bx(w - PROUD, h - 2 * PROUD, d * 0.14), cover, [PROUD / 2, 0, d * 0.43 - PROUD]), k.mesh(k.bx(w - PROUD, h - 2 * PROUD, d * 0.14), cover, [PROUD / 2, 0, -d * 0.43 + PROUD]), k.mesh(k.bx(w * 0.94, h * 0.96, d * 0.72), k.paper(15327692), [w * 0.02, 0, 0]), k.mesh(k.bx(w * 0.08, h, d), k.paper(shade(c.color, 0.8)), [-w * 0.46, 0, 0]));
|
|
519
|
+
};
|
|
520
|
+
var key = alongLong((c, L, a, b) => {
|
|
521
|
+
const { k } = c;
|
|
522
|
+
const metal = k.metal(12095802);
|
|
523
|
+
const ring = a * 0.5;
|
|
524
|
+
const tube2 = Math.min(b * 0.4, ring * 0.2);
|
|
525
|
+
return k.G(k.mesh(new c.k.T.TorusGeometry(ring * 0.8, tube2, 5, seg(c, 10)), k.metal(10132896), [-L / 2 + ring * 0.8 + tube2, 0, 0]), k.mesh(k.bx(L * 0.62, a * 0.28, b), metal, [L * 0.12, 0, 0]), k.mesh(k.bx(L * 0.08, a * 0.17, b), metal, [L * 0.36, -a * 0.225, 0]), k.mesh(k.bx(L * 0.06, a * 0.17, b), metal, [L * 0.2, -a * 0.225, 0]));
|
|
526
|
+
});
|
|
527
|
+
var battery = alongLong((c, L, a, b) => {
|
|
528
|
+
const { k } = c;
|
|
529
|
+
const r = Math.min(a, b) / 2;
|
|
530
|
+
return k.G(k.mesh(k.cyl(r, r, L * 0.94, seg(c, 14)), k.metal(c.color), [0, 0, 0], [0, 0, PI / 2]), k.mesh(k.cyl(r * 0.36, r * 0.36, L * 0.06, seg(c, 8)), k.metal(12172736), [L * 0.47, 0, 0], [0, 0, PI / 2]));
|
|
531
|
+
});
|
|
532
|
+
var plank = alongLong((c, L, a, b) => {
|
|
533
|
+
const { k } = c;
|
|
534
|
+
const nail = k.metal(8225158);
|
|
535
|
+
return k.G(k.mesh(k.bx(L, a, b), k.wood(11043929)), k.mesh(k.cyl(Math.min(a, b) * 0.1, Math.min(a, b) * 0.1, b * 0.98, 6), nail, [-L * 0.4, 0, 0], [PI / 2, 0, 0]), k.mesh(k.cyl(Math.min(a, b) * 0.1, Math.min(a, b) * 0.1, b * 0.98, 6), nail, [L * 0.4, 0, 0], [PI / 2, 0, 0]));
|
|
536
|
+
});
|
|
537
|
+
var device = (c) => {
|
|
538
|
+
const { k, w, h, d } = c;
|
|
539
|
+
const screen = k.M(10469258, "glass", { emissive: 3099170, emissiveIntensity: 0.6, roughness: 0.2 });
|
|
540
|
+
return k.G(k.mesh(k.bx(w, h, d * 0.96), k.plastic(c.color), [0, 0, -d * 0.02]), k.mesh(k.bx(w * 0.7, h * 0.32, d * 0.06), screen, [0, h * 0.22, d * 0.47]), k.mesh(k.cyl(Math.min(w, h) * 0.08, Math.min(w, h) * 0.08, d * 0.1, seg(c, 8)), k.metal(12172736), [w * 0.25, -h * 0.18, d * 0.45], [PI / 2, 0, 0]));
|
|
541
|
+
};
|
|
542
|
+
var DRAWERS = {
|
|
543
|
+
can,
|
|
544
|
+
bag,
|
|
545
|
+
box,
|
|
546
|
+
bottle,
|
|
547
|
+
tool,
|
|
548
|
+
roll,
|
|
549
|
+
dish,
|
|
550
|
+
cloth,
|
|
551
|
+
shoe,
|
|
552
|
+
jar,
|
|
553
|
+
paper,
|
|
554
|
+
fruit,
|
|
555
|
+
cup,
|
|
556
|
+
tube,
|
|
557
|
+
blade,
|
|
558
|
+
long_tool: longTool,
|
|
559
|
+
garment,
|
|
560
|
+
backpack,
|
|
561
|
+
jerrycan,
|
|
562
|
+
tank,
|
|
563
|
+
book,
|
|
564
|
+
key,
|
|
565
|
+
battery,
|
|
566
|
+
plank,
|
|
567
|
+
device
|
|
568
|
+
};
|
|
569
|
+
var isShape = (value) => value !== void 0 && value in DRAWERS;
|
|
570
|
+
function shapeOf(subject) {
|
|
571
|
+
const hint = subject.shape;
|
|
572
|
+
if (!isShape(hint)) return "box";
|
|
573
|
+
const [w, h, d] = subject.size;
|
|
574
|
+
const { L, a, b } = canonicalFrame(subject.size);
|
|
575
|
+
const long = L / Math.max(a, b, 1e-6) >= 4;
|
|
576
|
+
const flat = Math.min(w, h, d) / Math.max(w, h, d) <= 0.2;
|
|
577
|
+
switch (hint) {
|
|
578
|
+
case "tool":
|
|
579
|
+
if (subject.category === "keys") return "key";
|
|
580
|
+
if (subject.category === "electronics") return "device";
|
|
581
|
+
if (long) return subject.category === "melee" && Math.min(a, b) / L <= 0.1 && flat ? "blade" : "long_tool";
|
|
582
|
+
return hint;
|
|
583
|
+
case "cloth":
|
|
584
|
+
return subject.category === "clothing" ? "garment" : hint;
|
|
585
|
+
case "bag":
|
|
586
|
+
return subject.category === "bags" ? "backpack" : hint;
|
|
587
|
+
case "box":
|
|
588
|
+
if (subject.category === "electronics") return "device";
|
|
589
|
+
if (subject.category === "books") return "book";
|
|
590
|
+
if (subject.category === "keys") return "key";
|
|
591
|
+
return hint;
|
|
592
|
+
case "paper":
|
|
593
|
+
return subject.category === "books" ? "book" : hint;
|
|
594
|
+
default:
|
|
595
|
+
return hint;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function drawShape(k, shape, size, options = {}) {
|
|
599
|
+
const [w, h, d] = size;
|
|
600
|
+
return DRAWERS[shape]({ k, w, h, d, color: options.color ?? DEFAULT_COLOR, detail: options.detail ?? 1 });
|
|
601
|
+
}
|
|
602
|
+
|
|
345
603
|
// src/destruction.ts
|
|
346
604
|
var DESTRUCTION_MATERIAL_BY_TAG = {
|
|
347
605
|
metal: "steel",
|
|
@@ -350,12 +608,13 @@ var DESTRUCTION_MATERIAL_BY_TAG = {
|
|
|
350
608
|
paper: "paper",
|
|
351
609
|
plastic: "plastic",
|
|
352
610
|
cloth: "fabric",
|
|
611
|
+
rubber: "rubber",
|
|
353
612
|
food: "flesh_fruit"
|
|
354
613
|
};
|
|
355
614
|
var FAMILIES = destruction_default.families;
|
|
356
615
|
var CONTENTS = destruction_default.contents;
|
|
357
|
-
var
|
|
358
|
-
var shapeDestruction = (shapeId) =>
|
|
616
|
+
var SHAPES2 = destruction_default.shapes;
|
|
617
|
+
var shapeDestruction = (shapeId) => SHAPES2[shapeId];
|
|
359
618
|
var FAMILY_OF_MODEL = new Map(Object.entries(FAMILIES).flatMap(([family, entry]) => entry.models.map((model) => [model, family])));
|
|
360
619
|
var itemFamily = (modelId) => FAMILY_OF_MODEL.get(modelId);
|
|
361
620
|
var itemDestruction = (modelId) => {
|
|
@@ -385,6 +644,16 @@ function itemContents(subject) {
|
|
|
385
644
|
};
|
|
386
645
|
return { container, liquid: contents.liquid, liters };
|
|
387
646
|
}
|
|
647
|
+
var VESSEL_FLOORS = { cup: CUP_FLOOR_SHARE };
|
|
648
|
+
function itemVessel(subject) {
|
|
649
|
+
const capacity = subject.capacityLiters;
|
|
650
|
+
const floor = subject.shape === void 0 ? void 0 : VESSEL_FLOORS[subject.shape];
|
|
651
|
+
if (capacity === void 0 || !(capacity > 0) || floor === void 0) return void 0;
|
|
652
|
+
const [width, height, depth] = subject.size;
|
|
653
|
+
const radius = Math.min(width, depth) / 2 * WALL_SHARE;
|
|
654
|
+
const container = { capacity, liters: 0, shape: { kind: "cylinder", radius, height: height * WALL_SHARE }, opening: radius, closed: false };
|
|
655
|
+
return { container, offset: [0, height * floor, 0] };
|
|
656
|
+
}
|
|
388
657
|
function tagOf(mesh) {
|
|
389
658
|
const material = Array.isArray(mesh.material) ? mesh.material[0] : mesh.material;
|
|
390
659
|
const tag = material?.userData?.tag;
|
|
@@ -478,6 +747,7 @@ function tagForDestruction(root, options = {}) {
|
|
|
478
747
|
return;
|
|
479
748
|
}
|
|
480
749
|
const rule = modelId !== void 0 ? itemDestruction(modelId) : shapeId !== void 0 ? shapeDestruction(shapeId) : void 0;
|
|
750
|
+
const body = options.parts?.length === 1 ? options.parts[0] : void 0;
|
|
481
751
|
if (rule?.tessellate) tessellateShapes(root, rule.tessellate, three);
|
|
482
752
|
const solid = [];
|
|
483
753
|
root.traverse((object) => {
|
|
@@ -491,6 +761,10 @@ function tagForDestruction(root, options = {}) {
|
|
|
491
761
|
mesh.userData.destructionSkin = true;
|
|
492
762
|
return;
|
|
493
763
|
}
|
|
764
|
+
if (body) {
|
|
765
|
+
mesh.userData.destructionMaterial = body.material;
|
|
766
|
+
if (body.thickness !== void 0) mesh.userData.destructionThickness = body.thickness;
|
|
767
|
+
}
|
|
494
768
|
if (rule?.hollow) mesh.userData.hollow = true;
|
|
495
769
|
if (powder) mesh.userData.destructionPowder = { color: powder.color };
|
|
496
770
|
solid.push(mesh);
|
|
@@ -506,6 +780,7 @@ function tagForDestruction(root, options = {}) {
|
|
|
506
780
|
}
|
|
507
781
|
|
|
508
782
|
// src/kit.ts
|
|
783
|
+
import { CARRY_HANDLE_TAG } from "@adatechnology/game-contracts";
|
|
509
784
|
import { shapeGeometries } from "@adatechnology/game-shapes-three";
|
|
510
785
|
var WEAR_TAGS = ["metal", "wood", "cloth", "plastic", "paper", "food", "glass"];
|
|
511
786
|
var channelsOf = (hex2) => [(hex2 >> 16 & 255) / 255, (hex2 >> 8 & 255) / 255, (hex2 & 255) / 255];
|
|
@@ -528,6 +803,10 @@ function createItemKit(three) {
|
|
|
528
803
|
return object;
|
|
529
804
|
};
|
|
530
805
|
return {
|
|
806
|
+
carryHandle: (part) => {
|
|
807
|
+
part.userData[CARRY_HANDLE_TAG] = true;
|
|
808
|
+
return part;
|
|
809
|
+
},
|
|
531
810
|
T,
|
|
532
811
|
materials,
|
|
533
812
|
M,
|
|
@@ -3047,6 +3326,16 @@ var models_default = [
|
|
|
3047
3326
|
0.553
|
|
3048
3327
|
],
|
|
3049
3328
|
scale: 0.092308
|
|
3329
|
+
},
|
|
3330
|
+
{
|
|
3331
|
+
id: "plunger",
|
|
3332
|
+
teamId: "desentupidor",
|
|
3333
|
+
teamBox: [
|
|
3334
|
+
1.4,
|
|
3335
|
+
5.5,
|
|
3336
|
+
1.4
|
|
3337
|
+
],
|
|
3338
|
+
scale: 0.1
|
|
3050
3339
|
}
|
|
3051
3340
|
];
|
|
3052
3341
|
|
|
@@ -4229,6 +4518,16 @@ var alcohol70 = ({ mesh, cyl, lathe, G, glass, plastic, paper: paper2 }) => {
|
|
|
4229
4518
|
return G(bottle2, label, stripe, cap, nozzle);
|
|
4230
4519
|
};
|
|
4231
4520
|
|
|
4521
|
+
// src/models/plunger.ts
|
|
4522
|
+
var plunger = ({ mesh, cyl, G, M, wood }) => {
|
|
4523
|
+
const rubber = M(11545120, "rubber", { roughness: 0.75 });
|
|
4524
|
+
const cup2 = mesh(cyl(0.3, 0.7, 0.75, 16), rubber, [0, 0.455, 0]);
|
|
4525
|
+
const lip = mesh(cyl(0.7, 0.7, 0.08, 16), M(9314841, "rubber", { roughness: 0.8 }), [0, 0.04, 0]);
|
|
4526
|
+
const neck = mesh(cyl(0.2, 0.3, 0.3, 12), rubber, [0, 0.98, 0]);
|
|
4527
|
+
const handle = mesh(cyl(0.15, 0.15, 4.4, 10), wood(10122312), [0, 3.3, 0]);
|
|
4528
|
+
return G(cup2, lip, neck, handle);
|
|
4529
|
+
};
|
|
4530
|
+
|
|
4232
4531
|
// src/models/can-opener.ts
|
|
4233
4532
|
var canOpener = ({ mesh, bx, cyl, G, metal, plastic }) => {
|
|
4234
4533
|
const steel = metal(11120050);
|
|
@@ -4280,7 +4579,7 @@ var boltCutters = ({ mesh, bx, cyl, G, metal, plastic }) => {
|
|
|
4280
4579
|
};
|
|
4281
4580
|
|
|
4282
4581
|
// src/models/bucket.ts
|
|
4283
|
-
var bucket = ({ mesh, bx, cyl, G, plastic, metal }) => {
|
|
4582
|
+
var bucket = ({ mesh, bx, cyl, G, plastic, metal, carryHandle }) => {
|
|
4284
4583
|
const body = plastic(2908062);
|
|
4285
4584
|
const wire = metal(9080209);
|
|
4286
4585
|
return G(
|
|
@@ -4289,7 +4588,7 @@ var bucket = ({ mesh, bx, cyl, G, plastic, metal }) => {
|
|
|
4289
4588
|
mesh(cyl(11.8, 11.8, 1, 16), plastic(2313602), [0, -13, 0]),
|
|
4290
4589
|
mesh(bx(0.6, 3.7, 0.6), wire, [13, 11.35, 0]),
|
|
4291
4590
|
mesh(bx(0.6, 3.7, 0.6), wire, [-13, 11.35, 0]),
|
|
4292
|
-
mesh(bx(27.2, 0.5, 1.1), wire, [0, 13.25, 0])
|
|
4591
|
+
carryHandle(mesh(bx(27.2, 0.5, 1.1), wire, [0, 13.25, 0]))
|
|
4293
4592
|
);
|
|
4294
4593
|
};
|
|
4295
4594
|
|
|
@@ -5304,7 +5603,7 @@ var armyCamouflageUniform = ({ mesh, bx, G, cloth: cloth2 }) => {
|
|
|
5304
5603
|
};
|
|
5305
5604
|
|
|
5306
5605
|
// src/models/backpack.ts
|
|
5307
|
-
var
|
|
5606
|
+
var backpack2 = ({ mesh, bx, G, cloth: cloth2, plastic }) => {
|
|
5308
5607
|
const main = cloth2(3099243);
|
|
5309
5608
|
const trim = cloth2(1976890);
|
|
5310
5609
|
return G(
|
|
@@ -6757,444 +7056,189 @@ var BUILDERS = {
|
|
|
6757
7056
|
screwdriver,
|
|
6758
7057
|
adjustable_wrench: adjustableWrench,
|
|
6759
7058
|
hoe,
|
|
6760
|
-
fire_extinguisher: fireExtinguisher,
|
|
6761
|
-
duct_tape: ductTape,
|
|
6762
|
-
camp_stove: campStove,
|
|
6763
|
-
lighter,
|
|
6764
|
-
lockpick_kit: lockpickKit,
|
|
6765
|
-
sewing_kit: sewingKit,
|
|
6766
|
-
car_jack: carJack,
|
|
6767
|
-
mechanic_toolbox: mechanicToolbox,
|
|
6768
|
-
gas_torch: gasTorch,
|
|
6769
|
-
inverter_welder: inverterWelder,
|
|
6770
|
-
pot,
|
|
6771
|
-
cordless_drill: cordlessDrill,
|
|
6772
|
-
flint_striker: flintStriker,
|
|
6773
|
-
sharpening_stone: sharpeningStone,
|
|
6774
|
-
shovel,
|
|
6775
|
-
hacksaw,
|
|
6776
|
-
handsaw,
|
|
6777
|
-
scissors,
|
|
6778
|
-
recurve_bow: recurveBow,
|
|
6779
|
-
crossbow,
|
|
6780
|
-
iron_pipe: ironPipe,
|
|
6781
|
-
meat_cleaver: meatCleaver,
|
|
6782
|
-
slingshot,
|
|
6783
|
-
knife,
|
|
6784
|
-
tactical_knife: tacticalKnife,
|
|
6785
|
-
kabar,
|
|
6786
|
-
katana,
|
|
6787
|
-
brass_knuckles: brassKnuckles,
|
|
6788
|
-
arrows_and_bolts: arrowsAndBolts,
|
|
6789
|
-
sickle,
|
|
6790
|
-
cast_iron_skillet: castIronSkillet,
|
|
6791
|
-
improvised_spear: improvisedSpear,
|
|
6792
|
-
hatchet,
|
|
6793
|
-
sledgehammer,
|
|
6794
|
-
chainsaw,
|
|
6795
|
-
pickaxe,
|
|
6796
|
-
baseball_bat: baseballBat,
|
|
6797
|
-
police_baton: policeBaton,
|
|
6798
|
-
wire_roll: wireRoll,
|
|
6799
|
-
barbed_wire: barbedWire,
|
|
6800
|
-
glass_shards: glassShards,
|
|
6801
|
-
sheet_metal: sheetMetal,
|
|
6802
|
-
cement_bag: cementBag,
|
|
6803
|
-
epoxy_glue: epoxyGlue,
|
|
6804
|
-
electronic_components: electronicComponents,
|
|
6805
|
-
rope,
|
|
6806
|
-
copper_wire: copperWire,
|
|
6807
|
-
pet_bottle: petBottle,
|
|
6808
|
-
glass_bottle: glassBottle,
|
|
6809
|
-
empty_can: emptyCan,
|
|
6810
|
-
firewood,
|
|
6811
|
-
tarp,
|
|
6812
|
-
screws,
|
|
6813
|
-
nails,
|
|
6814
|
-
raffia_sack: raffiaSack,
|
|
6815
|
-
scrap_metal: scrapMetal,
|
|
6816
|
-
bricks,
|
|
6817
|
-
rag,
|
|
6818
|
-
rebar,
|
|
6819
|
-
lubricant_spray: lubricantSpray,
|
|
6820
|
-
army_camouflage_uniform: armyCamouflageUniform,
|
|
6821
|
-
backpack,
|
|
6822
|
-
ballistic_vest: ballisticVest,
|
|
6823
|
-
battery_9v: battery9V,
|
|
6824
|
-
bean_seeds: beanSeeds,
|
|
6825
|
-
beekeeper_suit: beekeeperSuit,
|
|
6826
|
-
candles,
|
|
6827
|
-
car_alarm_remote: carAlarmRemote,
|
|
6828
|
-
car_battery_12v: carBattery12V,
|
|
6829
|
-
car_key: carKey,
|
|
6830
|
-
cash,
|
|
6831
|
-
cassava_cuttings: cassavaCuttings,
|
|
6832
|
-
cb_radio: cbRadio,
|
|
6833
|
-
cell_key: cellKey,
|
|
6834
|
-
charcoal_bag: charcoalBag,
|
|
6835
|
-
cigarettes,
|
|
6836
|
-
city_map: cityMap,
|
|
6837
|
-
combat_boots: combatBoots,
|
|
6838
|
-
cooler_box: coolerBox,
|
|
6839
|
-
corn_seeds: cornSeeds,
|
|
6840
|
-
crossbody_bag: crossbodyBag,
|
|
6841
|
-
delivery_bag: deliveryBag,
|
|
6842
|
-
denim_jacket: denimJacket,
|
|
6843
|
-
diesel,
|
|
6844
|
-
diy_magazine: diyMagazine,
|
|
6845
|
-
dog_tag: dogTag,
|
|
6846
|
-
electric_fence_energizer: electricFenceEnergizer,
|
|
6847
|
-
extension_cord: extensionCord,
|
|
6848
|
-
fanny_pack: fannyPack,
|
|
6849
|
-
farmers_almanac: farmersAlmanac,
|
|
6850
|
-
fertilizer_bag: fertilizerBag,
|
|
6851
|
-
firefighter_suit: firefighterSuit,
|
|
6852
|
-
fishing_net: fishingNet,
|
|
6853
|
-
fishing_rod: fishingRod,
|
|
6854
|
-
fishing_tackle_box: fishingTackleBox,
|
|
6855
|
-
flip_flops: flipFlops,
|
|
6856
|
-
folding_solar_panel: foldingSolarPanel,
|
|
6857
|
-
gas_cartridge: gasCartridge,
|
|
6858
|
-
gasoline,
|
|
6859
|
-
generator_key: generatorKey,
|
|
6860
|
-
hard_hat: hardHat,
|
|
6861
|
-
headlamp,
|
|
6862
|
-
hoodie,
|
|
6863
|
-
janitor_keys: janitorKeys,
|
|
6864
|
-
jeans,
|
|
6865
|
-
kale_and_lettuce_seeds: kaleAndLettuceSeeds,
|
|
6866
|
-
kerosene,
|
|
6867
|
-
laptop,
|
|
6868
|
-
leather_motorcycle_jacket: leatherMotorcycleJacket,
|
|
6869
|
-
leather_motorcycle_pants: leatherMotorcyclePants,
|
|
6870
|
-
leather_work_gloves: leatherWorkGloves,
|
|
6871
|
-
led_camp_lantern: ledCampLantern,
|
|
6872
|
-
magazine_arm_guard: magazineArmGuard,
|
|
6873
|
-
magazines_and_comics: magazinesAndComics,
|
|
6874
|
-
master_key: masterKey,
|
|
6875
|
-
mechanic_coveralls: mechanicCoveralls,
|
|
6876
|
-
military_backpack: militaryBackpack,
|
|
6877
|
-
military_radio: militaryRadio,
|
|
6878
|
-
mobile_phone: mobilePhone,
|
|
6879
|
-
motor_oil: motorOil,
|
|
6880
|
-
night_vision_goggles: nightVisionGoggles,
|
|
6881
|
-
note,
|
|
6882
|
-
padded_coat: paddedCoat,
|
|
6883
|
-
padlock_key: padlockKey,
|
|
6884
|
-
photo,
|
|
6885
|
-
portable_generator: portableGenerator,
|
|
6886
|
-
power_bank: powerBank,
|
|
6887
|
-
pumpkin_seeds: pumpkinSeeds,
|
|
6888
|
-
raincoat,
|
|
6889
|
-
road_map: roadMap,
|
|
6890
|
-
rolling_suitcase: rollingSuitcase,
|
|
6891
|
-
rubber_boots: rubberBoots,
|
|
6892
|
-
safe_key: safeKey,
|
|
6893
|
-
safety_goggles: safetyGoggles,
|
|
6894
|
-
sheet_metal_forearm_guard: sheetMetalForearmGuard,
|
|
6895
|
-
shopping_bag: shoppingBag,
|
|
6896
|
-
shopping_cart: shoppingCart,
|
|
6897
|
-
skill_book: skillBook,
|
|
6898
|
-
snare_trap: snareTrap,
|
|
6899
|
-
sneakers,
|
|
6900
|
-
tactical_vest: tacticalVest,
|
|
6901
|
-
technical_manual: technicalManual,
|
|
6902
|
-
tool_belt: toolBelt,
|
|
6903
|
-
trash_bag: trashBag,
|
|
6904
|
-
trekking_backpack_70l: trekkingBackpack70L,
|
|
6905
|
-
tshirt,
|
|
6906
|
-
watering_can: wateringCan,
|
|
6907
|
-
wheelbarrow,
|
|
6908
|
-
windup_alarm_clock: windupAlarmClock
|
|
6909
|
-
};
|
|
6910
|
-
var SHIPPED_MODELS = models_default.map((entry) => {
|
|
6911
|
-
const builder = BUILDERS[entry.id];
|
|
6912
|
-
if (!builder) throw new Error(`game-items-three: no builder for the model "${entry.id}"`);
|
|
6913
|
-
return { entry, builder };
|
|
6914
|
-
});
|
|
6915
|
-
|
|
6916
|
-
// src/models/registry.ts
|
|
6917
|
-
var registryOver = (entries, builders) => ({
|
|
6918
|
-
has: (id) => builders.has(id),
|
|
6919
|
-
entry: (id) => entries.get(id),
|
|
6920
|
-
builder: (id) => builders.get(id),
|
|
6921
|
-
list: () => [...entries.keys()],
|
|
6922
|
-
register(entry, builder) {
|
|
6923
|
-
entries.set(entry.id, entry);
|
|
6924
|
-
builders.set(entry.id, builder);
|
|
6925
|
-
},
|
|
6926
|
-
unregister(id) {
|
|
6927
|
-
entries.delete(id);
|
|
6928
|
-
builders.delete(id);
|
|
6929
|
-
}
|
|
6930
|
-
});
|
|
6931
|
-
var defaultRegistry;
|
|
6932
|
-
var defaultItemModels = () => defaultRegistry ?? (defaultRegistry = registryOver(new Map(SHIPPED_MODELS.map(({ entry }) => [entry.id, entry])), new Map(SHIPPED_MODELS.map(({ entry, builder }) => [entry.id, builder]))));
|
|
6933
|
-
var registerItemModel = (entry, builder) => defaultItemModels().register(entry, builder);
|
|
6934
|
-
var unregisterItemModel = (id) => defaultItemModels().unregister(id);
|
|
6935
|
-
var itemModelEntry = (id) => defaultItemModels().entry(id);
|
|
6936
|
-
var itemModelBuilder = (id) => defaultItemModels().builder(id);
|
|
6937
|
-
var hasItemModel = (id) => defaultItemModels().has(id);
|
|
6938
|
-
var listItemModels = () => defaultItemModels().list();
|
|
6939
|
-
|
|
6940
|
-
// src/shapes.ts
|
|
6941
|
-
var SHAPES2 = [
|
|
6942
|
-
"can",
|
|
6943
|
-
"bag",
|
|
6944
|
-
"box",
|
|
6945
|
-
"bottle",
|
|
6946
|
-
"tool",
|
|
6947
|
-
"roll",
|
|
6948
|
-
"dish",
|
|
6949
|
-
"cloth",
|
|
6950
|
-
"shoe",
|
|
6951
|
-
"jar",
|
|
6952
|
-
"paper",
|
|
6953
|
-
"fruit",
|
|
6954
|
-
"cup",
|
|
6955
|
-
"tube",
|
|
6956
|
-
"blade",
|
|
6957
|
-
"long_tool",
|
|
6958
|
-
"garment",
|
|
6959
|
-
"backpack",
|
|
6960
|
-
"jerrycan",
|
|
6961
|
-
"tank",
|
|
6962
|
-
"book",
|
|
6963
|
-
"key",
|
|
6964
|
-
"battery",
|
|
6965
|
-
"plank",
|
|
6966
|
-
"device"
|
|
6967
|
-
];
|
|
6968
|
-
var DEFAULT_COLOR = 9080724;
|
|
6969
|
-
var PI = Math.PI;
|
|
6970
|
-
function shade(color, factor) {
|
|
6971
|
-
const channel = (shift) => Math.max(0, Math.min(255, Math.round((color >> shift & 255) * factor)));
|
|
6972
|
-
return channel(16) << 16 | channel(8) << 8 | channel(0);
|
|
6973
|
-
}
|
|
6974
|
-
var PROUD = 2e-3;
|
|
6975
|
-
var seg = (c, n) => Math.max(5, Math.round(n * c.detail));
|
|
6976
|
-
function canonicalFrame(size) {
|
|
6977
|
-
const [w, h, d] = size;
|
|
6978
|
-
if (h >= w && h >= d) return { axis: 1, L: h, a: w, b: d };
|
|
6979
|
-
if (d >= w && d >= h) return { axis: 2, L: d, a: h, b: w };
|
|
6980
|
-
return { axis: 0, L: w, a: h, b: d };
|
|
6981
|
-
}
|
|
6982
|
-
function orient(c, group, axis) {
|
|
6983
|
-
if (axis === 0) return group;
|
|
6984
|
-
const holder = c.k.G(group);
|
|
6985
|
-
if (axis === 1) holder.rotation.z = PI / 2;
|
|
6986
|
-
else holder.rotation.y = -PI / 2;
|
|
6987
|
-
return holder;
|
|
6988
|
-
}
|
|
6989
|
-
var alongLong = (draw) => (c) => {
|
|
6990
|
-
const { axis, L, a, b } = canonicalFrame([c.w, c.h, c.d]);
|
|
6991
|
-
return orient(c, draw(c, L, a, b), axis);
|
|
6992
|
-
};
|
|
6993
|
-
var across = (c, group) => {
|
|
6994
|
-
group.scale.set(c.w, 1, c.d);
|
|
6995
|
-
return c.k.G(group);
|
|
6996
|
-
};
|
|
6997
|
-
var can = (c) => {
|
|
6998
|
-
const { k, h } = c;
|
|
6999
|
-
const body = k.metal(9277590);
|
|
7000
|
-
const r = 0.5 - PROUD / Math.min(c.w, c.d);
|
|
7001
|
-
return across(c, k.G(k.mesh(k.cyl(r, r, h * 0.94, seg(c, 14)), body), k.mesh(k.cyl(0.5, 0.5, h * 0.5, seg(c, 14)), k.food(c.color)), k.mesh(k.cyl(0.5, 0.5, h * 0.03, seg(c, 14)), body, [0, h * 0.485, 0]), k.mesh(k.cyl(0.5, 0.5, h * 0.03, seg(c, 14)), body, [0, -h * 0.485, 0])));
|
|
7002
|
-
};
|
|
7003
|
-
var bottle = (c) => {
|
|
7004
|
-
const { k, h } = c;
|
|
7005
|
-
const r = 0.5;
|
|
7006
|
-
const profile = [[0, -h / 2], [r, -h / 2], [r, h * 0.12], [r * 0.45, h * 0.3], [r * 0.4, h * 0.4], [0, h * 0.4]];
|
|
7007
|
-
return across(c, k.G(k.mesh(k.lathe(profile, seg(c, 14)), k.glass(c.color, 0.6)), k.mesh(k.cyl(r * 0.42, r * 0.42, h * 0.1, seg(c, 10)), k.plastic(shade(c.color, 0.5)), [0, h * 0.45, 0])));
|
|
7008
|
-
};
|
|
7009
|
-
var jar = (c) => {
|
|
7010
|
-
const { k, h } = c;
|
|
7011
|
-
return across(c, k.G(k.mesh(k.cyl(0.5, 0.5, h * 0.82, seg(c, 14)), k.glass(c.color, 0.55), [0, -h * 0.09, 0]), k.mesh(k.cyl(0.5, 0.5, h * 0.18, seg(c, 14)), k.metal(12095802), [0, h * 0.41, 0])));
|
|
7012
|
-
};
|
|
7013
|
-
var bag = (c) => {
|
|
7014
|
-
const { k, w, h, d } = c;
|
|
7015
|
-
return k.G(k.mesh(k.bx(w, h * 0.88, d - 2 * PROUD), k.paper(c.color), [0, -h * 0.06, 0]), k.mesh(k.bx(w * 1, h * 0.12, d * 0.5), k.paper(shade(c.color, 0.85)), [0, h * 0.44, 0]), k.mesh(k.bx(w * 0.7, h * 0.3, d), k.paper(shade(c.color, 1.2)), [0, 0, 0]));
|
|
7016
|
-
};
|
|
7017
|
-
var box = (c) => {
|
|
7018
|
-
const { k, w, h, d } = c;
|
|
7019
|
-
return k.G(k.mesh(k.bx(w - 2 * PROUD, h - PROUD, d - 2 * PROUD), k.paper(c.color), [0, -PROUD / 2, 0]), k.mesh(k.bx(w, h * 0.12, d), k.paper(shade(c.color, 0.8)), [0, h * 0.44, 0]), k.mesh(k.bx(w * 0.62, h * 0.4, d), k.paper(shade(c.color, 1.25)), [0, -h * 0.02, 0]));
|
|
7020
|
-
};
|
|
7021
|
-
var cloth = (c) => {
|
|
7022
|
-
const { k, w, h, d } = c;
|
|
7023
|
-
const material = k.cloth(c.color);
|
|
7024
|
-
return k.G(k.mesh(k.bx(w, h * 0.55, d), material, [0, -h * 0.225, 0]), k.mesh(k.bx(w * 0.96, h * 0.45, d * 0.96), k.cloth(shade(c.color, 0.9)), [0, h * 0.275, 0]));
|
|
7025
|
-
};
|
|
7026
|
-
var paper = (c) => {
|
|
7027
|
-
const { k, w, h, d } = c;
|
|
7028
|
-
const sheet = k.paper(c.color);
|
|
7029
|
-
return k.G(k.mesh(k.bx(w, h / 3, d), sheet, [0, -h / 3, 0]), k.mesh(k.bx(w * 0.98, h / 3, d * 0.98), k.paper(shade(c.color, 0.95)), [0, 0, 0]), k.mesh(k.bx(w, h / 3, d), sheet, [0, h / 3, 0]));
|
|
7030
|
-
};
|
|
7031
|
-
var fruit = (c) => {
|
|
7032
|
-
const { k, w, h, d } = c;
|
|
7033
|
-
const sphere = new k.T.SphereGeometry(0.5, seg(c, 12), seg(c, 8));
|
|
7034
|
-
return k.G(k.mesh(sphere, k.food(c.color), [0, -h * 0.04, 0], [0, 0, 0], [w, h * 0.92, d]), k.mesh(k.cyl(h * 0.02, h * 0.02, h * 0.1, 6), k.wood(5913122), [0, h * 0.45, 0]));
|
|
7035
|
-
};
|
|
7036
|
-
var dish = (c) => {
|
|
7037
|
-
const { k, w, h, d } = c;
|
|
7038
|
-
return k.G(k.mesh(k.cyl(0.5, 0.35, h, seg(c, 16)), k.plastic(c.color), [0, 0, 0], [0, 0, 0], [w, 1, d]));
|
|
7039
|
-
};
|
|
7040
|
-
var cup = (c) => {
|
|
7041
|
-
const { k, w, h, d } = c;
|
|
7042
|
-
const profile = [[0, -h / 2], [0.38, -h / 2], [0.5, h / 2], [0.44, h / 2], [0.33, -h / 2 + h * 0.06], [0, -h / 2 + h * 0.06]];
|
|
7043
|
-
return k.G(k.mesh(k.lathe(profile, seg(c, 14)), k.plastic(c.color), [0, 0, 0], [0, 0, 0], [w, 1, d]));
|
|
7044
|
-
};
|
|
7045
|
-
var tube = (c) => {
|
|
7046
|
-
const { k, h } = c;
|
|
7047
|
-
const material = k.plastic(c.color);
|
|
7048
|
-
return across(c, k.G(k.mesh(k.cyl(0.5, 0.42, h * 0.86, seg(c, 12)), material, [0, -h * 0.04, 0]), k.mesh(k.cyl(0.35, 0.35, h * 0.12, seg(c, 12)), k.plastic(shade(c.color, 0.6)), [0, h * 0.44, 0]), k.mesh(k.bx(1, h * 0.06, 0.25), material, [0, -h * 0.47, 0])));
|
|
7049
|
-
};
|
|
7050
|
-
var roll = (c) => {
|
|
7051
|
-
const { k, w, h, d } = c;
|
|
7052
|
-
const body = k.G(k.mesh(k.cyl(0.5, 0.5, 1, seg(c, 18)), k.paper(c.color)), k.mesh(k.cyl(0.18, 0.18, 0.98, seg(c, 12)), k.paper(11902328)));
|
|
7053
|
-
if (h <= w && h <= d) body.scale.set(w, h, d);
|
|
7054
|
-
else if (w <= d) {
|
|
7055
|
-
body.rotation.z = PI / 2;
|
|
7056
|
-
body.scale.set(h, w, d);
|
|
7057
|
-
} else {
|
|
7058
|
-
body.rotation.x = PI / 2;
|
|
7059
|
-
body.scale.set(w, d, h);
|
|
7060
|
-
}
|
|
7061
|
-
return k.G(body);
|
|
7062
|
-
};
|
|
7063
|
-
var shoe = (c) => {
|
|
7064
|
-
const { k, w, h, d } = c;
|
|
7065
|
-
const upper = k.cloth(c.color);
|
|
7066
|
-
return k.G(k.mesh(k.bx(w, h * 0.22, d), k.plastic(2237727), [0, -h * 0.39, 0]), k.mesh(k.bx(w * 0.42, h * 0.78, d * 0.96), upper, [-w * 0.29, h * 0.11, 0]), k.mesh(k.bx(w * 0.5, h * 0.5, d * 0.96), upper, [w * 0.25, -h * 0.03, 0]));
|
|
7067
|
-
};
|
|
7068
|
-
var tool = alongLong((c, L, a, b) => {
|
|
7069
|
-
const { k } = c;
|
|
7070
|
-
const radius = Math.max(4e-3, Math.min(a, b) / 2);
|
|
7071
|
-
return k.G(k.mesh(k.cyl(radius, radius, L * 0.74, seg(c, 10)), k.wood(9069628), [-L * 0.13, 0, 0], [0, 0, PI / 2]), k.mesh(k.bx(L * 0.26, a, b), k.metal(shade(c.color, 1)), [L * 0.37, 0, 0]));
|
|
7072
|
-
});
|
|
7073
|
-
var longTool = alongLong((c, L, a, b) => {
|
|
7074
|
-
const { k } = c;
|
|
7075
|
-
const radius = Math.max(4e-3, Math.min(a, b) / 2) * 0.55;
|
|
7076
|
-
return k.G(k.mesh(k.cyl(radius, radius, L * 0.94, seg(c, 10)), k.wood(10122312), [0, 0, 0], [0, 0, PI / 2]), k.mesh(k.bx(L * 0.12, a, b), k.metal(c.color), [L * 0.44, 0, 0]));
|
|
7077
|
-
});
|
|
7078
|
-
var blade = alongLong((c, L, a, b) => {
|
|
7079
|
-
const { k } = c;
|
|
7080
|
-
const edge = Math.min(2e-4, b * 0.05);
|
|
7081
|
-
const steel = k.extrude([[0, 0], [L * 0.66, 0], [L * 0.68, a * 0.4], [0, a]], Math.max(5e-4, b * 0.4 - 2 * edge), edge);
|
|
7082
|
-
return k.G(k.mesh(steel, k.metal(11120048), [-L * 0.18, -a / 2, -b * 0.2 + edge]), k.mesh(k.bx(L * 0.34, a * 0.6, b), k.wood(3877408), [-L * 0.33, 0, 0]));
|
|
7083
|
-
});
|
|
7084
|
-
var garment = (c) => {
|
|
7085
|
-
const { k, w, h, d } = c;
|
|
7086
|
-
const material = k.cloth(c.color);
|
|
7087
|
-
return k.G(k.mesh(k.bx(w * 0.56, h, d), material), k.mesh(k.bx(w * 0.22, h * 0.42, d * 0.9), material, [-w * 0.39, h * 0.29, 0]), k.mesh(k.bx(w * 0.22, h * 0.42, d * 0.9), material, [w * 0.39, h * 0.29, 0]));
|
|
7088
|
-
};
|
|
7089
|
-
var backpack2 = (c) => {
|
|
7090
|
-
const { k, w, h, d } = c;
|
|
7091
|
-
const material = k.cloth(c.color);
|
|
7092
|
-
const dome = new k.T.SphereGeometry(0.5, seg(c, 12), seg(c, 6), 0, PI * 2, 0, PI / 2);
|
|
7093
|
-
const strap = k.cloth(shade(c.color, 0.6));
|
|
7094
|
-
return k.G(k.mesh(k.bx(w, h * 0.78, d * 0.68), material, [0, -h * 0.11, -d * 0.14]), k.mesh(dome, material, [0, h * 0.28, -d * 0.14], [0, 0, 0], [w, h * 0.44, d * 0.68]), k.mesh(k.bx(w * 0.7, h * 0.4, d * 0.3), k.cloth(shade(c.color, 0.75)), [0, -h * 0.18, d * 0.35]), k.mesh(k.bx(w * 0.1, h * 0.7, d * 0.04), strap, [-w * 0.25, -h * 0.05, -d * 0.48]), k.mesh(k.bx(w * 0.1, h * 0.7, d * 0.04), strap, [w * 0.25, -h * 0.05, -d * 0.48]));
|
|
7095
|
-
};
|
|
7096
|
-
var jerrycan = (c) => {
|
|
7097
|
-
const { k, w, h, d } = c;
|
|
7098
|
-
const material = k.plastic(c.color);
|
|
7099
|
-
return k.G(k.mesh(k.bx(w, h * 0.86, d), material, [0, -h * 0.07, 0]), k.mesh(k.bx(w * 0.4, h * 0.1, d * 0.5), material, [-w * 0.2, h * 0.45, 0]), k.mesh(k.cyl(d * 0.14, d * 0.18, h * 0.12, seg(c, 10)), k.plastic(14263361), [w * 0.3, h * 0.44, 0]));
|
|
7100
|
-
};
|
|
7101
|
-
var tank = (c) => {
|
|
7102
|
-
const { k, h } = c;
|
|
7103
|
-
const r = 0.5;
|
|
7104
|
-
const profile = [[0, -h / 2], [r * 0.9, -h / 2], [r, -h * 0.4], [r, h * 0.22], [r * 0.6, h * 0.36], [r * 0.2, h * 0.4], [0, h * 0.4]];
|
|
7105
|
-
const metal = k.metal(c.color);
|
|
7106
|
-
return across(c, k.G(k.mesh(k.lathe(profile, seg(c, 14)), metal), k.mesh(k.cyl(r * 0.62, r * 0.62, h * 0.05, seg(c, 14)), metal, [0, h * 0.3, 0]), k.mesh(k.cyl(r * 0.18, r * 0.18, h * 0.12, seg(c, 8)), k.metal(12095802), [0, h * 0.44, 0])));
|
|
7107
|
-
};
|
|
7108
|
-
var book = (c) => {
|
|
7109
|
-
const { k, w, h, d } = c;
|
|
7110
|
-
const cover = k.paper(c.color);
|
|
7111
|
-
return k.G(k.mesh(k.bx(w - PROUD, h - 2 * PROUD, d * 0.14), cover, [PROUD / 2, 0, d * 0.43 - PROUD]), k.mesh(k.bx(w - PROUD, h - 2 * PROUD, d * 0.14), cover, [PROUD / 2, 0, -d * 0.43 + PROUD]), k.mesh(k.bx(w * 0.94, h * 0.96, d * 0.72), k.paper(15327692), [w * 0.02, 0, 0]), k.mesh(k.bx(w * 0.08, h, d), k.paper(shade(c.color, 0.8)), [-w * 0.46, 0, 0]));
|
|
7112
|
-
};
|
|
7113
|
-
var key = alongLong((c, L, a, b) => {
|
|
7114
|
-
const { k } = c;
|
|
7115
|
-
const metal = k.metal(12095802);
|
|
7116
|
-
const ring = a * 0.5;
|
|
7117
|
-
const tube2 = Math.min(b * 0.4, ring * 0.2);
|
|
7118
|
-
return k.G(k.mesh(new c.k.T.TorusGeometry(ring * 0.8, tube2, 5, seg(c, 10)), k.metal(10132896), [-L / 2 + ring * 0.8 + tube2, 0, 0]), k.mesh(k.bx(L * 0.62, a * 0.28, b), metal, [L * 0.12, 0, 0]), k.mesh(k.bx(L * 0.08, a * 0.17, b), metal, [L * 0.36, -a * 0.225, 0]), k.mesh(k.bx(L * 0.06, a * 0.17, b), metal, [L * 0.2, -a * 0.225, 0]));
|
|
7119
|
-
});
|
|
7120
|
-
var battery = alongLong((c, L, a, b) => {
|
|
7121
|
-
const { k } = c;
|
|
7122
|
-
const r = Math.min(a, b) / 2;
|
|
7123
|
-
return k.G(k.mesh(k.cyl(r, r, L * 0.94, seg(c, 14)), k.metal(c.color), [0, 0, 0], [0, 0, PI / 2]), k.mesh(k.cyl(r * 0.36, r * 0.36, L * 0.06, seg(c, 8)), k.metal(12172736), [L * 0.47, 0, 0], [0, 0, PI / 2]));
|
|
7124
|
-
});
|
|
7125
|
-
var plank = alongLong((c, L, a, b) => {
|
|
7126
|
-
const { k } = c;
|
|
7127
|
-
const nail = k.metal(8225158);
|
|
7128
|
-
return k.G(k.mesh(k.bx(L, a, b), k.wood(11043929)), k.mesh(k.cyl(Math.min(a, b) * 0.1, Math.min(a, b) * 0.1, b * 0.98, 6), nail, [-L * 0.4, 0, 0], [PI / 2, 0, 0]), k.mesh(k.cyl(Math.min(a, b) * 0.1, Math.min(a, b) * 0.1, b * 0.98, 6), nail, [L * 0.4, 0, 0], [PI / 2, 0, 0]));
|
|
7129
|
-
});
|
|
7130
|
-
var device = (c) => {
|
|
7131
|
-
const { k, w, h, d } = c;
|
|
7132
|
-
const screen = k.M(10469258, "glass", { emissive: 3099170, emissiveIntensity: 0.6, roughness: 0.2 });
|
|
7133
|
-
return k.G(k.mesh(k.bx(w, h, d * 0.96), k.plastic(c.color), [0, 0, -d * 0.02]), k.mesh(k.bx(w * 0.7, h * 0.32, d * 0.06), screen, [0, h * 0.22, d * 0.47]), k.mesh(k.cyl(Math.min(w, h) * 0.08, Math.min(w, h) * 0.08, d * 0.1, seg(c, 8)), k.metal(12172736), [w * 0.25, -h * 0.18, d * 0.45], [PI / 2, 0, 0]));
|
|
7134
|
-
};
|
|
7135
|
-
var DRAWERS = {
|
|
7136
|
-
can,
|
|
7137
|
-
bag,
|
|
7138
|
-
box,
|
|
7139
|
-
bottle,
|
|
7140
|
-
tool,
|
|
7141
|
-
roll,
|
|
7142
|
-
dish,
|
|
7143
|
-
cloth,
|
|
7144
|
-
shoe,
|
|
7145
|
-
jar,
|
|
7146
|
-
paper,
|
|
7147
|
-
fruit,
|
|
7148
|
-
cup,
|
|
7149
|
-
tube,
|
|
7150
|
-
blade,
|
|
7151
|
-
long_tool: longTool,
|
|
7152
|
-
garment,
|
|
7059
|
+
fire_extinguisher: fireExtinguisher,
|
|
7060
|
+
duct_tape: ductTape,
|
|
7061
|
+
camp_stove: campStove,
|
|
7062
|
+
lighter,
|
|
7063
|
+
lockpick_kit: lockpickKit,
|
|
7064
|
+
sewing_kit: sewingKit,
|
|
7065
|
+
car_jack: carJack,
|
|
7066
|
+
mechanic_toolbox: mechanicToolbox,
|
|
7067
|
+
gas_torch: gasTorch,
|
|
7068
|
+
inverter_welder: inverterWelder,
|
|
7069
|
+
pot,
|
|
7070
|
+
cordless_drill: cordlessDrill,
|
|
7071
|
+
flint_striker: flintStriker,
|
|
7072
|
+
sharpening_stone: sharpeningStone,
|
|
7073
|
+
shovel,
|
|
7074
|
+
hacksaw,
|
|
7075
|
+
handsaw,
|
|
7076
|
+
scissors,
|
|
7077
|
+
recurve_bow: recurveBow,
|
|
7078
|
+
crossbow,
|
|
7079
|
+
iron_pipe: ironPipe,
|
|
7080
|
+
meat_cleaver: meatCleaver,
|
|
7081
|
+
slingshot,
|
|
7082
|
+
knife,
|
|
7083
|
+
tactical_knife: tacticalKnife,
|
|
7084
|
+
kabar,
|
|
7085
|
+
katana,
|
|
7086
|
+
brass_knuckles: brassKnuckles,
|
|
7087
|
+
arrows_and_bolts: arrowsAndBolts,
|
|
7088
|
+
sickle,
|
|
7089
|
+
cast_iron_skillet: castIronSkillet,
|
|
7090
|
+
improvised_spear: improvisedSpear,
|
|
7091
|
+
hatchet,
|
|
7092
|
+
sledgehammer,
|
|
7093
|
+
chainsaw,
|
|
7094
|
+
pickaxe,
|
|
7095
|
+
baseball_bat: baseballBat,
|
|
7096
|
+
police_baton: policeBaton,
|
|
7097
|
+
wire_roll: wireRoll,
|
|
7098
|
+
barbed_wire: barbedWire,
|
|
7099
|
+
glass_shards: glassShards,
|
|
7100
|
+
sheet_metal: sheetMetal,
|
|
7101
|
+
cement_bag: cementBag,
|
|
7102
|
+
epoxy_glue: epoxyGlue,
|
|
7103
|
+
electronic_components: electronicComponents,
|
|
7104
|
+
rope,
|
|
7105
|
+
copper_wire: copperWire,
|
|
7106
|
+
pet_bottle: petBottle,
|
|
7107
|
+
glass_bottle: glassBottle,
|
|
7108
|
+
empty_can: emptyCan,
|
|
7109
|
+
firewood,
|
|
7110
|
+
tarp,
|
|
7111
|
+
screws,
|
|
7112
|
+
nails,
|
|
7113
|
+
raffia_sack: raffiaSack,
|
|
7114
|
+
scrap_metal: scrapMetal,
|
|
7115
|
+
bricks,
|
|
7116
|
+
rag,
|
|
7117
|
+
rebar,
|
|
7118
|
+
lubricant_spray: lubricantSpray,
|
|
7119
|
+
army_camouflage_uniform: armyCamouflageUniform,
|
|
7153
7120
|
backpack: backpack2,
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7121
|
+
ballistic_vest: ballisticVest,
|
|
7122
|
+
battery_9v: battery9V,
|
|
7123
|
+
bean_seeds: beanSeeds,
|
|
7124
|
+
beekeeper_suit: beekeeperSuit,
|
|
7125
|
+
candles,
|
|
7126
|
+
car_alarm_remote: carAlarmRemote,
|
|
7127
|
+
car_battery_12v: carBattery12V,
|
|
7128
|
+
car_key: carKey,
|
|
7129
|
+
cash,
|
|
7130
|
+
cassava_cuttings: cassavaCuttings,
|
|
7131
|
+
cb_radio: cbRadio,
|
|
7132
|
+
cell_key: cellKey,
|
|
7133
|
+
charcoal_bag: charcoalBag,
|
|
7134
|
+
cigarettes,
|
|
7135
|
+
city_map: cityMap,
|
|
7136
|
+
combat_boots: combatBoots,
|
|
7137
|
+
cooler_box: coolerBox,
|
|
7138
|
+
corn_seeds: cornSeeds,
|
|
7139
|
+
crossbody_bag: crossbodyBag,
|
|
7140
|
+
delivery_bag: deliveryBag,
|
|
7141
|
+
denim_jacket: denimJacket,
|
|
7142
|
+
diesel,
|
|
7143
|
+
diy_magazine: diyMagazine,
|
|
7144
|
+
dog_tag: dogTag,
|
|
7145
|
+
electric_fence_energizer: electricFenceEnergizer,
|
|
7146
|
+
extension_cord: extensionCord,
|
|
7147
|
+
fanny_pack: fannyPack,
|
|
7148
|
+
farmers_almanac: farmersAlmanac,
|
|
7149
|
+
fertilizer_bag: fertilizerBag,
|
|
7150
|
+
firefighter_suit: firefighterSuit,
|
|
7151
|
+
fishing_net: fishingNet,
|
|
7152
|
+
fishing_rod: fishingRod,
|
|
7153
|
+
fishing_tackle_box: fishingTackleBox,
|
|
7154
|
+
flip_flops: flipFlops,
|
|
7155
|
+
folding_solar_panel: foldingSolarPanel,
|
|
7156
|
+
gas_cartridge: gasCartridge,
|
|
7157
|
+
gasoline,
|
|
7158
|
+
generator_key: generatorKey,
|
|
7159
|
+
hard_hat: hardHat,
|
|
7160
|
+
headlamp,
|
|
7161
|
+
hoodie,
|
|
7162
|
+
janitor_keys: janitorKeys,
|
|
7163
|
+
jeans,
|
|
7164
|
+
kale_and_lettuce_seeds: kaleAndLettuceSeeds,
|
|
7165
|
+
kerosene,
|
|
7166
|
+
laptop,
|
|
7167
|
+
leather_motorcycle_jacket: leatherMotorcycleJacket,
|
|
7168
|
+
leather_motorcycle_pants: leatherMotorcyclePants,
|
|
7169
|
+
leather_work_gloves: leatherWorkGloves,
|
|
7170
|
+
led_camp_lantern: ledCampLantern,
|
|
7171
|
+
magazine_arm_guard: magazineArmGuard,
|
|
7172
|
+
magazines_and_comics: magazinesAndComics,
|
|
7173
|
+
master_key: masterKey,
|
|
7174
|
+
mechanic_coveralls: mechanicCoveralls,
|
|
7175
|
+
military_backpack: militaryBackpack,
|
|
7176
|
+
military_radio: militaryRadio,
|
|
7177
|
+
mobile_phone: mobilePhone,
|
|
7178
|
+
motor_oil: motorOil,
|
|
7179
|
+
night_vision_goggles: nightVisionGoggles,
|
|
7180
|
+
note,
|
|
7181
|
+
padded_coat: paddedCoat,
|
|
7182
|
+
padlock_key: padlockKey,
|
|
7183
|
+
photo,
|
|
7184
|
+
portable_generator: portableGenerator,
|
|
7185
|
+
power_bank: powerBank,
|
|
7186
|
+
pumpkin_seeds: pumpkinSeeds,
|
|
7187
|
+
raincoat,
|
|
7188
|
+
road_map: roadMap,
|
|
7189
|
+
rolling_suitcase: rollingSuitcase,
|
|
7190
|
+
rubber_boots: rubberBoots,
|
|
7191
|
+
safe_key: safeKey,
|
|
7192
|
+
safety_goggles: safetyGoggles,
|
|
7193
|
+
sheet_metal_forearm_guard: sheetMetalForearmGuard,
|
|
7194
|
+
shopping_bag: shoppingBag,
|
|
7195
|
+
shopping_cart: shoppingCart,
|
|
7196
|
+
skill_book: skillBook,
|
|
7197
|
+
snare_trap: snareTrap,
|
|
7198
|
+
sneakers,
|
|
7199
|
+
tactical_vest: tacticalVest,
|
|
7200
|
+
technical_manual: technicalManual,
|
|
7201
|
+
tool_belt: toolBelt,
|
|
7202
|
+
trash_bag: trashBag,
|
|
7203
|
+
trekking_backpack_70l: trekkingBackpack70L,
|
|
7204
|
+
tshirt,
|
|
7205
|
+
watering_can: wateringCan,
|
|
7206
|
+
wheelbarrow,
|
|
7207
|
+
windup_alarm_clock: windupAlarmClock,
|
|
7208
|
+
plunger
|
|
7161
7209
|
};
|
|
7162
|
-
var
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
if (subject.category === "electronics") return "device";
|
|
7182
|
-
if (subject.category === "books") return "book";
|
|
7183
|
-
if (subject.category === "keys") return "key";
|
|
7184
|
-
return hint;
|
|
7185
|
-
case "paper":
|
|
7186
|
-
return subject.category === "books" ? "book" : hint;
|
|
7187
|
-
default:
|
|
7188
|
-
return hint;
|
|
7210
|
+
var SHIPPED_MODELS = models_default.map((entry) => {
|
|
7211
|
+
const builder = BUILDERS[entry.id];
|
|
7212
|
+
if (!builder) throw new Error(`game-items-three: no builder for the model "${entry.id}"`);
|
|
7213
|
+
return { entry, builder };
|
|
7214
|
+
});
|
|
7215
|
+
|
|
7216
|
+
// src/models/registry.ts
|
|
7217
|
+
var registryOver = (entries, builders) => ({
|
|
7218
|
+
has: (id) => builders.has(id),
|
|
7219
|
+
entry: (id) => entries.get(id),
|
|
7220
|
+
builder: (id) => builders.get(id),
|
|
7221
|
+
list: () => [...entries.keys()],
|
|
7222
|
+
register(entry, builder) {
|
|
7223
|
+
entries.set(entry.id, entry);
|
|
7224
|
+
builders.set(entry.id, builder);
|
|
7225
|
+
},
|
|
7226
|
+
unregister(id) {
|
|
7227
|
+
entries.delete(id);
|
|
7228
|
+
builders.delete(id);
|
|
7189
7229
|
}
|
|
7190
|
-
}
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7230
|
+
});
|
|
7231
|
+
var defaultRegistry;
|
|
7232
|
+
var defaultItemModels = () => defaultRegistry ?? (defaultRegistry = registryOver(new Map(SHIPPED_MODELS.map(({ entry }) => [entry.id, entry])), new Map(SHIPPED_MODELS.map(({ entry, builder }) => [entry.id, builder]))));
|
|
7233
|
+
var registerItemModel = (entry, builder) => defaultItemModels().register(entry, builder);
|
|
7234
|
+
var unregisterItemModel = (id) => defaultItemModels().unregister(id);
|
|
7235
|
+
var itemModelEntry = (id) => defaultItemModels().entry(id);
|
|
7236
|
+
var itemModelBuilder = (id) => defaultItemModels().builder(id);
|
|
7237
|
+
var hasItemModel = (id) => defaultItemModels().has(id);
|
|
7238
|
+
var listItemModels = () => defaultItemModels().list();
|
|
7195
7239
|
|
|
7196
7240
|
// src/wear.ts
|
|
7197
|
-
var WEAR_TARGET = { food: 6122286, metal: 8011293, wood: 4141862, cloth: 4866099, plastic: 7038294, paper: 9075282, glass: 5591098 };
|
|
7241
|
+
var WEAR_TARGET = { food: 6122286, metal: 8011293, wood: 4141862, cloth: 4866099, plastic: 7038294, paper: 9075282, glass: 5591098, rubber: 4860452 };
|
|
7198
7242
|
var WEAR_AMOUNT = [0, 0.3, 0.62];
|
|
7199
7243
|
var hexToRgb = (hex2) => [(hex2 >> 16 & 255) / 255, (hex2 >> 8 & 255) / 255, (hex2 & 255) / 255];
|
|
7200
7244
|
var dataOf = (material) => {
|
|
@@ -7260,7 +7304,7 @@ function buildItem(T, item, options = {}) {
|
|
|
7260
7304
|
const materials = kit.materials.slice(first);
|
|
7261
7305
|
if (options.wear) setWear(materials, options.wear);
|
|
7262
7306
|
root.userData.wear = options.wear ?? 0;
|
|
7263
|
-
if (options.destructible) tagForDestruction(root, { ...kind === "model" && item.model !== void 0 ? { modelId: item.model } : {}, ...shape === void 0 ? {} : { shapeId: shape }, ...item.weight === void 0 ? {} : { weight: item.weight }, size: item.size, ...item.powder ? { powder: item.powder } : {}, three: T });
|
|
7307
|
+
if (options.destructible) tagForDestruction(root, { ...kind === "model" && item.model !== void 0 ? { modelId: item.model } : {}, ...shape === void 0 ? {} : { shapeId: shape }, ...item.weight === void 0 ? {} : { weight: item.weight }, size: item.size, ...item.powder ? { powder: item.powder } : {}, ...item.parts ? { parts: item.parts } : {}, three: T });
|
|
7264
7308
|
markKitOrigin(root, { owner: "game-items-three", kind: "item", id: item.id, ...kind === "shape" ? { standIn: true } : {} });
|
|
7265
7309
|
return { root, kind, ...shape ? { shape } : {}, size: item.size, materials };
|
|
7266
7310
|
}
|
|
@@ -7395,6 +7439,153 @@ function renderItemThumbnail(T, renderer, item, options = {}) {
|
|
|
7395
7439
|
return renderer.domElement.toDataURL("image/png");
|
|
7396
7440
|
}
|
|
7397
7441
|
|
|
7442
|
+
// src/wash.ts
|
|
7443
|
+
var WASH_NAME = "item_wash";
|
|
7444
|
+
var STAIN_LIFT = 15e-4;
|
|
7445
|
+
var SPOTS = [
|
|
7446
|
+
[0, 0],
|
|
7447
|
+
[0.5, 0],
|
|
7448
|
+
[0.155, 0.476],
|
|
7449
|
+
[-0.405, 0.294],
|
|
7450
|
+
[-0.405, -0.294],
|
|
7451
|
+
[0.155, -0.476]
|
|
7452
|
+
];
|
|
7453
|
+
var STAIN_RADIUS = 0.12;
|
|
7454
|
+
var BUBBLE_RADIUS = 0.1;
|
|
7455
|
+
var BUBBLE_CLUSTER = [
|
|
7456
|
+
[0, 0, 1],
|
|
7457
|
+
[1.1, 0.3, 0.7],
|
|
7458
|
+
[-0.6, 0.9, 0.6]
|
|
7459
|
+
];
|
|
7460
|
+
var STAIN_COLORS = [8014370, 10903070, 6175260, 12088362, 9067050, 10243866];
|
|
7461
|
+
var FOAM_COLOR = 16054008;
|
|
7462
|
+
var overlays = /* @__PURE__ */ new WeakMap();
|
|
7463
|
+
var isOwnMesh = (mesh) => !mesh.userData.destructionDebris && mesh.parent?.name !== WASH_NAME;
|
|
7464
|
+
function localBox2(T, root) {
|
|
7465
|
+
root.updateMatrixWorld(true);
|
|
7466
|
+
const toRoot = new T.Matrix4().copy(root.matrixWorld).invert();
|
|
7467
|
+
const box2 = new T.Box3();
|
|
7468
|
+
const part = new T.Box3();
|
|
7469
|
+
const m = new T.Matrix4();
|
|
7470
|
+
root.traverse((o) => {
|
|
7471
|
+
const mesh = o;
|
|
7472
|
+
if (!mesh.isMesh || !isOwnMesh(mesh)) return;
|
|
7473
|
+
if (!mesh.geometry.boundingBox) mesh.geometry.computeBoundingBox();
|
|
7474
|
+
const bounds = mesh.geometry.boundingBox;
|
|
7475
|
+
if (!bounds) return;
|
|
7476
|
+
part.copy(bounds).applyMatrix4(m.multiplyMatrices(toRoot, mesh.matrixWorld));
|
|
7477
|
+
box2.union(part);
|
|
7478
|
+
});
|
|
7479
|
+
return box2;
|
|
7480
|
+
}
|
|
7481
|
+
function spotsOn(T, root, box2) {
|
|
7482
|
+
const meshes = [];
|
|
7483
|
+
root.traverse((o) => {
|
|
7484
|
+
const mesh = o;
|
|
7485
|
+
if (mesh.isMesh && isOwnMesh(mesh)) meshes.push(mesh);
|
|
7486
|
+
});
|
|
7487
|
+
const toRoot = new T.Matrix4().copy(root.matrixWorld).invert();
|
|
7488
|
+
const down = new T.Vector3(0, -1, 0).transformDirection(root.matrixWorld);
|
|
7489
|
+
const ray = new T.Raycaster();
|
|
7490
|
+
const centre = box2.getCenter(new T.Vector3());
|
|
7491
|
+
const half = box2.getSize(new T.Vector3()).multiplyScalar(0.5);
|
|
7492
|
+
const above = box2.max.y + half.y + 0.01;
|
|
7493
|
+
const spots = [];
|
|
7494
|
+
for (const [x, z] of SPOTS) {
|
|
7495
|
+
const origin = new T.Vector3(centre.x + x * half.x, above, centre.z + z * half.z).applyMatrix4(root.matrixWorld);
|
|
7496
|
+
ray.set(origin, down);
|
|
7497
|
+
const hit = ray.intersectObjects(meshes, false)[0];
|
|
7498
|
+
if (!hit?.face) continue;
|
|
7499
|
+
const normal = hit.face.normal.clone().transformDirection(hit.object.matrixWorld);
|
|
7500
|
+
if (normal.dot(down) > 0) normal.negate();
|
|
7501
|
+
const point = hit.point.clone().addScaledVector(normal, STAIN_LIFT).applyMatrix4(toRoot);
|
|
7502
|
+
spots.push({ point, normal: normal.transformDirection(toRoot) });
|
|
7503
|
+
}
|
|
7504
|
+
return spots;
|
|
7505
|
+
}
|
|
7506
|
+
function layerOf(T, geometry, material, bases, name) {
|
|
7507
|
+
const mesh = new T.InstancedMesh(geometry, material, bases.length);
|
|
7508
|
+
mesh.name = name;
|
|
7509
|
+
bases.forEach((base, i) => mesh.setMatrixAt(i, base));
|
|
7510
|
+
mesh.computeBoundingSphere();
|
|
7511
|
+
mesh.visible = false;
|
|
7512
|
+
mesh.userData.destructionDebris = true;
|
|
7513
|
+
mesh.raycast = () => {
|
|
7514
|
+
};
|
|
7515
|
+
return { mesh, bases, value: 0 };
|
|
7516
|
+
}
|
|
7517
|
+
function blotGeometry(T) {
|
|
7518
|
+
const geometry = new T.CircleGeometry(1, 9);
|
|
7519
|
+
const position = geometry.getAttribute("position");
|
|
7520
|
+
for (let i = 1; i < position.count; i++) {
|
|
7521
|
+
const wobble = 0.75 + 0.25 * Math.abs(Math.sin(i * 2.3));
|
|
7522
|
+
position.setXY(i, position.getX(i) * wobble, position.getY(i) * wobble);
|
|
7523
|
+
}
|
|
7524
|
+
return geometry.rotateX(-Math.PI / 2);
|
|
7525
|
+
}
|
|
7526
|
+
function createOverlay(T, root) {
|
|
7527
|
+
const scratch = { matrix: new T.Matrix4(), scale: new T.Matrix4() };
|
|
7528
|
+
const box2 = localBox2(T, root);
|
|
7529
|
+
const spots = box2.isEmpty() ? [] : spotsOn(T, root, box2);
|
|
7530
|
+
if (spots.length === 0) return { dirt: void 0, foam: void 0, scratch };
|
|
7531
|
+
const size = box2.getSize(new T.Vector3());
|
|
7532
|
+
const small = Math.min(size.x, size.z) / 2;
|
|
7533
|
+
const up = new T.Vector3(0, 1, 0);
|
|
7534
|
+
const turn = (normal, spin) => new T.Quaternion().setFromUnitVectors(up, normal).multiply(new T.Quaternion().setFromAxisAngle(up, spin));
|
|
7535
|
+
const stains = spots.map((spot, i) => {
|
|
7536
|
+
const r = small * STAIN_RADIUS;
|
|
7537
|
+
return new T.Matrix4().compose(spot.point, turn(spot.normal, i * 1.7), new T.Vector3(r, 1, r * (0.65 + 0.35 * (i * 0.37 % 1))));
|
|
7538
|
+
});
|
|
7539
|
+
const bubbleRadius = small * BUBBLE_RADIUS;
|
|
7540
|
+
const bubbles = spots.flatMap((spot, i) => {
|
|
7541
|
+
const q = turn(spot.normal, i * 1.1);
|
|
7542
|
+
return BUBBLE_CLUSTER.map(([along, across2, share]) => {
|
|
7543
|
+
const r = bubbleRadius * share;
|
|
7544
|
+
const at = new T.Vector3(along * bubbleRadius, r * 0.4 - STAIN_LIFT, across2 * bubbleRadius).applyQuaternion(q).add(spot.point);
|
|
7545
|
+
return new T.Matrix4().compose(at, q, new T.Vector3(r, r, r));
|
|
7546
|
+
});
|
|
7547
|
+
});
|
|
7548
|
+
const group = new T.Group();
|
|
7549
|
+
group.name = WASH_NAME;
|
|
7550
|
+
group.userData.destructionIgnore = true;
|
|
7551
|
+
const dirt = layerOf(T, blotGeometry(T), new T.MeshStandardMaterial({ roughness: 0.95, metalness: 0 }), stains, "item_dirt");
|
|
7552
|
+
stains.forEach((_, i) => dirt.mesh.setColorAt(i, new T.Color(STAIN_COLORS[i % STAIN_COLORS.length])));
|
|
7553
|
+
const foam = layerOf(T, new T.SphereGeometry(1, 8, 6), new T.MeshStandardMaterial({ color: FOAM_COLOR, roughness: 0.55, metalness: 0 }), bubbles, "item_foam");
|
|
7554
|
+
group.add(dirt.mesh, foam.mesh);
|
|
7555
|
+
root.add(group);
|
|
7556
|
+
return { dirt, foam, scratch };
|
|
7557
|
+
}
|
|
7558
|
+
function overlayOf(T, root) {
|
|
7559
|
+
const found = overlays.get(root);
|
|
7560
|
+
if (found) return found;
|
|
7561
|
+
const created = createOverlay(T, root);
|
|
7562
|
+
overlays.set(root, created);
|
|
7563
|
+
return created;
|
|
7564
|
+
}
|
|
7565
|
+
function showLayer(layer, value, scratch) {
|
|
7566
|
+
if (!layer) return;
|
|
7567
|
+
const share = Math.max(0, Math.min(1, value));
|
|
7568
|
+
if (share === layer.value) return;
|
|
7569
|
+
layer.value = share;
|
|
7570
|
+
layer.mesh.visible = share > 0;
|
|
7571
|
+
if (share === 0) return;
|
|
7572
|
+
const grow = 0.45 + 0.55 * share;
|
|
7573
|
+
scratch.scale.makeScale(grow, grow, grow);
|
|
7574
|
+
layer.bases.forEach((base, i) => {
|
|
7575
|
+
scratch.matrix.copy(base).multiply(scratch.scale);
|
|
7576
|
+
layer.mesh.setMatrixAt(i, scratch.matrix);
|
|
7577
|
+
});
|
|
7578
|
+
layer.mesh.instanceMatrix.needsUpdate = true;
|
|
7579
|
+
}
|
|
7580
|
+
function setItemDirt(T, root, dirt) {
|
|
7581
|
+
const overlay = overlayOf(T, root);
|
|
7582
|
+
showLayer(overlay.dirt, dirt, overlay.scratch);
|
|
7583
|
+
}
|
|
7584
|
+
function setItemFoam(T, root, amount) {
|
|
7585
|
+
const overlay = overlayOf(T, root);
|
|
7586
|
+
showLayer(overlay.foam, amount, overlay.scratch);
|
|
7587
|
+
}
|
|
7588
|
+
|
|
7398
7589
|
// src/test-area/area.ts
|
|
7399
7590
|
var SHOWCASE_STAND_ID = "stand_models";
|
|
7400
7591
|
var RULER_ID = "ruler_155";
|
|
@@ -7605,6 +7796,20 @@ function createItemsTestModule(options) {
|
|
|
7605
7796
|
const contents = itemContents(subject);
|
|
7606
7797
|
return contents ? { fluid: { container: contents.container, part: SHELL_PART_ID } } : {};
|
|
7607
7798
|
};
|
|
7799
|
+
const vesselOf = (def) => {
|
|
7800
|
+
const shape = def.model !== void 0 && modelSet.builder(def.model) ? void 0 : shapeOf(def);
|
|
7801
|
+
const vessel = itemVessel({ size: def.size, ...def.container?.capacityLiters === void 0 ? {} : { capacityLiters: def.container.capacityLiters }, ...shape === void 0 ? {} : { shape } });
|
|
7802
|
+
return vessel ? { fluid: { container: vessel.container, uses: ["drink", "sip", "pour", "pour_out"], offset: vessel.offset } } : {};
|
|
7803
|
+
};
|
|
7804
|
+
const washable = options.washable ?? ((def) => def.category !== "food" && (def.tags?.includes("kitchen") ?? false));
|
|
7805
|
+
const washOf = (def) => {
|
|
7806
|
+
if (!washable(def)) return {};
|
|
7807
|
+
const wash = {
|
|
7808
|
+
dirt: (root, dirt) => void (latestTHREE && setItemDirt(latestTHREE, root, dirt)),
|
|
7809
|
+
foam: (root, amount) => void (latestTHREE && setItemFoam(latestTHREE, root, amount))
|
|
7810
|
+
};
|
|
7811
|
+
return { wash };
|
|
7812
|
+
};
|
|
7608
7813
|
const sealOf = (def, fluid) => {
|
|
7609
7814
|
const model = def.model;
|
|
7610
7815
|
if (!def.seal || model === void 0 || !itemOpening(model)) return fluid;
|
|
@@ -7626,7 +7831,8 @@ function createItemsTestModule(options) {
|
|
|
7626
7831
|
};
|
|
7627
7832
|
const usesOf = (def) => {
|
|
7628
7833
|
const use = options.itemUse?.(def);
|
|
7629
|
-
const
|
|
7834
|
+
const contents = fluidOf({ ...def.model === void 0 ? {} : { model: def.model }, size: def.size, weight: def.weight });
|
|
7835
|
+
const liquid = sealOf(def, contents.fluid ? contents : vesselOf(def));
|
|
7630
7836
|
if (!use) return liquid;
|
|
7631
7837
|
const edible = def.category === "food" || def.category === "drink";
|
|
7632
7838
|
return { ...liquid, ...liquid.fluid && !edible ? { fluid: { ...liquid.fluid, uses: ["pour", "pour_out"] } } : {}, use };
|
|
@@ -7637,10 +7843,15 @@ function createItemsTestModule(options) {
|
|
|
7637
7843
|
movable: true,
|
|
7638
7844
|
thumbnail: itemThumbnailSvg(drawable(def)),
|
|
7639
7845
|
...usesOf(def),
|
|
7846
|
+
...washOf(def),
|
|
7847
|
+
catalogId: def.id,
|
|
7848
|
+
// what the item spends at each use (detergent, soap): the room takes its doses and shows what is left
|
|
7849
|
+
...def.consumable ? { consumable: def.consumable } : {},
|
|
7640
7850
|
// an item with a make-up (a shovel: ash handle riveted to a steel blade) is that spec, not the parts guessed from its meshes
|
|
7641
7851
|
...makeupSpecOf(def.model),
|
|
7642
7852
|
// an item that is also a tool of the arsenal (a shovel) is picked up as that tool
|
|
7643
7853
|
...def.weapon ? { weapon: def.weapon } : {},
|
|
7854
|
+
...def.tools ? { tools: def.tools } : {},
|
|
7644
7855
|
physical: { weightKg: def.weight, size: def.size, ...def.volume === void 0 ? {} : { litres: def.volume } },
|
|
7645
7856
|
build: (THREE) => {
|
|
7646
7857
|
const T = THREE;
|
|
@@ -8131,9 +8342,10 @@ export {
|
|
|
8131
8342
|
WEAR_AMOUNT,
|
|
8132
8343
|
wearableMaterials,
|
|
8133
8344
|
setWear,
|
|
8134
|
-
|
|
8345
|
+
SHAPES,
|
|
8135
8346
|
shade,
|
|
8136
8347
|
canonicalFrame,
|
|
8348
|
+
CUP_FLOOR_SHARE,
|
|
8137
8349
|
isShape,
|
|
8138
8350
|
shapeOf,
|
|
8139
8351
|
drawShape,
|
|
@@ -8147,6 +8359,7 @@ export {
|
|
|
8147
8359
|
ITEM_FAMILIES,
|
|
8148
8360
|
SHELL_PART_ID,
|
|
8149
8361
|
itemContents,
|
|
8362
|
+
itemVessel,
|
|
8150
8363
|
tagForDestruction,
|
|
8151
8364
|
itemOpening,
|
|
8152
8365
|
OPENING_NAME,
|
|
@@ -8164,6 +8377,9 @@ export {
|
|
|
8164
8377
|
hasItemModel,
|
|
8165
8378
|
listItemModels,
|
|
8166
8379
|
buildItem,
|
|
8380
|
+
WASH_NAME,
|
|
8381
|
+
setItemDirt,
|
|
8382
|
+
setItemFoam,
|
|
8167
8383
|
ITEM_BUDGETS,
|
|
8168
8384
|
sizeClassOf,
|
|
8169
8385
|
triangleBudgetOf,
|
|
@@ -8192,4 +8408,4 @@ export {
|
|
|
8192
8408
|
HUMAN_HEIGHT,
|
|
8193
8409
|
createItemsTestModule
|
|
8194
8410
|
};
|
|
8195
|
-
//# sourceMappingURL=chunk-
|
|
8411
|
+
//# sourceMappingURL=chunk-FCEKW7F6.js.map
|