@idosgames/characters 0.1.2 → 0.1.4

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.
@@ -1,6 +1,6 @@
1
- import { S as Skeleton, d as Slot, e as Attachment, R as RigDef, f as ArtPack, g as ArtDef, h as ArtStyle, P as PartsManager, a as Animator, A as ArtCatalog, C as CharacterLook, b as PlayOptions, c as AnimationEvent } from '../PartsManager-Cn3MU-VS.cjs';
2
- export { i as Animation, j as ArtId, B as BlinkOptions, k as Bone, l as BoneId, m as Color, n as ColorTargetDef, o as ColorTargetId, E as EditorGroup, p as ExpressionsDef, H as Hex, L as LOOK_VERSION, q as PartTypeDef, r as PartTypeId, s as PartsChange, t as PartsRule, u as Rng, v as RuleView, w as SkeletonData, x as Skin, W as WHITE, y as bothHands, z as colorOf, D as defineRig, F as hexToNumber, G as imageSizes, I as mergeLooks, J as numberToHex, K as parseLook, M as pick, N as readSkeletonData, O as seedOf, Q as seededRandom, T as skinImages, U as swapUnder } from '../PartsManager-Cn3MU-VS.cjs';
3
- export { H as HERO_PRESETS, L as LookPreset, P as PictureArt, T as ThumbnailBackdrop, a as ThumbnailRequest, b as Thumbnailer, c as createThumbnailer, v as vectorPictures } from '../thumbnail-BhGEEXux.cjs';
1
+ import { S as Skeleton, d as Slot, e as Attachment, f as RaceDef, R as RigDef, g as ArtPack, h as ArtDef, i as ArtStyle, P as PartsManager, a as Animator, A as ArtCatalog, C as CharacterLook, b as PlayOptions, c as AnimationEvent } from '../PartsManager-CmrzoyJR.cjs';
2
+ export { j as Animation, k as ArtId, B as BlinkOptions, l as BodyLook, m as Bone, n as BoneId, o as Color, p as ColorTargetDef, q as ColorTargetId, E as EditorGroup, r as ExpressionsDef, H as Hex, L as LOOK_VERSION, s as LookVersion, t as PartTypeDef, u as PartTypeId, v as PartsChange, w as PartsRule, x as RaceRegistry, y as Rng, z as RuleView, D as SkeletonData, F as Skin, W as WHITE, G as bothHands, I as colorOf, J as defineRig, K as hexToNumber, M as imageSizes, N as mergeLooks, O as numberToHex, Q as parseBody, T as parseLook, U as pick, V as raceAllowsSkin, X as raceLook, Y as raceName, Z as raceParts, _ as readSkeletonData, $ as seedOf, a0 as seededRandom, a1 as skinImages, a2 as swapUnder } from '../PartsManager-CmrzoyJR.cjs';
3
+ export { H as HERO_PRESETS, L as LookPreset, P as PictureArt, T as ThumbnailBackdrop, a as ThumbnailRequest, b as Thumbnailer, c as createThumbnailer, v as vectorPictures } from '../thumbnail-B1WjbWcW.cjs';
4
4
  import '../contract-DhZuKNIf.cjs';
5
5
 
