@adatechnology/game-fluids 0.3.6 → 0.4.1
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.d.ts +8 -3
- package/dist/index.global.js +204 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +204 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1477,7 +1477,7 @@ function createFluids(options = {}) {
|
|
|
1477
1477
|
settle(c);
|
|
1478
1478
|
return out;
|
|
1479
1479
|
},
|
|
1480
|
-
drink(id, liters) {
|
|
1480
|
+
drink(id, liters, options2) {
|
|
1481
1481
|
const c = containers.get(id);
|
|
1482
1482
|
const def = c ? defOf(c) : null;
|
|
1483
1483
|
if (!c || !def || c.closed || c.liters <= 1e-6 || !(liters > 0)) return null;
|
|
@@ -1490,8 +1490,9 @@ function createFluids(options = {}) {
|
|
|
1490
1490
|
liters: amount,
|
|
1491
1491
|
temperature: c.temperature,
|
|
1492
1492
|
thirst: (def.drink?.thirst ?? 0) * amount,
|
|
1493
|
-
effects: [...def.drink?.effects ?? []],
|
|
1494
|
-
burn: c.temperature > 65
|
|
1493
|
+
effects: options2?.eaten ? [] : [...def.drink?.effects ?? []],
|
|
1494
|
+
burn: c.temperature > 65,
|
|
1495
|
+
...options2?.eaten ? { eaten: true } : {}
|
|
1495
1496
|
};
|
|
1496
1497
|
emit(event);
|
|
1497
1498
|
refreshLevel(c);
|
|
@@ -1839,6 +1840,128 @@ var item_uses_default = [
|
|
|
1839
1840
|
}
|
|
1840
1841
|
]
|
|
1841
1842
|
},
|
|
1843
|
+
{
|
|
1844
|
+
id: "eat",
|
|
1845
|
+
duration: 3.6,
|
|
1846
|
+
keys: [
|
|
1847
|
+
{
|
|
1848
|
+
t: 0,
|
|
1849
|
+
position: [
|
|
1850
|
+
0.22,
|
|
1851
|
+
-0.2,
|
|
1852
|
+
-0.4
|
|
1853
|
+
],
|
|
1854
|
+
rotation: [
|
|
1855
|
+
0,
|
|
1856
|
+
0,
|
|
1857
|
+
0
|
|
1858
|
+
],
|
|
1859
|
+
action: "none"
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
t: 0.4,
|
|
1863
|
+
position: [
|
|
1864
|
+
0.04,
|
|
1865
|
+
-0.12,
|
|
1866
|
+
-0.28
|
|
1867
|
+
],
|
|
1868
|
+
rotation: [
|
|
1869
|
+
-0.35,
|
|
1870
|
+
0,
|
|
1871
|
+
0
|
|
1872
|
+
],
|
|
1873
|
+
action: "none"
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
t: 0.6,
|
|
1877
|
+
position: [
|
|
1878
|
+
0.04,
|
|
1879
|
+
-0.1,
|
|
1880
|
+
-0.26
|
|
1881
|
+
],
|
|
1882
|
+
rotation: [
|
|
1883
|
+
-0.45,
|
|
1884
|
+
0,
|
|
1885
|
+
0
|
|
1886
|
+
],
|
|
1887
|
+
action: "eat",
|
|
1888
|
+
rate: 0.06
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
t: 1.3,
|
|
1892
|
+
position: [
|
|
1893
|
+
0.04,
|
|
1894
|
+
-0.12,
|
|
1895
|
+
-0.28
|
|
1896
|
+
],
|
|
1897
|
+
rotation: [
|
|
1898
|
+
-0.35,
|
|
1899
|
+
0,
|
|
1900
|
+
0
|
|
1901
|
+
],
|
|
1902
|
+
action: "eat",
|
|
1903
|
+
rate: 0.06
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
t: 2,
|
|
1907
|
+
position: [
|
|
1908
|
+
0.04,
|
|
1909
|
+
-0.1,
|
|
1910
|
+
-0.26
|
|
1911
|
+
],
|
|
1912
|
+
rotation: [
|
|
1913
|
+
-0.45,
|
|
1914
|
+
0,
|
|
1915
|
+
0
|
|
1916
|
+
],
|
|
1917
|
+
action: "eat",
|
|
1918
|
+
rate: 0.06
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
t: 2.7,
|
|
1922
|
+
position: [
|
|
1923
|
+
0.04,
|
|
1924
|
+
-0.12,
|
|
1925
|
+
-0.28
|
|
1926
|
+
],
|
|
1927
|
+
rotation: [
|
|
1928
|
+
-0.35,
|
|
1929
|
+
0,
|
|
1930
|
+
0
|
|
1931
|
+
],
|
|
1932
|
+
action: "eat",
|
|
1933
|
+
rate: 0.06
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
t: 3.1,
|
|
1937
|
+
position: [
|
|
1938
|
+
0.04,
|
|
1939
|
+
-0.12,
|
|
1940
|
+
-0.28
|
|
1941
|
+
],
|
|
1942
|
+
rotation: [
|
|
1943
|
+
-0.35,
|
|
1944
|
+
0,
|
|
1945
|
+
0
|
|
1946
|
+
],
|
|
1947
|
+
action: "none"
|
|
1948
|
+
},
|
|
1949
|
+
{
|
|
1950
|
+
t: 3.6,
|
|
1951
|
+
position: [
|
|
1952
|
+
0.22,
|
|
1953
|
+
-0.2,
|
|
1954
|
+
-0.4
|
|
1955
|
+
],
|
|
1956
|
+
rotation: [
|
|
1957
|
+
0,
|
|
1958
|
+
0,
|
|
1959
|
+
0
|
|
1960
|
+
],
|
|
1961
|
+
action: "none"
|
|
1962
|
+
}
|
|
1963
|
+
]
|
|
1964
|
+
},
|
|
1842
1965
|
{
|
|
1843
1966
|
id: "pour",
|
|
1844
1967
|
duration: 3,
|
|
@@ -2116,6 +2239,82 @@ var item_uses_default = [
|
|
|
2116
2239
|
action: "none"
|
|
2117
2240
|
}
|
|
2118
2241
|
]
|
|
2242
|
+
},
|
|
2243
|
+
{
|
|
2244
|
+
id: "unscrew",
|
|
2245
|
+
duration: 2.6,
|
|
2246
|
+
keys: [
|
|
2247
|
+
{
|
|
2248
|
+
t: 0,
|
|
2249
|
+
position: [
|
|
2250
|
+
0.22,
|
|
2251
|
+
-0.2,
|
|
2252
|
+
-0.4
|
|
2253
|
+
],
|
|
2254
|
+
rotation: [
|
|
2255
|
+
0,
|
|
2256
|
+
0,
|
|
2257
|
+
0
|
|
2258
|
+
],
|
|
2259
|
+
action: "none"
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
t: 0.35,
|
|
2263
|
+
position: [
|
|
2264
|
+
0.06,
|
|
2265
|
+
-0.09,
|
|
2266
|
+
-0.34
|
|
2267
|
+
],
|
|
2268
|
+
rotation: [
|
|
2269
|
+
0,
|
|
2270
|
+
0,
|
|
2271
|
+
0
|
|
2272
|
+
],
|
|
2273
|
+
action: "turn"
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
t: 1.95,
|
|
2277
|
+
position: [
|
|
2278
|
+
0.06,
|
|
2279
|
+
-0.09,
|
|
2280
|
+
-0.34
|
|
2281
|
+
],
|
|
2282
|
+
rotation: [
|
|
2283
|
+
0,
|
|
2284
|
+
0,
|
|
2285
|
+
0
|
|
2286
|
+
],
|
|
2287
|
+
action: "none"
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
t: 2.2,
|
|
2291
|
+
position: [
|
|
2292
|
+
0.06,
|
|
2293
|
+
-0.09,
|
|
2294
|
+
-0.34
|
|
2295
|
+
],
|
|
2296
|
+
rotation: [
|
|
2297
|
+
0,
|
|
2298
|
+
0,
|
|
2299
|
+
0
|
|
2300
|
+
],
|
|
2301
|
+
action: "open"
|
|
2302
|
+
},
|
|
2303
|
+
{
|
|
2304
|
+
t: 2.6,
|
|
2305
|
+
position: [
|
|
2306
|
+
0.22,
|
|
2307
|
+
-0.2,
|
|
2308
|
+
-0.4
|
|
2309
|
+
],
|
|
2310
|
+
rotation: [
|
|
2311
|
+
0,
|
|
2312
|
+
0,
|
|
2313
|
+
0
|
|
2314
|
+
],
|
|
2315
|
+
action: "none"
|
|
2316
|
+
}
|
|
2317
|
+
]
|
|
2119
2318
|
}
|
|
2120
2319
|
];
|
|
2121
2320
|
|
|
@@ -2188,8 +2387,8 @@ function createItemUse(world, containerId, def, getHandTransform) {
|
|
|
2188
2387
|
}
|
|
2189
2388
|
const overlap = Math.min(end, spanEnd) - Math.max(start, spanStart);
|
|
2190
2389
|
if (overlap <= 0) continue;
|
|
2191
|
-
if (key.action === "drink") {
|
|
2192
|
-
const ev = world.drink(containerId, (key.rate ?? DEFAULT_DRINK_RATE) * overlap);
|
|
2390
|
+
if (key.action === "drink" || key.action === "eat") {
|
|
2391
|
+
const ev = world.drink(containerId, (key.rate ?? DEFAULT_DRINK_RATE) * overlap, key.action === "eat" ? { eaten: true } : void 0);
|
|
2193
2392
|
const left = world.container(containerId);
|
|
2194
2393
|
if (!ev || !left || left.liters <= 1e-6) {
|
|
2195
2394
|
time = def.duration;
|