@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.
- package/dist/index.d.ts +39 -11
- package/dist/index.global.js +1316 -7
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1312 -8
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BodySlot, SealSpec, DeepPartial, ToolCondition, SealState, SealBlock } from '@adatechnology/game-contracts';
|
|
1
|
+
import { BodySlot, ItemTool, SealSpec, DeepPartial, ToolCondition, SealState, SealBlock, WashSurface } from '@adatechnology/game-contracts';
|
|
2
2
|
export { BodySlot } from '@adatechnology/game-contracts';
|
|
3
3
|
import { ItemDef as ItemDef$1, rng, ItemStack as ItemStack$1, SlotSpec, LootTables } from '@adatechnology/game-interactables';
|
|
4
4
|
export { ItemDef as BaseItemDef } from '@adatechnology/game-interactables';
|
|
@@ -190,7 +190,13 @@ interface ItemDef extends ItemDef$1 {
|
|
|
190
190
|
liquid: string;
|
|
191
191
|
liters: number;
|
|
192
192
|
};
|
|
193
|
+
/** What it holds to the brim when it is a vessel (a bucket, a cup); `fluid` is what it holds now. */
|
|
194
|
+
container?: {
|
|
195
|
+
readonly capacityLiters?: number;
|
|
196
|
+
};
|
|
193
197
|
uses?: readonly string[];
|
|
198
|
+
/** What it works as for an object's uses (`ITEM_TOOLS` of game-contracts): a `plunger` pumps a clogged toilet. */
|
|
199
|
+
tools?: readonly ItemTool[];
|
|
194
200
|
finds?: {
|
|
195
201
|
places: readonly PlaceTag[];
|
|
196
202
|
};
|
|
@@ -904,16 +910,28 @@ declare const ARSENAL_CATEGORIES: readonly CategoryDef[];
|
|
|
904
910
|
*/
|
|
905
911
|
declare const itemsFromArsenal: (arsenal: ArsenalLike, options?: ArsenalItemsOptions) => ItemPack;
|
|
906
912
|
|
|
913
|
+
/**
|
|
914
|
+
* Uses of an item in the hand that holds no liquid (spec 015 R5): eating with the hand, taking a pill, putting on a dressing, rubbing soap in. A use is keys of where the
|
|
915
|
+
* item goes from the hand that holds it, in the frame of the eye (x to the right, y up, z back towards the eye; the mouth is near `[0, 0.02, -0.2]`), the same frame
|
|
916
|
+
* as the fluid uses of game-fluids, so a host moves the hand and the item alike for both. `body` tells the body which arms take part. Engine-agnostic and pure:
|
|
917
|
+
* the host reads `pose()` each frame and acts on the events (a bite shrinks the food, the end spends it). Data in `data/hand-uses.json`; a game adds its own.
|
|
918
|
+
*/
|
|
919
|
+
|
|
907
920
|
/**
|
|
908
921
|
* What happens at a key: a bite taken, a pill or a sip swallowed, the dressing pressed on, soap rubbed; a switch pressed (a flashlight), a flame struck (a lighter), a knob
|
|
909
|
-
* turned and words spoken (a radio), a key turned in its lock.
|
|
922
|
+
* turned and words spoken (a radio), a key turned in its lock. Washing: one `dose` of what the item spends taken (soap rubbed into the hands, shampoo poured in the
|
|
923
|
+
* palm, toothpaste squeezed on the brush), foam left on the key's `surface` (`lather`), the surface held under the water (`rinse`), the foam of the mouth spat out
|
|
924
|
+
* (`spit`) and the hands shaken dry (`dry`).
|
|
910
925
|
*/
|
|
911
|
-
type HandUseAction = 'bite' | 'swallow' | 'apply' | 'scrub' | 'switch' | 'ignite' | 'tune' | 'talk' | 'turn';
|
|
926
|
+
type HandUseAction = 'bite' | 'swallow' | 'apply' | 'scrub' | 'switch' | 'ignite' | 'tune' | 'talk' | 'turn' | 'dose' | 'lather' | 'rinse' | 'spit' | 'dry';
|
|
912
927
|
/**
|
|
913
|
-
* Which arms the use takes: the item to the `mouth`, both hands together in front of the body (`two_hands`), the one `hand` that holds it raised before the chest,
|
|
914
|
-
* that arm stretched out to `reach` something ahead (a lock)
|
|
928
|
+
* Which arms the use takes: the item to the `mouth`, both hands together in front of the body (`two_hands`), the one `hand` that holds it raised before the chest,
|
|
929
|
+
* that arm stretched out to `reach` something ahead (a lock), the hand that holds it going over the other forearm, the chest and the belly (`body`, soap in the
|
|
930
|
+
* shower), or both hands up rubbing the top of the head (`scalp`, shampoo).
|
|
915
931
|
*/
|
|
916
|
-
type HandUseBody = 'mouth' | 'two_hands' | 'hand' | 'reach';
|
|
932
|
+
type HandUseBody = 'mouth' | 'two_hands' | 'hand' | 'reach' | 'body' | 'scalp';
|
|
933
|
+
/** Where washing leaves foam or rinses it: the hands, the forearms, the chest and belly, the hair, the mouth, or the item itself (a toothbrush); the washing vocabulary of game-contracts. */
|
|
934
|
+
type HandUseSurface = WashSurface;
|
|
917
935
|
interface HandUseKey {
|
|
918
936
|
readonly t: number;
|
|
919
937
|
readonly position: readonly [number, number, number];
|
|
@@ -921,6 +939,8 @@ interface HandUseKey {
|
|
|
921
939
|
readonly action?: HandUseAction;
|
|
922
940
|
/** The item is at what the use reaches for at this key (a key in its lock): `aimHandUse` moves it there when the host has a target. */
|
|
923
941
|
readonly reach?: boolean;
|
|
942
|
+
/** The surface a `lather`, `rinse`, `spit` or `dry` acts on. */
|
|
943
|
+
readonly surface?: HandUseSurface;
|
|
924
944
|
}
|
|
925
945
|
interface HandUseDef {
|
|
926
946
|
readonly id: string;
|
|
@@ -933,6 +953,8 @@ interface HandUseDef {
|
|
|
933
953
|
interface HandUseEvent {
|
|
934
954
|
readonly action: HandUseAction;
|
|
935
955
|
readonly share: number;
|
|
956
|
+
/** The key's surface, when it names one. */
|
|
957
|
+
readonly surface?: HandUseSurface;
|
|
936
958
|
}
|
|
937
959
|
interface HandUsePlayer {
|
|
938
960
|
readonly def: HandUseDef;
|
|
@@ -950,11 +972,17 @@ interface HandUsePlayer {
|
|
|
950
972
|
declare const HAND_USES: readonly HandUseDef[];
|
|
951
973
|
/** The hand use with that id, among `defs`. */
|
|
952
974
|
declare const handUseOf: (id: string, defs?: readonly HandUseDef[]) => HandUseDef | undefined;
|
|
953
|
-
/** Farthest the hand carries an item from the eye (metres): an arm's length. */
|
|
954
|
-
declare const HAND_USE_REACH = 0.62;
|
|
955
975
|
/**
|
|
956
|
-
*
|
|
957
|
-
*
|
|
976
|
+
* Where the shoulder of the hand that reaches sits, in the eye's frame (x right, y up, z back toward the eye), metres: an adult's right shoulder is some 17 cm to the
|
|
977
|
+
* side of the eyes, 24 cm under them and a little behind. The reach is measured from it, not from the eye: a hand reaches farther forward and down than up.
|
|
978
|
+
*/
|
|
979
|
+
declare const HAND_USE_SHOULDER: readonly [number, number, number];
|
|
980
|
+
/** The arm's length from the shoulder to the middle of what the hand grips, metres (an adult's arm, the hand closed round a handle). */
|
|
981
|
+
declare const HAND_USE_ARM = 0.66;
|
|
982
|
+
/**
|
|
983
|
+
* The use with its `reach` keys moved onto `target` (a point in the eye's frame, as the keys are: a lock seen ahead, the stream under a tap), kept within the arm's
|
|
984
|
+
* length of the shoulder (`HAND_USE_SHOULDER`, `HAND_USE_ARM`); the keys keep how they lay around the first reach key, so a key still goes in, turns and comes out.
|
|
985
|
+
* Without reach keys the use is returned as it is.
|
|
958
986
|
*/
|
|
959
987
|
declare const aimHandUse: (def: HandUseDef, target: readonly [number, number, number]) => HandUseDef;
|
|
960
988
|
/** Plays a hand use: the pose between its keys, and its actions as the time passes them. */
|
|
@@ -1023,4 +1051,4 @@ declare const rinseFoam: (state: FoamState, water: FoamRinse, dt: number) => Foa
|
|
|
1023
1051
|
/** Share of a full layer still on it, 0..1. */
|
|
1024
1052
|
declare const foamLeft: (state: FoamState) => number;
|
|
1025
1053
|
|
|
1026
|
-
export { ARSENAL_CATEGORIES, type AgeOptions, type AgeState, type AmmoState, type ArsenalCaliberLike, type ArsenalItemRecord, type ArsenalItemsOptions, type ArsenalLike, type ArsenalWeaponLike, type AttackKind, BODY_SLOTS, type BagOption, type CarryEntry, type CategoryDef, type ConsumableForm, type ConsumableSpec, type ConsumableState, type ConsumableUnit, type Consumption, type ContainerDef, type CraftCheck, type CraftContext, type CraftOutcome, type CraftResult, DEFAULT_RULES, DURABILITY_KINDS, type DepletionRule, type DestructionObjectState, type DoseResult, type Durability, type DurabilityKind, FOAM_GONE, FOAM_RINSE_LITRES, type FindData, type FindStack, type FindState, type FindsProvider, type FindsProviderOptions, type FindsQuery, type FoamRinse, type FoamState, type Freshness, type FreshnessEffect, HAND_USES,
|
|
1054
|
+
export { ARSENAL_CATEGORIES, type AgeOptions, type AgeState, type AmmoState, type ArsenalCaliberLike, type ArsenalItemRecord, type ArsenalItemsOptions, type ArsenalLike, type ArsenalWeaponLike, type AttackKind, BODY_SLOTS, type BagOption, type CarryEntry, type CategoryDef, type ConsumableForm, type ConsumableSpec, type ConsumableState, type ConsumableUnit, type Consumption, type ContainerDef, type CraftCheck, type CraftContext, type CraftOutcome, type CraftResult, DEFAULT_RULES, DURABILITY_KINDS, type DepletionRule, type DestructionObjectState, type DoseResult, type Durability, type DurabilityKind, FOAM_GONE, FOAM_RINSE_LITRES, type FindData, type FindStack, type FindState, type FindsProvider, type FindsProviderOptions, type FindsQuery, type FoamRinse, type FoamState, type Freshness, type FreshnessEffect, HAND_USES, HAND_USE_ARM, HAND_USE_SHOULDER, type HandUseAction, type HandUseBody, type HandUseDef, type HandUseEvent, type HandUseKey, type HandUsePlayer, type HandUseSurface, ITEM_CATEGORIES, type Inventory, type InventoryFailure, type InventoryOptions, type InventoryResult, type InventorySlot, type InventoryTotals, type ItemCategory, type ItemDef, type ItemPack, type ItemRules, type ItemStack, type ItemState, type ItemsCatalog, type ItemsOptions, type LoadLevel, type LoadState, type LootTablesQuery, type NutritionResult, type PlaceDef, type PlaceTag, type PlacedFinds, type PoolEntry, type PoolPick, RARITIES, type Rarity, type RecipeDef, type RecipeInput, type RecipeMatch, type RecipeOutput, type RecipeTool, type Rng, type StorageId, type StorageRule, type StorageRules, type TakeOptions, type TakeParams, type TakeResult, type UseContext, type UseEffectDef, type UseResult, type WornPiece, addFoam, advanceAge, aimHandUse, bagOption, barScale, blockChance, canCraft, canTake, carriedKg, chargeLevel, checkItems, consumableMassKg, consumableOf, consumableProblems, craft, createFindsProvider, createHandUse, createInventory, createItems, depletionFactor, emptyFoam, failsToStart, fitsInside, foamLeft, freshness, fullConsumable, handUseOf, isSpent, itemLitres, itemsFromArsenal, loadState, maxLoadKg, moveToStorage, pieceBlock, placeFinds, remainingShare, repairPiece, resolveUse, rinseFoam, rollByCategory, rollExplicitPool, scaleCount, shelfRatio, spawnAgeDays, spawnData, storageMultiplier, takeDose, toLootTables, wearBlocked };
|