@adatechnology/game-items-three 0.11.8 → 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/{chunk-64JEKMFT.js → chunk-FCEKW7F6.js} +658 -442
- package/dist/chunk-FCEKW7F6.js.map +1 -0
- package/dist/index.d.ts +53 -4
- package/dist/index.global.js +1955 -1006
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-D2tqWTG4.d.ts → testing-DbKHUIwv.d.ts} +8 -2
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +16 -16
- package/dist/chunk-64JEKMFT.js.map +0 -1
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-
|
|
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-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 {
|
|
@@ -71,6 +73,12 @@ interface DrawableItem extends ShapeSubject {
|
|
|
71
73
|
powder?: {
|
|
72
74
|
color: number;
|
|
73
75
|
};
|
|
76
|
+
/** The parts the catalogue declares (`{ id, material, thickness? }`): with `destructible`, an item of one part is all of its material (`tagForDestruction`). */
|
|
77
|
+
parts?: readonly {
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly material: string;
|
|
80
|
+
readonly thickness?: number;
|
|
81
|
+
}[];
|
|
74
82
|
}
|
|
75
83
|
interface BuildItemOptions {
|
|
76
84
|
/** Wear of the materials, 0 new (default), 1 used, 2 spoiled. */
|
|
@@ -108,13 +116,16 @@ declare function buildItem(T: typeof THREE_NS, item: DrawableItem, options?: Bui
|
|
|
108
116
|
/** A stack held in a container (`ItemStack` of game-interactables): the item id and its free data. */
|
|
109
117
|
interface ContainedStack {
|
|
110
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>>;
|
|
111
121
|
}
|
|
112
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. */
|
|
113
123
|
type ContainedItemModel = (stack: ContainedStack, T: typeof THREE_NS) => THREE_NS.Object3D | null;
|
|
114
124
|
/**
|
|
115
125
|
* The model of the items inside furniture, for `createContentsView` of game-interactables-three and `interactives.itemModel` of game-floorplan-three: each
|
|
116
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
|
|
117
|
-
* 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.
|
|
118
129
|
*/
|
|
119
130
|
declare function createContainedItemModel(items: Iterable<DrawableItem>, options?: Omit<BuildItemOptions, 'kit'>): ContainedItemModel;
|
|
120
131
|
|
|
@@ -191,6 +202,24 @@ declare function itemContents(subject: ContentsSubject): {
|
|
|
191
202
|
readonly liquid: string;
|
|
192
203
|
readonly liters: number;
|
|
193
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;
|
|
194
223
|
/** What `tagForDestruction` needs to know about the item beside its meshes. */
|
|
195
224
|
interface DestructionTagOptions {
|
|
196
225
|
readonly modelId?: string;
|
|
@@ -206,6 +235,15 @@ interface DestructionTagOptions {
|
|
|
206
235
|
};
|
|
207
236
|
/** three.js, for the shapes three only makes from scratch (a cylinder with rings on its ends: `tessellate.cylinder.capRings`). */
|
|
208
237
|
readonly three?: typeof THREE_NS;
|
|
238
|
+
/**
|
|
239
|
+
* The parts the item's data declares (`{ id, material, thickness? }` of the catalogue): an item of one part (`body`) is all of that material (a wine glass is glass, a
|
|
240
|
+
* detergent bottle plastic, a sponge foam), whatever tag the model or the simple shape was painted with. The data is the item's truth; the paint is only its look.
|
|
241
|
+
*/
|
|
242
|
+
readonly parts?: readonly {
|
|
243
|
+
readonly id: string;
|
|
244
|
+
readonly material: string;
|
|
245
|
+
readonly thickness?: number;
|
|
246
|
+
}[];
|
|
209
247
|
}
|
|
210
248
|
/**
|
|
211
249
|
* Writes the `userData` that `specFromObject3D` reads onto the meshes of a drawn item: the destruction material of each mesh from its kit material tag,
|
|
@@ -214,6 +252,17 @@ interface DestructionTagOptions {
|
|
|
214
252
|
*/
|
|
215
253
|
declare function tagForDestruction(root: THREE_NS.Object3D, options?: DestructionTagOptions): void;
|
|
216
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
|
+
|
|
217
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. */
|
|
218
267
|
interface ItemMakeup {
|
|
219
268
|
/** Kit material tag of a drawn mesh to the id of the part it belongs to. */
|
|
@@ -418,4 +467,4 @@ interface ThumbnailRenderer {
|
|
|
418
467
|
*/
|
|
419
468
|
declare function renderItemThumbnail(T: typeof THREE_NS, renderer: ThumbnailRenderer, item: DrawableItem, options?: ThumbnailRenderOptions): string;
|
|
420
469
|
|
|
421
|
-
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 };
|