6
6
  interface Geometry {
@@ -26,6 +26,8 @@ declare const RANGED_ANIMATIONS: {
26
26
  * (the idle fight is ranged) the wave of its blow — a crescent from a swing, a spike from a stab; the
27
27
  * game's own glowing orb for magic and bare hands. */
28
28
  type ShotKind = "arrow" | "bolt" | "bullet" | "slash" | "thrust" | "orb";
29
+ /** The ranged parts held in both hands. */
30
+ declare const TWO_HANDED: ReadonlySet<string>;
29
31
 
30
32
  declare const HERO_ANIMATIONS: {
31
33
  readonly idle: "Idle";
@@ -65,6 +67,14 @@ declare const HERO_ANIMATIONS: {
65
67
  */
66
68
  declare const GAIT_GROUND_SPEED: Readonly<Record<string, number>>;
67
69
 
70
+ declare const HUMAN: RaceDef;
71
+ declare const ELF: RaceDef;
72
+ declare const DWARF: RaceDef;
73
+ declare const ORC: RaceDef;
74
+ declare const UNDEAD: RaceDef;
75
+ /** The hero's stock races, in the order an editor offers them. */
76
+ declare const HERO_RACES: readonly RaceDef[];
77
+
68
78
  /** The attack for what the weapon hand holds: a ranged weapon or a staff has its own (ranged.ts — a bow
69
79
  * drawn and loosed, a crossbow, a pistol, a musket, a burst, a cast); otherwise bare hands punch, a
70
80
  * thrusting weapon stabs, anything else — swords, axes, maces, clubs — swings. */
@@ -108,6 +118,11 @@ interface CharacterCanvasOptions {
108
118
  side: number;
109
119
  top: number;
110
120
  };
121
+ /**
122
+ * × the art's size its images are rasterized at, live (default 3). A game that draws the same hero passes its own
123
+ * resolution: the pictures it already made are then reused, not made again (art/raster.ts).
124
+ */
125
+ resolution?: number;
111
126
  }
112
127
  declare class CharacterCanvas {
113
128
  private readonly options;
@@ -134,6 +149,13 @@ declare class CharacterCanvas {
134
149
  /** An animation event, "end", or "*". Returns the unsubscribe. */
135
150
  on(event: string, listener: (e: AnimationEvent) => void): () => void;
136
151
  setLook(look: CharacterLook): void;
152
+ /**
153
+ * Puts the canvas into a host (moved out of the one it was in). A screen that closes and opens again keeps one
154
+ * view this way: its WebGL context and its textures stay, and the hero is there at once, not drawn anew.
155
+ */
156
+ attach(host: HTMLElement): void;
157
+ /** Takes the canvas off the page; it stops drawing until `attach`. */
158
+ detach(): void;
137
159
  destroy(): void;
138
160
  private stanceOf;
139
161
  private resize;
@@ -187,4 +209,4 @@ declare function picturesOf(rig: RigDef, skin: string): string[];
187
209
  /** Каталог всех пакетов рисунка; `extra` — пакеты игры или проекта поверх стандартных. */
188
210
  declare function createCatalog(extra?: readonly ArtPack[]): ArtCatalog;
189
211
 
190
- export { AnimationEvent, Animator, ArtCatalog, ArtDef, ArtPack, Attachment, CharacterCanvas, type CharacterCanvasOptions, CharacterLook, GAIT_GROUND_SPEED, HERO_ANIMATIONS, PartsManager, PlayOptions, RANGED_ANIMATIONS, RIG2D_RECIPE_LIMITS, type Rig2dRecipe, type Rig2dRecipeResult, RigDef, type ShotKind, Skeleton, Slot, allPacks, basePack, catalogFor, createCatalog, heroAttack, heroIsMelee, heroRig, heroShot, parseRig2dRecipe, picturesOf, rig2dRecipeBrief, sanitizeSvg, svgDocument, worldGeometry };
212
+ export { AnimationEvent, Animator, ArtCatalog, ArtDef, ArtPack, Attachment, CharacterCanvas, type CharacterCanvasOptions, CharacterLook, DWARF, ELF, GAIT_GROUND_SPEED, HERO_ANIMATIONS, HERO_RACES, HUMAN, ORC, PartsManager, PlayOptions, RANGED_ANIMATIONS, RIG2D_RECIPE_LIMITS, RaceDef, type Rig2dRecipe, type Rig2dRecipeResult, RigDef, type ShotKind, Skeleton, Slot, TWO_HANDED, UNDEAD, allPacks, basePack, catalogFor, createCatalog, heroAttack, heroIsMelee, heroRig, heroShot, parseRig2dRecipe, picturesOf, rig2dRecipeBrief, sanitizeSvg, svgDocument, worldGeometry };
@@ -1,6 +1,6 @@
1
- import { S as Skeleton, d as Slot, e as Attachment, R as RigDef, f as ArtPack, g as ArtDef, h as ArtStyle, P as PartsManager, a as Animator, A as ArtCatalog, C as CharacterLook, b as PlayOptions, c as AnimationEvent } from '../PartsManager-CAVBKvp6.js';
2
- export { i as Animation, j as ArtId, B as BlinkOptions, k as Bone, l as BoneId, m as Color, n as ColorTargetDef, o as ColorTargetId, E as EditorGroup, p as ExpressionsDef, H as Hex, L as LOOK_VERSION, q as PartTypeDef, r as PartTypeId, s as PartsChange, t as PartsRule, u as Rng, v as RuleView, w as SkeletonData, x as Skin, W as WHITE, y as bothHands, z as colorOf, D as defineRig, F as hexToNumber, G as imageSizes, I as mergeLooks, J as numberToHex, K as parseLook, M as pick, N as readSkeletonData, O as seedOf, Q as seededRandom, T as skinImages, U as swapUnder } from '../PartsManager-CAVBKvp6.js';
3
- export { H as HERO_PRESETS, L as LookPreset, P as PictureArt, T as ThumbnailBackdrop, a as ThumbnailRequest, b as Thumbnailer, c as createThumbnailer, v as vectorPictures } from '../thumbnail-Bp-jK70T.js';
1
+ import { S as Skeleton, d as Slot, e as Attachment, f as RaceDef, R as RigDef, g as ArtPack, h as ArtDef, i as ArtStyle, P as PartsManager, a as Animator, A as ArtCatalog, C as CharacterLook, b as PlayOptions, c as AnimationEvent } from '../PartsManager-BpAUMQXw.js';
2
+ export { j as Animation, k as ArtId, B as BlinkOptions, l as BodyLook, m as Bone, n as BoneId, o as Color, p as ColorTargetDef, q as ColorTargetId, E as EditorGroup, r as ExpressionsDef, H as Hex, L as LOOK_VERSION, s as LookVersion, t as PartTypeDef, u as PartTypeId, v as PartsChange, w as PartsRule, x as RaceRegistry, y as Rng, z as RuleView, D as SkeletonData, F as Skin, W as WHITE, G as bothHands, I as colorOf, J as defineRig, K as hexToNumber, M as imageSizes, N as mergeLooks, O as numberToHex, Q as parseBody, T as parseLook, U as pick, V as raceAllowsSkin, X as raceLook, Y as raceName, Z as raceParts, _ as readSkeletonData, $ as seedOf, a0 as seededRandom, a1 as skinImages, a2 as swapUnder } from '../PartsManager-BpAUMQXw.js';
3
+ export { H as HERO_PRESETS, L as LookPreset, P as PictureArt, T as ThumbnailBackdrop, a as ThumbnailRequest, b as Thumbnailer, c as createThumbnailer, v as vectorPictures } from '../thumbnail-B7wrQe1B.js';
4
4
  import '../contract-DhZuKNIf.js';
5
5
 
6
6
  interface Geometry {
@@ -26,6 +26,8 @@ declare const RANGED_ANIMATIONS: {
26
26
  * (the idle fight is ranged) the wave of its blow — a crescent from a swing, a spike from a stab; the
27
27
  * game's own glowing orb for magic and bare hands. */
28
28
  type ShotKind = "arrow" | "bolt" | "bullet" | "slash" | "thrust" | "orb";
29
+ /** The ranged parts held in both hands. */
30
+ declare const TWO_HANDED: ReadonlySet<string>;
29
31
 
30
32
  declare const HERO_ANIMATIONS: {
31
33
  readonly idle: "Idle";
@@ -65,6 +67,14 @@ declare const HERO_ANIMATIONS: {
65
67
  */
66
68
  declare const GAIT_GROUND_SPEED: Readonly<Record<string, number>>;
67
69
 
70
+ declare const HUMAN: RaceDef;
71
+ declare const ELF: RaceDef;
72
+ declare const DWARF: RaceDef;
73
+ declare const ORC: RaceDef;
74
+ declare const UNDEAD: RaceDef;
75
+ /** The hero's stock races, in the order an editor offers them. */
76
+ declare const HERO_RACES: readonly RaceDef[];
77
+
68
78
  /** The attack for what the weapon hand holds: a ranged weapon or a staff has its own (ranged.ts — a bow
69
79
  * drawn and loosed, a crossbow, a pistol, a musket, a burst, a cast); otherwise bare hands punch, a
70
80
  * thrusting weapon stabs, anything else — swords, axes, maces, clubs — swings. */
@@ -108,6 +118,11 @@ interface CharacterCanvasOptions {
108
118
  side: number;
109
119
  top: number;
110
120
  };
121
+ /**
122
+ * × the art's size its images are rasterized at, live (default 3). A game that draws the same hero passes its own
123
+ * resolution: the pictures it already made are then reused, not made again (art/raster.ts).
124
+ */
125
+ resolution?: number;
111
126
  }
112
127
  declare class CharacterCanvas {
113
128
  private readonly options;
@@ -134,6 +149,13 @@ declare class CharacterCanvas {
134
149
  /** An animation event, "end", or "*". Returns the unsubscribe. */
135
150
  on(event: string, listener: (e: AnimationEvent) => void): () => void;
136
151
  setLook(look: CharacterLook): void;
152
+ /**
153
+ * Puts the canvas into a host (moved out of the one it was in). A screen that closes and opens again keeps one
154
+ * view this way: its WebGL context and its textures stay, and the hero is there at once, not drawn anew.
155
+ */
156
+ attach(host: HTMLElement): void;
157
+ /** Takes the canvas off the page; it stops drawing until `attach`. */
158
+ detach(): void;
137
159
  destroy(): void;
138
160
  private stanceOf;
139
161
  private resize;
@@ -187,4 +209,4 @@ declare function picturesOf(rig: RigDef, skin: string): string[];
187
209
  /** Каталог всех пакетов рисунка; `extra` — пакеты игры или проекта поверх стандартных. */
188
210
  declare function createCatalog(extra?: readonly ArtPack[]): ArtCatalog;
189
211
 
190
- export { AnimationEvent, Animator, ArtCatalog, ArtDef, ArtPack, Attachment, CharacterCanvas, type CharacterCanvasOptions, CharacterLook, GAIT_GROUND_SPEED, HERO_ANIMATIONS, PartsManager, PlayOptions, RANGED_ANIMATIONS, RIG2D_RECIPE_LIMITS, type Rig2dRecipe, type Rig2dRecipeResult, RigDef, type ShotKind, Skeleton, Slot, allPacks, basePack, catalogFor, createCatalog, heroAttack, heroIsMelee, heroRig, heroShot, parseRig2dRecipe, picturesOf, rig2dRecipeBrief, sanitizeSvg, svgDocument, worldGeometry };
212
+ export { AnimationEvent, Animator, ArtCatalog, ArtDef, ArtPack, Attachment, CharacterCanvas, type CharacterCanvasOptions, CharacterLook, DWARF, ELF, GAIT_GROUND_SPEED, HERO_ANIMATIONS, HERO_RACES, HUMAN, ORC, PartsManager, PlayOptions, RANGED_ANIMATIONS, RIG2D_RECIPE_LIMITS, RaceDef, type Rig2dRecipe, type Rig2dRecipeResult, RigDef, type ShotKind, Skeleton, Slot, TWO_HANDED, UNDEAD, allPacks, basePack, catalogFor, createCatalog, heroAttack, heroIsMelee, heroRig, heroShot, parseRig2dRecipe, picturesOf, rig2dRecipeBrief, sanitizeSvg, svgDocument, worldGeometry };