@adatechnology/game-contracts 0.14.0 → 0.16.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 +32 -1
- package/dist/index.global.js +36 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -620,6 +620,8 @@ interface Fragment {
|
|
|
620
620
|
mass: number;
|
|
621
621
|
/** Holes the part had where this fragment came from, in the fragment's own axes: the renderer keeps them on the debris. */
|
|
622
622
|
marks?: readonly FragmentMark[];
|
|
623
|
+
/** Cut from inside the part (a page of a book, not its cover): the renderer draws it in the material's inner colour. */
|
|
624
|
+
inner?: boolean;
|
|
623
625
|
}
|
|
624
626
|
interface FragmentMark {
|
|
625
627
|
/** Relative to the fragment's centre, in the fragment's axes. */
|
|
@@ -2190,4 +2192,33 @@ declare const checkCategorized: <TEntry extends {
|
|
|
2190
2192
|
readonly id: string;
|
|
2191
2193
|
}>(entries: readonly TEntry[], registry: CategoryRegistry, checkers: readonly ContractChecker<TEntry>[], options?: CategorizedOptions) => CategorizedReport;
|
|
2192
2194
|
|
|
2193
|
-
|
|
2195
|
+
/**
|
|
2196
|
+
* Where a drawn object comes from. Every builder of the kit that draws a piece (a car of the fleet, a house or a wall, a piece of furniture, a person, an
|
|
2197
|
+
* animal, a plant, an item, a weapon) marks the root it returns, and every renderer that draws for the room (effects, debris, liquids, the room itself)
|
|
2198
|
+
* marks its own roots, so a host can tell a piece of the kit from something drawn on the spot. Duck-typed on three.js objects (`userData`, `parent`,
|
|
2199
|
+
* `children`), so the contracts stay free of three.js.
|
|
2200
|
+
*/
|
|
2201
|
+
declare const KIT_ORIGIN_KEY = "kitOrigin";
|
|
2202
|
+
/** What drew an object: the package and the kind of piece (`vehicle`, `structure`, `furniture`, `person`... or `effect`, `room` for what is not a piece). */
|
|
2203
|
+
interface KitOrigin {
|
|
2204
|
+
readonly owner: string;
|
|
2205
|
+
readonly kind: string;
|
|
2206
|
+
/** The catalogue id of the piece, when it has one. */
|
|
2207
|
+
readonly id?: string;
|
|
2208
|
+
/** Drawn as a simple stand-in shape because the kit has no model of the piece yet (an item with no team model): a model still to make. */
|
|
2209
|
+
readonly standIn?: boolean;
|
|
2210
|
+
}
|
|
2211
|
+
/** Marks `object` as drawn by `origin.owner` and returns it. */
|
|
2212
|
+
declare function markKitOrigin<T>(object: T, origin: KitOrigin): T;
|
|
2213
|
+
/** The origin of the object or of its nearest marked ancestor; null when nothing up the tree is marked. */
|
|
2214
|
+
declare function kitOriginOf(object: unknown): KitOrigin | null;
|
|
2215
|
+
/** A drawn thing that no builder of the kit marked: what was drawn on the spot. */
|
|
2216
|
+
interface UnmarkedDrawing {
|
|
2217
|
+
/** The names of the object and its named ancestors, outermost first. */
|
|
2218
|
+
readonly path: string;
|
|
2219
|
+
readonly object: unknown;
|
|
2220
|
+
}
|
|
2221
|
+
/** Every visible mesh, line, point cloud or sprite under `root` with no marked ancestor (`root` itself not counted as one). */
|
|
2222
|
+
declare function unmarkedDrawings(root: unknown): UnmarkedDrawing[];
|
|
2223
|
+
|
|
2224
|
+
export { type ActionControl, type AnimationClipSpec, type AnimationEventSpec, type AnimationKey, type AnimationPose, type AreaPlacement, type AudioListener, type AudioSink, type BallisticExtras, type BenchChange, type BenchDeclaration, type BenchReport, type BenchSheet, type BlastOptions, type BlastReport, type BlastShove, type BlastShoveOptions, type BlastSource, type BodyRegion, type BodySlot, type BooleanControl, type BusyOptions, type BusySink, type BusyTask, type CategorizedOptions, type CategorizedReport, type CategoryDef, type CategoryOptions, type CategoryRegistry, type ChainDelay, type CheckOptions, type CheckSpecOptions, type ChoiceControl, type ChoiceOption, type ConfinementOptions, type ContainerSpec, type ContractChecker, type ContractContext, type ControlPatch, type ControlValue, type Crack, DEFAULT_BLAST_SHOVE, DEFAULT_ENVIRONMENT, DEFAULT_IGNITION_RULES, type DamageStage, type DamageType, type DebrisKind, type DeepPartial, type Dent, type DestructibleImpl, type DestructibleSpec, type DestructionEvent, type DestructionEventType, type EffectHandle, type EffectRequest, type EffectSink, type EnvironmentBus, type EnvironmentKey, type EnvironmentState, type ExplosionChain, type FluidKind, type FractureStyle, type Fragment, type FragmentHitOptions, type FragmentMark, type HandPose, type HandTargetSource, type HandTargets, type Hit, type HitIgnition, type HitResult, type Hole, type HostEvent, type HostTool, type HostToolAttachment, IMPACT_CONTRACT, type IgnitionRules, type ImpactContract, type ItemAnimationContract, type ItemUseDef, type JointKind, type JointSpec, type JointState, KIT_ORIGIN_KEY, type KitOrigin, type LiquidId, type LoopHandle, MISSING_BITS, type MaterialId, type ModuleArea, type ModuleBench, type ModuleControl, type ModuleHost, type ModuleItemFluid, type ModuleLayer, type ModuleMetric, type ModuleScenario, type NumberControl, type ObjectState, type PartBreach, type PartShape, type PartSpec, type PartState, type PartStatus, type PartUnits, type PileSpec, type PlayerState, type Quat, type RayHit, type Reinforcement, STAGE_EVENT, type SegmentKind, type ShelterOptions, type Shot, type SoilLayer, type SoilProfile, type SoilState, type SoundHandle, type SoundRequest, type SpecReport, type StructureRole, type SurfaceLayer, TOOL_CLIP, type TensionRebar, type TestableItem, type TestableModule, type Thumbnail, type ToolAnimationStep, type ToolAnimator, type ToolClipId, type ToolClipPlayer, type ToolClipPlayerOptions, type ToolClipSet, type ToolCommand, type ToolCommandResult, type ToolKind, type ToolRig, type TunedMassDamper, type UnmarkedDrawing, type Use, type Vec3, type WarmUpProbes, type WindExposure, type WindState, applyPatches, blastShove, checkAnimation, checkBench, checkCategorized, checkDestructible, checkHit, checkSpec, checkToolClips, createEnvironmentBus, createToolClipPlayer, deepMerge, defineCategories, fillFactor, ignitionChance, kitOriginOf, markKitOrigin, mergeById, removeIds, resolveEntry, resolveIgnitionRules, sampleClip, scaleClip, shotExtras, shotToHit, sparkTargetFactor, toolAnimationStep, unmarkedDrawings, useToHit };
|
package/dist/index.global.js
CHANGED
|
@@ -25,6 +25,7 @@ var GameContracts = (() => {
|
|
|
25
25
|
DEFAULT_ENVIRONMENT: () => DEFAULT_ENVIRONMENT,
|
|
26
26
|
DEFAULT_IGNITION_RULES: () => DEFAULT_IGNITION_RULES,
|
|
27
27
|
IMPACT_CONTRACT: () => IMPACT_CONTRACT,
|
|
28
|
+
KIT_ORIGIN_KEY: () => KIT_ORIGIN_KEY,
|
|
28
29
|
MISSING_BITS: () => MISSING_BITS,
|
|
29
30
|
STAGE_EVENT: () => STAGE_EVENT,
|
|
30
31
|
TOOL_CLIP: () => TOOL_CLIP,
|
|
@@ -43,6 +44,8 @@ var GameContracts = (() => {
|
|
|
43
44
|
defineCategories: () => defineCategories,
|
|
44
45
|
fillFactor: () => fillFactor,
|
|
45
46
|
ignitionChance: () => ignitionChance,
|
|
47
|
+
kitOriginOf: () => kitOriginOf,
|
|
48
|
+
markKitOrigin: () => markKitOrigin,
|
|
46
49
|
mergeById: () => mergeById,
|
|
47
50
|
removeIds: () => removeIds,
|
|
48
51
|
resolveEntry: () => resolveEntry,
|
|
@@ -53,6 +56,7 @@ var GameContracts = (() => {
|
|
|
53
56
|
shotToHit: () => shotToHit,
|
|
54
57
|
sparkTargetFactor: () => sparkTargetFactor,
|
|
55
58
|
toolAnimationStep: () => toolAnimationStep,
|
|
59
|
+
unmarkedDrawings: () => unmarkedDrawings,
|
|
56
60
|
useToHit: () => useToHit
|
|
57
61
|
});
|
|
58
62
|
|
|
@@ -837,6 +841,38 @@ var GameContracts = (() => {
|
|
|
837
841
|
}
|
|
838
842
|
return { ok: problems.length === 0, problems: [...new Set(problems)], allowed };
|
|
839
843
|
};
|
|
844
|
+
|
|
845
|
+
// src/origin.ts
|
|
846
|
+
var KIT_ORIGIN_KEY = "kitOrigin";
|
|
847
|
+
function markKitOrigin(object, origin) {
|
|
848
|
+
const node = object;
|
|
849
|
+
node.userData = node.userData ?? {};
|
|
850
|
+
node.userData[KIT_ORIGIN_KEY] = { ...origin };
|
|
851
|
+
return object;
|
|
852
|
+
}
|
|
853
|
+
function kitOriginOf(object) {
|
|
854
|
+
for (let node = object; node; node = node.parent) {
|
|
855
|
+
const origin = node.userData?.[KIT_ORIGIN_KEY];
|
|
856
|
+
if (origin && typeof origin.owner === "string") return origin;
|
|
857
|
+
}
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
function unmarkedDrawings(root) {
|
|
861
|
+
const out = [];
|
|
862
|
+
const pathOf = (node) => {
|
|
863
|
+
const names = [];
|
|
864
|
+
for (let n = node; n && n !== root; n = n.parent) if (n.name) names.push(n.name);
|
|
865
|
+
return names.reverse().join(" > ") || "(no name)";
|
|
866
|
+
};
|
|
867
|
+
const walk = (node, marked) => {
|
|
868
|
+
if (node.visible === false) return;
|
|
869
|
+
const here = marked || node !== root && Boolean(node.userData?.[KIT_ORIGIN_KEY]?.owner);
|
|
870
|
+
if (!here && (node.isMesh || node.isPoints || node.isLine || node.isSprite)) out.push({ path: pathOf(node), object: node });
|
|
871
|
+
for (const child of node.children ?? []) walk(child, here);
|
|
872
|
+
};
|
|
873
|
+
walk(root, false);
|
|
874
|
+
return out;
|
|
875
|
+
}
|
|
840
876
|
return __toCommonJS(index_exports);
|
|
841
877
|
})();
|
|
842
878
|
//# sourceMappingURL=index.global.js.map
|