@adatechnology/game-items 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1404,12 +1404,499 @@ var hand_uses_default = [
1404
1404
  ]
1405
1405
  }
1406
1406
  ]
1407
+ },
1408
+ {
1409
+ id: "toggle_flashlight",
1410
+ body: "hand",
1411
+ duration: 1.1,
1412
+ note: "the flashlight raised before the chest and pointed ahead, the thumb pressing the tail switch (a small push), and back",
1413
+ keys: [
1414
+ {
1415
+ t: 0,
1416
+ position: [
1417
+ 0.22,
1418
+ -0.2,
1419
+ -0.4
1420
+ ],
1421
+ rotation: [
1422
+ 0,
1423
+ 0,
1424
+ 0
1425
+ ]
1426
+ },
1427
+ {
1428
+ t: 0.35,
1429
+ position: [
1430
+ 0.12,
1431
+ -0.12,
1432
+ -0.42
1433
+ ],
1434
+ rotation: [
1435
+ -1.45,
1436
+ 0,
1437
+ 0
1438
+ ]
1439
+ },
1440
+ {
1441
+ t: 0.47,
1442
+ position: [
1443
+ 0.12,
1444
+ -0.13,
1445
+ -0.42
1446
+ ],
1447
+ rotation: [
1448
+ -1.5,
1449
+ 0,
1450
+ 0
1451
+ ]
1452
+ },
1453
+ {
1454
+ t: 0.52,
1455
+ position: [
1456
+ 0.12,
1457
+ -0.125,
1458
+ -0.42
1459
+ ],
1460
+ rotation: [
1461
+ -1.47,
1462
+ 0,
1463
+ 0
1464
+ ],
1465
+ action: "switch"
1466
+ },
1467
+ {
1468
+ t: 0.7,
1469
+ position: [
1470
+ 0.12,
1471
+ -0.12,
1472
+ -0.42
1473
+ ],
1474
+ rotation: [
1475
+ -1.45,
1476
+ 0,
1477
+ 0
1478
+ ]
1479
+ },
1480
+ {
1481
+ t: 1.1,
1482
+ position: [
1483
+ 0.22,
1484
+ -0.2,
1485
+ -0.4
1486
+ ],
1487
+ rotation: [
1488
+ 0,
1489
+ 0,
1490
+ 0
1491
+ ]
1492
+ }
1493
+ ]
1494
+ },
1495
+ {
1496
+ id: "light_lighter",
1497
+ body: "hand",
1498
+ duration: 1.5,
1499
+ 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",
1500
+ keys: [
1501
+ {
1502
+ t: 0,
1503
+ position: [
1504
+ 0.22,
1505
+ -0.2,
1506
+ -0.4
1507
+ ],
1508
+ rotation: [
1509
+ 0,
1510
+ 0,
1511
+ 0
1512
+ ]
1513
+ },
1514
+ {
1515
+ t: 0.4,
1516
+ position: [
1517
+ 0.07,
1518
+ -0.12,
1519
+ -0.34
1520
+ ],
1521
+ rotation: [
1522
+ 0,
1523
+ 0,
1524
+ 0
1525
+ ]
1526
+ },
1527
+ {
1528
+ t: 0.52,
1529
+ position: [
1530
+ 0.07,
1531
+ -0.137,
1532
+ -0.34
1533
+ ],
1534
+ rotation: [
1535
+ 0.14,
1536
+ 0,
1537
+ -0.12
1538
+ ]
1539
+ },
1540
+ {
1541
+ t: 0.58,
1542
+ position: [
1543
+ 0.07,
1544
+ -0.125,
1545
+ -0.34
1546
+ ],
1547
+ rotation: [
1548
+ 0,
1549
+ 0,
1550
+ 0
1551
+ ],
1552
+ action: "ignite"
1553
+ },
1554
+ {
1555
+ t: 1.15,
1556
+ position: [
1557
+ 0.07,
1558
+ -0.115,
1559
+ -0.34
1560
+ ],
1561
+ rotation: [
1562
+ 0,
1563
+ 0,
1564
+ 0
1565
+ ]
1566
+ },
1567
+ {
1568
+ t: 1.5,
1569
+ position: [
1570
+ 0.22,
1571
+ -0.2,
1572
+ -0.4
1573
+ ],
1574
+ rotation: [
1575
+ 0,
1576
+ 0,
1577
+ 0
1578
+ ]
1579
+ }
1580
+ ]
1581
+ },
1582
+ {
1583
+ id: "use_radio",
1584
+ body: "mouth",
1585
+ duration: 3,
1586
+ 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",
1587
+ keys: [
1588
+ {
1589
+ t: 0,
1590
+ position: [
1591
+ 0.22,
1592
+ -0.2,
1593
+ -0.4
1594
+ ],
1595
+ rotation: [
1596
+ 0,
1597
+ 0,
1598
+ 0
1599
+ ]
1600
+ },
1601
+ {
1602
+ t: 0.5,
1603
+ position: [
1604
+ 0.08,
1605
+ -0.05,
1606
+ -0.22
1607
+ ],
1608
+ rotation: [
1609
+ 0,
1610
+ 0,
1611
+ 0.15
1612
+ ]
1613
+ },
1614
+ {
1615
+ t: 0.85,
1616
+ position: [
1617
+ 0.08,
1618
+ -0.05,
1619
+ -0.22
1620
+ ],
1621
+ rotation: [
1622
+ 0,
1623
+ 0,
1624
+ 0.15
1625
+ ]
1626
+ },
1627
+ {
1628
+ t: 1.05,
1629
+ position: [
1630
+ 0.08,
1631
+ -0.05,
1632
+ -0.22
1633
+ ],
1634
+ rotation: [
1635
+ 0,
1636
+ 0.3,
1637
+ 0.15
1638
+ ],
1639
+ action: "tune"
1640
+ },
1641
+ {
1642
+ t: 1.25,
1643
+ position: [
1644
+ 0.08,
1645
+ -0.05,
1646
+ -0.22
1647
+ ],
1648
+ rotation: [
1649
+ 0,
1650
+ 0,
1651
+ 0.15
1652
+ ]
1653
+ },
1654
+ {
1655
+ t: 1.45,
1656
+ position: [
1657
+ 0.05,
1658
+ -0.02,
1659
+ -0.19
1660
+ ],
1661
+ rotation: [
1662
+ -0.1,
1663
+ 0,
1664
+ 0.15
1665
+ ],
1666
+ action: "talk"
1667
+ },
1668
+ {
1669
+ t: 2.4,
1670
+ position: [
1671
+ 0.05,
1672
+ -0.02,
1673
+ -0.19
1674
+ ],
1675
+ rotation: [
1676
+ -0.1,
1677
+ 0,
1678
+ 0.15
1679
+ ]
1680
+ },
1681
+ {
1682
+ t: 3,
1683
+ position: [
1684
+ 0.22,
1685
+ -0.2,
1686
+ -0.4
1687
+ ],
1688
+ rotation: [
1689
+ 0,
1690
+ 0,
1691
+ 0
1692
+ ]
1693
+ }
1694
+ ]
1695
+ },
1696
+ {
1697
+ id: "turn_key",
1698
+ body: "reach",
1699
+ duration: 1.9,
1700
+ 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",
1701
+ keys: [
1702
+ {
1703
+ t: 0,
1704
+ position: [
1705
+ 0.22,
1706
+ -0.2,
1707
+ -0.4
1708
+ ],
1709
+ rotation: [
1710
+ 0,
1711
+ 0,
1712
+ 0
1713
+ ]
1714
+ },
1715
+ {
1716
+ t: 0.5,
1717
+ position: [
1718
+ 0.1,
1719
+ -0.15,
1720
+ -0.55
1721
+ ],
1722
+ rotation: [
1723
+ 0,
1724
+ 1.524,
1725
+ 0
1726
+ ],
1727
+ reach: true
1728
+ },
1729
+ {
1730
+ t: 0.75,
1731
+ position: [
1732
+ 0.1,
1733
+ -0.15,
1734
+ -0.57
1735
+ ],
1736
+ rotation: [
1737
+ 0,
1738
+ 1.524,
1739
+ 0
1740
+ ],
1741
+ reach: true
1742
+ },
1743
+ {
1744
+ t: 0.84,
1745
+ position: [
1746
+ 0.1,
1747
+ -0.15,
1748
+ -0.57
1749
+ ],
1750
+ rotation: [
1751
+ -1.46,
1752
+ 1.168,
1753
+ 1.45
1754
+ ],
1755
+ reach: true
1756
+ },
1757
+ {
1758
+ t: 0.93,
1759
+ position: [
1760
+ 0.1,
1761
+ -0.15,
1762
+ -0.57
1763
+ ],
1764
+ rotation: [
1765
+ -1.525,
1766
+ 0.77,
1767
+ 1.505
1768
+ ],
1769
+ reach: true
1770
+ },
1771
+ {
1772
+ t: 1.01,
1773
+ position: [
1774
+ 0.1,
1775
+ -0.15,
1776
+ -0.57
1777
+ ],
1778
+ rotation: [
1779
+ -1.552,
1780
+ 0.37,
1781
+ 1.52
1782
+ ],
1783
+ reach: true
1784
+ },
1785
+ {
1786
+ t: 1.1,
1787
+ position: [
1788
+ 0.1,
1789
+ -0.15,
1790
+ -0.57
1791
+ ],
1792
+ rotation: [
1793
+ -1.572,
1794
+ -0.029,
1795
+ 1.524
1796
+ ],
1797
+ action: "turn",
1798
+ reach: true
1799
+ },
1800
+ {
1801
+ t: 1.19,
1802
+ position: [
1803
+ 0.1,
1804
+ -0.15,
1805
+ -0.57
1806
+ ],
1807
+ rotation: [
1808
+ -1.552,
1809
+ 0.37,
1810
+ 1.52
1811
+ ],
1812
+ reach: true
1813
+ },
1814
+ {
1815
+ t: 1.27,
1816
+ position: [
1817
+ 0.1,
1818
+ -0.15,
1819
+ -0.57
1820
+ ],
1821
+ rotation: [
1822
+ -1.525,
1823
+ 0.77,
1824
+ 1.505
1825
+ ],
1826
+ reach: true
1827
+ },
1828
+ {
1829
+ t: 1.34,
1830
+ position: [
1831
+ 0.1,
1832
+ -0.15,
1833
+ -0.57
1834
+ ],
1835
+ rotation: [
1836
+ -1.46,
1837
+ 1.168,
1838
+ 1.45
1839
+ ],
1840
+ reach: true
1841
+ },
1842
+ {
1843
+ t: 1.4,
1844
+ position: [
1845
+ 0.1,
1846
+ -0.15,
1847
+ -0.57
1848
+ ],
1849
+ rotation: [
1850
+ 0,
1851
+ 1.524,
1852
+ 0
1853
+ ],
1854
+ reach: true
1855
+ },
1856
+ {
1857
+ t: 1.55,
1858
+ position: [
1859
+ 0.1,
1860
+ -0.15,
1861
+ -0.55
1862
+ ],
1863
+ rotation: [
1864
+ 0,
1865
+ 1.524,
1866
+ 0
1867
+ ],
1868
+ reach: true
1869
+ },
1870
+ {
1871
+ t: 1.9,
1872
+ position: [
1873
+ 0.22,
1874
+ -0.2,
1875
+ -0.4
1876
+ ],
1877
+ rotation: [
1878
+ 0,
1879
+ 0,
1880
+ 0
1881
+ ]
1882
+ }
1883
+ ]
1407
1884
  }
