@adatechnology/game-items 0.7.2 → 0.9.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,7 +28,8 @@ var GameItems = (() => {
28
28
  FOAM_GONE: () => FOAM_GONE,
29
29
  FOAM_RINSE_LITRES: () => FOAM_RINSE_LITRES,
30
30
  HAND_USES: () => HAND_USES,
31
- HAND_USE_REACH: () => HAND_USE_REACH,
31
+ HAND_USE_ARM: () => HAND_USE_ARM,
32
+ HAND_USE_SHOULDER: () => HAND_USE_SHOULDER,
32
33
  ITEM_CATEGORIES: () => ITEM_CATEGORIES,
33
34
  RARITIES: () => RARITIES,
34
35
  addFoam: () => addFoam,
@@ -125,6 +126,9 @@ var GameItems = (() => {
125
126
  [DEFERRED_QUEUE_ID.DESTRUCTION_PREFIT]: { priority: 40, phase: "idle", minEveryFrames: 30 }
126
127
  };
127
128
  var MUST_DRAIN_QUEUE_IDS = /* @__PURE__ */ new Set([DEFERRED_QUEUE_ID.DESTRUCTION_EVENTS, DEFERRED_QUEUE_ID.BREACH_CUT]);
129
+ var ITEM_TOOLS = ["plunger"];
130
+ var BODY_FOAM_SURFACES = ["hands", "arms", "torso", "hair", "mouth"];
131
+ var WASH_SURFACES = [...BODY_FOAM_SURFACES, "brush"];
128
132
  var WARNED_KEY = /* @__PURE__ */ Symbol.for("@adatechnology/game-contracts.warned");
129
133
  var warnedKeys = () => {
130
134
  const holder = globalThis;
@@ -445,6 +449,7 @@ var GameItems = (() => {
445
449
  if (item.shelfLife !== void 0 && !isPositive(item.shelfLife)) issue(`has a shelf life of ${item.shelfLife} days`);
446
450
  if (item.portions !== void 0 && !(Number.isInteger(item.portions) && item.portions > 0)) issue(`has ${item.portions} portions`);
447
451
  if (item.durability && !DURABILITY_KINDS.includes(item.durability.kind)) issue(`has unknown durability kind "${item.durability.kind}"`);
452
+ for (const tool of item.tools ?? []) if (!ITEM_TOOLS.includes(tool)) issue(`works as unknown tool "${tool}"`);
448
453
  if (item.consumable) for (const problem of consumableProblems(item.consumable)) issue(problem);
449
454
  const { protection } = item;
450
455
  if (protection) {
@@ -1016,6 +1021,11 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
1016
1021
  if (size[1] > max[1] + eps) return false;
1017
1022
  return size[0] <= max[0] + eps && size[2] <= max[2] + eps || size[2] <= max[0] + eps && size[0] <= max[2] + eps;
1018
1023
  }
1024
+ function laidSize(size, lay) {
1025
+ if (lay === "x") return [size[1], size[0], size[2]];
1026
+ if (lay === "z") return [size[0], size[2], size[1]];
1027
+ return size;
1028
+ }
1019
1029
  var pose = new Float64Array(7);
1020
1030
  var pose2 = new Float64Array(7);
1021
1031
 
@@ -1028,7 +1038,7 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
1028
1038
  const stackMax = item.stack ?? 1;
1029
1039
  let remaining = stack.count;
1030
1040
  while (remaining > 0) {
1031
- const index = slots.findIndex((slot, position) => contents[position] === null && fitsSize(item.size, slot.max));
1041
+ const index = slots.findIndex((slot, position) => contents[position] === null && fitsSize(laidSize(item.size, slot.lay), slot.max));
1032
1042
  if (index < 0) break;
1033
1043
  const qty = Math.min(remaining, stackMax);
1034
1044
  contents[index] = { type: item.id, qty, ...stack.data ? { data: { ...stack.data } } : {} };
@@ -2149,19 +2159,1317 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
2149
2159
  ]
2150
2160
  }
2151
2161
  ]
2162
+ },
2163
+ {
2164
+ id: "wash_dishes",
2165
+ body: "two_hands",
2166
+ duration: 3,
2167
+ 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)",
2168
+ keys: [
2169
+ {
2170
+ t: 0,
2171
+ position: [
2172
+ 0.22,
2173
+ -0.2,
2174
+ -0.4
2175
+ ],
2176
+ rotation: [
2177
+ 0,
2178
+ 0,
2179
+ 0
2180
+ ]
2181
+ },
2182
+ {
2183
+ t: 0.4,
2184
+ position: [
2185
+ 0,
2186
+ -0.55,
2187
+ -0.45
2188
+ ],
2189
+ rotation: [
2190
+ -0.5,
2191
+ 0,
2192
+ 0
2193
+ ],
2194
+ reach: true
2195
+ },
2196
+ {
2197
+ t: 0.7,
2198
+ position: [
2199
+ 0.04,
2200
+ -0.55,
2201
+ -0.41
2202
+ ],
2203
+ rotation: [
2204
+ -0.5,
2205
+ 0,
2206
+ 0
2207
+ ],
2208
+ action: "scrub",
2209
+ reach: true
2210
+ },
2211
+ {
2212
+ t: 0.95,
2213
+ position: [
2214
+ 0,
2215
+ -0.55,
2216
+ -0.37
2217
+ ],
2218
+ rotation: [
2219
+ -0.5,
2220
+ 0,
2221
+ 0
2222
+ ],
2223
+ reach: true
2224
+ },
2225
+ {
2226
+ t: 1.2,
2227
+ position: [
2228
+ -0.04,
2229
+ -0.55,
2230
+ -0.41
2231
+ ],
2232
+ rotation: [
2233
+ -0.5,
2234
+ 0,
2235
+ 0
2236
+ ],
2237
+ reach: true
2238
+ },
2239
+ {
2240
+ t: 1.45,
2241
+ position: [
2242
+ 0,
2243
+ -0.55,
2244
+ -0.45
2245
+ ],
2246
+ rotation: [
2247
+ -0.5,
2248
+ 0,
2249
+ 0
2250
+ ],
2251
+ action: "scrub",
2252
+ reach: true
2253
+ },
2254
+ {
2255
+ t: 1.7,
2256
+ position: [
2257
+ 0.04,
2258
+ -0.55,
2259
+ -0.41
2260
+ ],
2261
+ rotation: [
2262
+ -0.5,
2263
+ 0,
2264
+ 0
2265
+ ],
2266
+ reach: true
2267
+ },
2268
+ {
2269
+ t: 1.95,
2270
+ position: [
2271
+ 0,
2272
+ -0.55,
2273
+ -0.37
2274
+ ],
2275
+ rotation: [
2276
+ -0.5,
2277
+ 0,
2278
+ 0
2279
+ ],
2280
+ reach: true
2281
+ },
2282
+ {
2283
+ t: 2.2,
2284
+ position: [
2285
+ -0.04,
2286
+ -0.55,
2287
+ -0.41
2288
+ ],
2289
+ rotation: [
2290
+ -0.5,
2291
+ 0,
2292
+ 0
2293
+ ],
2294
+ action: "scrub",
2295
+ reach: true
2296
+ },
2297
+ {
2298
+ t: 2.5,
2299
+ position: [
2300
+ 0,
2301
+ -0.55,
2302
+ -0.45
2303
+ ],
2304
+ rotation: [
2305
+ -0.5,
2306
+ 0,
2307
+ 0
2308
+ ],
2309
+ reach: true
2310
+ },
2311
+ {
2312
+ t: 3,
2313
+ position: [
2314
+ 0.22,
2315
+ -0.2,
2316
+ -0.4
2317
+ ],
2318
+ rotation: [
2319
+ 0,
2320
+ 0,
2321
+ 0
2322
+ ]
2323
+ }
2324
+ ]
2325
+ },
2326
+ {
2327
+ id: "fill_cup",
2328
+ body: "hand",
2329
+ duration: 2.5,
2330
+ 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)",
2331
+ keys: [
2332
+ {
2333
+ t: 0,
2334
+ position: [
2335
+ 0.22,
2336
+ -0.2,
2337
+ -0.4
2338
+ ],
2339
+ rotation: [
2340
+ 0,
2341
+ 0,
2342
+ 0
2343
+ ]
2344
+ },
2345
+ {
2346
+ t: 0.5,
2347
+ position: [
2348
+ 0.05,
2349
+ -0.55,
2350
+ -0.45
2351
+ ],
2352
+ rotation: [
2353
+ 0,
2354
+ 0,
2355
+ 0
2356
+ ],
2357
+ reach: true
2358
+ },
2359
+ {
2360
+ t: 0.7,
2361
+ position: [
2362
+ 0.05,
2363
+ -0.55,
2364
+ -0.45
2365
+ ],
2366
+ rotation: [
2367
+ 0,
2368
+ 0,
2369
+ 0
2370
+ ],
2371
+ action: "apply",
2372
+ reach: true
2373
+ },
2374
+ {
2375
+ t: 1.8,
2376
+ position: [
2377
+ 0.05,
2378
+ -0.55,
2379
+ -0.45
2380
+ ],
2381
+ rotation: [
2382
+ 0,
2383
+ 0,
2384
+ 0
2385
+ ],
2386
+ reach: true
2387
+ },
2388
+ {
2389
+ t: 2.1,
2390
+ position: [
2391
+ 0.15,
2392
+ -0.32,
2393
+ -0.42
2394
+ ],
2395
+ rotation: [
2396
+ 0,
2397
+ 0,
2398
+ 0
2399
+ ]
2400
+ },
2401
+ {
2402
+ t: 2.5,
2403
+ position: [
2404
+ 0.22,
2405
+ -0.2,
2406
+ -0.4
2407
+ ],
2408
+ rotation: [
2409
+ 0,
2410
+ 0,
2411
+ 0
2412
+ ]
2413
+ }
2414
+ ]
2415
+ },
2416
+ {
2417
+ id: "drink_cupped_hands",
2418
+ body: "two_hands",
2419
+ duration: 5,
2420
+ 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",
2421
+ keys: [
2422
+ {
2423
+ t: 0,
2424
+ position: [
2425
+ 0.22,
2426
+ -0.2,
2427
+ -0.4
2428
+ ],
2429
+ rotation: [
2430
+ 0,
2431
+ 0,
2432
+ 0
2433
+ ]
2434
+ },
2435
+ {
2436
+ t: 0.5,
2437
+ position: [
2438
+ 0,
2439
+ -0.55,
2440
+ -0.42
2441
+ ],
2442
+ rotation: [
2443
+ -0.3,
2444
+ 0,
2445
+ 0
2446
+ ],
2447
+ reach: true
2448
+ },
2449
+ {
2450
+ t: 1,
2451
+ position: [
2452
+ 0,
2453
+ -0.55,
2454
+ -0.42
2455
+ ],
2456
+ rotation: [
2457
+ -0.3,
2458
+ 0,
2459
+ 0
2460
+ ],
2461
+ reach: true
2462
+ },
2463
+ {
2464
+ t: 1.45,
2465
+ position: [
2466
+ 0,
2467
+ 0,
2468
+ -0.22
2469
+ ],
2470
+ rotation: [
2471
+ -0.9,
2472
+ 0,
2473
+ 0
2474
+ ],
2475
+ action: "swallow"
2476
+ },
2477
+ {
2478
+ t: 1.7,
2479
+ position: [
2480
+ 0,
2481
+ 0,
2482
+ -0.22
2483
+ ],
2484
+ rotation: [
2485
+ -0.9,
2486
+ 0,
2487
+ 0
2488
+ ]
2489
+ },
2490
+ {
2491
+ t: 1.9,
2492
+ position: [
2493
+ 0,
2494
+ -0.55,
2495
+ -0.42
2496
+ ],
2497
+ rotation: [
2498
+ -0.3,
2499
+ 0,
2500
+ 0
2501
+ ],
2502
+ reach: true
2503
+ },
2504
+ {
2505
+ t: 2.4,
2506
+ position: [
2507
+ 0,
2508
+ -0.55,
2509
+ -0.42
2510
+ ],
2511
+ rotation: [
2512
+ -0.3,
2513
+ 0,
2514
+ 0
2515
+ ],
2516
+ reach: true
2517
+ },
2518
+ {
2519
+ t: 2.85,
2520
+ position: [
2521
+ 0,
2522
+ 0,
2523
+ -0.22
2524
+ ],
2525
+ rotation: [
2526
+ -0.9,
2527
+ 0,
2528
+ 0
2529
+ ],
2530
+ action: "swallow"
2531
+ },
2532
+ {
2533
+ t: 3.1,
2534
+ position: [
2535
+ 0,
2536
+ 0,
2537
+ -0.22
2538
+ ],
2539
+ rotation: [
2540
+ -0.9,
2541
+ 0,
2542
+ 0
2543
+ ]
2544
+ },
2545
+ {
2546
+ t: 3.3,
2547
+ position: [
2548
+ 0,
2549
+ -0.55,
2550
+ -0.42
2551
+ ],
2552
+ rotation: [
2553
+ -0.3,
2554
+ 0,
2555
+ 0
2556
+ ],
2557
+ reach: true
2558
+ },
2559
+ {
2560
+ t: 3.8,
2561
+ position: [
2562
+ 0,
2563
+ -0.55,
2564
+ -0.42
2565
+ ],
2566
+ rotation: [
2567
+ -0.3,
2568
+ 0,
2569
+ 0
2570
+ ],
2571
+ reach: true
2572
+ },
2573
+ {
2574
+ t: 4.25,
2575
+ position: [
2576
+ 0,
2577
+ 0,
2578
+ -0.22
2579
+ ],
2580
+ rotation: [
2581
+ -0.9,
2582
+ 0,
2583
+ 0
2584
+ ],
2585
+ action: "swallow"
2586
+ },
2587
+ {
2588
+ t: 4.5,
2589
+ position: [
2590
+ 0,
2591
+ 0,
2592
+ -0.22
2593
+ ],
2594
+ rotation: [
2595
+ -0.9,
2596
+ 0,
2597
+ 0
2598
+ ]
2599
+ },
2600
+ {
2601
+ t: 5,
2602
+ position: [
2603
+ 0.22,
2604
+ -0.2,
2605
+ -0.4
2606
+ ],
2607
+ rotation: [
2608
+ 0,
2609
+ 0,
2610
+ 0
2611
+ ]
2612
+ }
2613
+ ]
2614
+ },
2615
+ {
2616
+ id: "lather_body",
2617
+ body: "body",
2618
+ duration: 6.4,
2619
+ note: "bar soap rubbed between wet hands, then over the other forearm, the chest and the belly; foam left on each",
2620
+ keys: [
2621
+ {
2622
+ t: 0,
2623
+ position: [
2624
+ 0.22,
2625
+ -0.2,
2626
+ -0.4
2627
+ ],
2628
+ rotation: [
2629
+ 0,
2630
+ 0,
2631
+ 0
2632
+ ]
2633
+ },
2634
+ {
2635
+ t: 0.4,
2636
+ position: [
2637
+ 0.02,
2638
+ -0.22,
2639
+ -0.32
2640
+ ],
2641
+ rotation: [
2642
+ 0,
2643
+ 0,
2644
+ 1.5
2645
+ ]
2646
+ },
2647
+ {
2648
+ t: 0.7,
2649
+ position: [
2650
+ -0.04,
2651
+ -0.22,
2652
+ -0.32
2653
+ ],
2654
+ rotation: [
2655
+ 0,
2656
+ 0,
2657
+ 1.5
2658
+ ],
2659
+ action: "dose"
2660
+ },
2661
+ {
2662
+ t: 1,
2663
+ position: [
2664
+ 0.05,
2665
+ -0.22,
2666
+ -0.32
2667
+ ],
2668
+ rotation: [
2669
+ 0,
2670
+ 0,
2671
+ 1.5
2672
+ ],
2673
+ action: "lather",
2674
+ surface: "hands"
2675
+ },
2676
+ {
2677
+ t: 1.3,
2678
+ position: [
2679
+ -0.04,
2680
+ -0.22,
2681
+ -0.32
2682
+ ],
2683
+ rotation: [
2684
+ 0,
2685
+ 0,
2686
+ 1.5
2687
+ ]
2688
+ },
2689
+ {
2690
+ t: 1.75,
2691
+ position: [
2692
+ -0.2,
2693
+ -0.3,
2694
+ -0.3
2695
+ ],
2696
+ rotation: [
2697
+ 0,
2698
+ 0,
2699
+ 1.2
2700
+ ]
2701
+ },
2702
+ {
2703
+ t: 2.2,
2704
+ position: [
2705
+ -0.24,
2706
+ -0.2,
2707
+ -0.26
2708
+ ],
2709
+ rotation: [
2710
+ 0,
2711
+ 0,
2712
+ 1.2
2713
+ ],
2714
+ action: "lather",
2715
+ surface: "arms"
2716
+ },
2717
+ {
2718
+ t: 2.65,
2719
+ position: [
2720
+ -0.2,
2721
+ -0.3,
2722
+ -0.3
2723
+ ],
2724
+ rotation: [
2725
+ 0,
2726
+ 0,
2727
+ 1.2
2728
+ ]
2729
+ },
2730
+ {
2731
+ t: 3.1,
2732
+ position: [
2733
+ -0.24,
2734
+ -0.2,
2735
+ -0.26
2736
+ ],
2737
+ rotation: [
2738
+ 0,
2739
+ 0,
2740
+ 1.2
2741
+ ],
2742
+ action: "lather",
2743
+ surface: "arms"
2744
+ },
2745
+ {
2746
+ t: 3.55,
2747
+ position: [
2748
+ 0,
2749
+ -0.32,
2750
+ -0.24
2751
+ ],
2752
+ rotation: [
2753
+ 0,
2754
+ 0,
2755
+ 1.5
2756
+ ]
2757
+ },
2758
+ {
2759
+ t: 4,
2760
+ position: [
2761
+ -0.08,
2762
+ -0.34,
2763
+ -0.24
2764
+ ],
2765
+ rotation: [
2766
+ 0,
2767
+ 0,
2768
+ 1.5
2769
+ ],
2770
+ action: "lather",
2771
+ surface: "torso"
2772
+ },
2773
+ {
2774
+ t: 4.45,
2775
+ position: [
2776
+ 0.06,
2777
+ -0.32,
2778
+ -0.24
2779
+ ],
2780
+ rotation: [
2781
+ 0,
2782
+ 0,
2783
+ 1.5
2784
+ ]
2785
+ },
2786
+ {
2787
+ t: 4.9,
2788
+ position: [
2789
+ 0,
2790
+ -0.5,
2791
+ -0.26
2792
+ ],
2793
+ rotation: [
2794
+ 0,
2795
+ 0,
2796
+ 1.5
2797
+ ]
2798
+ },
2799
+ {
2800
+ t: 5.35,
2801
+ position: [
2802
+ -0.08,
2803
+ -0.52,
2804
+ -0.26
2805
+ ],
2806
+ rotation: [
2807
+ 0,
2808
+ 0,
2809
+ 1.5
2810
+ ],
2811
+ action: "lather",
2812
+ surface: "torso"
2813
+ },
2814
+ {
2815
+ t: 5.8,
2816
+ position: [
2817
+ 0.06,
2818
+ -0.5,
2819
+ -0.26
2820
+ ],
2821
+ rotation: [
2822
+ 0,
2823
+ 0,
2824
+ 1.5
2825
+ ]
2826
+ },
2827
+ {
2828
+ t: 6.4,
2829
+ position: [
2830
+ 0.22,
2831
+ -0.2,
2832
+ -0.4
2833
+ ],
2834
+ rotation: [
2835
+ 0,
2836
+ 0,
2837
+ 0
2838
+ ]
2839
+ }
2840
+ ]
2841
+ },
2842
+ {
2843
+ id: "shampoo_hair",
2844
+ body: "scalp",
2845
+ duration: 4.5,
2846
+ 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",
2847
+ keys: [
2848
+ {
2849
+ t: 0,
2850
+ position: [
2851
+ 0.22,
2852
+ -0.2,
2853
+ -0.4
2854
+ ],
2855
+ rotation: [
2856
+ 0,
2857
+ 0,
2858
+ 0
2859
+ ]
2860
+ },
2861
+ {
2862
+ t: 0.45,
2863
+ position: [
2864
+ 0.02,
2865
+ -0.16,
2866
+ -0.32
2867
+ ],
2868
+ rotation: [
2869
+ -2.4,
2870
+ 0,
2871
+ 0
2872
+ ]
2873
+ },
2874
+ {
2875
+ t: 0.8,
2876
+ position: [
2877
+ 0.02,
2878
+ -0.16,
2879
+ -0.32
2880
+ ],
2881
+ rotation: [
2882
+ -2.6,
2883
+ 0,
2884
+ 0
2885
+ ],
2886
+ action: "dose"
2887
+ },
2888
+ {
2889
+ t: 1.2,
2890
+ position: [
2891
+ 0.02,
2892
+ -0.2,
2893
+ -0.34
2894
+ ],
2895
+ rotation: [
2896
+ 0,
2897
+ 0,
2898
+ 0
2899
+ ]
2900
+ },
2901
+ {
2902
+ t: 1.65,
2903
+ position: [
2904
+ -0.05,
2905
+ 0.1,
2906
+ -0.06
2907
+ ],
2908
+ rotation: [
2909
+ 0,
2910
+ 0,
2911
+ 1.2
2912
+ ]
2913
+ },
2914
+ {
2915
+ t: 2.1,
2916
+ position: [
2917
+ 0.05,
2918
+ 0.1,
2919
+ -0.06
2920
+ ],
2921
+ rotation: [
2922
+ 0,
2923
+ 0,
2924
+ 1.2
2925
+ ],
2926
+ action: "lather",
2927
+ surface: "hair"
2928
+ },
2929
+ {
2930
+ t: 2.55,
2931
+ position: [
2932
+ -0.05,
2933
+ 0.1,
2934
+ -0.06
2935
+ ],
2936
+ rotation: [
2937
+ 0,
2938
+ 0,
2939
+ 1.2
2940
+ ]
2941
+ },
2942
+ {
2943
+ t: 3,
2944
+ position: [
2945
+ 0.05,
2946
+ 0.1,
2947
+ -0.06
2948
+ ],
2949
+ rotation: [
2950
+ 0,
2951
+ 0,
2952
+ 1.2
2953
+ ],
2954
+ action: "lather",
2955
+ surface: "hair"
2956
+ },
2957
+ {
2958
+ t: 3.45,
2959
+ position: [
2960
+ -0.05,
2961
+ 0.1,
2962
+ -0.06
2963
+ ],
2964
+ rotation: [
2965
+ 0,
2966
+ 0,
2967
+ 1.2
2968
+ ]
2969
+ },
2970
+ {
2971
+ t: 3.9,
2972
+ position: [
2973
+ 0.05,
2974
+ 0.1,
2975
+ -0.06
2976
+ ],
2977
+ rotation: [
2978
+ 0,
2979
+ 0,
2980
+ 1.2
2981
+ ],
2982
+ action: "lather",
2983
+ surface: "hair"
2984
+ },
2985
+ {
2986
+ t: 4.5,
2987
+ position: [
2988
+ 0.22,
2989
+ -0.2,
2990
+ -0.4
2991
+ ],
2992
+ rotation: [
2993
+ 0,
2994
+ 0,
2995
+ 0
2996
+ ]
2997
+ }
2998
+ ]
2999
+ },
3000
+ {
3001
+ id: "brush_teeth",
3002
+ body: "mouth",
3003
+ duration: 5.9,
3004
+ 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",
3005
+ keys: [
3006
+ {
3007
+ t: 0,
3008
+ position: [
3009
+ 0.22,
3010
+ -0.2,
3011
+ -0.4
3012
+ ],
3013
+ rotation: [
3014
+ 0,
3015
+ 0,
3016
+ 0
3017
+ ]
3018
+ },
3019
+ {
3020
+ t: 0.5,
3021
+ position: [
3022
+ 0.04,
3023
+ -0.2,
3024
+ -0.34
3025
+ ],
3026
+ rotation: [
3027
+ 0,
3028
+ 0,
3029
+ 1.5
3030
+ ]
3031
+ },
3032
+ {
3033
+ t: 0.9,
3034
+ position: [
3035
+ 0.04,
3036
+ -0.2,
3037
+ -0.34
3038
+ ],
3039
+ rotation: [
3040
+ 0,
3041
+ 0,
3042
+ 1.5
3043
+ ],
3044
+ action: "dose"
3045
+ },
3046
+ {
3047
+ t: 1.4,
3048
+ position: [
3049
+ 0.02,
3050
+ -0.06,
3051
+ -0.17
3052
+ ],
3053
+ rotation: [
3054
+ 0,
3055
+ 0,
3056
+ 1.5
3057
+ ]
3058
+ },
3059
+ {
3060
+ t: 1.7,
3061
+ position: [
3062
+ 0,
3063
+ -0.06,
3064
+ -0.17
3065
+ ],
3066
+ rotation: [
3067
+ 0,
3068
+ 0,
3069
+ 1.5
3070
+ ]
3071
+ },
3072
+ {
3073
+ t: 2,
3074
+ position: [
3075
+ 0.04,
3076
+ -0.06,
3077
+ -0.17
3078
+ ],
3079
+ rotation: [
3080
+ 0,
3081
+ 0,
3082
+ 1.5
3083
+ ],
3084
+ action: "lather",
3085
+ surface: "mouth"
3086
+ },
3087
+ {
3088
+ t: 2.3,
3089
+ position: [
3090
+ 0,
3091
+ -0.06,
3092
+ -0.17
3093
+ ],
3094
+ rotation: [
3095
+ 0,
3096
+ 0,
3097
+ 1.5
3098
+ ]
3099
+ },
3100
+ {
3101
+ t: 2.6,
3102
+ position: [
3103
+ 0.04,
3104
+ -0.06,
3105
+ -0.17
3106
+ ],
3107
+ rotation: [
3108
+ 0,
3109
+ 0,
3110
+ 1.5
3111
+ ],
3112
+ action: "lather",
3113
+ surface: "mouth"
3114
+ },
3115
+ {
3116
+ t: 2.9,
3117
+ position: [
3118
+ 0,
3119
+ -0.06,
3120
+ -0.17
3121
+ ],
3122
+ rotation: [
3123
+ 0,
3124
+ 0,
3125
+ 1.5
3126
+ ]
3127
+ },
3128
+ {
3129
+ t: 3.2,
3130
+ position: [
3131
+ 0.04,
3132
+ -0.06,
3133
+ -0.17
3134
+ ],
3135
+ rotation: [
3136
+ 0,
3137
+ 0,
3138
+ 1.5
3139
+ ],
3140
+ action: "lather",
3141
+ surface: "mouth"
3142
+ },
3143
+ {
3144
+ t: 3.5,
3145
+ position: [
3146
+ 0,
3147
+ -0.06,
3148
+ -0.17
3149
+ ],
3150
+ rotation: [
3151
+ 0,
3152
+ 0,
3153
+ 1.5
3154
+ ]
3155
+ },
3156
+ {
3157
+ t: 3.8,
3158
+ position: [
3159
+ 0.04,
3160
+ -0.06,
3161
+ -0.17
3162
+ ],
3163
+ rotation: [
3164
+ 0,
3165
+ 0,
3166
+ 1.5
3167
+ ],
3168
+ action: "lather",
3169
+ surface: "mouth"
3170
+ },
3171
+ {
3172
+ t: 4.2,
3173
+ position: [
3174
+ 0.02,
3175
+ -0.06,
3176
+ -0.2
3177
+ ],
3178
+ rotation: [
3179
+ 0,
3180
+ 0,
3181
+ 1.5
3182
+ ],
3183
+ action: "spit",
3184
+ surface: "mouth"
3185
+ },
3186
+ {
3187
+ t: 4.7,
3188
+ position: [
3189
+ 0.04,
3190
+ -0.34,
3191
+ -0.44
3192
+ ],
3193
+ rotation: [
3194
+ 0,
3195
+ 0,
3196
+ 1.5
3197
+ ]
3198
+ },
3199
+ {
3200
+ t: 5.3,
3201
+ position: [
3202
+ 0.04,
3203
+ -0.34,
3204
+ -0.44
3205
+ ],
3206
+ rotation: [
3207
+ 0,
3208
+ 0,
3209
+ 1.5
3210
+ ],
3211
+ action: "rinse",
3212
+ surface: "brush"
3213
+ },
3214
+ {
3215
+ t: 5.9,
3216
+ position: [
3217
+ 0.22,
3218
+ -0.2,
3219
+ -0.4
3220
+ ],
3221
+ rotation: [
3222
+ 0,
3223
+ 0,
3224
+ 0
3225
+ ]
3226
+ }
3227
+ ]
3228
+ },
3229
+ {
3230
+ id: "wash_hands",
3231
+ body: "two_hands",
3232
+ duration: 6.5,
3233
+ note: "hands wet under the tap, the bar rubbed between them into foam, rinsed under the water and shaken dry",
3234
+ keys: [
3235
+ {
3236
+ t: 0,
3237
+ position: [
3238
+ 0.22,
3239
+ -0.2,
3240
+ -0.4
3241
+ ],
3242
+ rotation: [
3243
+ 0,
3244
+ 0,
3245
+ 0
3246
+ ]
3247
+ },
3248
+ {
3249
+ t: 0.5,
3250
+ position: [
3251
+ 0,
3252
+ -0.34,
3253
+ -0.44
3254
+ ],
3255
+ rotation: [
3256
+ 0,
3257
+ 0,
3258
+ 1.5
3259
+ ]
3260
+ },
3261
+ {
3262
+ t: 1,
3263
+ position: [
3264
+ 0,
3265
+ -0.34,
3266
+ -0.44
3267
+ ],
3268
+ rotation: [
3269
+ 0,
3270
+ 0,
3271
+ 1.5
3272
+ ],
3273
+ action: "rinse",
3274
+ surface: "hands"
3275
+ },
3276
+ {
3277
+ t: 1.4,
3278
+ position: [
3279
+ 0.02,
3280
+ -0.26,
3281
+ -0.36
3282
+ ],
3283
+ rotation: [
3284
+ 0,
3285
+ 0,
3286
+ 1.5
3287
+ ],
3288
+ action: "dose"
3289
+ },
3290
+ {
3291
+ t: 1.7,
3292
+ position: [
3293
+ -0.04,
3294
+ -0.26,
3295
+ -0.36
3296
+ ],
3297
+ rotation: [
3298
+ 0,
3299
+ 0,
3300
+ 1.5
3301
+ ]
3302
+ },
3303
+ {
3304
+ t: 2,
3305
+ position: [
3306
+ 0.06,
3307
+ -0.26,
3308
+ -0.36
3309
+ ],
3310
+ rotation: [
3311
+ 0,
3312
+ 0,
3313
+ 1.5
3314
+ ],
3315
+ action: "lather",
3316
+ surface: "hands"
3317
+ },
3318
+ {
3319
+ t: 2.3,
3320
+ position: [
3321
+ -0.04,
3322
+ -0.26,
3323
+ -0.36
3324
+ ],
3325
+ rotation: [
3326
+ 0,
3327
+ 0,
3328
+ 1.5
3329
+ ]
3330
+ },
3331
+ {
3332
+ t: 2.6,
3333
+ position: [
3334
+ 0.06,
3335
+ -0.26,
3336
+ -0.36
3337
+ ],
3338
+ rotation: [
3339
+ 0,
3340
+ 0,
3341
+ 1.5
3342
+ ],
3343
+ action: "lather",
3344
+ surface: "hands"
3345
+ },
3346
+ {
3347
+ t: 2.9,
3348
+ position: [
3349
+ -0.04,
3350
+ -0.26,
3351
+ -0.36
3352
+ ],
3353
+ rotation: [
3354
+ 0,
3355
+ 0,
3356
+ 1.5
3357
+ ]
3358
+ },
3359
+ {
3360
+ t: 3.2,
3361
+ position: [
3362
+ 0.06,
3363
+ -0.26,
3364
+ -0.36
3365
+ ],
3366
+ rotation: [
3367
+ 0,
3368
+ 0,
3369
+ 1.5
3370
+ ],
3371
+ action: "lather",
3372
+ surface: "hands"
3373
+ },
3374
+ {
3375
+ t: 3.7,
3376
+ position: [
3377
+ 0,
3378
+ -0.34,
3379
+ -0.44
3380
+ ],
3381
+ rotation: [
3382
+ 0,
3383
+ 0,
3384
+ 1.5
3385
+ ]
3386
+ },
3387
+ {
3388
+ t: 4.6,
3389
+ position: [
3390
+ 0.04,
3391
+ -0.34,
3392
+ -0.44
3393
+ ],
3394
+ rotation: [
3395
+ 0,
3396
+ 0,
3397
+ 1.5
3398
+ ],
3399
+ action: "rinse",
3400
+ surface: "hands"
3401
+ },
3402
+ {
3403
+ t: 5.1,
3404
+ position: [
3405
+ 0.04,
3406
+ -0.24,
3407
+ -0.36
3408
+ ],
3409
+ rotation: [
3410
+ 0,
3411
+ 0,
3412
+ 1.5
3413
+ ]
3414
+ },
3415
+ {
3416
+ t: 5.5,
3417
+ position: [
3418
+ -0.02,
3419
+ -0.24,
3420
+ -0.36
3421
+ ],
3422
+ rotation: [
3423
+ 0,
3424
+ 0,
3425
+ 1.5
3426
+ ],
3427
+ action: "dry",
3428
+ surface: "hands"
3429
+ },
3430
+ {
3431
+ t: 5.9,
3432
+ position: [
3433
+ 0.04,
3434
+ -0.24,
3435
+ -0.36
3436
+ ],
3437
+ rotation: [
3438
+ 0,
3439
+ 0,
3440
+ 1.5
3441
+ ]
3442
+ },
3443
+ {
3444
+ t: 6.5,
3445
+ position: [
3446
+ 0.22,
3447
+ -0.2,
3448
+ -0.4
3449
+ ],
3450
+ rotation: [
3451
+ 0,
3452
+ 0,
3453
+ 0
3454
+ ]
3455
+ }
3456
+ ]
2152
3457
  }
2153
3458
  ];
