@wayward/types 2.13.0-beta.dev.20230427.1 → 2.13.0-beta.dev.20230428.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.
@@ -12,11 +12,12 @@ import { Action } from "game/entity/action/Action";
12
12
  import type { IActionUsable } from "game/entity/action/IAction";
13
13
  import { ActionArgument } from "game/entity/action/IAction";
14
14
  import type Creature from "game/entity/creature/Creature";
15
+ import type { ICreatureDescription } from "game/entity/creature/ICreature";
15
16
  import type Human from "game/entity/Human";
16
17
  import { AiType } from "game/entity/IEntity";
17
18
  export interface ISetCreatureAiCanUse extends IActionUsable {
18
19
  creature: Creature;
19
20
  }
20
- export declare function hasSkillToSetCreatureAi(human: Human, ai: AiType): boolean;
21
+ export declare function hasSkillToSetCreatureAi(human: Human, creatureDescription: ICreatureDescription | undefined, ai: AiType): boolean;
21
22
  declare const _default: Action<[ActionArgument.Integer32], Human<number>, void, ISetCreatureAiCanUse, [number]>;
22
23
  export default _default;
@@ -157,6 +157,10 @@ export interface ICreatureDescription extends IModdable, ITemperatureDescription
157
157
  * Prevents the creature from spawning for the provided WorldZ's
158
158
  */
159
159
  preventSpawnZs?: Set<WorldZ>;
160
+ /**
161
+ * Prevents release the creature from its tamed state
162
+ */
163
+ preventRelease?: boolean;
160
164
  fishable?: boolean;
161
165
  blood?: IRGB;
162
166
  aberrantBlood?: IRGB;
@@ -249,6 +253,10 @@ export interface ICreatureDescription extends IModdable, ITemperatureDescription
249
253
  * If set, creature will only listen to certain commands.
250
254
  */
251
255
  allowedCommands?: AiType[];
256
+ /**
257
+ * When true, the player will always be able to command the creature, regardless of their taming skill.
258
+ */
259
+ alwaysAllowCommands?: boolean;
252
260
  /**
253
261
  * Called when a stat changes
254
262
  */
@@ -128,7 +128,7 @@ export interface IMessageManager {
128
128
  * Signal that the message was sent to everyone
129
129
  */
130
130
  sentToAll(sentToAll?: boolean): this;
131
- upgrade(id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number): this;
131
+ upgrade(id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: Translation.ITranslationUpgrader): this;
132
132
  }
133
133
  export interface IMessageHistoryItem {
134
134
  id: number;
@@ -125,5 +125,5 @@ export default class MessageManager implements IMessageManager {
125
125
  */
126
126
  sentToAll(sentToAll?: boolean): this;
127
127
  private reset;
128
- upgrade(id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number): this;
128
+ upgrade(id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: Translation.ITranslationUpgrader): this;
129
129
  }
@@ -10,6 +10,9 @@
10
10
  */
11
11
  import type Island from "game/island/Island";
12
12
  import type { PartOfDay } from "game/time/ITimeManager";
13
+ import type Dictionary from "language/Dictionary";
14
+ import type { TranslationArg } from "language/ITranslation";
15
+ import Translation from "language/Translation";
13
16
  import Note from "language/dictionary/Note";
14
17
  import type { IModdable } from "mod/ModRegistry";
15
18
  import { HelpArticle } from "ui/screen/screens/menu/menus/help/HelpArticleDescriptions";
@@ -25,7 +28,7 @@ export interface INote {
25
28
  time: number;
26
29
  skilled: boolean;
27
30
  };
28
- args: any[];
31
+ args: TranslationArg[];
29
32
  unread?: boolean;
30
33
  }
