@adatechnology/game-items-three 0.12.0 → 0.14.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/{chunk-DBIE2ZMX.js → chunk-XJG7IGO3.js} +1541 -1218
- package/dist/chunk-XJG7IGO3.js.map +1 -0
- package/dist/index.d.ts +51 -7
- package/dist/index.global.js +1101 -495
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/{testing-Y05TqYH8.d.ts → testing-C96KjBjB.d.ts} +7 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +13 -13
- package/dist/chunk-DBIE2ZMX.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { V as Vec3Tuple, I as ItemKit, a as ItemModelRegistry, b as ItemModelEntry, c as ItemModelBuilder } from './testing-
|
|
2
|
-
export { F as FINDS_TABLE_ID, H as HUMAN_HEIGHT, d as HUMAN_ID, e as ITEM_PREFIX, f as ItemMaterialData, g as ItemsAreaState, h as ItemsTestModule, i as ItemsTestModuleOptions, L as LayoutItem, R as ROW_LIMIT, j as RULER_HEIGHT, k as RULER_ID, S as SHELF_HEIGHT, l as SHELF_PREFIX, m as SHOWCASE_PREFIX, n as SHOWCASE_STAND_ID, o as ScenarioLike, p as ShelfPlan, W as WEAR_TAGS, q as WearTag, r as createItemKit, s as createItemsTestModule, t as defaultItemModels, u as hasItemModel, v as itemModelBuilder, w as itemModelEntry, x as listItemModels, y as registerItemModel, z as shelvesLayout, A as unregisterItemModel } from './testing-
|
|
1
|
+
import { V as Vec3Tuple, I as ItemKit, a as ItemModelRegistry, b as ItemModelEntry, c as ItemModelBuilder } from './testing-C96KjBjB.js';
|
|
2
|
+
export { F as FINDS_TABLE_ID, H as HUMAN_HEIGHT, d as HUMAN_ID, e as ITEM_PREFIX, f as ItemMaterialData, g as ItemsAreaState, h as ItemsTestModule, i as ItemsTestModuleOptions, L as LayoutItem, R as ROW_LIMIT, j as RULER_HEIGHT, k as RULER_ID, S as SHELF_HEIGHT, l as SHELF_PREFIX, m as SHOWCASE_PREFIX, n as SHOWCASE_STAND_ID, o as ScenarioLike, p as ShelfPlan, W as WEAR_TAGS, q as WearTag, r as createItemKit, s as createItemsTestModule, t as defaultItemModels, u as hasItemModel, v as itemModelBuilder, w as itemModelEntry, x as listItemModels, y as registerItemModel, z as shelvesLayout, A as unregisterItemModel } from './testing-C96KjBjB.js';
|
|
3
3
|
import * as THREE_NS from 'three';
|
|
4
|
+
import { ItemDef, ItemRules, Freshness } from '@adatechnology/game-items';
|
|
4
5
|
import { ContainerSpec, DestructibleSpec, Thumbnail, DeepPartial } from '@adatechnology/game-contracts';
|
|
5
|
-
import '@adatechnology/game-items';
|
|
6
6
|
|
|
7
7
|
/** 0 new, 1 used, 2 spoiled (the three stages of the showcase). */
|
|
8
8
|
type WearStage = 0 | 1 | 2;
|
|
9
|
+
/** The wear an item shows by how fresh it is: fresh is new, stale is used, spoiled and rotten are spoiled. */
|
|
10
|
+
declare const wearOfFreshness: (state: Freshness) => WearStage;
|
|
11
|
+
/** The wear of an item `ageDays` old (a find's `data.ageDays`): 0 for an item that does not spoil. */
|
|
12
|
+
declare function wearOfAge(item: Pick<ItemDef, 'shelfLife'>, ageDays: number, rules?: ItemRules): WearStage;
|
|
9
13
|
/** The colour each material tag turns toward as it wears (`STAGE_TARGET` of the showcase). */
|
|
10
14
|
declare const WEAR_TARGET: Readonly<Record<string, number>>;
|
|
11
15
|
/** How far toward the target colour each stage goes (`AMT`). */
|
|
@@ -40,6 +44,8 @@ declare function canonicalFrame(size: Vec3Tuple): {
|
|
|
40
44
|
a: number;
|
|
41
45
|
b: number;
|
|
42
46
|
};
|
|
47
|
+
/** Height of the inside floor of a `cup` above its base, as a share of its height: where what it holds starts. */
|
|
48
|
+
declare const CUP_FLOOR_SHARE = 0.06;
|
|
43
49
|
declare const isShape: (value: string | undefined) => value is ShapeId;
|
|
44
50
|
/** The item fields the shape choice reads. */
|
|
45
51
|
interface ShapeSubject {
|
|
@@ -111,18 +117,27 @@ interface ItemModel {
|
|
|
111
117
|
*/
|
|
112
118
|
declare function buildItem(T: typeof THREE_NS, item: DrawableItem, options?: BuildItemOptions): ItemModel;
|
|
113
119
|
|
|
114
|
-
/** A stack held in a container (`ItemStack` of game-interactables): the item id and its free data. */
|
|
120
|
+
/** A stack held in a container (`ItemStack` of game-interactables): the item id and its free data (a find's age, `ageDays`). */
|
|
115
121
|
interface ContainedStack {
|
|
116
122
|
readonly type: string;
|
|
123
|
+
/** The stack's free data: `ageDays` (the age a find is rolled with) wears the item by its freshness, `dirt` (0 clean to 1 caked) draws the food left on it (a plate left dirty in a sink). */
|
|
124
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
117
125
|
}
|
|
126
|
+
/** How a contained item is drawn: `buildItem`'s options, and the rules its age is read by (the catalogue's; the default rules when left out). */
|
|
127
|
+
type ContainedItemOptions = Omit<BuildItemOptions, 'kit'> & {
|
|
128
|
+
readonly rules?: ItemRules;
|
|
129
|
+
};
|
|
118
130
|
/** What `createContainedItemModel` returns: the real model of a stack drawn with the caller's `THREE`, or null for an id the catalogue does not have. */
|
|
119
131
|
type ContainedItemModel = (stack: ContainedStack, T: typeof THREE_NS) => THREE_NS.Object3D | null;
|
|
120
132
|
/**
|
|
121
133
|
* The model of the items inside furniture, for `createContentsView` of game-interactables-three and `interactives.itemModel` of game-floorplan-three: each
|
|
122
134
|
* stack is drawn by `buildItem` from the catalogue (the team's model where there is one, the item's own shape otherwise), never a stand-in. Every item gets its
|
|
123
|
-
* own materials, so the view can discard it alone when it is taken. `root.userData.item` says what was drawn (`{ id, kind }`).
|
|
135
|
+
* own materials, so the view can discard it alone when it is taken. `root.userData.item` says what was drawn (`{ id, kind }`). A stack with an age (`data.ageDays`)
|
|
136
|
+
* shows the wear of its freshness, and one with `data.dirt` is drawn dirty (`setItemDirt`), the same as the item once it is in the world.
|
|
124
137
|
*/
|
|
125
|
-
declare function createContainedItemModel(items: Iterable<DrawableItem
|
|
138
|
+
declare function createContainedItemModel(items: Iterable<DrawableItem & {
|
|
139
|
+
readonly shelfLife?: number;
|
|
140
|
+
}>, options?: ContainedItemOptions): ContainedItemModel;
|
|
126
141
|
|
|
127
142
|
/** The destruction material (`game-destruction` id) of each material tag of the kit, for a mesh whose model says nothing else. */
|
|
128
143
|
declare const DESTRUCTION_MATERIAL_BY_TAG: Readonly<Record<string, string>>;
|
|
@@ -197,6 +212,24 @@ declare function itemContents(subject: ContentsSubject): {
|
|
|
197
212
|
readonly liquid: string;
|
|
198
213
|
readonly liters: number;
|
|
199
214
|
} | undefined;
|
|
215
|
+
/** The subject of `itemVessel`: an open item drawn as a simple shape, with what it holds to the brim. */
|
|
216
|
+
interface VesselSubject {
|
|
217
|
+
/** Metres. */
|
|
218
|
+
readonly size: readonly [number, number, number];
|
|
219
|
+
/** Litres to the brim (`container.capacityLiters` of the catalogue). */
|
|
220
|
+
readonly capacityLiters?: number;
|
|
221
|
+
/** The simple shape it is drawn as (`shapeOf`); undefined when a model is drawn, whose inside floor is not known. */
|
|
222
|
+
readonly shape?: string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The empty, open container a vessel is (a cup, a wine glass: `TestableItem.fluid` of the test room), so a tap fills it and the player drinks from it: the capacity
|
|
226
|
+
* of the catalogue in a cylinder of the item's size less its walls, open as wide as that cylinder. `offset` is the inside floor in the frame `buildItem` draws
|
|
227
|
+
* (origin at the bottom centre), the point the fluid renderer binds as the container's origin. Undefined for an item that holds nothing or has no inside.
|
|
228
|
+
*/
|
|
229
|
+
declare function itemVessel(subject: VesselSubject): {
|
|
230
|
+
readonly container: ContainerSpec;
|
|
231
|
+
readonly offset: [number, number, number];
|
|
232
|
+
} | undefined;
|
|
200
233
|
/** What `tagForDestruction` needs to know about the item beside its meshes. */
|
|
201
234
|
interface DestructionTagOptions {
|
|
202
235
|
readonly modelId?: string;
|
|
@@ -229,6 +262,17 @@ interface DestructionTagOptions {
|
|
|
229
262
|
*/
|
|
230
263
|
declare function tagForDestruction(root: THREE_NS.Object3D, options?: DestructionTagOptions): void;
|
|
231
264
|
|
|
265
|
+
/** Name of the group `setItemDirt` and `setItemFoam` hang on the item's root. */
|
|
266
|
+
declare const WASH_NAME = "item_wash";
|
|
267
|
+
/**
|
|
268
|
+
* Draws the food left on an item (`ModuleItemWash.dirt` of the test room): brown and orange blots on the face its top shows (the floor of a cup, the top of a
|
|
269
|
+
* plate), `dirt` 0 clean (hidden) to 1 caked. Made once on the first call from the item's drawn box, then only resized; it hangs on `root`, so releasing the item
|
|
270
|
+
* (`discardObject3D`) frees it.
|
|
271
|
+
*/
|
|
272
|
+
declare function setItemDirt(T: typeof THREE_NS, root: THREE_NS.Object3D, dirt: number): void;
|
|
273
|
+
/** Draws the foam scrubbed onto an item (`ModuleItemWash.foam`): heaps of white bubbles where the food was, `amount` 0 none (hidden) to 1 covered. Like `setItemDirt`. */
|
|
274
|
+
declare function setItemFoam(T: typeof THREE_NS, root: THREE_NS.Object3D, amount: number): void;
|
|
275
|
+
|
|
232
276
|
/** What an item is physically made of, part by part: the one description both the goods catalog and the weapons counter build the world object from. */
|
|
233
277
|
interface ItemMakeup {
|
|
234
278
|
/** Kit material tag of a drawn mesh to the id of the part it belongs to. */
|
|
@@ -433,4 +477,4 @@ interface ThumbnailRenderer {
|
|
|
433
477
|
*/
|
|
434
478
|
declare function renderItemThumbnail(T: typeof THREE_NS, renderer: ThumbnailRenderer, item: DrawableItem, options?: ThumbnailRenderOptions): string;
|
|
435
479
|
|
|
436
|
-
export { type BudgetReport, type BuildItemOptions, type ContainedItemModel, type ContainedStack, type ContentsSubject, DESTRUCTION_MATERIAL_BY_TAG, type DestructionTagOptions, type DrawableItem, ITEM_BUDGETS, ITEM_FAMILIES, type ItemBudgets, type ItemContents, type ItemDestruction, type ItemFamily, ItemKit, type ItemLod, type ItemLodOptions, type ItemMakeup, type ItemModel, ItemModelBuilder, ItemModelEntry, type ItemModelRecord, ItemModelRegistry, type ItemModels, type ItemModelsOptions, type ItemOpening, type ItemOpeningStyle, type ItemSizeClass, MODEL_BUDGET_DEVIATIONS, OPENING_NAME, SHAPES, SHELL_PART_ID, SHIPPED_MODELS, type ShapeContext, type ShapeId, type ShapeSubject, type ThumbnailRenderOptions, type ThumbnailRenderer, type ThumbnailScene, type Vec3Like, Vec3Tuple, WEAR_AMOUNT, WEAR_TARGET, type WearStage, asLid, buildItem, buildItemLod, canonicalFrame, checkBudget, composeThumbnailScene, countDrawCalls, countTriangles, createContainedItemModel, createItemModels, cullDistanceOf, drawShape, isShape, itemContents, itemDestruction, itemFamily, itemMakeup, itemModels, itemOpening, itemThumbnail, itemThumbnailSvg, makeupSpec, mergeItem, openItem, renderItemThumbnail, setOpeningContents, setWear, shade, shapeDestruction, shapeOf, shapeThumbnailSvg, sizeClassOf, tagForDestruction, tagMakeupParts, thumbnailPatch, triangleBudgetOf, turnItem, wearableMaterials };
|
|
480
|
+
export { type BudgetReport, type BuildItemOptions, CUP_FLOOR_SHARE, type ContainedItemModel, type ContainedItemOptions, type ContainedStack, type ContentsSubject, DESTRUCTION_MATERIAL_BY_TAG, type DestructionTagOptions, type DrawableItem, ITEM_BUDGETS, ITEM_FAMILIES, type ItemBudgets, type ItemContents, type ItemDestruction, type ItemFamily, ItemKit, type ItemLod, type ItemLodOptions, type ItemMakeup, type ItemModel, ItemModelBuilder, ItemModelEntry, type ItemModelRecord, ItemModelRegistry, type ItemModels, type ItemModelsOptions, type ItemOpening, type ItemOpeningStyle, type ItemSizeClass, MODEL_BUDGET_DEVIATIONS, OPENING_NAME, SHAPES, SHELL_PART_ID, SHIPPED_MODELS, type ShapeContext, type ShapeId, type ShapeSubject, type ThumbnailRenderOptions, type ThumbnailRenderer, type ThumbnailScene, type Vec3Like, Vec3Tuple, type VesselSubject, WASH_NAME, WEAR_AMOUNT, WEAR_TARGET, type WearStage, asLid, buildItem, buildItemLod, canonicalFrame, checkBudget, composeThumbnailScene, countDrawCalls, countTriangles, createContainedItemModel, createItemModels, cullDistanceOf, drawShape, isShape, itemContents, itemDestruction, itemFamily, itemMakeup, itemModels, itemOpening, itemThumbnail, itemThumbnailSvg, itemVessel, makeupSpec, mergeItem, openItem, renderItemThumbnail, setItemDirt, setItemFoam, setOpeningContents, setWear, shade, shapeDestruction, shapeOf, shapeThumbnailSvg, sizeClassOf, tagForDestruction, tagMakeupParts, thumbnailPatch, triangleBudgetOf, turnItem, wearOfAge, wearOfFreshness, wearableMaterials };
|