@wayward/types 2.13.3-beta.dev.20230627.1 → 2.13.3-beta.dev.20230627.2

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.
@@ -14,15 +14,19 @@ import type InterruptChoice from "language/dictionary/InterruptChoice";
14
14
  import type { TranslationGenerator } from "ui/component/IComponent";
15
15
  import type { MenuId } from "ui/screen/screens/menu/component/IMenu";
16
16
  export declare const promptDescriptions: Descriptions<PromptType, IPromptDescriptionBase<any>>;
17
- declare class PromptDescriptionFactory {
17
+ export default class PromptDescriptionFactory {
18
18
  private readonly _priority?;
19
19
  constructor(_priority?: PromptPriority | undefined);
20
+ static priority(priority: PromptPriority): PromptDescriptionFactory;
21
+ /**
22
+ * @deprecated Use {@link PromptDescriptionFactory.priority}
23
+ */
20
24
  priority(priority: PromptPriority): PromptDescriptionFactory;
21
- info<A extends any[] = []>(type: Prompt): IPromptInfoDescription<A>;
22
- confirm<A extends any[] = []>(type: Prompt, yesTranslation?: TranslationGenerator<InterruptChoice>, noTranslation?: TranslationGenerator<InterruptChoice>): IPromptConfirmDescription<A>;
23
- choice<A extends any[], CHOICES extends PromptChoices<A>>(type: Prompt, choices: CHOICES): IPromptChoiceDescription<A, CHOICES>;
25
+ info<A extends any[] = []>(type: SupplierOr<Prompt>): IPromptInfoDescription<A>;
26
+ confirm<A extends any[] = []>(type: SupplierOr<Prompt>, yesTranslation?: TranslationGenerator<InterruptChoice>, noTranslation?: TranslationGenerator<InterruptChoice>): IPromptConfirmDescription<A>;
27
+ choice<A extends any[], CHOICES extends PromptChoices<A>>(type: SupplierOr<Prompt>, choices: CHOICES): IPromptChoiceDescription<A, CHOICES>;
24
28
  input<A extends any[] = []>(type: Prompt, configure?: IPromptInputDescription<A>["configure"], canCancel?: true): IPromptInputDescription<A>;
25
29
  menu<MENU extends MenuId, A extends any[] = []>(type: Prompt, menu: MENU, configure?: IPromptMenuDescription<MENU, A>["configure"]): IPromptMenuDescription<MENU, A>;
30
+ private create;
26
31
  }
27
32
  export declare const promptDescriptionFactory: PromptDescriptionFactory;
28
- export {};
@@ -172,7 +172,7 @@ export declare abstract class BaseMod extends EventEmitter.Host<IModEvents> {
172
172
  * Allocates an enum for this mod.
173
173
  * @param id The enum type.
174
174
  * @param name The name of the enumeration value.
175
- * @param objectValue An object to register with the enum. For example, all values in the creature enumeration have a corresponding
175
+ * @param description An object to register with the enum. For example, all values in the creature enumeration have a corresponding
176
176
  * `description` object.
177
177
  * @param onAllocate A callback for when the enum has been allocated.
178
178
  * @param onUnallocate A callback for when the enum has been unallocated.
@@ -38,7 +38,8 @@ import type { InspectionClass } from "game/inspection/InspectionTypeMap";
38
38
  import type { IItemDescription, IItemGroupDescription, ItemTag, ItemType, ItemTypeGroup } from "game/item/IItem";
39
39
  import type { IMagicalPropertyDescription, MagicalPropertyType } from "game/magic/MagicalPropertyType";
40
40
  import type { ILoadingDescription } from "game/meta/Loading";
41
- import type { Prompt } from "game/meta/prompt/IPrompt";
41
+ import type { IPromptDescriptionBase, Prompt } from "game/meta/prompt/IPrompt";
42
+ import type PromptDescriptionFactory from "game/meta/prompt/PromptDescriptionFactory";
42
43
  import type { TempType } from "game/temperature/ITemperature";
43
44
  import type { ITerrainDescription, OverlayType, TerrainType } from "game/tile/ITerrain";
44
45
  import type { ITileEventDescription, TileEventType } from "game/tile/ITileEvent";
@@ -329,9 +330,11 @@ export interface IQuestRequirementRegistration extends IBaseModRegistration {
329
330
  name: string;
330
331
  description: QuestRequirement;
331
332
  }
333
+ export type PromptConstructorFunction<DESCRIPTION extends IPromptDescriptionBase<any[]>> = (type: Prompt, factory: PromptDescriptionFactory) => DESCRIPTION;
332
334
  export interface IPromptRegistration extends IBaseModRegistration {
333
335
  type: ModRegistrationType.Prompt;
334
336
  name: string;
337
+ construct: PromptConstructorFunction<IPromptDescriptionBase<any[]>>;
335
338
  }
336
339
  export interface ILoadRegistration extends IBaseModRegistration {
337
340
  type: ModRegistrationType.Load;
@@ -620,7 +623,7 @@ declare module Register {
620
623
  *
621
624
  * The decorated property will be injected with the id of the registered prompt.
622
625
  */
623
- export function prompt(name: string): <K extends string | number | symbol, T extends Record<K, Prompt>>(target: T, key: K) => void;
626
+ export function prompt<DESCRIPTION extends IPromptDescriptionBase<any[]>>(name: string, construct: PromptConstructorFunction<DESCRIPTION>): <K extends string | number | symbol, T extends Record<K, DESCRIPTION>>(target: T, key: K) => void;
624
627
  /**
625
628
  * Registers an interrupt choice.
626
629
  * @param name The name of the interrupt choice.
@@ -19,7 +19,8 @@ declare module EnumManager {
19
19
  */
20
20
  function clearCacheForMod(modIndex: number): void;
21
21
  function reset(): void;
22
- function allocate(modIndex: number, id: EnumId, name: string, objectValue?: ((enumNumber: number) => any) | any, onAllocate?: ((enumNumber: number) => void), onUnallocate?: ((enumNumber: number) => void)): EnumInfo | undefined;
22
+ function allocate<DESCRIPTION extends object | undefined>(modIndex: number, id: EnumId, name: string, description: DESCRIPTION, onAllocate?: ((enumNumber: number, description: DESCRIPTION) => void), onUnallocate?: ((enumNumber: number) => void)): EnumInfo | undefined;
23
+ function allocate<DESCRIPTION extends object | undefined>(modIndex: number, id: EnumId, name: string, description?: DESCRIPTION, onAllocate?: ((enumNumber: number, description?: DESCRIPTION) => void), onUnallocate?: ((enumNumber: number) => void)): EnumInfo | undefined;
23
24
  function unallocate(enumInfo: EnumInfo): void;
24
25
  function unallocateMod(modIndex: number): void;
25
26
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wayward/types",
3
3
  "description": "TypeScript declarations for Wayward, used for modding.",
4
- "version": "2.13.3-beta.dev.20230627.1",
4
+ "version": "2.13.3-beta.dev.20230627.2",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",