@adatechnology/game-items-three 0.12.0 → 0.13.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 CHANGED
@@ -1,5 +1,5 @@
1
- import { V as Vec3Tuple, I as ItemKit, a as ItemModelRegistry, b as ItemModelEntry, c as ItemModelBuilder } from './testing-Y05TqYH8.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-Y05TqYH8.js';
1
+ import { V as Vec3Tuple, I as ItemKit, a as ItemModelRegistry, b as ItemModelEntry, c as ItemModelBuilder } from './testing-DbKHUIwv.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-DbKHUIwv.js';
3
3
  import * as THREE_NS from 'three';
4
4
  import { ContainerSpec, DestructibleSpec, Thumbnail, DeepPartial } from '@adatechnology/game-contracts';
5
5
  import '@adatechnology/game-items';
@@ -40,6 +40,8 @@ declare function canonicalFrame(size: Vec3Tuple): {
40
40
  a: number;
41
41
  b: number;
42
42
  };
43
+ /** Height of the inside floor of a `cup` above its base, as a share of its height: where what it holds starts. */
44
+ declare const CUP_FLOOR_SHARE = 0.06;
43
45
  declare const isShape: (value: string | undefined) => value is ShapeId;
44
46
  /** The item fields the shape choice reads. */
45
47
  interface ShapeSubject {
@@ -114,13 +116,16 @@ declare function buildItem(T: typeof THREE_NS, item: DrawableItem, options?: Bui
114
116
  /** A stack held in a container (`ItemStack` of game-interactables): the item id and its free data. */
115
117
  interface ContainedStack {
116
118
  readonly type: string;
119
+ /** The stack's free data: `dirt` (0 clean to 1 caked) draws the food left on it (a plate left dirty in a sink). */
120
+ readonly data?: Readonly<Record<string, unknown>>;
117
121
  }
118
122
  /** 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
123
  type ContainedItemModel = (stack: ContainedStack, T: typeof THREE_NS) => THREE_NS.Object3D | null;
120
124
  /**
121
125
  * The model of the items inside furniture, for `createContentsView` of game-interactables-three and `interactives.itemModel` of game-floorplan-three: each
122
126
  * 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 }`).
127
+ * 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 `data.dirt` is drawn
128
+ * dirty (`setItemDirt`), the same as the item once it is in the world.
124
129
  */
125
130
  declare function createContainedItemModel(items: Iterable<DrawableItem>, options?: Omit<BuildItemOptions, 'kit'>): ContainedItemModel;
126
131
 
@@ -197,6 +202,24 @@ declare function itemContents(subject: ContentsSubject): {
197
202
  readonly liquid: string;
198
203
  readonly liters: number;
199
204
  } | undefined;
205
+ /** The subject of `itemVessel`: an open item drawn as a simple shape, with what it holds to the brim. */
206
+ interface VesselSubject {
207
+ /** Metres. */
208
+ readonly size: readonly [number, number, number];
209
+ /** Litres to the brim (`container.capacityLiters` of the catalogue). */
210
+ readonly capacityLiters?: number;
211
+ /** The simple shape it is drawn as (`shapeOf`); undefined when a model is drawn, whose inside floor is not known. */
212
+ readonly shape?: string;
213
+ }
214
+ /**
215
+ * 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
216
+ * 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
217
+ * (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.
218
+ */
219
+ declare function itemVessel(subject: VesselSubject): {
220
+ readonly container: ContainerSpec;
221
+ readonly offset: [number, number, number];
222
+ } | undefined;
200
223
  /** What `tagForDestruction` needs to know about the item beside its meshes. */
201
224
  interface DestructionTagOptions {
202
225
  readonly modelId?: string;
@@ -229,6 +252,17 @@ interface DestructionTagOptions {
229
252
  */
230
253
  declare function tagForDestruction(root: THREE_NS.Object3D, options?: DestructionTagOptions): void;
231
254
 
255
+ /** Name of the group `setItemDirt` and `setItemFoam` hang on the item's root. */
256
+ declare const WASH_NAME = "item_wash";
257
+ /**
258
+ * 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
259
+ * 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
260
+ * (`discardObject3D`) frees it.
261
+ */
262
+ declare function setItemDirt(T: typeof THREE_NS, root: THREE_NS.Object3D, dirt: number): void;
263
+ /** 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`. */
264
+ declare function setItemFoam(T: typeof THREE_NS, root: THREE_NS.Object3D, amount: number): void;
265
+
232
266
  /** 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
267
  interface ItemMakeup {
234
268
  /** Kit material tag of a drawn mesh to the id of the part it belongs to. */
@@ -433,4 +467,4 @@ interface ThumbnailRenderer {
433
467
  */
434
468
  declare function renderItemThumbnail(T: typeof THREE_NS, renderer: ThumbnailRenderer, item: DrawableItem, options?: ThumbnailRenderOptions): string;
435
469
 
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 };
470
+ export { type BudgetReport, type BuildItemOptions, CUP_FLOOR_SHARE, 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, 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, wearableMaterials };