@adatechnology/game-items 0.7.1 → 0.8.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.d.ts +18 -6
- package/dist/index.global.js +463 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +465 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -162,6 +162,9 @@ var ITEM_CATEGORIES = [
|
|
|
162
162
|
{ id: "keys", name: "Keys" }
|
|
163
163
|
];
|
|
164
164
|
|
|
165
|
+
// src/check-items.ts
|
|
166
|
+
import { ITEM_TOOLS } from "@adatechnology/game-contracts";
|
|
167
|
+
|
|
165
168
|
// src/consumable.ts
|
|
166
169
|
var KG_PER_GRAM = 1e-3;
|
|
167
170
|
var WATER_DENSITY = 1;
|
|
@@ -217,6 +220,7 @@ var checkItem = (item, { categories, places }) => {
|
|
|
217
220
|
if (item.shelfLife !== void 0 && !isPositive(item.shelfLife)) issue(`has a shelf life of ${item.shelfLife} days`);
|
|
218
221
|
if (item.portions !== void 0 && !(Number.isInteger(item.portions) && item.portions > 0)) issue(`has ${item.portions} portions`);
|
|
219
222
|
if (item.durability && !DURABILITY_KINDS.includes(item.durability.kind)) issue(`has unknown durability kind "${item.durability.kind}"`);
|
|
223
|
+
for (const tool of item.tools ?? []) if (!ITEM_TOOLS.includes(tool)) issue(`works as unknown tool "${tool}"`);
|
|
220
224
|
if (item.consumable) for (const problem of consumableProblems(item.consumable)) issue(problem);
|
|
221
225
|
const { protection } = item;
|
|
222
226
|
if (protection) {
|
|
@@ -1917,19 +1921,474 @@ var hand_uses_default = [
|
|
|
1917
1921
|
]
|
|
1918
1922
|
}
|
|
1919
1923
|
]
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
id: "wash_dishes",
|
|
1927
|
+
body: "two_hands",
|
|
1928
|
+
duration: 3,
|
|
1929
|
+
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)",
|
|
1930
|
+
keys: [
|
|
1931
|
+
{
|
|
1932
|
+
t: 0,
|
|
1933
|
+
position: [
|
|
1934
|
+
0.22,
|
|
1935
|
+
-0.2,
|
|
1936
|
+
-0.4
|
|
1937
|
+
],
|
|
1938
|
+
rotation: [
|
|
1939
|
+
0,
|
|
1940
|
+
0,
|
|
1941
|
+
0
|
|
1942
|
+
]
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
t: 0.4,
|
|
1946
|
+
position: [
|
|
1947
|
+
0,
|
|
1948
|
+
-0.55,
|
|
1949
|
+
-0.45
|
|
1950
|
+
],
|
|
1951
|
+
rotation: [
|
|
1952
|
+
-0.5,
|
|
1953
|
+
0,
|
|
1954
|
+
0
|
|
1955
|
+
],
|
|
1956
|
+
reach: true
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
t: 0.7,
|
|
1960
|
+
position: [
|
|
1961
|
+
0.04,
|
|
1962
|
+
-0.55,
|
|
1963
|
+
-0.41
|
|
1964
|
+
],
|
|
1965
|
+
rotation: [
|
|
1966
|
+
-0.5,
|
|
1967
|
+
0,
|
|
1968
|
+
0
|
|
1969
|
+
],
|
|
1970
|
+
action: "scrub",
|
|
1971
|
+
reach: true
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
t: 0.95,
|
|
1975
|
+
position: [
|
|
1976
|
+
0,
|
|
1977
|
+
-0.55,
|
|
1978
|
+
-0.37
|
|
1979
|
+
],
|
|
1980
|
+
rotation: [
|
|
1981
|
+
-0.5,
|
|
1982
|
+
0,
|
|
1983
|
+
0
|
|
1984
|
+
],
|
|
1985
|
+
reach: true
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
t: 1.2,
|
|
1989
|
+
position: [
|
|
1990
|
+
-0.04,
|
|
1991
|
+
-0.55,
|
|
1992
|
+
-0.41
|
|
1993
|
+
],
|
|
1994
|
+
rotation: [
|
|
1995
|
+
-0.5,
|
|
1996
|
+
0,
|
|
1997
|
+
0
|
|
1998
|
+
],
|
|
1999
|
+
reach: true
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
t: 1.45,
|
|
2003
|
+
position: [
|
|
2004
|
+
0,
|
|
2005
|
+
-0.55,
|
|
2006
|
+
-0.45
|
|
2007
|
+
],
|
|
2008
|
+
rotation: [
|
|
2009
|
+
-0.5,
|
|
2010
|
+
0,
|
|
2011
|
+
0
|
|
2012
|
+
],
|
|
2013
|
+
action: "scrub",
|
|
2014
|
+
reach: true
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
t: 1.7,
|
|
2018
|
+
position: [
|
|
2019
|
+
0.04,
|
|
2020
|
+
-0.55,
|
|
2021
|
+
-0.41
|
|
2022
|
+
],
|
|
2023
|
+
rotation: [
|
|
2024
|
+
-0.5,
|
|
2025
|
+
0,
|
|
2026
|
+
0
|
|
2027
|
+
],
|
|
2028
|
+
reach: true
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
t: 1.95,
|
|
2032
|
+
position: [
|
|
2033
|
+
0,
|
|
2034
|
+
-0.55,
|
|
2035
|
+
-0.37
|
|
2036
|
+
],
|
|
2037
|
+
rotation: [
|
|
2038
|
+
-0.5,
|
|
2039
|
+
0,
|
|
2040
|
+
0
|
|
2041
|
+
],
|
|
2042
|
+
reach: true
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
t: 2.2,
|
|
2046
|
+
position: [
|
|
2047
|
+
-0.04,
|
|
2048
|
+
-0.55,
|
|
2049
|
+
-0.41
|
|
2050
|
+
],
|
|
2051
|
+
rotation: [
|
|
2052
|
+
-0.5,
|
|
2053
|
+
0,
|
|
2054
|
+
0
|
|
2055
|
+
],
|
|
2056
|
+
action: "scrub",
|
|
2057
|
+
reach: true
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
t: 2.5,
|
|
2061
|
+
position: [
|
|
2062
|
+
0,
|
|
2063
|
+
-0.55,
|
|
2064
|
+
-0.45
|
|
2065
|
+
],
|
|
2066
|
+
rotation: [
|
|
2067
|
+
-0.5,
|
|
2068
|
+
0,
|
|
2069
|
+
0
|
|
2070
|
+
],
|
|
2071
|
+
reach: true
|
|
2072
|
+
},
|
|
2073
|
+
{
|
|
2074
|
+
t: 3,
|
|
2075
|
+
position: [
|
|
2076
|
+
0.22,
|
|
2077
|
+
-0.2,
|
|
2078
|
+
-0.4
|
|
2079
|
+
],
|
|
2080
|
+
rotation: [
|
|
2081
|
+
0,
|
|
2082
|
+
0,
|
|
2083
|
+
0
|
|
2084
|
+
]
|
|
2085
|
+
}
|
|
2086
|
+
]
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
id: "fill_cup",
|
|
2090
|
+
body: "hand",
|
|
2091
|
+
duration: 2.5,
|
|
2092
|
+
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)",
|
|
2093
|
+
keys: [
|
|
2094
|
+
{
|
|
2095
|
+
t: 0,
|
|
2096
|
+
position: [
|
|
2097
|
+
0.22,
|
|
2098
|
+
-0.2,
|
|
2099
|
+
-0.4
|
|
2100
|
+
],
|
|
2101
|
+
rotation: [
|
|
2102
|
+
0,
|
|
2103
|
+
0,
|
|
2104
|
+
0
|
|
2105
|
+
]
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
t: 0.5,
|
|
2109
|
+
position: [
|
|
2110
|
+
0.05,
|
|
2111
|
+
-0.55,
|
|
2112
|
+
-0.45
|
|
2113
|
+
],
|
|
2114
|
+
rotation: [
|
|
2115
|
+
0,
|
|
2116
|
+
0,
|
|
2117
|
+
0
|
|
2118
|
+
],
|
|
2119
|
+
reach: true
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
t: 0.7,
|
|
2123
|
+
position: [
|
|
2124
|
+
0.05,
|
|
2125
|
+
-0.55,
|
|
2126
|
+
-0.45
|
|
2127
|
+
],
|
|
2128
|
+
rotation: [
|
|
2129
|
+
0,
|
|
2130
|
+
0,
|
|
2131
|
+
0
|
|
2132
|
+
],
|
|
2133
|
+
action: "apply",
|
|
2134
|
+
reach: true
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
t: 1.8,
|
|
2138
|
+
position: [
|
|
2139
|
+
0.05,
|
|
2140
|
+
-0.55,
|
|
2141
|
+
-0.45
|
|
2142
|
+
],
|
|
2143
|
+
rotation: [
|
|
2144
|
+
0,
|
|
2145
|
+
0,
|
|
2146
|
+
0
|
|
2147
|
+
],
|
|
2148
|
+
reach: true
|
|
2149
|
+
},
|
|
2150
|
+
{
|
|
2151
|
+
t: 2.1,
|
|
2152
|
+
position: [
|
|
2153
|
+
0.15,
|
|
2154
|
+
-0.32,
|
|
2155
|
+
-0.42
|
|
2156
|
+
],
|
|
2157
|
+
rotation: [
|
|
2158
|
+
0,
|
|
2159
|
+
0,
|
|
2160
|
+
0
|
|
2161
|
+
]
|
|
2162
|
+
},
|
|
2163
|
+
{
|
|
2164
|
+
t: 2.5,
|
|
2165
|
+
position: [
|
|
2166
|
+
0.22,
|
|
2167
|
+
-0.2,
|
|
2168
|
+
-0.4
|
|
2169
|
+
],
|
|
2170
|
+
rotation: [
|
|
2171
|
+
0,
|
|
2172
|
+
0,
|
|
2173
|
+
0
|
|
2174
|
+
]
|
|
2175
|
+
}
|
|
2176
|
+
]
|
|
2177
|
+
},
|
|
2178
|
+
{
|
|
2179
|
+
id: "drink_cupped_hands",
|
|
2180
|
+
body: "two_hands",
|
|
2181
|
+
duration: 5,
|
|
2182
|
+
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",
|
|
2183
|
+
keys: [
|
|
2184
|
+
{
|
|
2185
|
+
t: 0,
|
|
2186
|
+
position: [
|
|
2187
|
+
0.22,
|
|
2188
|
+
-0.2,
|
|
2189
|
+
-0.4
|
|
2190
|
+
],
|
|
2191
|
+
rotation: [
|
|
2192
|
+
0,
|
|
2193
|
+
0,
|
|
2194
|
+
0
|
|
2195
|
+
]
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
t: 0.5,
|
|
2199
|
+
position: [
|
|
2200
|
+
0,
|
|
2201
|
+
-0.55,
|
|
2202
|
+
-0.42
|
|
2203
|
+
],
|
|
2204
|
+
rotation: [
|
|
2205
|
+
-0.3,
|
|
2206
|
+
0,
|
|
2207
|
+
0
|
|
2208
|
+
],
|
|
2209
|
+
reach: true
|
|
2210
|
+
},
|
|
2211
|
+
{
|
|
2212
|
+
t: 1,
|
|
2213
|
+
position: [
|
|
2214
|
+
0,
|
|
2215
|
+
-0.55,
|
|
2216
|
+
-0.42
|
|
2217
|
+
],
|
|
2218
|
+
rotation: [
|
|
2219
|
+
-0.3,
|
|
2220
|
+
0,
|
|
2221
|
+
0
|
|
2222
|
+
],
|
|
2223
|
+
reach: true
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
t: 1.45,
|
|
2227
|
+
position: [
|
|
2228
|
+
0,
|
|
2229
|
+
0,
|
|
2230
|
+
-0.22
|
|
2231
|
+
],
|
|
2232
|
+
rotation: [
|
|
2233
|
+
-0.9,
|
|
2234
|
+
0,
|
|
2235
|
+
0
|
|
2236
|
+
],
|
|
2237
|
+
action: "swallow"
|
|
2238
|
+
},
|
|
2239
|
+
{
|
|
2240
|
+
t: 1.7,
|
|
2241
|
+
position: [
|
|
2242
|
+
0,
|
|
2243
|
+
0,
|
|
2244
|
+
-0.22
|
|
2245
|
+
],
|
|
2246
|
+
rotation: [
|
|
2247
|
+
-0.9,
|
|
2248
|
+
0,
|
|
2249
|
+
0
|
|
2250
|
+
]
|
|
2251
|
+
},
|
|
2252
|
+
{
|
|
2253
|
+
t: 1.9,
|
|
2254
|
+
position: [
|
|
2255
|
+
0,
|
|
2256
|
+
-0.55,
|
|
2257
|
+
-0.42
|
|
2258
|
+
],
|
|
2259
|
+
rotation: [
|
|
2260
|
+
-0.3,
|
|
2261
|
+
0,
|
|
2262
|
+
0
|
|
2263
|
+
],
|
|
2264
|
+
reach: true
|
|
2265
|
+
},
|
|
2266
|
+
{
|
|
2267
|
+
t: 2.4,
|
|
2268
|
+
position: [
|
|
2269
|
+
0,
|
|
2270
|
+
-0.55,
|
|
2271
|
+
-0.42
|
|
2272
|
+
],
|
|
2273
|
+
rotation: [
|
|
2274
|
+
-0.3,
|
|
2275
|
+
0,
|
|
2276
|
+
0
|
|
2277
|
+
],
|
|
2278
|
+
reach: true
|
|
2279
|
+
},
|
|
2280
|
+
{
|
|
2281
|
+
t: 2.85,
|
|
2282
|
+
position: [
|
|
2283
|
+
0,
|
|
2284
|
+
0,
|
|
2285
|
+
-0.22
|
|
2286
|
+
],
|
|
2287
|
+
rotation: [
|
|
2288
|
+
-0.9,
|
|
2289
|
+
0,
|
|
2290
|
+
0
|
|
2291
|
+
],
|
|
2292
|
+
action: "swallow"
|
|
2293
|
+
},
|
|
2294
|
+
{
|
|
2295
|
+
t: 3.1,
|
|
2296
|
+
position: [
|
|
2297
|
+
0,
|
|
2298
|
+
0,
|
|
2299
|
+
-0.22
|
|
2300
|
+
],
|
|
2301
|
+
rotation: [
|
|
2302
|
+
-0.9,
|
|
2303
|
+
0,
|
|
2304
|
+
0
|
|
2305
|
+
]
|
|
2306
|
+
},
|
|
2307
|
+
{
|
|
2308
|
+
t: 3.3,
|
|
2309
|
+
position: [
|
|
2310
|
+
0,
|
|
2311
|
+
-0.55,
|
|
2312
|
+
-0.42
|
|
2313
|
+
],
|
|
2314
|
+
rotation: [
|
|
2315
|
+
-0.3,
|
|
2316
|
+
0,
|
|
2317
|
+
0
|
|
2318
|
+
],
|
|
2319
|
+
reach: true
|
|
2320
|
+
},
|
|
2321
|
+
{
|
|
2322
|
+
t: 3.8,
|
|
2323
|
+
position: [
|
|
2324
|
+
0,
|
|
2325
|
+
-0.55,
|
|
2326
|
+
-0.42
|
|
2327
|
+
],
|
|
2328
|
+
rotation: [
|
|
2329
|
+
-0.3,
|
|
2330
|
+
0,
|
|
2331
|
+
0
|
|
2332
|
+
],
|
|
2333
|
+
reach: true
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
t: 4.25,
|
|
2337
|
+
position: [
|
|
2338
|
+
0,
|
|
2339
|
+
0,
|
|
2340
|
+
-0.22
|
|
2341
|
+
],
|
|
2342
|
+
rotation: [
|
|
2343
|
+
-0.9,
|
|
2344
|
+
0,
|
|
2345
|
+
0
|
|
2346
|
+
],
|
|
2347
|
+
action: "swallow"
|
|
2348
|
+
},
|
|
2349
|
+
{
|
|
2350
|
+
t: 4.5,
|
|
2351
|
+
position: [
|
|
2352
|
+
0,
|
|
2353
|
+
0,
|
|
2354
|
+
-0.22
|
|
2355
|
+
],
|
|
2356
|
+
rotation: [
|
|
2357
|
+
-0.9,
|
|
2358
|
+
0,
|
|
2359
|
+
0
|
|
2360
|
+
]
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
t: 5,
|
|
2364
|
+
position: [
|
|
2365
|
+
0.22,
|
|
2366
|
+
-0.2,
|
|
2367
|
+
-0.4
|
|
2368
|
+
],
|
|
2369
|
+
rotation: [
|
|
2370
|
+
0,
|
|
2371
|
+
0,
|
|
2372
|
+
0
|
|
2373
|
+
]
|
|
2374
|
+
}
|
|
2375
|
+
]
|
|
1920
2376
|
}
|
|
1921
2377
|
];
|
|
1922
2378
|
|
|
1923
2379
|
// src/hand-use.ts
|
|
1924
2380
|
var HAND_USES = hand_uses_default;
|
|
1925
2381
|
var handUseOf = (id, defs = HAND_USES) => defs.find((def) => def.id === id);
|
|
1926
|
-
var
|
|
2382
|
+
var HAND_USE_SHOULDER = [0.17, -0.24, 0.04];
|
|
2383
|
+
var HAND_USE_ARM = 0.66;
|
|
1927
2384
|
var aimHandUse = (def, target) => {
|
|
1928
2385
|
const anchor = def.keys.find((key) => key.reach);
|
|
1929
2386
|
if (!anchor) return def;
|
|
1930
|
-
const
|
|
1931
|
-
const
|
|
1932
|
-
const
|
|
2387
|
+
const [sx, sy, sz] = HAND_USE_SHOULDER;
|
|
2388
|
+
const length = Math.hypot(target[0] - sx, target[1] - sy, target[2] - sz);
|
|
2389
|
+
const k = length > HAND_USE_ARM ? HAND_USE_ARM / length : 1;
|
|
2390
|
+
const reached = [sx + (target[0] - sx) * k, sy + (target[1] - sy) * k, sz + (target[2] - sz) * k];
|
|
2391
|
+
const shift = [reached[0] - anchor.position[0], reached[1] - anchor.position[1], reached[2] - anchor.position[2]];
|
|
1933
2392
|
const moved = (key) => ({ ...key, position: [key.position[0] + shift[0], key.position[1] + shift[1], key.position[2] + shift[2]] });
|
|
1934
2393
|
return { ...def, keys: def.keys.map((key) => key.reach ? moved(key) : key) };
|
|
1935
2394
|
};
|
|
@@ -2000,7 +2459,8 @@ export {
|
|
|
2000
2459
|
FOAM_GONE,
|
|
2001
2460
|
FOAM_RINSE_LITRES,
|
|
2002
2461
|
HAND_USES,
|
|
2003
|
-
|
|
2462
|
+
HAND_USE_ARM,
|
|
2463
|
+
HAND_USE_SHOULDER,
|
|
2004
2464
|
ITEM_CATEGORIES,
|
|
2005
2465
|
RARITIES,
|
|
2006
2466
|
addFoam,
|