2154
3459
 
2155
3460
  // src/hand-use.ts
2156
3461
  var HAND_USES = hand_uses_default;
2157
3462
  var handUseOf = (id, defs = HAND_USES) => defs.find((def) => def.id === id);
2158
- var HAND_USE_REACH = 0.62;
3463
+ var HAND_USE_SHOULDER = [0.17, -0.24, 0.04];
3464
+ var HAND_USE_ARM = 0.66;
2159
3465
  var aimHandUse = (def, target) => {
2160
3466
  const anchor = def.keys.find((key) => key.reach);
2161
3467
  if (!anchor) return def;
2162
- const length = Math.hypot(target[0], target[1], target[2]);
2163
- const k = length > HAND_USE_REACH ? HAND_USE_REACH / length : 1;
2164
- const shift = [target[0] * k - anchor.position[0], target[1] * k - anchor.position[1], target[2] * k - anchor.position[2]];
3468
+ const [sx, sy, sz] = HAND_USE_SHOULDER;
3469
+ const length = Math.hypot(target[0] - sx, target[1] - sy, target[2] - sz);
3470
+ const k = length > HAND_USE_ARM ? HAND_USE_ARM / length : 1;
3471
+ const reached = [sx + (target[0] - sx) * k, sy + (target[1] - sy) * k, sz + (target[2] - sz) * k];
3472
+ const shift = [reached[0] - anchor.position[0], reached[1] - anchor.position[1], reached[2] - anchor.position[2]];
2165
3473
  const moved = (key) => ({ ...key, position: [key.position[0] + shift[0], key.position[1] + shift[1], key.position[2] + shift[2]] });
2166
3474
  return { ...def, keys: def.keys.map((key) => key.reach ? moved(key) : key) };
2167
3475
  };
@@ -2201,7 +3509,8 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
2201
3509
  const events = [];
2202
3510
  while (reached < actions.length && actions[reached].t <= time) {
2203
3511
  reached++;
2204
- events.push({ action: actions[reached - 1].action, share: reached / actions.length });
3512
+ const key = actions[reached - 1];
3513
+ events.push({ action: key.action, share: reached / actions.length, ...key.surface ? { surface: key.surface } : {} });
2205
3514
  }
2206
3515
  done = time >= def.duration;
2207
3516
  return events;