@adatechnology/game-items-three 0.13.0 → 0.14.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-FCEKW7F6.js → chunk-XJG7IGO3.js} +124 -7
- package/dist/chunk-XJG7IGO3.js.map +1 -0
- package/dist/index.d.ts +19 -9
- package/dist/index.global.js +663 -432
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/{testing-DbKHUIwv.d.ts → testing-C96KjBjB.d.ts} +5 -3
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +12 -12
- package/dist/chunk-FCEKW7F6.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { discardObject3D } from "@adatechnology/game-shapes-three";
|
|
|
3
3
|
import { markKitOrigin as markKitOrigin2 } from "@adatechnology/game-contracts";
|
|
4
4
|
import { furnitureSpec } from "@adatechnology/game-floorplan-three";
|
|
5
5
|
import { rng } from "@adatechnology/game-interactables";
|
|
6
|
-
import { canCraft, craft, createFindsProvider, freshness, ITEM_CATEGORIES } from "@adatechnology/game-items";
|
|
6
|
+
import { canCraft, craft, createFindsProvider, freshness as freshness2, ITEM_CATEGORIES } from "@adatechnology/game-items";
|
|
7
7
|
|
|
8
8
|
// src/area-layout.ts
|
|
9
9
|
var SHELF_HEIGHT = 0.9;
|
|
@@ -156,7 +156,9 @@ var destruction_default = {
|
|
|
156
156
|
"coconut_water",
|
|
157
157
|
"cooking_oil",
|
|
158
158
|
"alcohol_70",
|
|
159
|
-
"fuel_jerrycan"
|
|
159
|
+
"fuel_jerrycan",
|
|
160
|
+
"shampoo",
|
|
161
|
+
"toothpaste"
|
|
160
162
|
],
|
|
161
163
|
rule: {
|
|
162
164
|
hollow: true,
|
|
@@ -291,6 +293,14 @@ var destruction_default = {
|
|
|
291
293
|
condensed_milk: {
|
|
292
294
|
liquid: "honey",
|
|
293
295
|
fill: 0.9
|
|
296
|
+
},
|
|
297
|
+
shampoo: {
|
|
298
|
+
liquid: "shampoo",
|
|
299
|
+
fill: 0.9
|
|
300
|
+
},
|
|
301
|
+
toothpaste: {
|
|
302
|
+
liquid: "toothpaste",
|
|
303
|
+
fill: 0.85
|
|
294
304
|
}
|
|
295
305
|
},
|
|
296
306
|
shapes: {
|
|
@@ -3327,6 +3337,46 @@ var models_default = [
|
|
|
3327
3337
|
],
|
|
3328
3338
|
scale: 0.092308
|
|
3329
3339
|
},
|
|
3340
|
+
{
|
|
3341
|
+
id: "soap",
|
|
3342
|
+
teamId: "sabonete",
|
|
3343
|
+
teamBox: [
|
|
3344
|
+
0.9,
|
|
3345
|
+
0.3,
|
|
3346
|
+
0.5
|
|
3347
|
+
],
|
|
3348
|
+
scale: 0.1
|
|
3349
|
+
},
|
|
3350
|
+
{
|
|
3351
|
+
id: "shampoo",
|
|
3352
|
+
teamId: "shampoo",
|
|
3353
|
+
teamBox: [
|
|
3354
|
+
0.6,
|
|
3355
|
+
2,
|
|
3356
|
+
0.4002
|
|
3357
|
+
],
|
|
3358
|
+
scale: 0.1
|
|
3359
|
+
},
|
|
3360
|
+
{
|
|
3361
|
+
id: "toothpaste",
|
|
3362
|
+
teamId: "pasta_dente",
|
|
3363
|
+
teamBox: [
|
|
3364
|
+
0.4,
|
|
3365
|
+
1.8,
|
|
3366
|
+
0.3
|
|
3367
|
+
],
|
|
3368
|
+
scale: 0.1
|
|
3369
|
+
},
|
|
3370
|
+
{
|
|
3371
|
+
id: "toothbrush",
|
|
3372
|
+
teamId: "escova_dente",
|
|
3373
|
+
teamBox: [
|
|
3374
|
+
0.2,
|
|
3375
|
+
1.8,
|
|
3376
|
+
0.2
|
|
3377
|
+
],
|
|
3378
|
+
scale: 0.1
|
|
3379
|
+
},
|
|
3330
3380
|
{
|
|
3331
3381
|
id: "plunger",
|
|
3332
3382
|
teamId: "desentupidor",
|
|
@@ -4518,6 +4568,61 @@ var alcohol70 = ({ mesh, cyl, lathe, G, glass, plastic, paper: paper2 }) => {
|
|
|
4518
4568
|
return G(bottle2, label, stripe, cap, nozzle);
|
|
4519
4569
|
};
|
|
4520
4570
|
|
|
4571
|
+
// src/models/shampoo.ts
|
|
4572
|
+
var shampoo = ({ mesh, cyl, lathe, G, plastic, paper: paper2 }) => {
|
|
4573
|
+
const oval = [1, 1, 0.667];
|
|
4574
|
+
const body = mesh(lathe([[0, -1], [0.24, -1], [0.28, -0.94], [0.28, 0.42], [0.25, 0.55], [0.15, 0.62], [0.15, 0.66], [0, 0.66]], 14), plastic(4885200), [0, 0, 0], [0, 0, 0], oval);
|
|
4575
|
+
const label = mesh(cyl(0.3, 0.3, 0.8, 16), paper2(15922680), [0, -0.35, 0], [0, 0, 0], oval);
|
|
4576
|
+
const cap = mesh(cyl(0.17, 0.17, 0.28, 12), plastic(15790320), [0, 0.8, 0], [0, 0, 0], oval);
|
|
4577
|
+
const lid = mesh(cyl(0.12, 0.17, 0.06, 12), plastic(14869218), [0, 0.97, 0], [0, 0, 0], oval);
|
|
4578
|
+
return G(body, label, cap, lid);
|
|
4579
|
+
};
|
|
4580
|
+
|
|
4581
|
+
// src/models/soap.ts
|
|
4582
|
+
var roundedRect = (width, depth, corner, steps = 4) => {
|
|
4583
|
+
const points = [];
|
|
4584
|
+
const centres = [
|
|
4585
|
+
[width / 2 - corner, depth / 2 - corner, 0],
|
|
4586
|
+
[-width / 2 + corner, depth / 2 - corner, Math.PI / 2],
|
|
4587
|
+
[-width / 2 + corner, -depth / 2 + corner, Math.PI],
|
|
4588
|
+
[width / 2 - corner, -depth / 2 + corner, 3 * Math.PI / 2]
|
|
4589
|
+
];
|
|
4590
|
+
for (const [cx, cy, start] of centres) {
|
|
4591
|
+
for (let step = 0; step <= steps; step++) {
|
|
4592
|
+
const angle = start + step / steps * (Math.PI / 2);
|
|
4593
|
+
points.push([cx + Math.cos(angle) * corner, cy + Math.sin(angle) * corner]);
|
|
4594
|
+
}
|
|
4595
|
+
}
|
|
4596
|
+
return points;
|
|
4597
|
+
};
|
|
4598
|
+
var soap = ({ mesh, extrude, M, G }) => {
|
|
4599
|
+
const edge = 0.04;
|
|
4600
|
+
const bar = extrude(roundedRect(0.9 - 2 * edge, 0.5 - 2 * edge, 0.14), 0.3 - 2 * edge, edge);
|
|
4601
|
+
bar.center();
|
|
4602
|
+
return G(mesh(bar, M(15984338, "wax", { roughness: 0.55 }), [0, 0, 0], [Math.PI / 2, 0, 0]));
|
|
4603
|
+
};
|
|
4604
|
+
|
|
4605
|
+
// src/models/toothbrush.ts
|
|
4606
|
+
var toothbrush = ({ mesh, bx, G, plastic, M }) => {
|
|
4607
|
+
const handle = mesh(bx(0.16, 0.8, 0.1), plastic(3840720), [0, 0.75, -0.05]);
|
|
4608
|
+
const grip = mesh(bx(0.2, 0.35, 0.12), plastic(2912160), [0, 0.175, -0.05]);
|
|
4609
|
+
const neck = mesh(bx(0.08, 0.3, 0.08), plastic(3840720), [0, 1.3, -0.05]);
|
|
4610
|
+
const head = mesh(bx(0.14, 0.35, 0.06), plastic(3840720), [0, 1.625, -0.06]);
|
|
4611
|
+
const bristles = mesh(bx(0.12, 0.32, 0.12), M(16054008, "plastic", { roughness: 0.9 }), [0, 1.62, 0.03]);
|
|
4612
|
+
return G(handle, grip, neck, head, bristles);
|
|
4613
|
+
};
|
|
4614
|
+
|
|
4615
|
+
// src/models/toothpaste.ts
|
|
4616
|
+
var toothpaste = ({ mesh, cyl, bx, G, plastic }) => {
|
|
4617
|
+
const flat = [1, 1, 0.75];
|
|
4618
|
+
const cap = mesh(cyl(0.11, 0.12, 0.22, 12), plastic(2056104), [0, 0.11, 0]);
|
|
4619
|
+
const shoulder = mesh(cyl(0.2, 0.11, 0.08, 14), plastic(16053494), [0, 0.26, 0], [0, 0, 0], flat);
|
|
4620
|
+
const body = mesh(cyl(0.2, 0.2, 0.9, 14), plastic(16053494), [0, 0.75, 0], [0, 0, 0], flat);
|
|
4621
|
+
const taper = mesh(cyl(0.2, 0.2, 0.44, 14), plastic(16053494), [0, 1.41, 0], [0, 0, 0], [1, 1, 0.42]);
|
|
4622
|
+
const crimp = mesh(bx(0.4, 0.17, 0.04), plastic(15132394), [0, 1.715, 0]);
|
|
4623
|
+
return G(cap, shoulder, body, taper, crimp);
|
|
4624
|
+
};
|
|
4625
|
+
|
|
4521
4626
|
// src/models/plunger.ts
|
|
4522
4627
|
var plunger = ({ mesh, cyl, G, M, wood }) => {
|
|
4523
4628
|
const rubber = M(11545120, "rubber", { roughness: 0.75 });
|
|
@@ -7205,6 +7310,10 @@ var BUILDERS = {
|
|
|
7205
7310
|
watering_can: wateringCan,
|
|
7206
7311
|
wheelbarrow,
|
|
7207
7312
|
windup_alarm_clock: windupAlarmClock,
|
|
7313
|
+
soap,
|
|
7314
|
+
shampoo,
|
|
7315
|
+
toothpaste,
|
|
7316
|
+
toothbrush,
|
|
7208
7317
|
plunger
|
|
7209
7318
|
};
|
|
7210
7319
|
var SHIPPED_MODELS = models_default.map((entry) => {
|
|
@@ -7238,6 +7347,13 @@ var hasItemModel = (id) => defaultItemModels().has(id);
|
|
|
7238
7347
|
var listItemModels = () => defaultItemModels().list();
|
|
7239
7348
|
|
|
7240
7349
|
// src/wear.ts
|
|
7350
|
+
import { freshness } from "@adatechnology/game-items";
|
|
7351
|
+
var wearOfFreshness = (state) => state === "fresh" ? 0 : state === "stale" ? 1 : 2;
|
|
7352
|
+
var AGED_IN = "ambient";
|
|
7353
|
+
function wearOfAge(item, ageDays, rules) {
|
|
7354
|
+
if (item.shelfLife === void 0 || ageDays <= 0) return 0;
|
|
7355
|
+
return wearOfFreshness(freshness(item, { ageDays, since: 0, storage: AGED_IN, storedAt: 0 }, 0, rules ? { rules } : {}));
|
|
7356
|
+
}
|
|
7241
7357
|
var WEAR_TARGET = { food: 6122286, metal: 8011293, wood: 4141862, cloth: 4866099, plastic: 7038294, paper: 9075282, glass: 5591098, rubber: 4860452 };
|
|
7242
7358
|
var WEAR_AMOUNT = [0, 0.3, 0.62];
|
|
7243
7359
|
var hexToRgb = (hex2) => [(hex2 >> 16 & 255) / 255, (hex2 >> 8 & 255) / 255, (hex2 & 255) / 255];
|
|
@@ -7715,9 +7831,8 @@ var fill = (template, vars) => template.replace(/\{(\w+)\}/g, (_, key2) => Strin
|
|
|
7715
7831
|
var humanize = (id) => id.replace(/_/g, " ").replace(/^./, (c) => c.toUpperCase());
|
|
7716
7832
|
var stageOf = (catalog, item, base, ageDays, storage, powered) => {
|
|
7717
7833
|
if (item.shelfLife === void 0 || ageDays <= 0) return base;
|
|
7718
|
-
const state =
|
|
7719
|
-
|
|
7720
|
-
return Math.max(base, aged);
|
|
7834
|
+
const state = freshness2(item, { ageDays: 0, since: 0, storage, storedAt: 0 }, ageDays, { powered, rules: catalog.rules });
|
|
7835
|
+
return Math.max(base, wearOfFreshness(state));
|
|
7721
7836
|
};
|
|
7722
7837
|
var sizeOfModel = (modelSet, id) => {
|
|
7723
7838
|
const entry = modelSet.entry(id);
|
|
@@ -8313,7 +8428,7 @@ function scenariosOf(module, catalog, text, provider, modelSet) {
|
|
|
8313
8428
|
run: ({ expect }) => {
|
|
8314
8429
|
const food = catalog.list().find((item) => item.shelfLife !== void 0 && item.shelfLife > 0);
|
|
8315
8430
|
if (!food) return expect(false, "the catalog has a food that spoils");
|
|
8316
|
-
const at = (storage, days2) =>
|
|
8431
|
+
const at = (storage, days2) => freshness2(food, { ageDays: 0, since: 0, storage, storedAt: 0 }, days2, { rules: catalog.rules });
|
|
8317
8432
|
const days = food.shelfLife * 1.2;
|
|
8318
8433
|
expect(at("ambient", days) !== "fresh", "at room temperature it is past its best", { food: food.id });
|
|
8319
8434
|
if ("fridge" in catalog.rules.storage) expect(at("fridge", days) !== at("ambient", days) || at("fridge", days) === "fresh", "in the fridge it keeps better", { food: food.id });
|
|
@@ -8338,6 +8453,8 @@ function scenariosOf(module, catalog, text, provider, modelSet) {
|
|
|
8338
8453
|
export {
|
|
8339
8454
|
WEAR_TAGS,
|
|
8340
8455
|
createItemKit,
|
|
8456
|
+
wearOfFreshness,
|
|
8457
|
+
wearOfAge,
|
|
8341
8458
|
WEAR_TARGET,
|
|
8342
8459
|
WEAR_AMOUNT,
|
|
8343
8460
|
wearableMaterials,
|
|
@@ -8408,4 +8525,4 @@ export {
|
|
|
8408
8525
|
HUMAN_HEIGHT,
|
|
8409
8526
|
createItemsTestModule
|
|
8410
8527
|
};
|
|
8411
|
-
//# sourceMappingURL=chunk-
|
|
8528
|
+
//# sourceMappingURL=chunk-XJG7IGO3.js.map
|