31
34
  export interface INoteManager {
@@ -35,6 +38,7 @@ export interface INoteManager {
35
38
  write(note: Note, ...args: any[]): void;
36
39
  getUnread(): INote[];
37
40
  markRead(noteId: number): void;
41
+ upgrade(id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: Translation.ITranslationUpgrader): this;
38
42
  }
39
43
  export interface INoteHost {
40
44
  getIsland(): Island;
@@ -47,9 +51,10 @@ export declare class NoteManagerNoOp implements INoteManager {
47
51
  readonly notes: INote[];
48
52
  getNote(id: number): INote | undefined;
49
53
  wasWritten(note: Note): boolean;
50
- write(note: Note, ...args: any[]): void;
54
+ write(note: Note, ...args: TranslationArg[]): void;
51
55
  getUnread(): INote[];
52
56
  markRead(noteId: number): void;
57
+ upgrade(id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: Translation.ITranslationUpgrader): this;
53
58
  }
54
59
  export default class NoteManager implements INoteManager {
55
60
  private readonly host;
@@ -58,7 +63,8 @@ export default class NoteManager implements INoteManager {
58
63
  get notes(): INote[];
59
64
  getNote(id: number): INote | undefined;
60
65
  wasWritten(note: Note): boolean;
61
- write(note: Note, ...args: any[]): void;
66
+ write(note: Note, ...args: TranslationArg[]): void;
62
67
  getUnread(): INote[];
63
68
  markRead(noteId: number): void;
69
+ upgrade(id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: Translation.ITranslationUpgrader): this;
64
70
  }
@@ -163,7 +163,7 @@ export declare class SimpleInfoProvider extends InfoProvider {
163
163
  private childComponentClass;
164
164
  private validWhen?;
165
165
  constructor(...translations: Array<TranslationGenerator | InfoProvider>);
166
- get(): (import("../../language/ITranslation").ISerializedTranslation | import("../../language/impl/TranslationImpl").default | import("../../language/dictionary/UiTranslation").default | (() => import("../../language/ITranslation").ISerializedTranslation | import("../../language/impl/TranslationImpl").default | Iterable<import("../../utilities/string/Interpolator").IStringSection> | import("../../language/dictionary/UiTranslation").default | undefined) | InfoProvider)[];
166
+ get(): (import("../../language/ITranslation").ISerializedTranslation | import("../../language/impl/TranslationImpl").default | import("../../language/dictionary/UiTranslation").default | (() => import("../../language/ITranslation").ISerializedTranslation | import("../../language/impl/TranslationImpl").default | import("../../utilities/string/Interpolator").IStringSection[] | import("../../language/dictionary/UiTranslation").default | undefined) | InfoProvider)[];
167
167
  add(...translations: Array<TranslationGenerator | InfoProvider | Falsy>): this;
168
168
  onlyIfHasContents(): this | undefined;
169
169
  addInfoGetter(provider: () => InfoProvider | undefined): this;
@@ -40,7 +40,7 @@ export interface ISerializedInterpolator {
40
40
  options?: IInterpolationOptions;
41
41
  segments?: Segment[];
42
42
  }
43
- export type TranslationArg = string | number | boolean | Translation | ISerializedTranslation | IStringSection | Iterable<IStringSection> | TranslationArg[] | ITranslationArgRecord | (() => TranslationArg) | undefined | null;
43
+ export type TranslationArg = string | number | boolean | Translation | ISerializedTranslation | IStringSection | TranslationArg[] | ITranslationArgRecord | (() => TranslationArg) | undefined | null;
44
44
  export interface ITranslationArgRecord {
45
45
  [key: string]: ITranslationArgRecord | TranslationArg;
46
46
  }
@@ -24,7 +24,7 @@ import TranslationImpl from "language/impl/TranslationImpl";
24
24
  import type { ISerializedTranslation, TranslationArg } from "language/ITranslation";
25
25
  import { formatListTranslation } from "language/segment/FormatListSegment";
26
26
  import ITranslationSorter from "language/utility/TranslationSorter";
27
- import type { IStringSection } from "utilities/string/Interpolator";
27
+ import { IStringSection } from "utilities/string/Interpolator";
28
28
  export declare enum Article {
29
29
  /**
30
30
  * Use no article.
@@ -149,6 +149,11 @@ declare module Translation {
149
149
  function reformatSingularNoun(article: Article): Translation;
150
150
  function reformatSingularNoun(count: number, article: Article): Translation;
151
151
  function reformatSingularNoun(count?: number | Article, article?: Article): Translation;
152
- function upgrade(translation: ISerializedTranslation, id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number): void;
152
+ interface ITranslationUpgrader {
153
+ translation?(translation: TranslationImpl | ISerializedTranslation): any;
154
+ argument?(argument: TranslationArg): TranslationArg;
155
+ }
156
+ function upgrade(translation: ISerializedTranslation, id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: ITranslationUpgrader): ISerializedTranslation | TranslationImpl;
157
+ function upgradeTranslationArgument(argument: TranslationArg, id: string, dictionary: Dictionary, entry: number, upgrader?: ITranslationUpgrader): TranslationArg;
153
158
  }
154
159
  export default Translation;
@@ -46,9 +46,9 @@ export default class TranslationImpl implements Omit<ISerializable, "deserialize
46
46
  private static getStringSections;
47
47
  readonly isValid: boolean;
48
48
  private readonly translationData;
49
- private readonly translationId;
50
- private readonly args;
51
- private readonly reformatters;
49
+ readonly id: string;
50
+ readonly args: TranslationArg[];
51
+ readonly reformatters: Array<TranslationImpl | ((sections: IStringSection[]) => IStringSection[])>;
52
52
  private interpolator;
53
53
  private _context;
54
54
  get context(): TextContext;
@@ -102,6 +102,7 @@ export default class TranslationImpl implements Omit<ISerializable, "deserialize
102
102
  private getCustomInterpolatorSegments;
103
103
  serializeObject(): ISerializedTranslation;
104
104
  serialize(depth?: number): ISerializedTranslation;
105
+ static serializeTranslationArg(arg: any, depth?: number, maxSerializationDepth?: number): any;
105
106
  private canCache;
106
107
  private getCachedTranslation;
107
108
  /**
@@ -12,6 +12,6 @@ import type { ISerializedTranslation } from "language/ITranslation";
12
12
  import { ListEnder } from "language/ITranslation";
13
13
  import type Translation from "language/Translation";
14
14
  import type { ISegment, IStringSection } from "utilities/string/Interpolator";
15
- export declare function formatListTranslation(items: Iterable<string | IStringSection | Iterable<IStringSection> | Translation | ISerializedTranslation>, ender?: ListEnder | false): Translation;
15
+ export declare function formatListTranslation(items: Iterable<string | IStringSection | IStringSection[] | Translation | ISerializedTranslation>, ender?: ListEnder | false): Translation;
16
16
  declare const _default: ISegment;
17
17
  export default _default;
@@ -90,7 +90,7 @@ export interface IDisableable {
90
90
  disabled: boolean;
91
91
  setDisabled(disabled: boolean): this;
92
92
  }
93
- export type TranslationGenerator<ENUM extends number = UiTranslation, A extends any[] = []> = Translation | ENUM | ISerializedTranslation | ((...args: A) => Iterable<IStringSection> | Translation | ENUM | ISerializedTranslation | undefined);
93
+ export type TranslationGenerator<ENUM extends number = UiTranslation, A extends any[] = []> = Translation | ENUM | ISerializedTranslation | ((...args: A) => IStringSection[] | Translation | ENUM | ISerializedTranslation | undefined);
94
94
  export interface IBox {
95
95
  left: number;
96
96
  top: number;
@@ -24,7 +24,6 @@ import type TooltipLocationHandler from "ui/tooltip/TooltipLocationHandler";
24
24
  import type { IDraggableEvents } from "ui/util/Draggable";
25
25
  import Draggable from "ui/util/Draggable";
26
26
  import Log from "utilities/Log";
27
- import type { IStringSection } from "utilities/string/Interpolator";
28
27
  /**
29
28
  * The positions of each edge of the dialog. Stored as percentages.
30
29
  */
@@ -188,7 +187,7 @@ declare abstract class Dialog extends Component implements IDialog {
188
187
  /**
189
188
  * The name is displayed in the `Move To` context menu option, and in the `Switch With` options
190
189
  */
191
- getName(): Iterable<IStringSection> | Translation | UiTranslation | ISerializedTranslation | undefined;
190
+ getName(): Translation | UiTranslation | ISerializedTranslation | undefined;
192
191
  /**
193
192
  * Event handler for when this dialog is appended
194
193
  */
@@ -16,7 +16,7 @@ export default class BookDialog extends Dialog {
16
16
  private book?;
17
17
  private readonly text;
18
18
  constructor();
19
- getName(): import("../../../../../language/ITranslation").ISerializedTranslation | import("../../../../../language/impl/TranslationImpl").default | Iterable<import("../../../../../utilities/string/Interpolator").IStringSection> | import("../../../../../language/dictionary/UiTranslation").default | undefined;
19
+ getName(): import("../../../../../language/ITranslation").ISerializedTranslation | import("../../../../../language/impl/TranslationImpl").default | import("../../../../../language/dictionary/UiTranslation").default | undefined;
20
20
  openBook(item: Item): void;
21
21
  private getText;
22
22
  protected onInventoryItemRemove(_: any, itemOrItems: Item | Item[]): void;
@@ -17,7 +17,7 @@ export interface ISegmentApi extends Readonly<IInterpolationOptions> {
17
17
  interpolate(str: string, ...args: any[]): IStringSection[];
18
18
  interpolateString(str: string, ...args: any[]): string;
19
19
  with(options: IInterpolationOptions): ISegmentApi;
20
- formatValue(value: unknown): string | Iterable<IStringSection>;
20
+ formatValue(value: unknown): string | IStringSection[];
21
21
  }
22
22
  export interface IInterpolationOptions {
23
23
  formatNumbers?: boolean;
@@ -38,6 +38,7 @@ export interface IStringSection {
38
38
  stringOnly?: true;
39
39
  }
40
40
  export declare namespace IStringSection {
41
+ function is(value: unknown): value is IStringSection;
41
42
  function get(content?: string | IStringSection | Iterable<IStringSection>): Iterable<IStringSection>;
42
43
  }
43
44
  export interface IReferenceSection extends IStringSection {
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.0-beta.dev.20230427.1",
4
+ "version": "2.13.0-beta.dev.20230428.2",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",