@wayward/types 2.13.0-beta.dev.20230430.2 → 2.13.0-beta.dev.20230501.1

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.
@@ -26,7 +26,7 @@ import { TileUpdateType } from "game/IGame";
26
26
  import type { IContainer, ItemType } from "game/item/IItem";
27
27
  import type Item from "game/item/Item";
28
28
  import type Tile from "game/tile/Tile";
29
- import Message from "language/dictionary/Message";
29
+ import type TranslationImpl from "language/impl/TranslationImpl";
30
30
  import Translation from "language/Translation";
31
31
  export interface INPCEvents extends Events<Human> {
32
32
  /**
@@ -116,7 +116,7 @@ export default abstract class NPC extends Human<NPCType> {
116
116
  /**
117
117
  * @param timeSinceLastChat The time it's been since the human last chatted with this NPC, or false if it's the first time.
118
118
  */
119
- getGreeting(human: Human, timeSinceLastChat: number | false): Message | undefined;
119
+ getGreeting(human: Human, timeSinceLastChat: number | false): TranslationImpl | undefined;
120
120
  getDefaultInteraction(): number | undefined;
121
121
  isAlreadyInteracting(human: Human, interactType?: number): boolean;
122
122
  canInteract(human: Human, interactType?: number): IActionUsable | IActionNotUsable;
@@ -134,7 +134,7 @@ export default abstract class NPC extends Human<NPCType> {
134
134
  * Sets the default weightCapacity of an NPC (based on their equipment and starting items).
135
135
  */
136
136
  generateWeightCapacity(): void;
137
- getName(asKnownBy?: Human): import("../../../language/impl/TranslationImpl").default;
137
+ getName(asKnownBy?: Human): TranslationImpl;
138
138
  /**
139
139
  * The name of the npc - called when created
140
140
  */
@@ -18,7 +18,7 @@ import NPC from "game/entity/npc/NPC";
18
18
  import type { IContainer } from "game/item/IItem";
19
19
  import { ItemType } from "game/item/IItem";
20
20
  import type Item from "game/item/Item";
21
- import Message from "language/dictionary/Message";
21
+ import type TranslationImpl from "language/impl/TranslationImpl";
22
22
  export interface IMerchantBuyPrice {
23
23
  base: number;
24
24
  bonus: number;
@@ -40,7 +40,7 @@ export default class MerchantNPC extends NPC {
40
40
  getPublicContainer(): IContainer | undefined;
41
41
  getSellPrice(human: Human, item: Item): number | undefined;
42
42
  getBuyPrice(human: Human, item: Item): IMerchantBuyPrice | undefined;
43
- getGreeting(human: Human, timeSinceLastChat: number | false): Message | undefined;
43
+ getGreeting(human: Human, timeSinceLastChat: number | false): TranslationImpl | undefined;
44
44
  canInteract(human: Human): IActionUsable | IActionNotUsable;
45
45
  interact(action: IActionHandlerApi<Human>, interactType?: number | undefined): void;
46
46
  /**
@@ -48,7 +48,7 @@ export default class MerchantNPC extends NPC {
48
48
  */
49
49
  closeContainerDialogs(): void;
50
50
  protected getReputationChangeOnDeath(): number;
51
- protected getDefaultName(): import("../../../../language/impl/TranslationImpl").default;
51
+ protected getDefaultName(): TranslationImpl;
52
52
  protected initializeStats(): void;
53
53
  protected getDefaultEquipment(equipType: EquipType): Item | ItemType | undefined;
54
54
  protected getDefaultInventory(): Array<Item | ItemType>;
@@ -21,7 +21,7 @@ import type { IContainer } from "game/item/IItem";
21
21
  import { ItemType } from "game/item/IItem";
22
22
  import type Item from "game/item/Item";
23
23
  import type Tile from "game/tile/Tile";
24
- import Message from "language/dictionary/Message";
24
+ import type TranslationImpl from "language/impl/TranslationImpl";
25
25
  import type { IVector2 } from "utilities/math/IVector";
26
26
  interface IShipTarget {
27
27
  islandId: IslandId;
@@ -33,7 +33,7 @@ export default class ShipperNPC extends NPC {
33
33
  constructor(options?: INPCConstructorOptions);
34
34
  spawn(): void;
35
35
  getActions(): ActionType[] | undefined;
36
- getGreeting(human: Human, timeSinceLastChat: number | false): Message | undefined;
36
+ getGreeting(human: Human, timeSinceLastChat: number | false): TranslationImpl | undefined;
37
37
  getDefaultInteraction(): number | undefined;
38
38
  canInteract(human: Human, interactType: number): IActionUsable | IActionNotUsable;
39
39
  interact(action: IActionHandlerApi<Human>, interactType: ShipperNPCInteractType): void;
@@ -44,7 +44,7 @@ export default class ShipperNPC extends NPC {
44
44
  canSailTo(x: number, y: number): boolean;
45
45
  getPublicContainer(): IContainer | undefined;
46
46
  protected getReputationChangeOnDeath(): number;
47
- protected getDefaultName(): import("../../../../language/impl/TranslationImpl").default;
47
+ protected getDefaultName(): TranslationImpl;
48
48
  protected initializeStats(): void;
49
49
  protected getDefaultEquipment(equipType: EquipType): Item | ItemType | undefined;
50
50
  protected getDefaultInventory(): Array<Item | ItemType>;
@@ -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 | import("../../utilities/string/Interpolator").IStringSection[] | import("../../language/dictionary/UiTranslation").default | undefined) | InfoProvider)[];
166
+ get(): (import("../../language/impl/TranslationImpl").default | import("../../language/ITranslation").ISerializedTranslation | import("../../language/dictionary/UiTranslation").default | (() => import("../../language/impl/TranslationImpl").default | import("../../language/ITranslation").ISerializedTranslation | 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;
@@ -153,7 +153,7 @@ declare module Translation {
153
153
  translation?(translation: TranslationImpl | ISerializedTranslation): any;
154
154
  argument?(argument: TranslationArg): TranslationArg;
155
155
  }
156
- function upgrade(translation: ISerializedTranslation, id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: ITranslationUpgrader): ISerializedTranslation | TranslationImpl;
156
+ function upgrade(translation: ISerializedTranslation, id: `${keyof typeof Dictionary}:${string}`, dictionary: Dictionary, entry: number, upgrader?: ITranslationUpgrader): TranslationImpl | ISerializedTranslation;
157
157
  function upgradeTranslationArgument(argument: TranslationArg, id: string, dictionary: Dictionary, entry: number, upgrader?: ITranslationUpgrader): TranslationArg;
158
158
  }
159
159
  export default Translation;
@@ -12,8 +12,9 @@ import { LobbyType } from "@hosts/shared/interfaces";
12
12
  import type { ICharacter } from "game/entity/IHuman";
13
13
  import type { PlayerState } from "game/entity/player/IPlayer";
14
14
  import type Player from "game/entity/player/Player";
15
- import type { ISynchronizeState } from "game/IGame";
15
+ import type { ISynchronizeState, PauseSource } from "game/IGame";
16
16
  import { TurnMode } from "game/IGame";
17
+ import type { Load } from "game/meta/Loading";
17
18
  import type { Milestone } from "game/milestones/IMilestone";
18
19
  import type { GameMode, IGameOptions } from "game/options/IGameOptions";
19
20
  import type { IMatchmakingInfo } from "multiplayer/matchmaking/IMatchmaking";
@@ -213,3 +214,15 @@ export interface IJoinServerOptions {
213
214
  automaticallyRetry: boolean;
214
215
  enableSteamNetworkConnections: boolean;
215
216
  }
217
+ export interface IMultiplayerRunSafelyOptions {
218
+ isSynced: boolean;
219
+ pauseGame?: PauseSource;
220
+ pauseIncomingPacketProcessing?: boolean;
221
+ showLoadingScreen?: {
222
+ load: Load;
223
+ args?: any[];
224
+ excludeTargets?: PacketTarget;
225
+ disableDelayAfter?: boolean;
226
+ hostInitiatesHide?: boolean;
227
+ };
228
+ }
@@ -11,7 +11,7 @@
11
11
  import EventEmitter from "event/EventEmitter";
12
12
  import Player from "game/entity/player/Player";
13
13
  import type Island from "game/island/Island";
14
- import type { IJoinServerOptions, IMultiplayerEvents, IMultiplayerOptions, PacketTarget, ServerInfo } from "multiplayer/IMultiplayer";
14
+ import type { IJoinServerOptions, IMultiplayerEvents, IMultiplayerOptions, IMultiplayerRunSafelyOptions, PacketTarget, ServerInfo } from "multiplayer/IMultiplayer";
15
15
  import { DisconnectReason, JoinServerRetryReason, MultiplayerSyncCheck, MultiplayerSyncCheckLevel, UnableToJoinReason } from "multiplayer/IMultiplayer";
16
16
  import type { IMatchmakingInfo } from "multiplayer/matchmaking/IMatchmaking";
17
17
  import type { IConnection } from "multiplayer/networking/IConnection";
@@ -146,10 +146,14 @@ export default class Multiplayer extends EventEmitter.Host<IMultiplayerEvents> {
146
146
  markCurrentProcessingPacket(packetId: number, processing: boolean): void;
147
147
  clearSyncPacketWaiting(packet: IPacket, wait: number): void;
148
148
  clearSyncPacketsWaiting(waitId?: string): void;
149
- pauseIncomingPacketProcessing(pause: boolean, clearQueue?: boolean): void;
149
+ private pauseIncomingPacketProcessing;
150
+ /**
151
+ * Execute an async function while applying some temporary state changes
152
+ */
153
+ runSafely<T = void>(executor: () => Promise<T>, options: IMultiplayerRunSafelyOptions): Promise<T>;
150
154
  updatePlayerId(oldPid: number, newPid: number): void;
151
155
  suppressSyncChecks(suppress: boolean): void;
152
- syncGameState(): void;
156
+ syncGameState(): Promise<void>;
153
157
  isKeepAliveTimeoutPaused(): boolean;
154
158
  pauseKeepAliveTimeouts(): void;
155
159
  resumeKeepAliveTimeouts(): void;
@@ -16,5 +16,5 @@ export default class ConnectPacket extends ServerPacket {
16
16
  getDebugInfo(): string;
17
17
  getAllowedStates(): ConnectionState;
18
18
  isAllowedWhenPaused(): boolean;
19
- process(): void;
19
+ process(): Promise<void>;
20
20
  }
@@ -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 | import("../../../../../language/dictionary/UiTranslation").default | undefined;
19
+ getName(): import("../../../../../language/impl/TranslationImpl").default | import("../../../../../language/ITranslation").ISerializedTranslation | 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;
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.20230430.2",
4
+ "version": "2.13.0-beta.dev.20230501.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",