@adatechnology/game-interactables-household 0.9.0 → 0.11.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.
@@ -28,16 +28,17 @@ var GameInteractablesHousehold = (() => {
28
28
  HOUSEHOLD_TYPES: () => HOUSEHOLD_TYPES,
29
29
  STOVE_WALL_GAP: () => STOVE_WALL_GAP,
30
30
  WALL_PLATE: () => WALL_PLATE,
31
+ assembleHouseholdType: () => assembleHouseholdType,
31
32
  cornersOf: () => cornersOf,
32
33
  createHousehold: () => createHousehold,
34
+ createHouseholdAssemblies: () => createHouseholdAssemblies,
33
35
  createRecorder: () => createRecorder,
36
+ drawHouseholdAssembly: () => drawHouseholdAssembly,
34
37
  motionPoint: () => motionPoint,
35
38
  sweepOf: () => sweepOf
36
39
  });
37
40
 
38
- // ../game-contracts/dist/index.js
39
- var DEFAULT_BLAST_IMPULSE = { bodyArea: 0.7, lift: 0.15, minSpeed: 0.3, tntPerJoule: 0.24 / 2e5 };
40
- var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
41
+ // ../game-contracts/src/spec.ts
41
42
  var STRUCTURE_ROLES = ["foundation", "column", "beam", "slab", "wall", "partition", "roof", "stair", "none"];
42
43
  var BEARS = [true, false, "a_on_b", "b_on_a"];
43
44
  var finite = (n) => typeof n === "number" && Number.isFinite(n);
@@ -140,46 +141,16 @@ var GameInteractablesHousehold = (() => {
140
141
  }
141
142
  return { ok: problems.length === 0, problems, warnings };
142
143
  };
144
+
145
+ // ../game-contracts/src/seal.ts
143
146
  var sealBlock = (seal, state) => {
144
147
  if (seal.spoilsWhenBreached && state.breached) return "breached";
145
148
  if (seal.spoilsWhenBreached && state.leaked) return "leaked";
146
149
  if (!state.opened) return "sealed";
147
150
  return void 0;
148
151
  };
149
- var DEFERRED_QUEUE_ID = {
150
- DESTRUCTION_EVENTS: "destruction.events",
151
- BREACH_PAINT: "floorplan.breach-paint",
152
- BREACH_CUT: "floorplan.breach-cut",
153
- AUDIO_VOICES: "audio.voices",
154
- VEHICLE_CREASE: "vehicles.crease",
155
- AUDIO_OCCLUSION: "audio.occlusion",
156
- FLUID_FILM: "fluids.film",
157
- VEHICLE_LOD_BATCH: "vehicles.lod-batch",
158
- SETTLED_BATCH: "destruction.settled-batch",
159
- STATIC_BATCH: "render.static-batch",
160
- ANIMALS_STATIC_BATCH: "animals.static-batch",
161
- CHARACTERS_STATIC_BATCH: "characters.static-batch",
162
- HOUSE_SHADOW_BATCH: "floorplan.shadow-batch",
163
- DESTRUCTION_PREFIT: "destruction.prefit"
164
- };
165
- var DEFERRED_PRIORITY = {
166
- [DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS]: { priority: 300, phase: "present" },
167
- // every frame: the walls cut since the last frame are painted once each, and a hole must show in the frame of the blast
168
- [DEFERRED_QUEUE_ID.BREACH_CUT]: { priority: 260, phase: "present", minEveryFrames: 1 },
169
- [DEFERRED_QUEUE_ID.BREACH_PAINT]: { priority: 250, phase: "present", minEveryFrames: 1 },
170
- [DEFERRED_QUEUE_ID.AUDIO_VOICES]: { priority: 200, phase: "idle", reserveMs: 1 },
171
- [DEFERRED_QUEUE_ID.AUDIO_OCCLUSION]: { priority: 190, phase: "idle", minEveryFrames: 8 },
172
- [DEFERRED_QUEUE_ID.FLUID_FILM]: { priority: 120, phase: "idle", minEveryFrames: 2 },
173
- [DEFERRED_QUEUE_ID.VEHICLE_CREASE]: { priority: 100, phase: "idle" },
174
- [DEFERRED_QUEUE_ID.VEHICLE_LOD_BATCH]: { priority: 90, phase: "idle", minEveryFrames: 4 },
175
- [DEFERRED_QUEUE_ID.SETTLED_BATCH]: { priority: 70, phase: "idle", minEveryFrames: 8 },
176
- [DEFERRED_QUEUE_ID.STATIC_BATCH]: { priority: 60, phase: "idle", minEveryFrames: 8 },
177
- [DEFERRED_QUEUE_ID.ANIMALS_STATIC_BATCH]: { priority: 60, phase: "idle", minEveryFrames: 8 },
178
- [DEFERRED_QUEUE_ID.CHARACTERS_STATIC_BATCH]: { priority: 60, phase: "idle", minEveryFrames: 8 },
179
- [DEFERRED_QUEUE_ID.HOUSE_SHADOW_BATCH]: { priority: 50, phase: "idle", minEveryFrames: 8 },
180
- [DEFERRED_QUEUE_ID.DESTRUCTION_PREFIT]: { priority: 40, phase: "idle", minEveryFrames: 30 }
181
- };
182
- var MUST_DRAIN_QUEUE_IDS = /* @__PURE__ */ new Set([DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS, DEFERRED_QUEUE_ID.BREACH_CUT]);
152
+
153
+ // ../game-contracts/src/warn.ts
183
154
  var WARNED_KEY = /* @__PURE__ */ Symbol.for("@adatechnology/game-contracts.warned");
