@adatechnology/game-items-three 0.13.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-FCEKW7F6.js → chunk-XJG7IGO3.js} +124 -7
- package/dist/chunk-XJG7IGO3.js.map +1 -0
- package/dist/index.d.ts +19 -9
- package/dist/index.global.js +663 -432
- 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 } 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`). */
|
|
@@ -113,21 +117,27 @@ interface ItemModel {
|
|
|
113
117
|
*/
|
|
114
118
|
declare function buildItem(T: typeof THREE_NS, item: DrawableItem, options?: BuildItemOptions): ItemModel;
|
|
115
119
|
|
|
116
|
-
/** 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`). */
|
|
117
121
|
interface ContainedStack {
|
|
118
122
|
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). */
|
|
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). */
|
|
120
124
|
readonly data?: Readonly<Record<string, unknown>>;
|
|
121
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
|
+
};
|
|
122
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. */
|
|
123
131
|
type ContainedItemModel = (stack: ContainedStack, T: typeof THREE_NS) => THREE_NS.Object3D | null;
|
|
124
132
|
/**
|
|
125
133
|
* The model of the items inside furniture, for `createContentsView` of game-interactables-three and `interactives.itemModel` of game-floorplan-three: each
|
|
126
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
|
|
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.
|
|
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.
|
|
129
137
|
*/
|
|
130
|
-
declare function createContainedItemModel(items: Iterable<DrawableItem
|
|
138
|
+
declare function createContainedItemModel(items: Iterable<DrawableItem & {
|
|
139
|
+
readonly shelfLife?: number;
|
|
140
|
+
}>, options?: ContainedItemOptions): ContainedItemModel;
|
|
131
141
|
|
|
132
142
|
/** The destruction material (`game-destruction` id) of each material tag of the kit, for a mesh whose model says nothing else. */
|
|
133
143
|
declare const DESTRUCTION_MATERIAL_BY_TAG: Readonly<Record<string, string>>;
|
|
@@ -467,4 +477,4 @@ interface ThumbnailRenderer {
|
|
|
467
477
|
*/
|
|
468
478
|
declare function renderItemThumbnail(T: typeof THREE_NS, renderer: ThumbnailRenderer, item: DrawableItem, options?: ThumbnailRenderOptions): string;
|
|
469
479
|
|
|
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 };
|
|
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 };
|