@adatechnology/game-items-three 0.13.0 → 0.14.1
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-FCEKW7F6.js → chunk-PAQ3Q5I2.js} +148 -14
- package/dist/chunk-PAQ3Q5I2.js.map +1 -0
- package/dist/index.d.ts +38 -9
- package/dist/index.global.js +971 -483
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/{testing-DbKHUIwv.d.ts → testing-C96KjBjB.d.ts} +5 -3
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +12 -12
- package/dist/chunk-FCEKW7F6.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, ConsumableSpec } 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`). */
|
|
@@ -79,6 +83,13 @@ interface DrawableItem extends ShapeSubject {
|
|
|
79
83
|
readonly material: string;
|
|
80
84
|
readonly thickness?: number;
|
|
81
85
|
}[];
|
|
86
|
+
/** What the item holds (`ItemDef.fluid`): with `destructible`, its body holds it and a hole through it leaks (`tagForDestruction`). */
|
|
87
|
+
fluid?: {
|
|
88
|
+
readonly liquid: string;
|
|
89
|
+
readonly liters?: number;
|
|
90
|
+
};
|
|
91
|
+
/** What it spends at each use (`ItemDef.consumable`): a liquid one says the litres the item holds (`itemFluid`). */
|
|
92
|
+
consumable?: ConsumableSpec;
|
|
82
93
|
}
|
|
83
94
|
interface BuildItemOptions {
|
|
84
95
|
/** Wear of the materials, 0 new (default), 1 used, 2 spoiled. */
|
|
@@ -113,21 +124,27 @@ interface ItemModel {
|
|
|
113
124
|
*/
|
|
114
125
|
declare function buildItem(T: typeof THREE_NS, item: DrawableItem, options?: BuildItemOptions): ItemModel;
|
|
115
126
|
|
|
116
|
-
/** A stack held in a container (`ItemStack` of game-interactables): the item id and its free data. */
|
|
127
|
+
/** A stack held in a container (`ItemStack` of game-interactables): the item id and its free data (a find's age, `ageDays`). */
|
|
117
128
|
interface ContainedStack {
|
|
118
129
|
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). */
|
|
130
|
+
/** 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). */
|
|
120
131
|
readonly data?: Readonly<Record<string, unknown>>;
|
|
121
132
|
}
|
|
133
|
+
/** 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). */
|
|
134
|
+
type ContainedItemOptions = Omit<BuildItemOptions, 'kit'> & {
|
|
135
|
+
readonly rules?: ItemRules;
|
|
136
|
+
};
|
|
122
137
|
/** 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. */
|
|
123
138
|
type ContainedItemModel = (stack: ContainedStack, T: typeof THREE_NS) => THREE_NS.Object3D | null;
|
|
124
139
|
/**
|
|
125
140
|
* The model of the items inside furniture, for `createContentsView` of game-interactables-three and `interactives.itemModel` of game-floorplan-three: each
|
|
126
141
|
* 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
|
|
127
|
-
* own materials, so the view can discard it alone when it is taken. `root.userData.item` says what was drawn (`{ id, kind }`)
|
|
128
|
-
* dirty (`setItemDirt`), the same as the item once it is in the world.
|
|
142
|
+
* 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`)
|
|
143
|
+
* 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.
|
|
129
144
|
*/
|
|
130
|
-
declare function createContainedItemModel(items: Iterable<DrawableItem
|
|
145
|
+
declare function createContainedItemModel(items: Iterable<DrawableItem & {
|
|
146
|
+
readonly shelfLife?: number;
|
|
147
|
+
}>, options?: ContainedItemOptions): ContainedItemModel;
|
|
131
148
|
|
|
132
149
|
/** The destruction material (`game-destruction` id) of each material tag of the kit, for a mesh whose model says nothing else. */
|
|
133
150
|
declare const DESTRUCTION_MATERIAL_BY_TAG: Readonly<Record<string, string>>;
|
|
@@ -190,6 +207,13 @@ interface ContentsSubject {
|
|
|
190
207
|
readonly size: readonly [number, number, number];
|
|
191
208
|
/** Kg, shell included. */
|
|
192
209
|
readonly weight?: number;
|
|
210
|
+
/** What the item's data says it holds (`ItemDef.fluid`): the contents of a model the family table does not know (a detergent bottle, a tub of yogurt). */
|
|
211
|
+
readonly fluid?: {
|
|
212
|
+
readonly liquid: string;
|
|
213
|
+
readonly liters: number;
|
|
214
|
+
};
|
|
215
|
+
/** The container is a box (a carton) rather than a cylinder (a bottle, a pot). */
|
|
216
|
+
readonly box?: boolean;
|
|
193
217
|
}
|
|
194
218
|
/** Id of the welded part that is the whole shell of a container. */
|
|
195
219
|
declare const SHELL_PART_ID = "shell";
|
|
@@ -244,6 +268,11 @@ interface DestructionTagOptions {
|
|
|
244
268
|
readonly material: string;
|
|
245
269
|
readonly thickness?: number;
|
|
246
270
|
}[];
|
|
271
|
+
/** What the item's data says it holds (`ItemDef.fluid`): written on its body as on the shell of a can, so a hole through it leaks. */
|
|
272
|
+
readonly fluid?: {
|
|
273
|
+
readonly liquid: string;
|
|
274
|
+
readonly liters: number;
|
|
275
|
+
};
|
|
247
276
|
}
|
|
248
277
|
/**
|
|
249
278
|
* Writes the `userData` that `specFromObject3D` reads onto the meshes of a drawn item: the destruction material of each mesh from its kit material tag,
|
|
@@ -467,4 +496,4 @@ interface ThumbnailRenderer {
|
|
|
467
496
|
*/
|
|
468
497
|
declare function renderItemThumbnail(T: typeof THREE_NS, renderer: ThumbnailRenderer, item: DrawableItem, options?: ThumbnailRenderOptions): string;
|
|
469
498
|
|
|
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 };
|
|
499
|
+
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 };
|