184
155
  var warnedKeys = () => {
185
156
  const holder = globalThis;
@@ -200,6 +171,8 @@ var GameInteractablesHousehold = (() => {
200
171
  seen.add(key);
201
172
  console.warn(`[game-kit] ${message}`);
202
173
  };
174
+
175
+ // ../game-contracts/src/registry.ts
203
176
  var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
204
177
  var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
205
178
  var deepMerge = (base, patch) => {
@@ -229,6 +202,8 @@ var GameInteractablesHousehold = (() => {
229
202
  if (!entries.delete(id)) warnOnce(`registry.remove.${id}`, `remove of "${id}" ignored: no entry has that id`);
230
203
  }
231
204
  };
205
+
206
+ // ../game-contracts/src/categories.ts
232
207
  var defineCategories = (defs, options = {}) => {
233
208
  const problems = [];
234
209
  const duplicates = (list) => {
@@ -292,60 +267,55 @@ var GameInteractablesHousehold = (() => {
292
267
  return registry;
293
268
  };
294
269
  var resolveEntry = (registry, entry, kindField = "kind") => deepMerge(registry.defaults(String(entry[kindField])), entry);
295
- var SURFACE_IDS = ["concrete", "asphalt", "wood", "tile", "dirt", "grass", "gravel", "sand", "metal", "water", "glass", "carpet"];
296
- var GAIT_IDS = ["walk", "run"];
297
- var LANDING_IDS = ["light", "heavy"];
298
- var BODY_SOUND_IDS = [
299
- "jump",
300
- "cloth_rustle",
301
- "body_fall",
302
- "fall_damage",
303
- "player_hurt",
304
- "player_breath_run",
305
- "player_death",
306
- "bite",
307
- "grab",
308
- "punch_swing",
309
- "punch_hit_body",
310
- "punch_hit_face",
311
- "punch_hit_object",
312
- "kick_swing",
313
- "kick_hit",
314
- "kick_hit_object",
315
- "shove_two_hands",
316
- "knife_swing",
317
- "knife_stab",
318
- "knife_slash",
319
- "knife_hit_object",
320
- "blunt_swing",
321
- "blunt_hit",
322
- "blunt_hit_object",
323
- "axe_swing",
324
- "axe_chop",
325
- "axe_hit_object"
326
- ];
327
- var footstepSoundId = (surface, gait) => `footstep_${surface}_${gait}`;
328
- var FOOTSTEP_SOUND_IDS = SURFACE_IDS.flatMap((surface) => GAIT_IDS.map((gait) => footstepSoundId(surface, gait)));
329
- var LAND_SOUND_IDS = SURFACE_IDS.flatMap((surface) => LANDING_IDS.map((landing) => `land_${surface}_${landing}`));
330
- var BODY_FOLEY_IDS = [...FOOTSTEP_SOUND_IDS, ...LAND_SOUND_IDS, ...BODY_SOUND_IDS];
331
- var WORKER_KIND_ID = {
332
- GROUND_TILES: "destruction.ground-tiles",
333
- CROWD_PHYSICS: "crowd.physics",
334
- PIECE_BOXES: "destruction.piece-boxes",
335
- STATIC_COLLIDERS: "destruction.static-colliders",
336
- SHAPES_GENERATE: "shapes.generate",
337
- WORLD_REGION: "world.region",
338
- VEHICLE_HULL_PLAN: "vehicles.hull-plan"
339
- };
340
- var WORKER_KIND_DEFAULTS = {
341
- [WORKER_KIND_ID.GROUND_TILES]: { lane: "sim", priority: 300, latencyFrames: 2, late: "sync" },
342
- [WORKER_KIND_ID.CROWD_PHYSICS]: { lane: "sim", priority: 250, latencyFrames: 1, late: "sync" },
343
- [WORKER_KIND_ID.PIECE_BOXES]: { lane: "sim", priority: 200, latencyFrames: 2, late: "sync" },
344
- [WORKER_KIND_ID.STATIC_COLLIDERS]: { lane: "build", priority: 150, late: "sync" },
345
- [WORKER_KIND_ID.SHAPES_GENERATE]: { lane: "build", priority: 100, late: "sync" },
346
- [WORKER_KIND_ID.WORLD_REGION]: { lane: "background", priority: 10, latencyFrames: 10, late: "drop" },
347
- [WORKER_KIND_ID.VEHICLE_HULL_PLAN]: { lane: "build", priority: 120, late: "keep-waiting" }
348
- };
270
+
271
+ // ../game-interactables/src/math.ts
272
+ var DEFAULT_AXIS = [0, 1, 0];
273
+ function poseOf(motion, t) {
274
+ const tt = Math.max(0, Math.min(1, t));
275
+ const axis = motion.axis ?? DEFAULT_AXIS;
276
+ const pose = { position: [0, 0, 0], rotation: { axis: [axis[0], axis[1], axis[2]], angle: 0 }, scale: [1, 1, 1] };
277
+ switch (motion.kind) {
278
+ case "hinge":
279
+ case "rocker":
280
+ case "knob":
281
+ pose.rotation.angle = (motion.angle ?? Math.PI / 2) * tt;
282
+ break;
283
+ case "slide": {
284
+ const d = (motion.distance ?? 0.4) * tt;
285
+ pose.position = [axis[0] * d, axis[1] * d, axis[2] * d];
286
+ break;
287
+ }
288
+ case "scale": {
289
+ const k = 1 + ((motion.scale ?? 0.2) - 1) * tt;
290
+ pose.scale = [axis[0] !== 0 ? k : 1, axis[1] !== 0 ? k : 1, axis[2] !== 0 ? k : 1];
291
+ break;
292
+ }
293
+ }
294
+ return pose;
295
+ }
296
+
297
+ // ../game-interactables/src/cast-with-member.ts
298
+ var COLLAR_REACH = 0.03;
299
+ var END_GAP = 5e-3;
300
+ function centredOn(member, other) {
301
+ for (const k of [0, 2]) {
302
+ if (other[k] < member[k] - COLLAR_REACH || other[k + 3] > member[k + 3] + COLLAR_REACH) return false;
303
+ if (Math.abs((other[k] + other[k + 3]) / 2 - (member[k] + member[k + 3]) / 2) > COLLAR_REACH) return false;
304
+ }
305
+ return true;
306
+ }
307
+ function wrapsMember(member, collar) {
308
+ const overlap = Math.min(collar[4], member[4]) - Math.max(collar[1], member[1]);
309
+ return overlap >= (collar[4] - collar[1]) / 2 && centredOn(member, collar);
310
+ }
311
+ function endsMember(member, end) {
312
+ const under = Math.abs(end[4] - member[1]) <= END_GAP;
313
+ const over = Math.abs(end[1] - member[4]) <= END_GAP;
314
+ return (under || over) && end[4] - end[1] <= member[4] - member[1] && centredOn(member, end);
315
+ }
316
+ function castWithMember(member, other) {
317
+ return wrapsMember(member, other) || endsMember(member, other);
318
+ }
349
319
 
350
320
  // ../game-items/dist/index.js
351
321
  var DEFAULT_RULES = {
@@ -424,64 +394,2476 @@ var GameInteractablesHousehold = (() => {
424
394
  fillable: ["fuel_jerrycan"],
425
395
  fill: [0, 0.6]
426
396
  },
427
- finds: {
428
- fallbackContainer: "zombie_corpse",
429
- rollExcluded: ["ammo_7_62x39"],
430
- depletion: [
431
- { places: ["pharmacy", "gun_shop", "police_station"], perDay: 0.05, floor: 0.3 },
432
- { places: ["supermarket", "gas_station"], perDay: 0.04, floor: 0.35 },
433
- { places: ["mall", "hospital"], perDay: 0.025, floor: 0.5 },
434
- { places: ["house", "apartment"], perDay: 0.01, floor: 0.7 },
435
- { places: ["farm", "warehouse", "mine", "dam", "lodge", "church"], perDay: 5e-3, floor: 0.85 },
436
- { places: ["military_base"], perDay: 0, floor: 1 }
437
- ],
438
- regionMultiplier: {},
439
- states: { normal: "normal", fortified: "fortified", abandoned: "abandoned" },
440
- pool: {
441
- defaultFootprint: 0.5,
442
- offset: 1.5,
443
- perSquareMetre: 3,
444
- jitter: 1.5,
445
- min: 2,
446
- max: 5,
447
- fortifiedExtra: 2,
448
- supplyWeight: 2.5,
449
- supplyExtraQty: 1,
450
- abandonedEmptyChance: 0.4,
451
- abandonedKept: 1,
452
- junkChance: 0.5,
453
- junkItem: "food_packaging",
454
- spoiledFoodItem: "leftover_meal",
455
- coldContainers: ["geladeira", "refrig_exp", "freezer"]
456
- }
397
+ finds: {
398
+ fallbackContainer: "zombie_corpse",
399
+ rollExcluded: ["ammo_7_62x39"],
400
+ depletion: [
401
+ { places: ["pharmacy", "gun_shop", "police_station"], perDay: 0.05, floor: 0.3 },
402
+ { places: ["supermarket", "gas_station"], perDay: 0.04, floor: 0.35 },
403
+ { places: ["mall", "hospital"], perDay: 0.025, floor: 0.5 },
404
+ { places: ["house", "apartment"], perDay: 0.01, floor: 0.7 },
405
+ { places: ["farm", "warehouse", "mine", "dam", "lodge", "church"], perDay: 5e-3, floor: 0.85 },
406
+ { places: ["military_base"], perDay: 0, floor: 1 }
407
+ ],
408
+ regionMultiplier: {},
409
+ states: { normal: "normal", fortified: "fortified", abandoned: "abandoned" },
410
+ pool: {
411
+ defaultFootprint: 0.5,
412
+ offset: 1.5,
413
+ perSquareMetre: 3,
414
+ jitter: 1.5,
415
+ min: 2,
416
+ max: 5,
417
+ fortifiedExtra: 2,
418
+ supplyWeight: 2.5,
419
+ supplyExtraQty: 1,
420
+ abandonedEmptyChance: 0.4,
421
+ abandonedKept: 1,
422
+ junkChance: 0.5,
423
+ junkItem: "food_packaging",
424
+ spoiledFoodItem: "leftover_meal",
425
+ coldContainers: ["geladeira", "refrig_exp", "freezer"]
426
+ }
427
+ }
428
+ };
429
+ var FRESH_NUTRITION = { satietyFactor: 1, poisonChance: 0, morale: 0, isEdible: true };
430
+ var nutritionOf = (item, context, rules) => {
431
+ const state = context.freshness ?? "fresh";
432
+ const effect = state === "fresh" ? FRESH_NUTRITION : rules.use.freshness[state];
433
+ const poisonShare = context.isCooked ? rules.use.cookedPoisonFactor : 1;
434
+ return {
435
+ satiety: (item.nutrition?.satiety ?? 0) * effect.satietyFactor,
436
+ hydration: item.nutrition?.hydration ?? 0,
437
+ morale: effect.morale,
438
+ poisonChance: effect.poisonChance * poisonShare,
439
+ isEdible: effect.isEdible
440
+ };
441
+ };
442
+ var findEffect = (item, effects) => effects.find((entry) => entry.items?.includes(item.id)) ?? effects.find((entry) => entry.category?.includes(item.category));
443
+ var resolveUse = (item, effects, context = {}, rules = DEFAULT_RULES) => {
444
+ const def = findEffect(item, effects);
445
+ if (!def) return void 0;
446
+ const base = { useId: def.id, effect: def.effect, params: def.params ?? {}, consumes: def.consumes };
447
+ if (def.effect !== "consume_nutrition") return base;
448
+ const nutrition = nutritionOf(item, context, rules);
449
+ const blocked = item.seal && context.seal ? sealBlock(item.seal, context.seal) : void 0;
450
+ if (blocked) return { ...base, consumes: false, nutrition: { ...nutrition, isEdible: false }, blocked };
451
+ return { ...base, consumes: def.consumes && nutrition.isEdible, nutrition };
452
+ };
453
+ var MM = 1e-3;
454
+ var BOX_WALL = 6 * MM;
455
+ var hand_uses_default = [
456
+ {
457
+ id: "eat_food",
458
+ body: "mouth",
459
+ duration: 3.4,
460
+ note: "three bites: the food to the mouth, a bite, down a little to chew, and again",
461
+ keys: [
462
+ {
463
+ t: 0,
464
+ position: [
465
+ 0.22,
466
+ -0.2,
467
+ -0.4
468
+ ],
469
+ rotation: [
470
+ 0,
471
+ 0,
472
+ 0
473
+ ]
474
+ },
475
+ {
476
+ t: 0.45,
477
+ position: [
478
+ 0.01,
479
+ 0,
480
+ -0.17
481
+ ],
482
+ rotation: [
483
+ -0.3,
484
+ 0,
485
+ 0
486
+ ],
487
+ action: "bite"
488
+ },
489
+ {
490
+ t: 0.8,
491
+ position: [
492
+ 0.05,
493
+ -0.08,
494
+ -0.26
495
+ ],
496
+ rotation: [
497
+ -0.15,
498
+ 0,
499
+ 0
500
+ ]
501
+ },
502
+ {
503
+ t: 1.25,
504
+ position: [
505
+ 0.01,
506
+ 0,
507
+ -0.17
508
+ ],
509
+ rotation: [
510
+ -0.3,
511
+ 0,
512
+ 0
513
+ ],
514
+ action: "bite"
515
+ },
516
+ {
517
+ t: 1.6,
518
+ position: [
519
+ 0.05,
520
+ -0.08,
521
+ -0.26
522
+ ],
523
+ rotation: [
524
+ -0.15,
525
+ 0,
526
+ 0
527
+ ]
528
+ },
529
+ {
530
+ t: 2.05,
531
+ position: [
532
+ 0.01,
533
+ 0,
534
+ -0.17
535
+ ],
536
+ rotation: [
537
+ -0.3,
538
+ 0,
539
+ 0
540
+ ],
541
+ action: "bite"
542
+ },
543
+ {
544
+ t: 2.8,
545
+ position: [
546
+ 0.05,
547
+ -0.08,
548
+ -0.26
549
+ ],
550
+ rotation: [
551
+ -0.15,
552
+ 0,
553
+ 0
554
+ ]
555
+ },
556
+ {
557
+ t: 3.4,
558
+ position: [
559
+ 0.22,
560
+ -0.2,
561
+ -0.4
562
+ ],
563
+ rotation: [
564
+ 0,
565
+ 0,
566
+ 0
567
+ ]
568
+ }
569
+ ]
570
+ },
571
+ {
572
+ id: "drink",
573
+ body: "mouth",
574
+ duration: 2.5,
575
+ note: "a drink without a liquid of its own (a juice box): to the mouth and tipped up, as the fluid drink",
576
+ keys: [
577
+ {
578
+ t: 0,
579
+ position: [
580
+ 0.22,
581
+ -0.2,
582
+ -0.4
583
+ ],
584
+ rotation: [
585
+ 0,
586
+ 0,
587
+ 0
588
+ ]
589
+ },
590
+ {
591
+ t: 0.5,
592
+ position: [
593
+ 0,
594
+ 0.02,
595
+ -0.2
596
+ ],
597
+ rotation: [
598
+ 0,
599
+ 0,
600
+ 0
601
+ ]
602
+ },
603
+ {
604
+ t: 0.8,
605
+ position: [
606
+ 0,
607
+ 0.02,
608
+ -0.2
609
+ ],
610
+ rotation: [
611
+ -1.22,
612
+ 0,
613
+ 0
614
+ ],
615
+ action: "swallow"
616
+ },
617
+ {
618
+ t: 2,
619
+ position: [
620
+ 0,
621
+ 0.02,
622
+ -0.2
623
+ ],
624
+ rotation: [
625
+ -1.22,
626
+ 0,
627
+ 0
628
+ ]
629
+ },
630
+ {
631
+ t: 2.5,
632
+ position: [
633
+ 0.22,
634
+ -0.2,
635
+ -0.4
636
+ ],
637
+ rotation: [
638
+ 0,
639
+ 0,
640
+ 0
641
+ ]
642
+ }
643
+ ]
644
+ },
645
+ {
646
+ id: "take_medicine",
647
+ body: "mouth",
648
+ duration: 2.6,
649
+ note: "the box before the chest, shaken for a pill, the pill to the mouth and swallowed",
650
+ keys: [
651
+ {
652
+ t: 0,
653
+ position: [
654
+ 0.22,
655
+ -0.2,
656
+ -0.4
657
+ ],
658
+ rotation: [
659
+ 0,
660
+ 0,
661
+ 0
662
+ ]
663
+ },
664
+ {
665
+ t: 0.4,
666
+ position: [
667
+ 0.06,
668
+ -0.16,
669
+ -0.3
670
+ ],
671
+ rotation: [
672
+ 0,
673
+ 0,
674
+ 0
675
+ ]
676
+ },
677
+ {
678
+ t: 0.65,
679
+ position: [
680
+ 0.06,
681
+ -0.16,
682
+ -0.3
683
+ ],
684
+ rotation: [
685
+ 0,
686
+ 0,
687
+ 0.5
688
+ ]
689
+ },
690
+ {
691
+ t: 0.85,
692
+ position: [
693
+ 0.06,
694
+ -0.16,
695
+ -0.3
696
+ ],
697
+ rotation: [
698
+ 0,
699
+ 0,
700
+ -0.5
701
+ ]
702
+ },
703
+ {
704
+ t: 1.05,
705
+ position: [
706
+ 0.06,
707
+ -0.16,
708
+ -0.3
709
+ ],
710
+ rotation: [
711
+ 0,
712
+ 0,
713
+ 0
714
+ ]
715
+ },
716
+ {
717
+ t: 1.6,
718
+ position: [
719
+ 0,
720
+ 0.02,
721
+ -0.18
722
+ ],
723
+ rotation: [
724
+ -0.6,
725
+ 0,
726
+ 0
727
+ ],
728
+ action: "swallow"
729
+ },
730
+ {
731
+ t: 2,
732
+ position: [
733
+ 0,
734
+ 0.02,
735
+ -0.18
736
+ ],
737
+ rotation: [
738
+ -0.6,
739
+ 0,
740
+ 0
741
+ ]
742
+ },
743
+ {
744
+ t: 2.6,
745
+ position: [
746
+ 0.22,
747
+ -0.2,
748
+ -0.4
749
+ ],
750
+ rotation: [
751
+ 0,
752
+ 0,
753
+ 0
754
+ ]
755
+ }
756
+ ]
757
+ },
758
+ {
759
+ id: "apply_dressing",
760
+ body: "two_hands",
761
+ duration: 3.2,
762
+ note: "the dressing laid on the other forearm and wound round it twice",
763
+ keys: [
764
+ {
765
+ t: 0,
766
+ position: [
767
+ 0.22,
768
+ -0.2,
769
+ -0.4
770
+ ],
771
+ rotation: [
772
+ 0,
773
+ 0,
774
+ 0
775
+ ]
776
+ },
777
+ {
778
+ t: 0.5,
779
+ position: [
780
+ -0.06,
781
+ -0.12,
782
+ -0.3
783
+ ],
784
+ rotation: [
785
+ 0,
786
+ 0,
787
+ 1.2
788
+ ]
789
+ },
790
+ {
791
+ t: 1,
792
+ position: [
793
+ -0.1,
794
+ -0.15,
795
+ -0.28
796
+ ],
797
+ rotation: [
798
+ 0.4,
799
+ 0,
800
+ 1.4
801
+ ],
802
+ action: "apply"
803
+ },
804
+ {
805
+ t: 1.5,
806
+ position: [
807
+ -0.02,
808
+ -0.1,
809
+ -0.32
810
+ ],
811
+ rotation: [
812
+ 0,
813
+ 0,
814
+ 1.2
815
+ ]
816
+ },
817
+ {
818
+ t: 2,
819
+ position: [
820
+ -0.1,
821
+ -0.15,
822
+ -0.28
823
+ ],
824
+ rotation: [
825
+ 0.4,
826
+ 0,
827
+ 1.4
828
+ ],
829
+ action: "apply"
830
+ },
831
+ {
832
+ t: 2.6,
833
+ position: [
834
+ -0.06,
835
+ -0.12,
836
+ -0.3
837
+ ],
838
+ rotation: [
839
+ 0,
840
+ 0,
841
+ 1.2
842
+ ]
843
+ },
844
+ {
845
+ t: 3.2,
846
+ position: [
847
+ 0.22,
848
+ -0.2,
849
+ -0.4
850
+ ],
851
+ rotation: [
852
+ 0,
853
+ 0,
854
+ 0
855
+ ]
856
+ }
857
+ ]
858
+ },
859
+ {
860
+ id: "use_hygiene",
861
+ body: "two_hands",
862
+ duration: 3,
863
+ note: "soap (or what is rubbed in) between both hands in front of the body, rubbed side to side",
864
+ keys: [
865
+ {
866
+ t: 0,
867
+ position: [
868
+ 0.22,
869
+ -0.2,
870
+ -0.4
871
+ ],
872
+ rotation: [
873
+ 0,
874
+ 0,
875
+ 0
876
+ ]
877
+ },
878
+ {
879
+ t: 0.4,
880
+ position: [
881
+ 0.02,
882
+ -0.18,
883
+ -0.32
884
+ ],
885
+ rotation: [
886
+ 0,
887
+ 0,
888
+ 1.5
889
+ ]
890
+ },
891
+ {
892
+ t: 0.7,
893
+ position: [
894
+ -0.04,
895
+ -0.18,
896
+ -0.32
897
+ ],
898
+ rotation: [
899
+ 0,
900
+ 0,
901
+ 1.5
902
+ ],
903
+ action: "scrub"
904
+ },
905
+ {
906
+ t: 1,
907
+ position: [
908
+ 0.06,
909
+ -0.18,
910
+ -0.32
911
+ ],
912
+ rotation: [
913
+ 0,
914
+ 0,
915
+ 1.5
916
+ ]
917
+ },
918
+ {
919
+ t: 1.3,
920
+ position: [
921
+ -0.04,
922
+ -0.18,
923
+ -0.32
924
+ ],
925
+ rotation: [
926
+ 0,
927
+ 0,
928
+ 1.5
929
+ ],
930
+ action: "scrub"
931
+ },
932
+ {
933
+ t: 1.6,
934
+ position: [
935
+ 0.06,
936
+ -0.18,
937
+ -0.32
938
+ ],
939
+ rotation: [
940
+ 0,
941
+ 0,
942
+ 1.5
943
+ ]
944
+ },
945
+ {
946
+ t: 1.9,
947
+ position: [
948
+ -0.04,
949
+ -0.18,
950
+ -0.32
951
+ ],
952
+ rotation: [
953
+ 0,
954
+ 0,
955
+ 1.5
956
+ ],
957
+ action: "scrub"
958
+ },
959
+ {
960
+ t: 2.3,
961
+ position: [
962
+ 0.02,
963
+ -0.18,
964
+ -0.32
965
+ ],
966
+ rotation: [
967
+ 0,
968
+ 0,
969
+ 1.5
970
+ ]
971
+ },
972
+ {
973
+ t: 3,
974
+ position: [
975
+ 0.22,
976
+ -0.2,
977
+ -0.4
978
+ ],
979
+ rotation: [
980
+ 0,
981
+ 0,
982
+ 0
983
+ ]
984
+ }
985
+ ]
986
+ },
987
+ {
988
+ id: "toggle_flashlight",
989
+ body: "hand",
990
+ duration: 1.1,
991
+ note: "the flashlight raised before the chest and pointed ahead, the thumb pressing the tail switch (a small push), and back",
992
+ keys: [
993
+ {
994
+ t: 0,
995
+ position: [
996
+ 0.22,
997
+ -0.2,
998
+ -0.4
999
+ ],
1000
+ rotation: [
1001
+ 0,
1002
+ 0,
1003
+ 0
1004
+ ]
1005
+ },
1006
+ {
1007
+ t: 0.35,
1008
+ position: [
1009
+ 0.12,
1010
+ -0.12,
1011
+ -0.42
1012
+ ],
1013
+ rotation: [
1014
+ -1.45,
1015
+ 0,
1016
+ 0
1017
+ ]
1018
+ },
1019
+ {
1020
+ t: 0.47,
1021
+ position: [
1022
+ 0.12,
1023
+ -0.13,
1024
+ -0.42
1025
+ ],
1026
+ rotation: [
1027
+ -1.5,
1028
+ 0,
1029
+ 0
1030
+ ]
1031
+ },
1032
+ {
1033
+ t: 0.52,
1034
+ position: [
1035
+ 0.12,
1036
+ -0.125,
1037
+ -0.42
1038
+ ],
1039
+ rotation: [
1040
+ -1.47,
1041
+ 0,
1042
+ 0
1043
+ ],
1044
+ action: "switch"
1045
+ },
1046
+ {
1047
+ t: 0.7,
1048
+ position: [
1049
+ 0.12,
1050
+ -0.12,
1051
+ -0.42
1052
+ ],
1053
+ rotation: [
1054
+ -1.45,
1055
+ 0,
1056
+ 0
1057
+ ]
1058
+ },
1059
+ {
1060
+ t: 1.1,
1061
+ position: [
1062
+ 0.22,
1063
+ -0.2,
1064
+ -0.4
1065
+ ],
1066
+ rotation: [
1067
+ 0,
1068
+ 0,
1069
+ 0
1070
+ ]
1071
+ }
1072
+ ]
1073
+ },
1074
+ {
1075
+ id: "light_lighter",
1076
+ body: "hand",
1077
+ duration: 1.5,
1078
+ note: "the lighter brought before the chest, the thumb rolled down over the wheel (the lighter dips and tips with it), the flame catches and is held up a moment, and back",
1079
+ keys: [
1080
+ {
1081
+ t: 0,
1082
+ position: [
1083
+ 0.22,
1084
+ -0.2,
1085
+ -0.4
1086
+ ],
1087
+ rotation: [
1088
+ 0,
1089
+ 0,
1090
+ 0
1091
+ ]
1092
+ },
1093
+ {
1094
+ t: 0.4,
1095
+ position: [
1096
+ 0.07,
1097
+ -0.12,
1098
+ -0.34
1099
+ ],
1100
+ rotation: [
1101
+ 0,
1102
+ 0,
1103
+ 0
1104
+ ]
1105
+ },
1106
+ {
1107
+ t: 0.52,
1108
+ position: [
1109
+ 0.07,
1110
+ -0.137,
1111
+ -0.34
1112
+ ],
1113
+ rotation: [
1114
+ 0.14,
1115
+ 0,
1116
+ -0.12
1117
+ ]
1118
+ },
1119
+ {
1120
+ t: 0.58,
1121
+ position: [
1122
+ 0.07,
1123
+ -0.125,
1124
+ -0.34
1125
+ ],
1126
+ rotation: [
1127
+ 0,
1128
+ 0,
1129
+ 0
1130
+ ],
1131
+ action: "ignite"
1132
+ },
1133
+ {
1134
+ t: 1.15,
1135
+ position: [
1136
+ 0.07,
1137
+ -0.115,
1138
+ -0.34
1139
+ ],
1140
+ rotation: [
1141
+ 0,
1142
+ 0,
1143
+ 0
1144
+ ]
1145
+ },
1146
+ {
1147
+ t: 1.5,
1148
+ position: [
1149
+ 0.22,
1150
+ -0.2,
1151
+ -0.4
1152
+ ],
1153
+ rotation: [
1154
+ 0,
1155
+ 0,
1156
+ 0
1157
+ ]
1158
+ }
1159
+ ]
1160
+ },
1161
+ {
1162
+ id: "use_radio",
1163
+ body: "mouth",
1164
+ duration: 3,
1165
+ note: "the radio brought up beside the face, the thumb turning the knob (the radio twists a little with it), held at the mouth while talking, and back down",
1166
+ keys: [
1167
+ {
1168
+ t: 0,
1169
+ position: [
1170
+ 0.22,
1171
+ -0.2,
1172
+ -0.4
1173
+ ],
1174
+ rotation: [
1175
+ 0,
1176
+ 0,
1177
+ 0
1178
+ ]
1179
+ },
1180
+ {
1181
+ t: 0.5,
1182
+ position: [
1183
+ 0.08,
1184
+ -0.05,
1185
+ -0.22
1186
+ ],
1187
+ rotation: [
1188
+ 0,
1189
+ 0,
1190
+ 0.15
1191
+ ]
1192
+ },
1193
+ {
1194
+ t: 0.85,
1195
+ position: [
1196
+ 0.08,
1197
+ -0.05,
1198
+ -0.22
1199
+ ],
1200
+ rotation: [
1201
+ 0,
1202
+ 0,
1203
+ 0.15
1204
+ ]
1205
+ },
1206
+ {
1207
+ t: 1.05,
1208
+ position: [
1209
+ 0.08,
1210
+ -0.05,
1211
+ -0.22
1212
+ ],
1213
+ rotation: [
1214
+ 0,
1215
+ 0.3,
1216
+ 0.15
1217
+ ],
1218
+ action: "tune"
1219
+ },
1220
+ {
1221
+ t: 1.25,
1222
+ position: [
1223
+ 0.08,
1224
+ -0.05,
1225
+ -0.22
1226
+ ],
1227
+ rotation: [
1228
+ 0,
1229
+ 0,
1230
+ 0.15
1231
+ ]
1232
+ },
1233
+ {
1234
+ t: 1.45,
1235
+ position: [
1236
+ 0.05,
1237
+ -0.02,
1238
+ -0.19
1239
+ ],
1240
+ rotation: [
1241
+ -0.1,
1242
+ 0,
1243
+ 0.15
1244
+ ],
1245
+ action: "talk"
1246
+ },
1247
+ {
1248
+ t: 2.4,
1249
+ position: [
1250
+ 0.05,
1251
+ -0.02,
1252
+ -0.19
1253
+ ],
1254
+ rotation: [
1255
+ -0.1,
1256
+ 0,
1257
+ 0.15
1258
+ ]
1259
+ },
1260
+ {
1261
+ t: 3,
1262
+ position: [
1263
+ 0.22,
1264
+ -0.2,
1265
+ -0.4
1266
+ ],
1267
+ rotation: [
1268
+ 0,
1269
+ 0,
1270
+ 0
1271
+ ]
1272
+ }
1273
+ ]
1274
+ },
1275
+ {
1276
+ id: "turn_key",
1277
+ body: "reach",
1278
+ duration: 1.9,
1279
+ note: "the key carried out at arm's length and pointed into the lock (the keys marked reach go to the lock the host aims them at, or stay in the air before the chest), turned about itself a quarter and more, turned back, drawn out",
1280
+ keys: [
1281
+ {
1282
+ t: 0,
1283
+ position: [
1284
+ 0.22,
1285
+ -0.2,
1286
+ -0.4
1287
+ ],
1288
+ rotation: [
1289
+ 0,
1290
+ 0,
1291
+ 0
1292
+ ]
1293
+ },
1294
+ {
1295
+ t: 0.5,
1296
+ position: [
1297
+ 0.1,
1298
+ -0.15,
1299
+ -0.55
1300
+ ],
1301
+ rotation: [
1302
+ 0,
1303
+ 1.524,
1304
+ 0
1305
+ ],
1306
+ reach: true
1307
+ },
1308
+ {
1309
+ t: 0.75,
1310
+ position: [
1311
+ 0.1,
1312
+ -0.15,
1313
+ -0.57
1314
+ ],
1315
+ rotation: [
1316
+ 0,
1317
+ 1.524,
1318
+ 0
1319
+ ],
1320
+ reach: true
1321
+ },
1322
+ {
1323
+ t: 0.84,
1324
+ position: [
1325
+ 0.1,
1326
+ -0.15,
1327
+ -0.57
1328
+ ],
1329
+ rotation: [
1330
+ -1.46,
1331
+ 1.168,
1332
+ 1.45
1333
+ ],
1334
+ reach: true
1335
+ },
1336
+ {
1337
+ t: 0.93,
1338
+ position: [
1339
+ 0.1,
1340
+ -0.15,
1341
+ -0.57
1342
+ ],
1343
+ rotation: [
1344
+ -1.525,
1345
+ 0.77,
1346
+ 1.505
1347
+ ],
1348
+ reach: true
1349
+ },
1350
+ {
1351
+ t: 1.01,
1352
+ position: [
1353
+ 0.1,
1354
+ -0.15,
1355
+ -0.57
1356
+ ],
1357
+ rotation: [
1358
+ -1.552,
1359
+ 0.37,
1360
+ 1.52
1361
+ ],
1362
+ reach: true
1363
+ },
1364
+ {
1365
+ t: 1.1,
1366
+ position: [
1367
+ 0.1,
1368
+ -0.15,
1369
+ -0.57
1370
+ ],
1371
+ rotation: [
1372
+ -1.572,
1373
+ -0.029,
1374
+ 1.524
1375
+ ],
1376
+ action: "turn",
1377
+ reach: true
1378
+ },
1379
+ {
1380
+ t: 1.19,
1381
+ position: [
1382
+ 0.1,
1383
+ -0.15,
1384
+ -0.57
1385
+ ],
1386
+ rotation: [
1387
+ -1.552,
1388
+ 0.37,
1389
+ 1.52
1390
+ ],
1391
+ reach: true
1392
+ },
1393
+ {
1394
+ t: 1.27,
1395
+ position: [
1396
+ 0.1,
1397
+ -0.15,
1398
+ -0.57
1399
+ ],
1400
+ rotation: [
1401
+ -1.525,
1402
+ 0.77,
1403
+ 1.505
1404
+ ],
1405
+ reach: true
1406
+ },
1407
+ {
1408
+ t: 1.34,
1409
+ position: [
1410
+ 0.1,
1411
+ -0.15,
1412
+ -0.57
1413
+ ],
1414
+ rotation: [
1415
+ -1.46,
1416
+ 1.168,
1417
+ 1.45
1418
+ ],
1419
+ reach: true
1420
+ },
1421
+ {
1422
+ t: 1.4,
1423
+ position: [
1424
+ 0.1,
1425
+ -0.15,
1426
+ -0.57
1427
+ ],
1428
+ rotation: [
1429
+ 0,
1430
+ 1.524,
1431
+ 0
1432
+ ],
1433
+ reach: true
1434
+ },
1435
+ {
1436
+ t: 1.55,
1437
+ position: [
1438
+ 0.1,
1439
+ -0.15,
1440
+ -0.55
1441
+ ],
1442
+ rotation: [
1443
+ 0,
1444
+ 1.524,
1445
+ 0
1446
+ ],
1447
+ reach: true
1448
+ },
1449
+ {
1450
+ t: 1.9,
1451
+ position: [
1452
+ 0.22,
1453
+ -0.2,
1454
+ -0.4
1455
+ ],
1456
+ rotation: [
1457
+ 0,
1458
+ 0,
1459
+ 0
1460
+ ]
1461
+ }
1462
+ ]
1463
+ },
1464
+ {
1465
+ id: "wash_dishes",
1466
+ body: "two_hands",
1467
+ duration: 3,
1468
+ note: "both hands low in front at the height of a sink basin, the dish tipped toward the body and scrubbed in small circles, three rounds, and back; the scrubbing keys reach under the tap (aimHandUse)",
1469
+ keys: [
1470
+ {
1471
+ t: 0,
1472
+ position: [
1473
+ 0.22,
1474
+ -0.2,
1475
+ -0.4
1476
+ ],
1477
+ rotation: [
1478
+ 0,
1479
+ 0,
1480
+ 0
1481
+ ]
1482
+ },
1483
+ {
1484
+ t: 0.4,
1485
+ position: [
1486
+ 0,
1487
+ -0.55,
1488
+ -0.45
1489
+ ],
1490
+ rotation: [
1491
+ -0.5,
1492
+ 0,
1493
+ 0
1494
+ ],
1495
+ reach: true
1496
+ },
1497
+ {
1498
+ t: 0.7,
1499
+ position: [
1500
+ 0.04,
1501
+ -0.55,
1502
+ -0.41
1503
+ ],
1504
+ rotation: [
1505
+ -0.5,
1506
+ 0,
1507
+ 0
1508
+ ],
1509
+ action: "scrub",
1510
+ reach: true
1511
+ },
1512
+ {
1513
+ t: 0.95,
1514
+ position: [
1515
+ 0,
1516
+ -0.55,
1517
+ -0.37
1518
+ ],
1519
+ rotation: [
1520
+ -0.5,
1521
+ 0,
1522
+ 0
1523
+ ],
1524
+ reach: true
1525
+ },
1526
+ {
1527
+ t: 1.2,
1528
+ position: [
1529
+ -0.04,
1530
+ -0.55,
1531
+ -0.41
1532
+ ],
1533
+ rotation: [
1534
+ -0.5,
1535
+ 0,
1536
+ 0
1537
+ ],
1538
+ reach: true
1539
+ },
1540
+ {
1541
+ t: 1.45,
1542
+ position: [
1543
+ 0,
1544
+ -0.55,
1545
+ -0.45
1546
+ ],
1547
+ rotation: [
1548
+ -0.5,
1549
+ 0,
1550
+ 0
1551
+ ],
1552
+ action: "scrub",
1553
+ reach: true
1554
+ },
1555
+ {
1556
+ t: 1.7,
1557
+ position: [
1558
+ 0.04,
1559
+ -0.55,
1560
+ -0.41
1561
+ ],
1562
+ rotation: [
1563
+ -0.5,
1564
+ 0,
1565
+ 0
1566
+ ],
1567
+ reach: true
1568
+ },
1569
+ {
1570
+ t: 1.95,
1571
+ position: [
1572
+ 0,
1573
+ -0.55,
1574
+ -0.37
1575
+ ],
1576
+ rotation: [
1577
+ -0.5,
1578
+ 0,
1579
+ 0
1580
+ ],
1581
+ reach: true
1582
+ },
1583
+ {
1584
+ t: 2.2,
1585
+ position: [
1586
+ -0.04,
1587
+ -0.55,
1588
+ -0.41
1589
+ ],
1590
+ rotation: [
1591
+ -0.5,
1592
+ 0,
1593
+ 0
1594
+ ],
1595
+ action: "scrub",
1596
+ reach: true
1597
+ },
1598
+ {
1599
+ t: 2.5,
1600
+ position: [
1601
+ 0,
1602
+ -0.55,
1603
+ -0.45
1604
+ ],
1605
+ rotation: [
1606
+ -0.5,
1607
+ 0,
1608
+ 0
1609
+ ],
1610
+ reach: true
1611
+ },
1612
+ {
1613
+ t: 3,
1614
+ position: [
1615
+ 0.22,
1616
+ -0.2,
1617
+ -0.4
1618
+ ],
1619
+ rotation: [
1620
+ 0,
1621
+ 0,
1622
+ 0
1623
+ ]
1624
+ }
1625
+ ]
1626
+ },
1627
+ {
1628
+ id: "rinse_dish",
1629
+ body: "two_hands",
1630
+ duration: 3,
1631
+ note: "the scrubbed dish brought under the running tap and turned so the water runs over one face and then the other, the foam and the rest of the dirt going with it, and back; played again while foam is left; the rinsing keys reach under the tap (aimHandUse)",
1632
+ keys: [
1633
+ {
1634
+ t: 0,
1635
+ position: [
1636
+ 0.22,
1637
+ -0.2,
1638
+ -0.4
1639
+ ],
1640
+ rotation: [
1641
+ 0,
1642
+ 0,
1643
+ 0
1644
+ ]
1645
+ },
1646
+ {
1647
+ t: 0.4,
1648
+ position: [
1649
+ 0,
1650
+ -0.55,
1651
+ -0.43
1652
+ ],
1653
+ rotation: [
1654
+ -0.5,
1655
+ 0,
1656
+ 0
1657
+ ],
1658
+ reach: true
1659
+ },
1660
+ {
1661
+ t: 0.95,
1662
+ position: [
1663
+ 0.02,
1664
+ -0.55,
1665
+ -0.43
1666
+ ],
1667
+ rotation: [
1668
+ -0.9,
1669
+ 0,
1670
+ 0.25
1671
+ ],
1672
+ reach: true
1673
+ },
1674
+ {
1675
+ t: 1.5,
1676
+ position: [
1677
+ -0.02,
1678
+ -0.55,
1679
+ -0.43
1680
+ ],
1681
+ rotation: [
1682
+ -0.2,
1683
+ 0,
1684
+ -0.25
1685
+ ],
1686
+ reach: true,
1687
+ action: "rinse"
1688
+ },
1689
+ {
1690
+ t: 2.05,
1691
+ position: [
1692
+ 0.02,
1693
+ -0.55,
1694
+ -0.43
1695
+ ],
1696
+ rotation: [
1697
+ -0.9,
1698
+ 0,
1699
+ 0.25
1700
+ ],
1701
+ reach: true
1702
+ },
1703
+ {
1704
+ t: 2.6,
1705
+ position: [
1706
+ 0,
1707
+ -0.55,
1708
+ -0.43
1709
+ ],
1710
+ rotation: [
1711
+ -0.5,
1712
+ 0,
1713
+ 0
1714
+ ],
1715
+ reach: true
1716
+ },
1717
+ {
1718
+ t: 3,
1719
+ position: [
1720
+ 0.22,
1721
+ -0.2,
1722
+ -0.4
1723
+ ],
1724
+ rotation: [
1725
+ 0,
1726
+ 0,
1727
+ 0
1728
+ ]
1729
+ }
1730
+ ]
1731
+ },
1732
+ {
1733
+ id: "fill_cup",
1734
+ body: "hand",
1735
+ duration: 2.5,
1736
+ note: "the cup held upright, forward and low under where the tap runs, kept still while it fills, then brought back up; the keys under the tap reach where the stream is (aimHandUse)",
1737
+ keys: [
1738
+ {
1739
+ t: 0,
1740
+ position: [
1741
+ 0.22,
1742
+ -0.2,
1743
+ -0.4
1744
+ ],
1745
+ rotation: [
1746
+ 0,
1747
+ 0,
1748
+ 0
1749
+ ]
1750
+ },
1751
+ {
1752
+ t: 0.5,
1753
+ position: [
1754
+ 0.05,
1755
+ -0.55,
1756
+ -0.45
1757
+ ],
1758
+ rotation: [
1759
+ 0,
1760
+ 0,
1761
+ 0
1762
+ ],
1763
+ reach: true
1764
+ },
1765
+ {
1766
+ t: 0.7,
1767
+ position: [
1768
+ 0.05,
1769
+ -0.55,
1770
+ -0.45
1771
+ ],
1772
+ rotation: [
1773
+ 0,
1774
+ 0,
1775
+ 0
1776
+ ],
1777
+ action: "apply",
1778
+ reach: true
1779
+ },
1780
+ {
1781
+ t: 1.8,
1782
+ position: [
1783
+ 0.05,
1784
+ -0.55,
1785
+ -0.45
1786
+ ],
1787
+ rotation: [
1788
+ 0,
1789
+ 0,
1790
+ 0
1791
+ ],
1792
+ reach: true
1793
+ },
1794
+ {
1795
+ t: 2.1,
1796
+ position: [
1797
+ 0.15,
1798
+ -0.32,
1799
+ -0.42
1800
+ ],
1801
+ rotation: [
1802
+ 0,
1803
+ 0,
1804
+ 0
1805
+ ]
1806
+ },
1807
+ {
1808
+ t: 2.5,
1809
+ position: [
1810
+ 0.22,
1811
+ -0.2,
1812
+ -0.4
1813
+ ],
1814
+ rotation: [
1815
+ 0,
1816
+ 0,
1817
+ 0
1818
+ ]
1819
+ }
1820
+ ]
1821
+ },
1822
+ {
1823
+ id: "drink_cupped_hands",
1824
+ body: "two_hands",
1825
+ duration: 5,
1826
+ note: "bent over the sink: both hands cupped under the running tap, the water caught in them lifted to the mouth and drunk, three handfuls, and back; the cupped hands reach under the stream (aimHandUse) and come up to the mouth",
1827
+ keys: [
1828
+ {
1829
+ t: 0,
1830
+ position: [
1831
+ 0.22,
1832
+ -0.2,
1833
+ -0.4
1834
+ ],
1835
+ rotation: [
1836
+ 0,
1837
+ 0,
1838
+ 0
1839
+ ]
1840
+ },
1841
+ {
1842
+ t: 0.5,
1843
+ position: [
1844
+ 0,
1845
+ -0.55,
1846
+ -0.42
1847
+ ],
1848
+ rotation: [
1849
+ -0.3,
1850
+ 0,
1851
+ 0
1852
+ ],
1853
+ reach: true
1854
+ },
1855
+ {
1856
+ t: 1,
1857
+ position: [
1858
+ 0,
1859
+ -0.55,
1860
+ -0.42
1861
+ ],
1862
+ rotation: [
1863
+ -0.3,
1864
+ 0,
1865
+ 0
1866
+ ],
1867
+ reach: true
1868
+ },
1869
+ {
1870
+ t: 1.45,
1871
+ position: [
1872
+ 0,
1873
+ 0,
1874
+ -0.22
1875
+ ],
1876
+ rotation: [
1877
+ -0.9,
1878
+ 0,
1879
+ 0
1880
+ ],
1881
+ action: "swallow"
1882
+ },
1883
+ {
1884
+ t: 1.7,
1885
+ position: [
1886
+ 0,
1887
+ 0,
1888
+ -0.22
1889
+ ],
1890
+ rotation: [
1891
+ -0.9,
1892
+ 0,
1893
+ 0
1894
+ ]
1895
+ },
1896
+ {
1897
+ t: 1.9,
1898
+ position: [
1899
+ 0,
1900
+ -0.55,
1901
+ -0.42
1902
+ ],
1903
+ rotation: [
1904
+ -0.3,
1905
+ 0,
1906
+ 0
1907
+ ],
1908
+ reach: true
1909
+ },
1910
+ {
1911
+ t: 2.4,
1912
+ position: [
1913
+ 0,
1914
+ -0.55,
1915
+ -0.42
1916
+ ],
1917
+ rotation: [
1918
+ -0.3,
1919
+ 0,
1920
+ 0
1921
+ ],
1922
+ reach: true
1923
+ },
1924
+ {
1925
+ t: 2.85,
1926
+ position: [
1927
+ 0,
1928
+ 0,
1929
+ -0.22
1930
+ ],
1931
+ rotation: [
1932
+ -0.9,
1933
+ 0,
1934
+ 0
1935
+ ],
1936
+ action: "swallow"
1937
+ },
1938
+ {
1939
+ t: 3.1,
1940
+ position: [
1941
+ 0,
1942
+ 0,
1943
+ -0.22
1944
+ ],
1945
+ rotation: [
1946
+ -0.9,
1947
+ 0,
1948
+ 0
1949
+ ]
1950
+ },
1951
+ {
1952
+ t: 3.3,
1953
+ position: [
1954
+ 0,
1955
+ -0.55,
1956
+ -0.42
1957
+ ],
1958
+ rotation: [
1959
+ -0.3,
1960
+ 0,
1961
+ 0
1962
+ ],
1963
+ reach: true
1964
+ },
1965
+ {
1966
+ t: 3.8,
1967
+ position: [
1968
+ 0,
1969
+ -0.55,
1970
+ -0.42
1971
+ ],
1972
+ rotation: [
1973
+ -0.3,
1974
+ 0,
1975
+ 0
1976
+ ],
1977
+ reach: true
1978
+ },
1979
+ {
1980
+ t: 4.25,
1981
+ position: [
1982
+ 0,
1983
+ 0,
1984
+ -0.22
1985
+ ],
1986
+ rotation: [
1987
+ -0.9,
1988
+ 0,
1989
+ 0
1990
+ ],
1991
+ action: "swallow"
1992
+ },
1993
+ {
1994
+ t: 4.5,
1995
+ position: [
1996
+ 0,
1997
+ 0,
1998
+ -0.22
1999
+ ],
2000
+ rotation: [
2001
+ -0.9,
2002
+ 0,
2003
+ 0
2004
+ ]
2005
+ },
2006
+ {
2007
+ t: 5,
2008
+ position: [
2009
+ 0.22,
2010
+ -0.2,
2011
+ -0.4
2012
+ ],
2013
+ rotation: [
2014
+ 0,
2015
+ 0,
2016
+ 0
2017
+ ]
2018
+ }
2019
+ ]
2020
+ },
2021
+ {
2022
+ id: "lather_body",
2023
+ body: "body",
2024
+ duration: 6.4,
2025
+ note: "bar soap rubbed between wet hands, then over the other forearm, the chest and the belly; foam left on each",
2026
+ keys: [
2027
+ {
2028
+ t: 0,
2029
+ position: [
2030
+ 0.22,
2031
+ -0.2,
2032
+ -0.4
2033
+ ],
2034
+ rotation: [
2035
+ 0,
2036
+ 0,
2037
+ 0
2038
+ ]
2039
+ },
2040
+ {
2041
+ t: 0.4,
2042
+ position: [
2043
+ 0.02,
2044
+ -0.22,
2045
+ -0.32
2046
+ ],
2047
+ rotation: [
2048
+ 0,
2049
+ 0,
2050
+ 1.5
2051
+ ]
2052
+ },
2053
+ {
2054
+ t: 0.7,
2055
+ position: [
2056
+ -0.04,
2057
+ -0.22,
2058
+ -0.32
2059
+ ],
2060
+ rotation: [
2061
+ 0,
2062
+ 0,
2063
+ 1.5
2064
+ ],
2065
+ action: "dose"
2066
+ },
2067
+ {
2068
+ t: 1,
2069
+ position: [
2070
+ 0.05,
2071
+ -0.22,
2072
+ -0.32
2073
+ ],
2074
+ rotation: [
2075
+ 0,
2076
+ 0,
2077
+ 1.5
2078
+ ],
2079
+ action: "lather",
2080
+ surface: "hands"
2081
+ },
2082
+ {
2083
+ t: 1.3,
2084
+ position: [
2085
+ -0.04,
2086
+ -0.22,
2087
+ -0.32
2088
+ ],
2089
+ rotation: [
2090
+ 0,
2091
+ 0,
2092
+ 1.5
2093
+ ]
2094
+ },
2095
+ {
2096
+ t: 1.75,
2097
+ position: [
2098
+ -0.2,
2099
+ -0.3,
2100
+ -0.3
2101
+ ],
2102
+ rotation: [
2103
+ 0,
2104
+ 0,
2105
+ 1.2
2106
+ ]
2107
+ },
2108
+ {
2109
+ t: 2.2,
2110
+ position: [
2111
+ -0.24,
2112
+ -0.2,
2113
+ -0.26
2114
+ ],
2115
+ rotation: [
2116
+ 0,
2117
+ 0,
2118
+ 1.2
2119
+ ],
2120
+ action: "lather",
2121
+ surface: "arms"
2122
+ },
2123
+ {
2124
+ t: 2.65,
2125
+ position: [
2126
+ -0.2,
2127
+ -0.3,
2128
+ -0.3
2129
+ ],
2130
+ rotation: [
2131
+ 0,
2132
+ 0,
2133
+ 1.2
2134
+ ]
2135
+ },
2136
+ {
2137
+ t: 3.1,
2138
+ position: [
2139
+ -0.24,
2140
+ -0.2,
2141
+ -0.26
2142
+ ],
2143
+ rotation: [
2144
+ 0,
2145
+ 0,
2146
+ 1.2
2147
+ ],
2148
+ action: "lather",
2149
+ surface: "arms"
2150
+ },
2151
+ {
2152
+ t: 3.55,
2153
+ position: [
2154
+ 0,
2155
+ -0.32,
2156
+ -0.24
2157
+ ],
2158
+ rotation: [
2159
+ 0,
2160
+ 0,
2161
+ 1.5
2162
+ ]
2163
+ },
2164
+ {
2165
+ t: 4,
2166
+ position: [
2167
+ -0.08,
2168
+ -0.34,
2169
+ -0.24
2170
+ ],
2171
+ rotation: [
2172
+ 0,
2173
+ 0,
2174
+ 1.5
2175
+ ],
2176
+ action: "lather",
2177
+ surface: "torso"
2178
+ },
2179
+ {
2180
+ t: 4.45,
2181
+ position: [
2182
+ 0.06,
2183
+ -0.32,
2184
+ -0.24
2185
+ ],
2186
+ rotation: [
2187
+ 0,
2188
+ 0,
2189
+ 1.5
2190
+ ]
2191
+ },
2192
+ {
2193
+ t: 4.9,
2194
+ position: [
2195
+ 0,
2196
+ -0.5,
2197
+ -0.26
2198
+ ],
2199
+ rotation: [
2200
+ 0,
2201
+ 0,
2202
+ 1.5
2203
+ ]
2204
+ },
2205
+ {
2206
+ t: 5.35,
2207
+ position: [
2208
+ -0.08,
2209
+ -0.52,
2210
+ -0.26
2211
+ ],
2212
+ rotation: [
2213
+ 0,
2214
+ 0,
2215
+ 1.5
2216
+ ],
2217
+ action: "lather",
2218
+ surface: "torso"
2219
+ },
2220
+ {
2221
+ t: 5.8,
2222
+ position: [
2223
+ 0.06,
2224
+ -0.5,
2225
+ -0.26
2226
+ ],
2227
+ rotation: [
2228
+ 0,
2229
+ 0,
2230
+ 1.5
2231
+ ]
2232
+ },
2233
+ {
2234
+ t: 6.4,
2235
+ position: [
2236
+ 0.22,
2237
+ -0.2,
2238
+ -0.4
2239
+ ],
2240
+ rotation: [
2241
+ 0,
2242
+ 0,
2243
+ 0
2244
+ ]
2245
+ }
2246
+ ]
2247
+ },
2248
+ {
2249
+ id: "shampoo_hair",
2250
+ body: "scalp",
2251
+ duration: 4.5,
2252
+ note: "shampoo poured from the bottle into the palm, then both hands rub the hair at the top of the head; foam left in the hair",
2253
+ keys: [
2254
+ {
2255
+ t: 0,
2256
+ position: [
2257
+ 0.22,
2258
+ -0.2,
2259
+ -0.4
2260
+ ],
2261
+ rotation: [
2262
+ 0,
2263
+ 0,
2264
+ 0
2265
+ ]
2266
+ },
2267
+ {
2268
+ t: 0.45,
2269
+ position: [
2270
+ 0.02,
2271
+ -0.16,
2272
+ -0.32
2273
+ ],
2274
+ rotation: [
2275
+ -2.4,
2276
+ 0,
2277
+ 0
2278
+ ]
2279
+ },
2280
+ {
2281
+ t: 0.8,
2282
+ position: [
2283
+ 0.02,
2284
+ -0.16,
2285
+ -0.32
2286
+ ],
2287
+ rotation: [
2288
+ -2.6,
2289
+ 0,
2290
+ 0
2291
+ ],
2292
+ action: "dose"
2293
+ },
2294
+ {
2295
+ t: 1.2,
2296
+ position: [
2297
+ 0.02,
2298
+ -0.2,
2299
+ -0.34
2300
+ ],
2301
+ rotation: [
2302
+ 0,
2303
+ 0,
2304
+ 0
2305
+ ]
2306
+ },
2307
+ {
2308
+ t: 1.65,
2309
+ position: [
2310
+ -0.05,
2311
+ 0.1,
2312
+ -0.06
2313
+ ],
2314
+ rotation: [
2315
+ 0,
2316
+ 0,
2317
+ 1.2
2318
+ ]
2319
+ },
2320
+ {
2321
+ t: 2.1,
2322
+ position: [
2323
+ 0.05,
2324
+ 0.1,
2325
+ -0.06
2326
+ ],
2327
+ rotation: [
2328
+ 0,
2329
+ 0,
2330
+ 1.2
2331
+ ],
2332
+ action: "lather",
2333
+ surface: "hair"
2334
+ },
2335
+ {
2336
+ t: 2.55,
2337
+ position: [
2338
+ -0.05,
2339
+ 0.1,
2340
+ -0.06
2341
+ ],
2342
+ rotation: [
2343
+ 0,
2344
+ 0,
2345
+ 1.2
2346
+ ]
2347
+ },
2348
+ {
2349
+ t: 3,
2350
+ position: [
2351
+ 0.05,
2352
+ 0.1,
2353
+ -0.06
2354
+ ],
2355
+ rotation: [
2356
+ 0,
2357
+ 0,
2358
+ 1.2
2359
+ ],
2360
+ action: "lather",
2361
+ surface: "hair"
2362
+ },
2363
+ {
2364
+ t: 3.45,
2365
+ position: [
2366
+ -0.05,
2367
+ 0.1,
2368
+ -0.06
2369
+ ],
2370
+ rotation: [
2371
+ 0,
2372
+ 0,
2373
+ 1.2
2374
+ ]
2375
+ },
2376
+ {
2377
+ t: 3.9,
2378
+ position: [
2379
+ 0.05,
2380
+ 0.1,
2381
+ -0.06
2382
+ ],
2383
+ rotation: [
2384
+ 0,
2385
+ 0,
2386
+ 1.2
2387
+ ],
2388
+ action: "lather",
2389
+ surface: "hair"
2390
+ },
2391
+ {
2392
+ t: 4.5,
2393
+ position: [
2394
+ 0.22,
2395
+ -0.2,
2396
+ -0.4
2397
+ ],
2398
+ rotation: [
2399
+ 0,
2400
+ 0,
2401
+ 0
2402
+ ]
2403
+ }
2404
+ ]
2405
+ },
2406
+ {
2407
+ id: "brush_teeth",
2408
+ body: "mouth",
2409
+ duration: 5.9,
2410
+ note: "toothpaste squeezed on the brush, the brush scrubbed side to side in the mouth, foam spat into the basin, the brush rinsed under the tap",
2411
+ keys: [
2412
+ {
2413
+ t: 0,
2414
+ position: [
2415
+ 0.22,
2416
+ -0.2,
2417
+ -0.4
2418
+ ],
2419
+ rotation: [
2420
+ 0,
2421
+ 0,
2422
+ 0
2423
+ ]
2424
+ },
2425
+ {
2426
+ t: 0.5,
2427
+ position: [
2428
+ 0.04,
2429
+ -0.2,
2430
+ -0.34
2431
+ ],
2432
+ rotation: [
2433
+ 0,
2434
+ 0,
2435
+ 1.5
2436
+ ]
2437
+ },
2438
+ {
2439
+ t: 0.9,
2440
+ position: [
2441
+ 0.04,
2442
+ -0.2,
2443
+ -0.34
2444
+ ],
2445
+ rotation: [
2446
+ 0,
2447
+ 0,
2448
+ 1.5
2449
+ ],
2450
+ action: "dose"
2451
+ },
2452
+ {
2453
+ t: 1.4,
2454
+ position: [
2455
+ 0.02,
2456
+ -0.06,
2457
+ -0.17
2458
+ ],
2459
+ rotation: [
2460
+ 0,
2461
+ 0,
2462
+ 1.5
2463
+ ]
2464
+ },
2465
+ {
2466
+ t: 1.7,
2467
+ position: [
2468
+ 0,
2469
+ -0.06,
2470
+ -0.17
2471
+ ],
2472
+ rotation: [
2473
+ 0,
2474
+ 0,
2475
+ 1.5
2476
+ ]
2477
+ },
2478
+ {
2479
+ t: 2,
2480
+ position: [
2481
+ 0.04,
2482
+ -0.06,
2483
+ -0.17
2484
+ ],
2485
+ rotation: [
2486
+ 0,
2487
+ 0,
2488
+ 1.5
2489
+ ],
2490
+ action: "lather",
2491
+ surface: "mouth"
2492
+ },
2493
+ {
2494
+ t: 2.3,
2495
+ position: [
2496
+ 0,
2497
+ -0.06,
2498
+ -0.17
2499
+ ],
2500
+ rotation: [
2501
+ 0,
2502
+ 0,
2503
+ 1.5
2504
+ ]
2505
+ },
2506
+ {
2507
+ t: 2.6,
2508
+ position: [
2509
+ 0.04,
2510
+ -0.06,
2511
+ -0.17
2512
+ ],
2513
+ rotation: [
2514
+ 0,
2515
+ 0,
2516
+ 1.5
2517
+ ],
2518
+ action: "lather",
2519
+ surface: "mouth"
2520
+ },
2521
+ {
2522
+ t: 2.9,
2523
+ position: [
2524
+ 0,
2525
+ -0.06,
2526
+ -0.17
2527
+ ],
2528
+ rotation: [
2529
+ 0,
2530
+ 0,
2531
+ 1.5
2532
+ ]
2533
+ },
2534
+ {
2535
+ t: 3.2,
2536
+ position: [
2537
+ 0.04,
2538
+ -0.06,
2539
+ -0.17
2540
+ ],
2541
+ rotation: [
2542
+ 0,
2543
+ 0,
2544
+ 1.5
2545
+ ],
2546
+ action: "lather",
2547
+ surface: "mouth"
2548
+ },
2549
+ {
2550
+ t: 3.5,
2551
+ position: [
2552
+ 0,
2553
+ -0.06,
2554
+ -0.17
2555
+ ],
2556
+ rotation: [
2557
+ 0,
2558
+ 0,
2559
+ 1.5
2560
+ ]
2561
+ },
2562
+ {
2563
+ t: 3.8,
2564
+ position: [
2565
+ 0.04,
2566
+ -0.06,
2567
+ -0.17
2568
+ ],
2569
+ rotation: [
2570
+ 0,
2571
+ 0,
2572
+ 1.5
2573
+ ],
2574
+ action: "lather",
2575
+ surface: "mouth"
2576
+ },
2577
+ {
2578
+ t: 4.2,
2579
+ position: [
2580
+ 0.02,
2581
+ -0.06,
2582
+ -0.2
2583
+ ],
2584
+ rotation: [
2585
+ 0,
2586
+ 0,
2587
+ 1.5
2588
+ ],
2589
+ action: "spit",
2590
+ surface: "mouth"
2591
+ },
2592
+ {
2593
+ t: 4.7,
2594
+ position: [
2595
+ 0.04,
2596
+ -0.34,
2597
+ -0.44
2598
+ ],
2599
+ rotation: [
2600
+ 0,
2601
+ 0,
2602
+ 1.5
2603
+ ]
2604
+ },
2605
+ {
2606
+ t: 5.3,
2607
+ position: [
2608
+ 0.04,
2609
+ -0.34,
2610
+ -0.44
2611
+ ],
2612
+ rotation: [
2613
+ 0,
2614
+ 0,
2615
+ 1.5
2616
+ ],
2617
+ action: "rinse",
2618
+ surface: "brush"
2619
+ },
2620
+ {
2621
+ t: 5.9,
2622
+ position: [
2623
+ 0.22,
2624
+ -0.2,
2625
+ -0.4
2626
+ ],
2627
+ rotation: [
2628
+ 0,
2629
+ 0,
2630
+ 0
2631
+ ]
2632
+ }
2633
+ ]
2634
+ },
2635
+ {
2636
+ id: "wash_hands",
2637
+ body: "two_hands",
2638
+ duration: 6.5,
2639
+ note: "hands wet under the tap, the bar rubbed between them into foam, rinsed under the water and shaken dry",
2640
+ keys: [
2641
+ {
2642
+ t: 0,
2643
+ position: [
2644
+ 0.22,
2645
+ -0.2,
2646
+ -0.4
2647
+ ],
2648
+ rotation: [
2649
+ 0,
2650
+ 0,
2651
+ 0
2652
+ ]
2653
+ },
2654
+ {
2655
+ t: 0.5,
2656
+ position: [
2657
+ 0,
2658
+ -0.34,
2659
+ -0.44
2660
+ ],
2661
+ rotation: [
2662
+ 0,
2663
+ 0,
2664
+ 1.5
2665
+ ]
2666
+ },
2667
+ {
2668
+ t: 1,
2669
+ position: [
2670
+ 0,
2671
+ -0.34,
2672
+ -0.44
2673
+ ],
2674
+ rotation: [
2675
+ 0,
2676
+ 0,
2677
+ 1.5
2678
+ ],
2679
+ action: "rinse",
2680
+ surface: "hands"
2681
+ },
2682
+ {
2683
+ t: 1.4,
2684
+ position: [
2685
+ 0.02,
2686
+ -0.26,
2687
+ -0.36
2688
+ ],
2689
+ rotation: [
2690
+ 0,
2691
+ 0,
2692
+ 1.5
2693
+ ],
2694
+ action: "dose"
2695
+ },
2696
+ {
2697
+ t: 1.7,
2698
+ position: [
2699
+ -0.04,
2700
+ -0.26,
2701
+ -0.36
2702
+ ],
2703
+ rotation: [
2704
+ 0,
2705
+ 0,
2706
+ 1.5
2707
+ ]
2708
+ },
2709
+ {
2710
+ t: 2,
2711
+ position: [
2712
+ 0.06,
2713
+ -0.26,
2714
+ -0.36
2715
+ ],
2716
+ rotation: [
2717
+ 0,
2718
+ 0,
2719
+ 1.5
2720
+ ],
2721
+ action: "lather",
2722
+ surface: "hands"
2723
+ },
2724
+ {
2725
+ t: 2.3,
2726
+ position: [
2727
+ -0.04,
2728
+ -0.26,
2729
+ -0.36
2730
+ ],
2731
+ rotation: [
2732
+ 0,
2733
+ 0,
2734
+ 1.5
2735
+ ]
2736
+ },
2737
+ {
2738
+ t: 2.6,
2739
+ position: [
2740
+ 0.06,
2741
+ -0.26,
2742
+ -0.36
2743
+ ],
2744
+ rotation: [
2745
+ 0,
2746
+ 0,
2747
+ 1.5
2748
+ ],
2749
+ action: "lather",
2750
+ surface: "hands"
2751
+ },
2752
+ {
2753
+ t: 2.9,
2754
+ position: [
2755
+ -0.04,
2756
+ -0.26,
2757
+ -0.36
2758
+ ],
2759
+ rotation: [
2760
+ 0,
2761
+ 0,
2762
+ 1.5
2763
+ ]
2764
+ },
2765
+ {
2766
+ t: 3.2,
2767
+ position: [
2768
+ 0.06,
2769
+ -0.26,
2770
+ -0.36
2771
+ ],
2772
+ rotation: [
2773
+ 0,
2774
+ 0,
2775
+ 1.5
2776
+ ],
2777
+ action: "lather",
2778
+ surface: "hands"
2779
+ },
2780
+ {
2781
+ t: 3.7,
2782
+ position: [
2783
+ 0,
2784
+ -0.34,
2785
+ -0.44
2786
+ ],
2787
+ rotation: [
2788
+ 0,
2789
+ 0,
2790
+ 1.5
2791
+ ]
2792
+ },
2793
+ {
2794
+ t: 4.6,
2795
+ position: [
2796
+ 0.04,
2797
+ -0.34,
2798
+ -0.44
2799
+ ],
2800
+ rotation: [
2801
+ 0,
2802
+ 0,
2803
+ 1.5
2804
+ ],
2805
+ action: "rinse",
2806
+ surface: "hands"
2807
+ },
2808
+ {
2809
+ t: 5.1,
2810
+ position: [
2811
+ 0.04,
2812
+ -0.24,
2813
+ -0.36
2814
+ ],
2815
+ rotation: [
2816
+ 0,
2817
+ 0,
2818
+ 1.5
2819
+ ]
2820
+ },
2821
+ {
2822
+ t: 5.5,
2823
+ position: [
2824
+ -0.02,
2825
+ -0.24,
2826
+ -0.36
2827
+ ],
2828
+ rotation: [
2829
+ 0,
2830
+ 0,
2831
+ 1.5
2832
+ ],
2833
+ action: "dry",
2834
+ surface: "hands"
2835
+ },
2836
+ {
2837
+ t: 5.9,
2838
+ position: [
2839
+ 0.04,
2840
+ -0.24,
2841
+ -0.36
2842
+ ],
2843
+ rotation: [
2844
+ 0,
2845
+ 0,
2846
+ 1.5
2847
+ ]
2848
+ },
2849
+ {
2850
+ t: 6.5,
2851
+ position: [
2852
+ 0.22,
2853
+ -0.2,
2854
+ -0.4
2855
+ ],
2856
+ rotation: [
2857
+ 0,
2858
+ 0,
2859
+ 0
2860
+ ]
2861
+ }
2862
+ ]
457
2863
  }
458
- };
459
- var FRESH_NUTRITION = { satietyFactor: 1, poisonChance: 0, morale: 0, isEdible: true };
460
- var nutritionOf = (item, context, rules) => {
461
- const state = context.freshness ?? "fresh";
462
- const effect = state === "fresh" ? FRESH_NUTRITION : rules.use.freshness[state];
463
- const poisonShare = context.isCooked ? rules.use.cookedPoisonFactor : 1;
464
- return {
465
- satiety: (item.nutrition?.satiety ?? 0) * effect.satietyFactor,
466
- hydration: item.nutrition?.hydration ?? 0,
467
- morale: effect.morale,
468
- poisonChance: effect.poisonChance * poisonShare,
469
- isEdible: effect.isEdible
470
- };
471
- };
472
- var findEffect = (item, effects) => effects.find((entry) => entry.items?.includes(item.id)) ?? effects.find((entry) => entry.category?.includes(item.category));
473
- var resolveUse = (item, effects, context = {}, rules = DEFAULT_RULES) => {
474
- const def = findEffect(item, effects);
475
- if (!def) return void 0;
476
- const base = { useId: def.id, effect: def.effect, params: def.params ?? {}, consumes: def.consumes };
477
- if (def.effect !== "consume_nutrition") return base;
478
- const nutrition = nutritionOf(item, context, rules);
479
- const blocked = item.seal && context.seal ? sealBlock(item.seal, context.seal) : void 0;
480
- if (blocked) return { ...base, consumes: false, nutrition: { ...nutrition, isEdible: false }, blocked };
481
- return { ...base, consumes: def.consumes && nutrition.isEdible, nutrition };
482
- };
483
- var MM = 1e-3;
484
- var BOX_WALL = 6 * MM;
2864
+ ];
2865
+ var HAND_USES = hand_uses_default;
2866
+ var handUseOf = (id, defs = HAND_USES) => defs.find((def) => def.id === id);
485
2867
 
486
2868
  // ../game-fluids/dist/index.js
487
2869
  var liquids_default = [
@@ -939,17 +3321,118 @@ var GameInteractablesHousehold = (() => {
939
3321
  dryTime: 900,
940
3322
  gloss: 0.4,
941
3323
  tags: [
942
- "dirty"
3324
+ "dirty"
3325
+ ]
3326
+ },
3327
+ {
3328
+ id: "coolant",
3329
+ color: 3455050,
3330
+ opacity: 0.7,
3331
+ stainColor: 2783796,
3332
+ viscosity: 4,
3333
+ density: 1070,
3334
+ dryTime: 1200,
3335
+ gloss: 0.85,
3336
+ leavesMark: true,
3337
+ drink: {
3338
+ thirst: 0,
3339
+ effects: [
3340
+ "poison"
3341
+ ]
3342
+ },
3343
+ tags: [
3344
+ "coolant"
3345
+ ]
3346
+ },
3347
+ {
3348
+ id: "brake_fluid",
3349
+ color: 13145646,
3350
+ opacity: 0.8,
3351
+ stainColor: 9069600,
3352
+ viscosity: 8,
3353
+ density: 1050,
3354
+ dryTime: 3600,
3355
+ gloss: 0.9,
3356
+ leavesMark: true,
3357
+ drink: {
3358
+ thirst: 0,
3359
+ effects: [
3360
+ "poison"
3361
+ ]
3362
+ },
3363
+ tags: [
3364
+ "brake_fluid"
3365
+ ]
3366
+ },
3367
+ {
3368
+ id: "detergent",
3369
+ color: 15916378,
3370
+ opacity: 0.6,
3371
+ stainColor: 14077068,
3372
+ viscosity: 400,
3373
+ density: 1030,
3374
+ dryTime: 1800,
3375
+ gloss: 0.95,
3376
+ leavesMark: true,
3377
+ drink: {
3378
+ thirst: 0,
3379
+ effects: [
3380
+ "poison"
3381
+ ]
3382
+ },
3383
+ tags: [
3384
+ "soap"
3385
+ ]
3386
+ },
3387
+ {
3388
+ id: "shampoo",
3389
+ color: 6069216,
3390
+ opacity: 0.75,
3391
+ stainColor: 9418462,
3392
+ viscosity: 4e3,
3393
+ density: 1020,
3394
+ dryTime: 3600,
3395
+ gloss: 0.9,
3396
+ leavesMark: true,
3397
+ drink: {
3398
+ thirst: 0,
3399
+ effects: [
3400
+ "poison"
3401
+ ]
3402
+ },
3403
+ tags: [
3404
+ "soap",
3405
+ "sticky"
3406
+ ]
3407
+ },
3408
+ {
3409
+ id: "fabric_softener",
3410
+ color: 9225452,
3411
+ opacity: 0.8,
3412
+ stainColor: 11061470,
3413
+ viscosity: 80,
3414
+ density: 1e3,
3415
+ dryTime: 1800,
3416
+ gloss: 0.8,
3417
+ leavesMark: true,
3418
+ drink: {
3419
+ thirst: 0,
3420
+ effects: [
3421
+ "poison"
3422
+ ]
3423
+ },
3424
+ tags: [
3425
+ "soap"
943
3426
  ]
944
3427
  },
945
3428
  {
946
- id: "coolant",
947
- color: 3455050,
948
- opacity: 0.7,
949
- stainColor: 2783796,
950
- viscosity: 4,
951
- density: 1070,
952
- dryTime: 1200,
3429
+ id: "disinfectant",
3430
+ color: 14205040,
3431
+ opacity: 0.6,
3432
+ stainColor: 13154442,
3433
+ viscosity: 1.5,
3434
+ density: 1e3,
3435
+ dryTime: 600,
953
3436
  gloss: 0.85,
954
3437
  leavesMark: true,
955
3438
  drink: {
@@ -959,18 +3442,37 @@ var GameInteractablesHousehold = (() => {
959
3442
  ]
960
3443
  },
961
3444
  tags: [
962
- "coolant"
3445
+ "corrosive"
963
3446
  ]
964
3447
  },
965
3448
  {
966
- id: "brake_fluid",
967
- color: 13145646,
968
- opacity: 0.8,
969
- stainColor: 9069600,
970
- viscosity: 8,
971
- density: 1050,
972
- dryTime: 3600,
973
- gloss: 0.9,
3449
+ id: "yogurt",
3450
+ color: 15986404,
3451
+ opacity: 1,
3452
+ stainColor: 15130576,
3453
+ viscosity: 1500,
3454
+ density: 1040,
3455
+ dryTime: 7200,
3456
+ gloss: 0.5,
3457
+ leavesMark: true,
3458
+ drink: {
3459
+ thirst: 10,
3460
+ effects: []
3461
+ },
3462
+ tags: [
3463
+ "food",
3464
+ "sticky"
3465
+ ]
3466
+ },
3467
+ {
3468
+ id: "toothpaste",
3469
+ color: 16054008,
3470
+ opacity: 1,
3471
+ stainColor: 15133935,
3472
+ viscosity: 1e5,
3473
+ density: 1300,
3474
+ dryTime: 7200,
3475
+ gloss: 0.6,
974
3476
  leavesMark: true,
975
3477
  drink: {
976
3478
  thirst: 0,
@@ -979,7 +3481,8 @@ var GameInteractablesHousehold = (() => {
979
3481
  ]
980
3482
  },
981
3483
  tags: [
982
- "brake_fluid"
3484
+ "soap",
3485
+ "paste"
983
3486
  ]
984
3487
  }
985
3488
  ];
@@ -11819,8 +14322,13 @@ var GameInteractablesHousehold = (() => {
11819
14322
  shelfLife: 28,
11820
14323
  estimated: [
11821
14324
  "nutrition",
11822
- "shelfLife"
11823
- ]
14325
+ "shelfLife",
14326
+ "fluid"
14327
+ ],
14328
+ fluid: {
14329
+ liquid: "yogurt",
14330
+ liters: 0.17
14331
+ }
11824
14332
  },
11825
14333
  {
11826
14334
  id: "apple",
@@ -12108,6 +14616,7 @@ var GameInteractablesHousehold = (() => {
12108
14616
  shape: "box",
12109
14617
  color: 15790304,
12110
14618
  rarity: "common",
14619
+ model: "soap",
12111
14620
  parts: [
12112
14621
  {
12113
14622
  id: "body",
@@ -12143,6 +14652,7 @@ var GameInteractablesHousehold = (() => {
12143
14652
  shape: "bottle",
12144
14653
  color: 4885200,
12145
14654
  rarity: "common",
14655
+ model: "shampoo",
12146
14656
  consumable: {
12147
14657
  form: "liquid",
12148
14658
  unit: "ml",
@@ -12150,6 +14660,21 @@ var GameInteractablesHousehold = (() => {
12150
14660
  dose: 8,
12151
14661
  emptyKg: 0.044,
12152
14662
  density: 1.02
14663
+ },
14664
+ parts: [
14665
+ {
14666
+ id: "body",
14667
+ material: "plastic",
14668
+ thickness: 8e-4
14669
+ }
14670
+ ],
14671
+ estimated: [
14672
+ "fluid",
14673
+ "parts"
14674
+ ],
14675
+ fluid: {
14676
+ liquid: "shampoo",
14677
+ liters: 0.3
12153
14678
  }
12154
14679
  },
12155
14680
  {
@@ -12169,13 +14694,24 @@ var GameInteractablesHousehold = (() => {
12169
14694
  shape: "tube",
12170
14695
  color: 15790320,
12171
14696
  rarity: "common",
14697
+ model: "toothpaste",
12172
14698
  consumable: {
12173
14699
  form: "paste",
12174
14700
  unit: "g",
12175
14701
  amount: 90,
12176
14702
  dose: 1,
12177
14703
  emptyKg: 0.01
12178
- }
14704
+ },
14705
+ parts: [
14706
+ {
14707
+ id: "body",
14708
+ material: "plastic",
14709
+ thickness: 8e-4
14710
+ }
14711
+ ],
14712
+ estimated: [
14713
+ "parts"
14714
+ ]
12179
14715
  },
12180
14716
  {
12181
14717
  id: "toothbrush",
@@ -12193,7 +14729,18 @@ var GameInteractablesHousehold = (() => {
12193
14729
  stack: 3,
12194
14730
  shape: "tool",
12195
14731
  color: 3840720,
12196
- rarity: "common"
14732
+ rarity: "common",
14733
+ model: "toothbrush",
14734
+ parts: [
14735
+ {
14736
+ id: "body",
14737
+ material: "plastic",
14738
+ thickness: 5e-3
14739
+ }
14740
+ ],
14741
+ estimated: [
14742
+ "parts"
14743
+ ]
12197
14744
  },
12198
14745
  {
12199
14746
  id: "deodorant",
@@ -12305,8 +14852,13 @@ var GameInteractablesHousehold = (() => {
12305
14852
  ],
12306
14853
  estimated: [
12307
14854
  "parts",
14855
+ "fluid",
12308
14856
  "consumable"
12309
14857
  ],
14858
+ fluid: {
14859
+ liquid: "detergent",
14860
+ liters: 0.45
14861
+ },
12310
14862
  consumable: {
12311
14863
  form: "liquid",
12312
14864
  unit: "ml",
@@ -12341,8 +14893,13 @@ var GameInteractablesHousehold = (() => {
12341
14893
  }
12342
14894
  ],
12343
14895
  estimated: [
12344
- "parts"
12345
- ]
14896
+ "parts",
14897
+ "fluid"
14898
+ ],
14899
+ fluid: {
14900
+ liquid: "bleach",
14901
+ liters: 1
14902
+ }
12346
14903
  },
12347
14904
  {
12348
14905
  id: "sponge",
@@ -12945,7 +15502,14 @@ var GameInteractablesHousehold = (() => {
12945
15502
  stack: 1,
12946
15503
  shape: "can",
12947
15504
  color: 15261904,
12948
- rarity: "common"
15505
+ rarity: "common",
15506
+ estimated: [
15507
+ "fluid"
15508
+ ],
15509
+ fluid: {
15510
+ liquid: "paint",
15511
+ liters: 3.6
15512
+ }
12949
15513
  },
12950
15514
  {
12951
15515
  id: "ice_pack",
@@ -13305,8 +15869,13 @@ var GameInteractablesHousehold = (() => {
13305
15869
  }
13306
15870
  ],
13307
15871
  estimated: [
13308
- "parts"
13309
- ]
15872
+ "parts",
15873
+ "fluid"
15874
+ ],
15875
+ fluid: {
15876
+ liquid: "disinfectant",
15877
+ liters: 0.5
15878
+ }
13310
15879
  },
13311
15880
  {
13312
15881
  id: "seasoning",
@@ -13526,8 +16095,12 @@ var GameInteractablesHousehold = (() => {
13526
16095
  }
13527
16096
  ],
13528
16097
  estimated: [
13529
- "parts"
13530
- ]
16098
+ "parts",
16099
+ "powder"
16100
+ ],
16101
+ powder: {
16102
+ color: 15659508
16103
+ }
13531
16104
  },
13532
16105
  {
13533
16106
  id: "broom",
@@ -13639,8 +16212,13 @@ var GameInteractablesHousehold = (() => {
13639
16212
  }
13640
16213
  ],
13641
16214
  estimated: [
13642
- "parts"
13643
- ]
16215
+ "parts",
16216
+ "fluid"
16217
+ ],
16218
+ fluid: {
16219
+ liquid: "fabric_softener",
16220
+ liters: 2
16221
+ }
13644
16222
  },
13645
16223
  {
13646
16224
  id: "clothespins",
@@ -14067,9 +16645,8 @@ var GameInteractablesHousehold = (() => {
14067
16645
  shed: false
14068
16646
  },
14069
16647
  use: {
14070
- clip: "open_can_eat",
16648
+ clip: "eat_food",
14071
16649
  sounds: [
14072
- "can_open",
14073
16650
  "chew"
14074
16651
  ]
14075
16652
  },
@@ -14237,9 +16814,8 @@ var GameInteractablesHousehold = (() => {
14237
16814
  shed: false
14238
16815
  },
14239
16816
  use: {
14240
- clip: "open_can_drink",
16817
+ clip: "drink",
14241
16818
  sounds: [
14242
- "can_open",
14243
16819
  "gulp"
14244
16820
  ]
14245
16821
  },
@@ -20013,7 +22589,7 @@ var GameInteractablesHousehold = (() => {
20013
22589
  return m(16) << 16 | m(8) << 8 | m(0);
20014
22590
  }
20015
22591
  var round3 = (n) => Math.round(n * 1e3) / 1e3;
20016
- function rotateAxis(p, o, axis, ang) {
22592
+ function rotateAxis2(p, o, axis, ang) {
20017
22593
  const l = Math.hypot(axis[0], axis[1], axis[2]) || 1;
20018
22594
  const k = [axis[0] / l, axis[1] / l, axis[2] / l];
20019
22595
  const v = [p[0] - o[0], p[1] - o[1], p[2] - o[2]];
@@ -20077,7 +22653,7 @@ var GameInteractablesHousehold = (() => {
20077
22653
  const dot = (p[0] - pivot[0]) * k[0] + (p[1] - pivot[1]) * k[1] + (p[2] - pivot[2]) * k[2];
20078
22654
  return [p[0] + k[0] * dot * s, p[1] + k[1] * dot * s, p[2] + k[2] * dot * s];
20079
22655
  }
20080
- return rotateAxis(p, pivot, axis, (m.angle ?? 0) * t);
22656
+ return rotateAxis2(p, pivot, axis, (m.angle ?? 0) * t);
20081
22657
  }
20082
22658
  function sweepOf(points, pivot, m, margin = 0.01) {
20083
22659
  let x0 = Infinity;
@@ -22902,6 +25478,12 @@ var GameInteractablesHousehold = (() => {
22902
25478
  // src/builders/kitchen.ts
22903
25479
  var STOVE_WALL_GAP = 0.04;
22904
25480
  var STEEL = 11843772;
25481
+ var HAND_WASH_SOAP_GRAMS = 0.4;
25482
+ function scrubSecondsOf(clip) {
25483
+ const use = handUseOf(clip);
25484
+ if (!use) throw new Error(`No hand use for the washing clip ${clip}`);
25485
+ return use.duration;
25486
+ }
22905
25487
  var CHROME = 13817562;
22906
25488
  var DISHES = ["plate", "bowl", "cup", "wine_glass", "cutlery", "knife", "pot", "pan"];
22907
25489
  var DISH_NEEDS = ["detergent", "sponge"];
@@ -22963,7 +25545,8 @@ var GameInteractablesHousehold = (() => {
22963
25545
  label: "use.wash_dishes",
22964
25546
  needs: [...DISH_NEEDS],
22965
25547
  dose: { need: 0 },
22966
- dishes: { ids: [...DISHES], basin: basin.id, rack }
25548
+ dishes: { ids: [...DISHES], basin: basin.id, rack },
25549
+ rinse: { clip: "rinse_dish", seconds: scrubSecondsOf("rinse_dish") }
22967
25550
  });
22968
25551
  }
22969
25552
  function tap2(c, x, y, z, id, partId, basin) {
@@ -23234,6 +25817,44 @@ var GameInteractablesHousehold = (() => {
23234
25817
  slots: c.row(sh.ix0 + 0.15, sh.ix1 - 0.01, sh.iy0, (sh.iz0 + sh.iz1) / 2, 1, [0.3, 0.4, 0.3]),
23235
25818
  loot: "under_sink"
23236
25819
  });
25820
+ washbasinCounter(c, top, hw * 0.6);
25821
+ c.add("uses", { id: "wash_hands", do: "wash", fixture: "tap", surface: "hands", clip: "wash_hands", label: "use.wash_hands", needs: ["soap"], dose: { need: 0, amount: HAND_WASH_SOAP_GRAMS }, scrubSeconds: scrubSecondsOf("wash_hands") });
25822
+ c.add("uses", { id: "brush_teeth", do: "wash", fixture: "tap", surface: "mouth", clip: "brush_teeth", label: "use.brush_teeth", needs: ["toothbrush", "toothpaste"], dose: { need: 1 }, scrubSeconds: scrubSecondsOf("brush_teeth") });
25823
+ }
25824
+ function washbasinCounter(c, top, basinEdge) {
25825
+ const { hw, hd } = c;
25826
+ const side = round3((basinEdge + hw) / 2);
25827
+ c.container({
25828
+ id: "counter",
25829
+ from: [-hw, top, -hd],
25830
+ to: [hw, top + 0.12, hd],
25831
+ slots: [
25832
+ { pos: [-side, top, 0], max: [0.1, 0.04, 0.1] },
25833
+ { pos: [round3(side - 0.025), top, 0.02], max: [0.03, 0.03, 0.19], lay: "z" },
25834
+ { pos: [round3(side + 0.028), top, 0.02], max: [0.045, 0.04, 0.19], lay: "z" },
25835
+ { pos: [round3(-basinEdge + 0.01), top, round3(-hd + 0.065)], max: [0.09, 0.1, 0.09] }
25836
+ ],
25837
+ contents: [{ type: "soap", qty: 1 }, { type: "toothbrush", qty: 1 }, { type: "toothpaste", qty: 1 }, { type: "cup", qty: 1 }]
25838
+ });
25839
+ }
25840
+ function showerShelf(c) {
25841
+ const { hw, hd } = c;
25842
+ const y = 0.85;
25843
+ const x0 = -hw + 0.033;
25844
+ const x1 = round3(x0 + 0.3);
25845
+ const z0 = -hd + 0.033;
25846
+ const z1 = round3(z0 + 0.13);
25847
+ c.b("plain", x0, y - 0.025, z0, x1, y, z1, 15133162);
25848
+ c.container({
25849
+ id: "shelf",
25850
+ from: [x0, y, z0],
25851
+ to: [x1, y + 0.25, z1],
25852
+ slots: [
25853
+ { pos: [round3(x0 + 0.07), y, round3((z0 + z1) / 2)], max: [0.1, 0.04, 0.06] },
25854
+ { pos: [round3(x0 + 0.2), y, round3((z0 + z1) / 2)], max: [0.07, 0.21, 0.05] }
25855
+ ],
25856
+ contents: [{ type: "soap", qty: 1 }, { type: "shampoo", qty: 1 }]
25857
+ });
23237
25858
  }
23238
25859
  function utilitySink(c) {
23239
25860
  const { hw, hd } = c;
@@ -23299,6 +25920,9 @@ var GameInteractablesHousehold = (() => {
23299
25920
  c.add("emitters", { id: "shower_water", kind: "water", pos: outlet, dir: [0, -1, 0.15], source: "shower", size: 0.35 });
23300
25921
  c.add("emitters", { id: "shower_steam", kind: "steam", pos: [0, 1.4, 0], dir: [0, 1, 0], source: "shower", size: 0.8 });
23301
25922
  c.interact("use_shower", [0.25, 1.1, -hd + 0.08], { do: "toggle_fixture", fixture: "shower" }, "prompt.shower", 1.3);
25923
+ showerShelf(c);
25924
+ c.add("uses", { id: "lather_body", do: "wash", fixture: "shower", surface: "body", clip: "lather_body", label: "use.lather_body", needs: ["soap"], dose: { need: 0 }, opensFixture: false, requiresFlowing: true, scrubSeconds: scrubSecondsOf("lather_body") });
25925
+ c.add("uses", { id: "shampoo_hair", do: "wash", fixture: "shower", surface: "hair", clip: "shampoo_hair", label: "use.shampoo_hair", needs: ["shampoo"], dose: { need: 0 }, opensFixture: false, requiresFlowing: true, scrubSeconds: scrubSecondsOf("shampoo_hair") });
23302
25926
  const gl = 12573670;
23303
25927
  const zFront = hd - 0.015;
23304
25928
  const gh = h - 0.1;
@@ -25719,6 +28343,688 @@ var GameInteractablesHousehold = (() => {
25719
28343
  };
25720
28344
  return { api, primitives, parts: parts2 };
25721
28345
  }
28346
+
28347
+ // src/assembly/geometry.ts
28348
+ var round = (value, digits = 4) => Math.round(value * 10 ** digits) / 10 ** digits;
28349
+ var sanitize = (id) => String(id).trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
28350
+ var rotateX = (v, angle) => [v[0], v[1] * Math.cos(angle) - v[2] * Math.sin(angle), v[1] * Math.sin(angle) + v[2] * Math.cos(angle)];
28351
+ var rotateY = (v, angle) => [v[0] * Math.cos(angle) + v[2] * Math.sin(angle), v[1], -v[0] * Math.sin(angle) + v[2] * Math.cos(angle)];
28352
+ var rotateZ = (v, angle) => [v[0] * Math.cos(angle) - v[1] * Math.sin(angle), v[0] * Math.sin(angle) + v[1] * Math.cos(angle), v[2]];
28353
+ function aabbOfBox(center, size, turn = {}) {
28354
+ const { ry = 0, rx = 0, rz = 0 } = turn;
28355
+ const lo = [Infinity, Infinity, Infinity];
28356
+ const hi = [-Infinity, -Infinity, -Infinity];
28357
+ for (const sx of [-0.5, 0.5])
28358
+ for (const sy of [-0.5, 0.5])
28359
+ for (const sz of [-0.5, 0.5]) {
28360
+ let v = [sx * size[0], sy * size[1], sz * size[2]];
28361
+ if (rz) v = rotateZ(v, rz);
28362
+ if (rx) v = rotateX(v, rx);
28363
+ if (ry) v = rotateY(v, ry);
28364
+ for (let k = 0; k < 3; k++) {
28365
+ lo[k] = Math.min(lo[k], center[k] + v[k]);
28366
+ hi[k] = Math.max(hi[k], center[k] + v[k]);
28367
+ }
28368
+ }
28369
+ return [...lo, ...hi];
28370
+ }
28371
+ function latheShape(args) {
28372
+ const [, material, x, y, z, points] = args;
28373
+ const radius = Math.max(...points.map((q) => q[0]));
28374
+ const heights = points.map((q) => q[1]);
28375
+ const lo = Math.min(...heights);
28376
+ const hi = Math.max(...heights);
28377
+ let moment = 0;
28378
+ for (let i = 0; i < points.length; i++) {
28379
+ const [r0, y0] = points[i];
28380
+ const [r1, y1] = points[(i + 1) % points.length];
28381
+ moment += (r0 * y1 - r1 * y0) * (r0 + r1) / 6;
28382
+ }
28383
+ return { key: material, aabb: [x - radius, y + lo, z - radius, x + radius, y + hi, z + radius], vol: Math.max(1e-6, 2 * Math.PI * Math.abs(moment)) };
28384
+ }
28385
+ function describePrimitive(fn, args) {
28386
+ if (fn === "box") {
28387
+ const [, material, x2, y2, z2, w2, h2, d, , ry2 = 0, rx = 0, rz = 0] = args;
28388
+ return { key: material, aabb: aabbOfBox([x2, y2 + h2 / 2, z2], [w2, h2, d], { ry: ry2, rx, rz }), vol: w2 * h2 * d };
28389
+ }
28390
+ if (fn === "cylinder") {
28391
+ const [, material, x2, y2, z2, r, h2, , rx = 0, rz = 0, shape] = args;
28392
+ const tilted = rx || rz;
28393
+ const share = shape === "cone" ? 1 / 3 : shape === "sphere" ? 2 / 3 : 1;
28394
+ return { key: material, aabb: aabbOfBox([x2, tilted ? y2 : y2 + h2 / 2, z2], [2 * r, h2, 2 * r], { rx, rz }), vol: Math.PI * r * r * h2 * share };
28395
+ }
28396
+ if (fn === "plane") {
28397
+ const [, material, x2, y2, z2, w2, h2, , ry2 = 0, rx = 0, rz = 0] = args;
28398
+ return { key: material, aabb: aabbOfBox([x2, y2, z2], [w2, h2, 0.012], { ry: ry2, rx, rz }), vol: w2 * h2 * 0.012 };
28399
+ }
28400
+ if (fn === "lathe") return latheShape(args);
28401
+ const [, x, y, z, w, h, , ry = 0] = args;
28402
+ return { key: "plant", aabb: aabbOfBox([x, y + h / 2, z], [w, h, w * 0.2], { ry }), vol: w * h * w * 0.1 };
28403
+ }
28404
+ var unionBox = (a, b) => [Math.min(a[0], b[0]), Math.min(a[1], b[1]), Math.min(a[2], b[2]), Math.max(a[3], b[3]), Math.max(a[4], b[4]), Math.max(a[5], b[5])];
28405
+ var thinnestOf = (b) => Math.min(b[3] - b[0], b[4] - b[1], b[5] - b[2]);
28406
+ var boxVolume = (b) => Math.max(1e-9, (b[3] - b[0]) * (b[4] - b[1]) * (b[5] - b[2]));
28407
+ var centre = (b) => [(b[0] + b[3]) / 2, (b[1] + b[4]) / 2, (b[2] + b[5]) / 2];
28408
+ function coverOf(skin, under) {
28409
+ const sizes = [skin[3] - skin[0], skin[4] - skin[1], skin[5] - skin[2]];
28410
+ const thin = sizes.indexOf(Math.min(...sizes));
28411
+ let share = 1;
28412
+ for (let k = 0; k < 3; k++) {
28413
+ if (k === thin) continue;
28414
+ const overlap = Math.max(0, Math.min(skin[k + 3], under[k + 3]) - Math.max(skin[k], under[k]));
28415
+ share *= overlap / Math.max(sizes[k], 1e-9);
28416
+ }
28417
+ return share;
28418
+ }
28419
+ function boxGap(a, b) {
28420
+ const dx = Math.max(0, a[0] - b[3], b[0] - a[3]);
28421
+ const dy = Math.max(0, a[1] - b[4], b[1] - a[4]);
28422
+ const dz = Math.max(0, a[2] - b[5], b[2] - a[5]);
28423
+ return Math.hypot(dx, dy, dz);
28424
+ }
28425
+ var SOLID_MIN = 2e-3;
28426
+ function solidsOf(prims, box) {
28427
+ if (prims.length < 2) return void 0;
28428
+ const c = centre(box);
28429
+ return prims.map((p) => {
28430
+ const at = centre(p.aabb);
28431
+ return {
28432
+ center: [round(at[0] - c[0]), round(at[1] - c[1]), round(at[2] - c[2])],
28433
+ size: [0, 1, 2].map((k) => round(Math.max(SOLID_MIN, p.aabb[k + 3] - p.aabb[k])))
28434
+ };
28435
+ });
28436
+ }
28437
+ function primitiveBoxInObject(mover, prim) {
28438
+ let box;
28439
+ for (const sx of [prim.aabb[0], prim.aabb[3]])
28440
+ for (const sy of [prim.aabb[1], prim.aabb[4]])
28441
+ for (const sz of [prim.aabb[2], prim.aabb[5]]) {
28442
+ const v = mover.ry ? rotateY([sx, sy, sz], mover.ry) : [sx, sy, sz];
28443
+ const w = [v[0] + mover.pivot[0], v[1] + mover.pivot[1], v[2] + mover.pivot[2]];
28444
+ box = box ? unionBox(box, [...w, ...w]) : [...w, ...w];
28445
+ }
28446
+ return box;
28447
+ }
28448
+ function moverBox(mover) {
28449
+ let box;
28450
+ for (const p of mover.prims) {
28451
+ const b = primitiveBoxInObject(mover, p);
28452
+ box = box ? unionBox(box, b) : b;
28453
+ }
28454
+ return box;
28455
+ }
28456
+
28457
+ // src/assembly/animations.ts
28458
+ var SOUND = { door: "door", drawer: "drawer", lid: "lid", flap: "flap", knob: "knob", button: "click", rocker: "click", breaker: "click" };
28459
+ var OWN_CLIPS_MAX = 8;
28460
+ function quaternionOf(motion) {
28461
+ const pose = poseOf(motion, 1);
28462
+ const [x, y, z] = pose.rotation.axis;
28463
+ const length = Math.hypot(x, y, z) || 1;
28464
+ const s = Math.sin(pose.rotation.angle / 2);
28465
+ return { position: [...pose.position], quaternion: [x / length * s, y / length * s, z / length * s, Math.cos(pose.rotation.angle / 2)] };
28466
+ }
28467
+ function eulerOf([x, y, z, w]) {
28468
+ const m13 = 2 * (x * z + w * y);
28469
+ const ey = Math.asin(Math.max(-1, Math.min(1, m13)));
28470
+ const ex = Math.abs(m13) < 0.9999999 ? Math.atan2(-2 * (y * z - w * x), 1 - 2 * (x * x + y * y)) : Math.atan2(2 * (y * z + w * x), 1 - 2 * (x * x + z * z));
28471
+ const ez = Math.abs(m13) < 0.9999999 ? Math.atan2(-2 * (x * y - w * z), 1 - 2 * (y * y + z * z)) : 0;
28472
+ return [round(ex), round(ey), round(ez)];
28473
+ }
28474
+ function partMotionPose(motion, ry) {
28475
+ const { position: p, quaternion } = quaternionOf(motion);
28476
+ const [x, y, z, w] = quaternion;
28477
+ const px = p[0] * Math.cos(ry) + p[2] * Math.sin(ry);
28478
+ const pz = -p[0] * Math.sin(ry) + p[2] * Math.cos(ry);
28479
+ const position = [round(px), round(p[1]), round(pz)];
28480
+ const along = [x, y, z].map((c) => Math.abs(c) > 1e-9);
28481
+ if (along.filter(Boolean).length <= 1) {
28482
+ const turn = [x, y, z].map((c) => Math.abs(c) > 1e-9 ? 2 * Math.atan2(c, w) : 0);
28483
+ return { position, rotation: [round(turn[0]), round(turn[1]), round(turn[2])] };
28484
+ }
28485
+ return { position, rotation: eulerOf(quaternion) };
28486
+ }
28487
+ function staged(list) {
28488
+ const bySource = new Map(list.map((p) => [p.source, p]));
28489
+ const start = (p) => {
28490
+ const before = p.requires ? bySource.get(p.requires) : void 0;
28491
+ return before ? start(before) + 0.5 : 0;
28492
+ };
28493
+ return list.map((p) => ({ ...p, start: start(p), end: start(p) + p.seconds }));
28494
+ }
28495
+ function clipOf({ id, list, closing, sound }) {
28496
+ const parts2 = staged(list);
28497
+ const duration = Math.max(...parts2.map((p) => p.end));
28498
+ const times = [.../* @__PURE__ */ new Set([0, duration, ...parts2.flatMap((p) => [p.start, p.end])])].sort((a, b) => a - b);
28499
+ const keys = times.map((t) => ({
28500
+ t: round(t, 3),
28501
+ parts: Object.fromEntries(
28502
+ parts2.map((p) => {
28503
+ const share = Math.max(0, Math.min(1, (t - p.start) / (p.end - p.start)));
28504
+ const f = closing ? 1 - share : share;
28505
+ return [p.id, { position: p.pose.position.map((v) => round(v * f)), rotation: p.pose.rotation.map((v) => round(v * f)) }];
28506
+ })
28507
+ )
28508
+ }));
28509
+ return { id, duration: round(duration, 3), keys, events: [{ t: 0, type: "sound", data: { key: `${sound}_${closing ? "close" : "open"}` } }] };
28510
+ }
28511
+ function buildAnimations({ spec, ids, present }) {
28512
+ const movers = (spec.parts ?? []).filter((p) => p.motion.kind !== "scale" && present.has(p.id));
28513
+ if (movers.length === 0) return [];
28514
+ const info = movers.map((p) => {
28515
+ const kind = p.motion.kind;
28516
+ const on = kind === "knob" || kind === "rocker";
28517
+ const piece2 = p.destruction?.piece ?? (kind === "slide" ? "drawer" : "door");
28518
+ return {
28519
+ source: p.id,
28520
+ id: ids.get(p.id) ?? p.id,
28521
+ on,
28522
+ pose: partMotionPose(p.motion, p.ry ?? 0),
28523
+ seconds: on ? 0.4 : kind === "slide" ? 0.8 : 1.1,
28524
+ sound: SOUND[piece2] ?? "door",
28525
+ requires: p.requires
28526
+ };
28527
+ });
28528
+ const clips = [];
28529
+ const doors = info.filter((p) => !p.on);
28530
+ const knobs = info.filter((p) => p.on);
28531
+ if (doors.length) clips.push(clipOf({ id: "open_all", list: doors, closing: false, sound: "door" }), clipOf({ id: "close_all", list: doors, closing: true, sound: "door" }));
28532
+ if (knobs.length) clips.push(clipOf({ id: "on_all", list: knobs, closing: false, sound: "switch" }), clipOf({ id: "off_all", list: knobs, closing: true, sound: "switch" }));
28533
+ if (info.length > OWN_CLIPS_MAX) return clips;
28534
+ for (const p of info) {
28535
+ clips.push(
28536
+ clipOf({ id: `${p.on ? "on" : "open"}_${p.id}`, list: [p], closing: false, sound: p.sound }),
28537
+ clipOf({ id: `${p.on ? "off" : "close"}_${p.id}`, list: [p], closing: true, sound: p.sound })
28538
+ );
28539
+ }
28540
+ return clips;
28541
+ }
28542
+
28543
+ // src/assembly/cluster.ts
28544
+ var MAX_PIECES = {
28545
+ service_entrance: 32,
28546
+ service_mast: 24,
28547
+ bbq: 30,
28548
+ clothesline: 24,
28549
+ dog_house: 24,
28550
+ gas_bottle: 6,
28551
+ microwave: 10,
28552
+ washing_machine: 12,
28553
+ tv: 8,
28554
+ fridge_compact: 12,
28555
+ utility_sink: 12,
28556
+ wall_socket: 3,
28557
+ wall_switch: 3
28558
+ };
28559
+ var DEFAULT_MAX_PIECES = 18;
28560
+ var STRETCH_DIAMETERS = 2.5;
28561
+ var SKIN_MAX = 4e-3;
28562
+ var SKIN_GAP = 1e-3;
28563
+ var SKIN_COVER = 0.9;
28564
+ var SPECK = 0.02;
28565
+ function layInStretches(statics) {
28566
+ let member = 0;
28567
+ for (let i = statics.length - 1; i >= 0; i--) {
28568
+ const prim = statics[i];
28569
+ if (prim.fn !== "cylinder") continue;
28570
+ const [, , , y, , r, h, , rx = 0, rz = 0, shape] = prim.args;
28571
+ if (rx || rz || shape !== void 0 && shape !== "cyl" && shape !== "cyl6" || h < 2 * STRETCH_DIAMETERS * 2 * r) continue;
28572
+ const count = Math.floor(h / (STRETCH_DIAMETERS * 2 * r));
28573
+ const id = member++;
28574
+ const stretches = Array.from({ length: count }, (_, k) => {
28575
+ const args = prim.args.slice();
28576
+ args[3] = y + h * k / count;
28577
+ args[6] = h / count;
28578
+ return { fn: prim.fn, args, member: id, ...describePrimitive(prim.fn, args) };
28579
+ });
28580
+ statics.splice(i, 1, ...stretches);
28581
+ }
28582
+ }
28583
+ var glassy = (p) => p.keys.has("glass") || p.keys.has("emissive");
28584
+ var sizeOf = (p) => Math.max(p.box[3] - p.box[0], p.box[4] - p.box[1], p.box[5] - p.box[2]);
28585
+ function merge(into, from) {
28586
+ into.indices.push(...from.indices);
28587
+ into.box = unionBox(into.box, from.box);
28588
+ into.vol += from.vol;
28589
+ for (const k of from.keys) into.keys.add(k);
28590
+ for (const [k, v] of Object.entries(from.area)) into.area[k] = (into.area[k] ?? 0) + v;
28591
+ }
28592
+ function hostOf(pieces, small) {
28593
+ let best;
28594
+ let bestScore = Infinity;
28595
+ for (const q of pieces) {
28596
+ if (q === small || glassy(q) !== glassy(small)) continue;
28597
+ const score = boxGap(small.box, q.box) * 1e3 - Math.log(boxVolume(q.box));
28598
+ if (score < bestScore) {
28599
+ bestScore = score;
28600
+ best = q;
28601
+ }
28602
+ }
28603
+ return best;
28604
+ }
28605
+ function clusterStatics({ type, statics, castWith }) {
28606
+ const max = MAX_PIECES[type] ?? DEFAULT_MAX_PIECES;
28607
+ let pieces = statics.map((p, i) => ({ indices: [i], box: p.aabb.slice(), vol: p.vol, keys: /* @__PURE__ */ new Set([p.key]), area: { [p.key]: p.vol } }));
28608
+ const join = (host, piece2) => {
28609
+ merge(host, piece2);
28610
+ pieces = pieces.filter((q) => q !== piece2);
28611
+ };
28612
+ const absorb = (small) => {
28613
+ const host = hostOf(pieces, small);
28614
+ if (!host) return false;
28615
+ join(host, small);
28616
+ return true;
28617
+ };
28618
+ for (const p of pieces.slice()) {
28619
+ if (glassy(p) || pieces.length < 2) continue;
28620
+ const thin = thinnestOf(p.box);
28621
+ if (thin > SKIN_MAX) continue;
28622
+ const host = pieces.find((q) => q !== p && !glassy(q) && thinnestOf(q.box) > thin && boxGap(p.box, q.box) <= SKIN_GAP && coverOf(p.box, q.box) >= SKIN_COVER);
28623
+ if (host) join(host, p);
28624
+ }
28625
+ for (const p of pieces.slice()) {
28626
+ if (p.indices.length !== 1 || statics[p.indices[0]].member !== void 0) continue;
28627
+ const host = pieces.find((q) => q !== p && q.indices.some((i) => statics[i].member !== void 0) && castWith?.(q.box, p.box));
28628
+ if (host) join(host, p);
28629
+ }
28630
+ for (const p of pieces.slice()) if (sizeOf(p) < SPECK && pieces.length > 1 && !glassy(p)) absorb(p);
28631
+ while (pieces.length > max) {
28632
+ const candidates = pieces.filter((p) => !glassy(p) || pieces.filter(glassy).length > 3);
28633
+ const small = (candidates.length ? candidates : pieces).reduce((m, p) => boxVolume(p.box) < boxVolume(m.box) ? p : m);
28634
+ if (!absorb(small)) break;
28635
+ }
28636
+ return pieces.sort((a, b) => boxVolume(b.box) - boxVolume(a.box));
28637
+ }
28638
+
28639
+ // src/assembly/draw-recorder.ts
28640
+ var KINDS2 = ["box", "cylinder", "plane", "leaf", "lathe"];
28641
+ var NOOP_API = { part: (_id, _pivot, _ry, draw) => draw(), box() {
28642
+ }, cylinder() {
28643
+ }, plane() {
28644
+ }, leaf() {
28645
+ }, light() {
28646
+ }, lathe() {
28647
+ } };
28648
+ var callOf = (api, kind) => api[kind];
28649
+ function createDrawRecorder(inner) {
28650
+ const statics = [];
28651
+ const movers = /* @__PURE__ */ new Map();
28652
+ const stack = [];
28653
+ const api = {
28654
+ light: (...args) => inner.light?.(...args),
28655
+ part(id, pivot, ry, draw) {
28656
+ stack.push(id);
28657
+ movers.set(id, { id, pivot: [...pivot], ry: ry || 0, prims: [] });
28658
+ inner.part(id, pivot, ry, draw);
28659
+ stack.pop();
28660
+ }
28661
+ };
28662
+ for (const fn of KINDS2) {
28663
+ ;
28664
+ api[fn] = (...args) => {
28665
+ const prim = { fn, args, ...describePrimitive(fn, args) };
28666
+ const open = stack[stack.length - 1];
28667
+ if (open === void 0) {
28668
+ statics.push(prim);
28669
+ return;
28670
+ }
28671
+ movers.get(open)?.prims.push(prim);
28672
+ callOf(inner, fn)(...args);
28673
+ };
28674
+ }
28675
+ const flush = (pieces, laid2 = statics) => {
28676
+ for (const piece2 of pieces) {
28677
+ inner.part(piece2.id, [0, 0, 0], 0, () => {
28678
+ for (const i of piece2.indices) callOf(inner, laid2[i].fn)(...laid2[i].args);
28679
+ });
28680
+ }
28681
+ };
28682
+ return { api, statics, movers, flush };
28683
+ }
28684
+
28685
+ // src/assembly/fluid.ts
28686
+ var BOWL_FILL_MAX = 0.7;
28687
+ var WATER_TEMPERATURE = 18;
28688
+ var FLUIDS = {
28689
+ sink_kitchen: { liters: 4, capacity: 14, size: [0.5, 0.16, 0.36], opening: 0.2 },
28690
+ sink_bathroom: { liters: 2, capacity: 6, size: [0.34, 0.12, 0.28], opening: 0.15 },
28691
+ utility_sink: { liters: 8, capacity: 28, size: [0.5, 0.25, 0.4], opening: 0.22 },
28692
+ toilet: { liters: 3, capacity: 6, size: [0.3, 0.18, 0.3], opening: 0.14 }
28693
+ };
28694
+ function fluidOf({ type, basin, parts: parts2, basinPiece }) {
28695
+ const fixture = FLUIDS[type];
28696
+ if (!fixture) return void 0;
28697
+ if (basin) return bowlFluid(fixture, basin, parts2);
28698
+ const part = parts2.find((p) => p.id === basinPiece);
28699
+ if (!part) return void 0;
28700
+ const top = part.position[1] + part.shape.size[1] / 2;
28701
+ return {
28702
+ container: { capacity: fixture.capacity, liquid: "water", liters: fixture.liters, temperature: WATER_TEMPERATURE, shape: { kind: "box", size: [...fixture.size] }, opening: fixture.opening },
28703
+ part: part.id,
28704
+ uses: ["pour"],
28705
+ offset: [part.position[0], round(top - fixture.size[1] - 0.01), part.position[2]]
28706
+ };
28707
+ }
28708
+ var isInside = (offset, part) => [0, 1, 2].every((k) => Math.abs(offset[k] + (k === 1 ? 5e-3 : 0) - part.position[k]) <= part.shape.size[k] / 2 + 0.01);
28709
+ function bowlFluid(fixture, bowl, parts2) {
28710
+ const size = [0, 1, 2].map((k) => round(bowl.to[k] - bowl.from[k]));
28711
+ const offset = [round((bowl.from[0] + bowl.to[0]) / 2), round(bowl.from[1]), round((bowl.from[2] + bowl.to[2]) / 2)];
28712
+ const radius = round(Math.min(size[0], size[2]) / 2);
28713
+ const isRound = bowl.shape === "round";
28714
+ const capacity = round((isRound ? Math.PI * radius * radius * size[1] : size[0] * size[1] * size[2]) * 1e3, 2);
28715
+ const part = parts2.find((p) => isInside(offset, p)) ?? parts2[0];
28716
+ return {
28717
+ container: {
28718
+ capacity,
28719
+ liquid: "water",
28720
+ liters: Math.min(fixture.liters, round(capacity * BOWL_FILL_MAX, 2)),
28721
+ temperature: WATER_TEMPERATURE,
28722
+ shape: isRound ? { kind: "cylinder", radius, height: size[1] } : { kind: "box", size },
28723
+ opening: Math.min(fixture.opening, radius)
28724
+ },
28725
+ ...part ? { part: part.id } : {},
28726
+ uses: ["pour"],
28727
+ offset
28728
+ };
28729
+ }
28730
+
28731
+ // src/assembly/joints.ts
28732
+ var TOUCH = 0.01;
28733
+ var DEGREE_MAX = 5;
28734
+ var STRETCH_JOINT = { reinforced: "rebar", plain: "weld" };
28735
+ function createGroups(ids) {
28736
+ const parent = new Map(ids.map((id) => [id, id]));
28737
+ const find = (id) => {
28738
+ const up = parent.get(id) ?? id;
28739
+ if (up === id) return id;
28740
+ const root = find(up);
28741
+ parent.set(id, root);
28742
+ return root;
28743
+ };
28744
+ return { find, join: (a, b) => void parent.set(find(a), find(b)) };
28745
+ }
28746
+ function jointsOf({ spec, pieces, movers, statics }) {
28747
+ const body = spec.destruction ?? {};
28748
+ const cage = body.reinforcement;
28749
+ const bodyKind = body.joint ?? "screw";
28750
+ const memberOf = (piece2) => piece2.indices.map((i) => statics[i].member).find((member) => member !== void 0);
28751
+ const kindOf = (a, b) => {
28752
+ const member = memberOf(a);
28753
+ if (member !== void 0 && member === memberOf(b)) return cage ? STRETCH_JOINT.reinforced : STRETCH_JOINT.plain;
28754
+ if (a.material.includes("glass") || b.material.includes("glass")) return "clip";
28755
+ if (a.material === "foam" !== (b.material === "foam")) return "tie";
28756
+ return cage && (a.material !== body.material || b.material !== body.material) ? "bolt" : bodyKind;
28757
+ };
28758
+ const joints = [];
28759
+ const degree = /* @__PURE__ */ new Map();
28760
+ const groups = createGroups(pieces.map((p) => p.id));
28761
+ const edges = [];
28762
+ for (let i = 0; i < pieces.length; i++)
28763
+ for (let j = i + 1; j < pieces.length; j++) {
28764
+ const gap = boxGap(pieces[i].box, pieces[j].box);
28765
+ if (gap <= TOUCH) edges.push({ a: pieces[i], b: pieces[j], gap });
28766
+ }
28767
+ edges.sort((x, y) => x.gap - y.gap || Math.min(boxVolume(y.a.box), boxVolume(y.b.box)) - Math.min(boxVolume(x.a.box), boxVolume(x.b.box)));
28768
+ for (const e of edges) {
28769
+ if ((degree.get(e.a.id) ?? 0) >= DEGREE_MAX || (degree.get(e.b.id) ?? 0) >= DEGREE_MAX) continue;
28770
+ degree.set(e.a.id, (degree.get(e.a.id) ?? 0) + 1);
28771
+ degree.set(e.b.id, (degree.get(e.b.id) ?? 0) + 1);
28772
+ groups.join(e.a.id, e.b.id);
28773
+ joints.push({ a: e.a.id, b: e.b.id, kind: kindOf(e.a, e.b) });
28774
+ }
28775
+ joints.push(...bridgesOf(pieces, groups, kindOf));
28776
+ for (const m of movers) {
28777
+ const host = hostOf2(pieces, m);
28778
+ if (host) joints.push({ a: m.id, b: host.id, kind: m.tag.joint ?? "hinge" });
28779
+ }
28780
+ return joints;
28781
+ }
28782
+ function bridgesOf(pieces, groups, kindOf) {
28783
+ const bridges = [];
28784
+ while (new Set(pieces.map((p) => groups.find(p.id))).size > 1) {
28785
+ let best;
28786
+ for (const a of pieces)
28787
+ for (const b of pieces) {
28788
+ if (groups.find(a.id) === groups.find(b.id)) continue;
28789
+ const gap = boxGap(a.box, b.box);
28790
+ if (!best || gap < best.gap) best = { a, b, gap };
28791
+ }
28792
+ if (!best) break;
28793
+ groups.join(best.a.id, best.b.id);
28794
+ bridges.push({ a: best.a.id, b: best.b.id, kind: kindOf(best.a, best.b) });
28795
+ }
28796
+ return bridges;
28797
+ }
28798
+ function hostOf2(pieces, mover) {
28799
+ let best = pieces[0];
28800
+ let bestScore = Infinity;
28801
+ for (const h of pieces) {
28802
+ const score = boxGap(mover.box, h.box) * 1e3 - Math.log(boxVolume(h.box));
28803
+ if (score < bestScore) {
28804
+ bestScore = score;
28805
+ best = h;
28806
+ }
28807
+ }
28808
+ return best;
28809
+ }
28810
+
28811
+ // src/assembly/materials.ts
28812
+ var WOOD_FAMILY = /* @__PURE__ */ new Set(["wood_soft", "wood_hard", "mdf", "plywood"]);
28813
+ var METAL_FAMILY = /* @__PURE__ */ new Set(["steel", "aluminium", "cast_iron", "copper"]);
28814
+ var KEY_OVERRIDES = {
28815
+ shower: { plain: "ceramic", metal: "aluminium", glass: "tempered_glass" },
28816
+ sink_kitchen: { wood: "mdf" },
28817
+ sink_bathroom: { wood: "mdf" },
28818
+ mailbox: { wood: "steel" },
28819
+ sofa: { metal: "spring_steel" },
28820
+ armchair: { metal: "spring_steel" },
28821
+ bed_double: { metal: "spring_steel" },
28822
+ bed_single: { metal: "spring_steel" },
28823
+ box_bed: { metal: "spring_steel" }
28824
+ };
28825
+ var DENSITY = {
28826
+ steel: 7850,
28827
+ aluminium: 2700,
28828
+ cast_iron: 7200,
28829
+ copper: 8900,
28830
+ wood_soft: 550,
28831
+ wood_hard: 750,
28832
+ mdf: 700,
28833
+ plywood: 600,
28834
+ glass: 2500,
28835
+ tempered_glass: 2500,
28836
+ ceramic: 2300,
28837
+ plastic: 1e3,
28838
+ rubber: 1100,
28839
+ fabric: 250,
28840
+ foam: 40,
28841
+ brick: 1800,
28842
+ concrete: 2400,
28843
+ foliage: 100
28844
+ };
28845
+ var DEFAULT_DENSITY = 800;
28846
+ var THICKNESS = { steel: 12e-4, aluminium: 1e-3, copper: 2e-3, plastic: 3e-3, ceramic: 0.012, glass: 4e-3, tempered_glass: 6e-3 };
28847
+ function materialFor({ type, spec, key }) {
28848
+ const body = spec.destruction?.material ?? "plastic";
28849
+ const over = KEY_OVERRIDES[type]?.[key];
28850
+ if (over) return over;
28851
+ if (key === "glass" || key === "emissive") return body === "tempered_glass" ? "tempered_glass" : "glass";
28852
+ if (key === "metal") return METAL_FAMILY.has(body) ? body : "steel";
28853
+ if (key === "wood") return WOOD_FAMILY.has(body) ? body : "wood_soft";
28854
+ if (key === "foam") return "foam";
28855
+ if (key === "fabric") return "fabric";
28856
+ if (key === "plant") return "foliage";
28857
+ return body;
28858
+ }
28859
+
28860
+ // src/assembly/parts.ts
28861
+ var GROUND_TOUCH = 0.02;
28862
+ var CAGE_UNIT = 0.1;
28863
+ var CAGE_MIN = 0.1;
28864
+ var UPHOLSTERY_COVER = 2e-3;
28865
+ var GLASS_HP = { glass: 20, tempered_glass: 40 };
28866
+ function weightOf(piece2) {
28867
+ const [dx, dy, dz] = [piece2.box[3] - piece2.box[0], piece2.box[4] - piece2.box[1], piece2.box[5] - piece2.box[2]];
28868
+ const thin = THICKNESS[piece2.material];
28869
+ return (thin ? Math.min(piece2.vol, 2 * (dx * dy + dy * dz + dz * dx) * thin) : piece2.vol) * (DENSITY[piece2.material] ?? DEFAULT_DENSITY);
28870
+ }
28871
+ function shapeOf(type, piece2) {
28872
+ const size = [0, 1, 2].map((k) => Math.max(4e-3, piece2.box[k + 3] - piece2.box[k]));
28873
+ const fill = Math.max(0.03, Math.min(1, piece2.vol / (size[0] * size[1] * size[2])));
28874
+ return {
28875
+ id: piece2.id,
28876
+ material: piece2.material,
28877
+ shape: { kind: "box", size: size.map((v) => round(v)) },
28878
+ position: centre(piece2.box).map((v) => round(v)),
28879
+ fill: round(piece2.material === "foam" || piece2.material === "fabric" ? fill * 0.5 : fill, 3),
28880
+ tags: [type, ...piece2.mover && piece2.tag.piece ? [piece2.tag.piece] : []],
28881
+ ...piece2.solids ? { solids: piece2.solids } : {}
28882
+ };
28883
+ }
28884
+ function bodyBuildOf(piece2, body) {
28885
+ if (piece2.mover || piece2.material !== body.material) return {};
28886
+ const side = Math.min(piece2.box[3] - piece2.box[0], piece2.box[4] - piece2.box[1], piece2.box[5] - piece2.box[2]);
28887
+ const cage = body.reinforcement;
28888
+ if (cage && side >= CAGE_MIN) {
28889
+ return {
28890
+ reinforcement: { material: cage.material, spacing: cage.spacing, diameter: cage.diameter },
28891
+ units: { size: [CAGE_UNIT, CAGE_UNIT, round(side)], bond: "stack", mortar: piece2.material },
28892
+ structure: { role: "column" }
28893
+ };
28894
+ }
28895
+ const laid2 = body.units;
28896
+ return laid2 ? { units: { size: [laid2.size[0], laid2.size[1], laid2.size[2]], bond: laid2.bond, mortar: laid2.mortar } } : {};
28897
+ }
28898
+ function partsOf({ type, spec, pieces, all, massKg, planted }) {
28899
+ const body = spec.destruction ?? {};
28900
+ const totalWeight = all.reduce((sum, piece2) => sum + weightOf(piece2), 0) || 1;
28901
+ const parts2 = all.map((piece2) => {
28902
+ const extra = {};
28903
+ if (planted && !piece2.mover && piece2.box[1] <= GROUND_TOUCH) extra.anchored = true;
28904
+ Object.assign(extra, bodyBuildOf(piece2, body));
28905
+ const own = piece2.mover ? piece2.tag : void 0;
28906
+ if (own?.explodes) extra.explodes = { ...own.explodes };
28907
+ if (own?.contains) extra.contains = { ...own.contains };
28908
+ if (massKg) extra.mass = round(Math.max(0.01, massKg * weightOf(piece2) / totalWeight), 3);
28909
+ if (!piece2.mover && piece2.key === "foam") extra.layers = [{ material: "fabric", thickness: UPHOLSTERY_COVER, faces: "all" }];
28910
+ const hp = GLASS_HP[piece2.material];
28911
+ if (hp) extra.hp = hp;
28912
+ const thin = THICKNESS[piece2.material];
28913
+ if (thin) extra.thickness = Math.min(thin, Math.max(5e-4, Math.min(piece2.box[3] - piece2.box[0], piece2.box[4] - piece2.box[1], piece2.box[5] - piece2.box[2])));
28914
+ return Object.assign(shapeOf(type, piece2), extra);
28915
+ });
28916
+ const shell2 = pieces.length ? parts2.find((p) => p.id === pieces[0].id) : void 0;
28917
+ if (shell2 && body.explodes) shell2.explodes = { ...body.explodes };
28918
+ if (shell2 && body.contains) shell2.contains = { ...body.contains };
28919
+ return parts2;
28920
+ }
28921
+
28922
+ // src/assembly/pieces.ts
28923
+ function createIds() {
28924
+ const used = /* @__PURE__ */ new Set();
28925
+ return (base) => {
28926
+ let id = base;
28927
+ for (let n = 2; used.has(id); n++) id = `${base}_${n}`;
28928
+ used.add(id);
28929
+ return id;
28930
+ };
28931
+ }
28932
+ function bodyPiecesOf({ type, spec, clusters, statics, unique }) {
28933
+ const pieces = clusters.map((c) => {
28934
+ const dominant = Object.entries(c.area).sort((a, b) => b[1] - a[1])[0][0];
28935
+ const material = materialFor({ type, spec, key: dominant });
28936
+ const solids = solidsOf(c.indices.map((i) => statics[i]), c.box);
28937
+ return { id: unique(dominant === "emissive" ? "screen" : material), indices: c.indices, box: c.box, vol: c.vol, material, key: dominant, mover: false, ...solids ? { solids } : {} };
28938
+ });
28939
+ return pieces.length ? pieces : wirePiecesOf({ spec, unique });
28940
+ }
28941
+ function wirePiecesOf({ spec, unique }) {
28942
+ const pieces = [];
28943
+ for (const w of spec.wires ?? []) {
28944
+ if (!w.points || w.points.length < 2) continue;
28945
+ const r = w.radius ?? 0.01;
28946
+ const lo = [Infinity, Infinity, Infinity];
28947
+ const hi = [-Infinity, -Infinity, -Infinity];
28948
+ let length = 0;
28949
+ w.points.forEach((q, i) => {
28950
+ for (let k = 0; k < 3; k++) {
28951
+ lo[k] = Math.min(lo[k], q[k] - r);
28952
+ hi[k] = Math.max(hi[k], q[k] + r);
28953
+ }
28954
+ if (i) length += Math.hypot(q[0] - w.points[i - 1][0], q[1] - w.points[i - 1][1], q[2] - w.points[i - 1][2]);
28955
+ });
28956
+ const material = spec.destruction?.material ?? "plastic";
28957
+ pieces.push({ id: unique(w.kind === "conduit" ? "conduit" : w.kind), indices: [], box: [...lo, ...hi], vol: Math.PI * r * r * length, material, key: "plain", mover: false });
28958
+ }
28959
+ return pieces;
28960
+ }
28961
+ function moverPiecesOf({ spec, recorded, partIds }) {
28962
+ const movers = [];
28963
+ for (const p of spec.parts ?? []) {
28964
+ const r = recorded.get(p.id);
28965
+ if (!r || r.prims.length === 0) continue;
28966
+ const box = p.bounds ?? moverBox(r);
28967
+ if (!box) continue;
28968
+ const vol = r.prims.reduce((sum, q) => sum + q.vol, 0);
28969
+ const tag = p.destruction ?? {};
28970
+ const solids = solidsOf(r.prims.map((q) => ({ aabb: primitiveBoxInObject(r, q) })), box);
28971
+ const id = partIds.get(p.id) ?? p.id;
28972
+ movers.push({ id, source: p, indices: [], box, vol, material: tag.material ?? spec.destruction?.material ?? "plastic", mover: true, tag, ...solids ? { solids } : {} });
28973
+ }
28974
+ return movers;
28975
+ }
28976
+ function partIdsOf(spec, unique) {
28977
+ const ids = /* @__PURE__ */ new Map();
28978
+ for (const p of spec.parts ?? []) ids.set(p.id, unique(sanitize(p.id)));
28979
+ return ids;
28980
+ }
28981
+
28982
+ // src/assembly/assemble.ts
28983
+ var ASSEMBLY_SEED = 1;
28984
+ function assembleHouseholdType({ household, type, castWith = castWithMember }) {
28985
+ const recorder = createDrawRecorder(NOOP_API);
28986
+ const spec = household.build(type, { seed: ASSEMBLY_SEED }, recorder.api);
28987
+ const def = household.types.find((t) => t.id === type);
28988
+ const planted = def?.fixed === true && def.y <= 0;
28989
+ if (planted) layInStretches(recorder.statics);
28990
+ const clusters = clusterStatics({ type, statics: recorder.statics, castWith });
28991
+ const unique = createIds();
28992
+ const partIds = partIdsOf(spec, unique);
28993
+ const pieces = bodyPiecesOf({ type, spec, clusters, statics: recorder.statics, unique });
28994
+ const movers = moverPiecesOf({ spec, recorded: recorder.movers, partIds });
28995
+ const parts2 = partsOf({ type, spec, pieces, all: [...pieces, ...movers], massKg: def?.massKg, planted });
28996
+ const joints = jointsOf({ spec, pieces, movers, statics: recorder.statics });
28997
+ const destructible2 = { name: type, parts: parts2, joints, tags: ["furniture", type], ...planted ? { fixed: true } : {} };
28998
+ const animations = buildAnimations({ spec, ids: partIds, present: new Set(movers.map((m) => m.source.id)) });
28999
+ const basinPiece = (pieces.find((p) => p.material === "ceramic") ?? pieces[0])?.id;
29000
+ const fluid = fluidOf({ type, basin: spec.basins?.[0], parts: parts2, basinPiece });
29001
+ return { type, spec, pieces, movers, partIds, destructible: destructible2, animations, fluid, statics: recorder.statics };
29002
+ }
29003
+ function drawHouseholdAssembly(params) {
29004
+ const { household, assembly, api } = params;
29005
+ const recorder = createDrawRecorder(api);
29006
+ const item = { seed: ASSEMBLY_SEED };
29007
+ const spec = household.build(assembly.type, item, recorder.api);
29008
+ recorder.flush(assembly.pieces, assembly.statics);
29009
+ return spec;
29010
+ }
29011
+ var REGION_OF = { en: "us", "pt-BR": "br" };
29012
+ function createHouseholdAssemblies(options = {}) {
29013
+ const households = {};
29014
+ const assemblies = /* @__PURE__ */ new Map();
29015
+ const household = (locale) => households[locale] ?? (households[locale] = createHousehold({ locale, region: REGION_OF[locale] }));
29016
+ const assemble = (locale, type) => {
29017
+ const key = `${locale}:${type}`;
29018
+ let assembly = assemblies.get(key);
29019
+ if (!assembly) assemblies.set(key, assembly = assembleHouseholdType({ household: household(locale), type, ...options.castWith ? { castWith: options.castWith } : {} }));
29020
+ return assembly;
29021
+ };
29022
+ return {
29023
+ household,
29024
+ assemble,
29025
+ draw: (locale, type, api) => drawHouseholdAssembly({ household: household(locale), assembly: assemble(locale, type), api })
29026
+ };
29027
+ }
25722
29028
  return __toCommonJS(index_exports);
25723
29029
  })();
25724
29030
  //# sourceMappingURL=index.global.js.map