1408
1885
  ];
1409
1886
 
1410
1887
  // src/hand-use.ts
1411
1888
  var HAND_USES = hand_uses_default;
1412
1889
  var handUseOf = (id, defs = HAND_USES) => defs.find((def) => def.id === id);
1890
+ var HAND_USE_REACH = 0.62;
1891
+ var aimHandUse = (def, target) => {
1892
+ const anchor = def.keys.find((key) => key.reach);
1893
+ if (!anchor) return def;
1894
+ const length = Math.hypot(target[0], target[1], target[2]);
1895
+ const k = length > HAND_USE_REACH ? HAND_USE_REACH / length : 1;
1896
+ const shift = [target[0] * k - anchor.position[0], target[1] * k - anchor.position[1], target[2] * k - anchor.position[2]];
1897
+ const moved = (key) => ({ ...key, position: [key.position[0] + shift[0], key.position[1] + shift[1], key.position[2] + shift[2]] });
1898
+ return { ...def, keys: def.keys.map((key) => key.reach ? moved(key) : key) };
1899
+ };
1413
1900
  var lerp = (a, b, k) => [
1414
1901
  a[0] + (b[0] - a[0]) * k,
1415
1902
  a[1] + (b[1] - a[1]) * k,
@@ -1462,9 +1949,11 @@ export {
1462
1949
  DEFAULT_RULES,
1463
1950
  DURABILITY_KINDS,
1464
1951
  HAND_USES,
1952
+ HAND_USE_REACH,
1465
1953
  ITEM_CATEGORIES,
1466
1954
  RARITIES,
1467
1955
  advanceAge,
1956
+ aimHandUse,
1468
1957
  bagOption,
1469
1958
  blockChance,
1470
1959
  canCraft,