@wayward/types 2.11.1-beta.dev.20211231.1 → 2.11.1-beta.dev.20220103.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.
@@ -17,7 +17,7 @@ import { Delay, SkillType } from "game/entity/IHuman";
17
17
  import type { TurnType } from "game/entity/player/IPlayer";
18
18
  import type Player from "game/entity/player/Player";
19
19
  import type { IGameEvents, IPlayOptions, ISynchronizeState } from "game/IGame";
20
- import { SaveType, TickFlag, TurnMode } from "game/IGame";
20
+ import { SaveType, TickFlag, TurnMode, PauseSource } from "game/IGame";
21
21
  import type Island from "game/island/Island";
22
22
  import IslandManager from "game/island/IslandManager";
23
23
  import type { MultiplayerLoadingDescription } from "game/meta/Loading";
@@ -25,6 +25,8 @@ import type { Milestone } from "game/milestones/IMilestone";
25
25
  import type { IGameOptions } from "game/options/IGameOptions";
26
26
  import { GameMode } from "game/options/IGameOptions";
27
27
  import type { ChallengeModifiersCollection } from "game/options/modifiers/challenge/ChallengeModifiers";
28
+ import type { GameplayModifiersCollection } from "game/options/modifiers/GameplayModifiersManager";
29
+ import type MilestoneModifier from "game/options/modifiers/milestone/MilestoneModifier";
28
30
  import ReferenceManager from "game/reference/ReferenceManager";
29
31
  import TimeManager from "game/time/TimeManager";
30
32
  import VotingManager from "game/VotingManager";
@@ -59,7 +61,7 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
59
61
  readonly interval = 16.6666;
60
62
  slot: number | undefined;
61
63
  absoluteTime: number;
62
- paused: boolean;
64
+ paused: Set<PauseSource>;
63
65
  playing: boolean;
64
66
  nextTickTime: number | undefined;
65
67
  lastTickTime: number | undefined;
@@ -70,7 +72,7 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
70
72
  mapSizeSq: number;
71
73
  readonly itemStylesheetHandler: ItemStylesheetHandler | undefined;
72
74
  readonly voting: VotingManager;
73
- readonly milestonesCollection: import("./options/modifiers/GameplayModifiersManager").GameplayModifiersCollection<import("./options/modifiers/milestone/MilestoneModifier").default, Milestone, import("./options/modifiers/milestone/MilestoneModifier").MilestoneModifierInstance, []>;
75
+ milestonesCollection?: GameplayModifiersCollection<MilestoneModifier, Milestone>;
74
76
  challengeCollection?: ChallengeModifiersCollection;
75
77
  debugRenderer: ITextureDebugRenderer | undefined;
76
78
  webGlContext: WebGlContext | undefined;
@@ -82,6 +84,8 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
82
84
  private gameOptionsCached?;
83
85
  private synchronizeStateId;
84
86
  protected stringTokenizer: StringTokenizer | undefined;
87
+ toString(): string;
88
+ get isPaused(): boolean;
85
89
  initializeRenderer(): void;
86
90
  globalSlotReady(): void;
87
91
  /**
@@ -96,7 +100,7 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
96
100
  resetWebGL(): void;
97
101
  setGlContextSize(width: number, height: number): void;
98
102
  resizeRenderer(): void;
99
- setPaused(paused: boolean, showChatMessage?: boolean): void;
103
+ setPaused(pause: boolean, source: PauseSource): void;
100
104
  gameLogicLoop: () => void;
101
105
  isSimulatedOrRealTimeMode(): boolean;
102
106
  getTurnMode(): TurnMode;
@@ -205,6 +205,18 @@ export declare enum CreationId {
205
205
  Item = 4,
206
206
  TileEvent = 5
207
207
  }
208
+ export declare enum PauseSource {
209
+ /**
210
+ * Used for pauses that the player will be able to turn on / off / override
211
+ */
212
+ Generic = 0,
213
+ IslandLoad = 1,
214
+ Mod = 2,
215
+ PlayerMoveToIsland = 3,
216
+ SyncGameState = 4,
217
+ WebGlContextLost = 5,
218
+ MultiplayerConnect = 6
219
+ }
208
220
  /**
209
221
  * For items and terrain that can decay, the temperature range that controls the rate of decay.
210
222
  * If not provided for items, they will always decays no matter the temperature.
@@ -105,6 +105,7 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
105
105
  modifiersCollection?: IslandModifiersCollection;
106
106
  details?: IIslandDetails;
107
107
  constructor(position?: IVector2, seed?: number);
108
+ toString(): string;
108
109
  private registerMemoryLeakDetector;
109
110
  preSerializeObject(serializer: ISerializer): void;
110
111
  onUnserialized(): void;
@@ -201,7 +202,7 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
201
202
  * @param z The z coord to get the closest player.
202
203
  * @param canSee If set to true, check if the player can see the x/y/z coords. Defaults to false.
203
204
  */
204
- getNearestPlayer(x: number, y: number, z?: number, canSee?: boolean, includeConnecting?: boolean): {
205
+ getNearestPlayer(x: number, y: number, z?: number, canSee?: boolean, includeGhosts?: boolean, includeConnecting?: boolean): {
205
206
  player?: Player;
206
207
  distance?: number;
207
208
  };
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type GameplayModifier from "game/options/modifiers/GameplayModifier";
12
12
  import type { GameplayModifierInstance, GetModifierId, GetModifierInstance, GetModifierInstanceArgs } from "game/options/modifiers/GameplayModifier";
13
+ import type { StringableObject } from "utilities/object/Objects";
13
14
  export default abstract class GameplayModifiersManager<MODIFIER extends GameplayModifier<number, GameplayModifierInstance<number>, any[]>, ID extends GetModifierId<MODIFIER> = GetModifierId<MODIFIER>, INSTANCE_ARGS extends GetModifierInstanceArgs<MODIFIER> = GetModifierInstanceArgs<MODIFIER>> {
14
15
  private readonly enumObject;
15
16
  private readonly classes;
@@ -26,8 +27,8 @@ export declare class GameplayModifiersCollection<MODIFIER extends GameplayModifi
26
27
  protected readonly args: INSTANCE_ARGS;
27
28
  constructor(manager: GameplayModifiersManager<MODIFIER>, ...args: INSTANCE_ARGS);
28
29
  hasAny(): boolean;
29
- initialize(id: ID): INSTANCE | undefined;
30
- uninitialize(): void;
30
+ initialize(source: StringableObject, ids: Iterable<ID>): INSTANCE[];
31
+ uninitialize(source: StringableObject): void;
31
32
  options(): import("@wayward/goodstream").default<import("../IGameOptions").IGameOptionsPartial>;
32
33
  initialized(): IterableIterator<ID>;
33
34
  }
@@ -15,6 +15,7 @@ import type Tooltip from "ui/tooltip/Tooltip";
15
15
  export declare const EXCLUSIVE_MODIFIERS: Challenge[][];
16
16
  declare class ChallengeModifiersManager extends GameplayModifiersManager<ChallengeModifier> {
17
17
  constructor();
18
+ toString(): string;
18
19
  createCollection(seed?: number): ChallengeModifiersCollection;
19
20
  }
20
21
  declare const _default: ChallengeModifiersManager;
@@ -74,31 +74,32 @@ export declare enum MultiplayerSyncCheck {
74
74
  Merchant = 36,
75
75
  MilestoneSeed = 37,
76
76
  Misc = 38,
77
- MoveToTile = 39,
78
- PenaltyFieldHashCode = 40,
79
- PlaceOnTile = 41,
80
- PlayerManager = 42,
81
- PlayerPositions = 43,
82
- Players = 44,
83
- PlayerSetup = 45,
84
- Random = 46,
85
- Reputation = 47,
86
- Seed = 48,
87
- SeededGenerator = 49,
88
- SkillGain = 50,
89
- StaminaChanges = 51,
90
- StatChange = 52,
91
- Stats = 53,
92
- StatusChange = 54,
93
- StatusEffect = 55,
94
- SyncChecks = 56,
95
- TemperatureManager = 57,
96
- Temporary = 58,
97
- Tick = 59,
98
- TileEvent = 60,
99
- Time = 61,
100
- UpdateDirection = 62,
101
- Weight = 63
77
+ Modifier = 39,
78
+ MoveToTile = 40,
79
+ PenaltyFieldHashCode = 41,
80
+ PlaceOnTile = 42,
81
+ PlayerManager = 43,
82
+ PlayerPositions = 44,
83
+ Players = 45,
84
+ PlayerSetup = 46,
85
+ Random = 47,
86
+ Reputation = 48,
87
+ Seed = 49,
88
+ SeededGenerator = 50,
89
+ SkillGain = 51,
90
+ StaminaChanges = 52,
91
+ StatChange = 53,
92
+ Stats = 54,
93
+ StatusChange = 55,
94
+ StatusEffect = 56,
95
+ SyncChecks = 57,
96
+ TemperatureManager = 58,
97
+ Temporary = 59,
98
+ Tick = 60,
99
+ TileEvent = 61,
100
+ Time = 62,
101
+ UpdateDirection = 63,
102
+ Weight = 64
102
103
  }
103
104
  export declare const maxPlayers = 32;
104
105
  export declare const packetTickRate = 16;
@@ -8,10 +8,11 @@
8
8
  * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide:
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
+ import { PauseSource } from "game/IGame";
11
12
  import ClientPacket from "multiplayer/packets/ClientPacket";
12
13
  export default class PausePacket extends ClientPacket {
13
14
  paused: boolean;
14
- showChatMessage: boolean;
15
+ pauseSource: PauseSource;
15
16
  getDebugInfo(): string;
16
17
  process(): void;
17
18
  }
@@ -26,61 +26,62 @@ export declare enum LogSource {
26
26
  FileDataStorage = 13,
27
27
  FlowFieldManager = 14,
28
28
  Game = 15,
29
- GarbageCollection = 16,
30
- HookManager = 17,
31
- IndexedDBDataStorage = 18,
32
- Input = 19,
33
- InputManager = 20,
34
- InterModRegistryManager = 21,
35
- Island = 22,
36
- ItemManager = 23,
37
- ItemReference = 24,
38
- ItemStylesheet = 25,
39
- Languages = 26,
40
- Loading = 27,
41
- LocalStorageDataStorage = 28,
42
- MapGen = 29,
43
- Matchmaking = 30,
44
- MatchmakingServer = 31,
45
- MemoryLeakDetector = 32,
46
- Message = 33,
47
- Mod = 34,
48
- Mods = 35,
49
- Multiplayer = 36,
50
- NPC = 37,
51
- NPCManager = 38,
52
- OldUi = 39,
53
- Packet = 40,
54
- Player = 41,
55
- PlayerManager = 42,
56
- Prompts = 43,
57
- Reflow = 44,
58
- Renderer = 45,
59
- ReplayManager = 46,
60
- ResourceLoader = 47,
61
- SaveManager = 48,
62
- Serializer = 49,
63
- Shaders = 50,
64
- SoundEffect = 51,
65
- SpritePack = 52,
66
- SshCommandManager = 53,
67
- SshServer = 54,
68
- Steamworks = 55,
69
- StringTokenizer = 56,
70
- TemperatureManager = 57,
71
- TileEventManager = 58,
72
- TileUpdate = 59,
73
- Timer = 60,
74
- Trello = 61,
75
- Ui = 62,
76
- Utilities = 63,
77
- WebAssembly = 64,
78
- WebGlContext = 65,
79
- WebRTCConnection = 66,
80
- WebSocketConnection = 67,
81
- World = 68,
82
- WorldLayerRenderer = 69,
83
- WorldRenderer = 70
29
+ GameplayModifier = 16,
30
+ GarbageCollection = 17,
31
+ HookManager = 18,
32
+ IndexedDBDataStorage = 19,
33
+ Input = 20,
34
+ InputManager = 21,
35
+ InterModRegistryManager = 22,
36
+ Island = 23,
37
+ ItemManager = 24,
38
+ ItemReference = 25,
39
+ ItemStylesheet = 26,
40
+ Languages = 27,
41
+ Loading = 28,
42
+ LocalStorageDataStorage = 29,
43
+ MapGen = 30,
44
+ Matchmaking = 31,
45
+ MatchmakingServer = 32,
46
+ MemoryLeakDetector = 33,
47
+ Message = 34,
48
+ Mod = 35,
49
+ Mods = 36,
50
+ Multiplayer = 37,
51
+ NPC = 38,
52
+ NPCManager = 39,
53
+ OldUi = 40,
54
+ Packet = 41,
55
+ Player = 42,
56
+ PlayerManager = 43,
57
+ Prompts = 44,
58
+ Reflow = 45,
59
+ Renderer = 46,
60
+ ReplayManager = 47,
61
+ ResourceLoader = 48,
62
+ SaveManager = 49,
63
+ Serializer = 50,
64
+ Shaders = 51,
65
+ SoundEffect = 52,
66
+ SpritePack = 53,
67
+ SshCommandManager = 54,
68
+ SshServer = 55,
69
+ Steamworks = 56,
70
+ StringTokenizer = 57,
71
+ TemperatureManager = 58,
72
+ TileEventManager = 59,
73
+ TileUpdate = 60,
74
+ Timer = 61,
75
+ Trello = 62,
76
+ Ui = 63,
77
+ Utilities = 64,
78
+ WebAssembly = 65,
79
+ WebGlContext = 66,
80
+ WebRTCConnection = 67,
81
+ WebSocketConnection = 68,
82
+ World = 69,
83
+ WorldLayerRenderer = 70,
84
+ WorldRenderer = 71
84
85
  }
85
86
  export declare enum LogLineType {
86
87
  Debug = 0,
@@ -12,7 +12,7 @@
12
12
  import type { Stat } from "../../game/game/entity/IStats";
13
13
  import { Direction } from "../../game/utilities/math/Direction";
14
14
  import type { Random, SeededGenerator } from "../../game/utilities/random/Random";
15
- import type { IDedicatedServerGameOptions, INewGameOptions } from "../interfaces";
15
+ import type { IDedicatedServerGameOptions, IJoinServerOptions, INewGameOptions } from "../interfaces";
16
16
  import type { IslandId } from "../../game/game/island/IIsland";
17
17
  import ApplicationDom from "./applicationDom";
18
18
  import ApplicationLogger from "./applicationLogger";
@@ -67,8 +67,7 @@ export default class ApplicationInteractions {
67
67
  waitForGameEndScreen(isWinner: boolean): Promise<void>;
68
68
  returnToTitleScreen(): Promise<void>;
69
69
  getServerGameCode(): Promise<string>;
70
- joinMultiplayerServer(gameCode: string): Promise<void>;
71
- joinMultiplayerDedicatedServer(gameCode: string): Promise<void>;
70
+ joinMultiplayerServer(gameCode: string, options: IJoinServerOptions, isDedicatedServer: boolean): Promise<void>;
72
71
  pauseGame(): Promise<void>;
73
72
  unpauseGame(): Promise<void>;
74
73
  moveToIslandId(islandId: IslandId): Promise<void>;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type Player from "../../game/game/entity/player/Player";
12
12
  import { Direction } from "../../game/utilities/math/Direction";
13
- import type { INewGameOptions } from "../interfaces";
13
+ import type { IJoinServerOptions, INewGameOptions } from "../interfaces";
14
14
  import type { IDifferences } from "../../game/utilities/object/JsonHelper";
15
15
  import type Application from "./application";
16
16
  import type { ITestState } from "./application";
@@ -65,12 +65,13 @@ export declare class Apps {
65
65
  createMultiplayerGame(options: Omit<INewGameOptions, "playMode">): Promise<void>;
66
66
  setClientJoinIsland(x: number, y: number): Promise<void>;
67
67
  getServerGameCode(): Promise<string>;
68
- joinServer(...apps: Application[]): Promise<void>;
68
+ joinServer(options: IJoinServerOptions, ...apps: Application[]): Promise<void>;
69
69
  leaveServer(...apps: Application[]): Promise<void>;
70
70
  returnToTitleScreen(): Promise<void>;
71
71
  waitUntilLoadingIsFinished(): Promise<void>;
72
72
  randomInput(count: number): Promise<void>;
73
73
  moveToTowardsIsland(app: Application, direction: Direction.Cardinal, recoverStats?: boolean): Promise<void>;
74
+ recoverStats(app: Application): Promise<void>;
74
75
  moveAndVerifyTicks(app: Application, direction: Direction.Cardinal): Promise<void>;
75
76
  waitForClientConsistency(): Promise<void>;
76
77
  sailToCivilization(winnerApp: Application): Promise<void>;
@@ -18,6 +18,10 @@ export interface INewGameOptions extends ICommonGameOptions {
18
18
  reuseCharacter?: boolean;
19
19
  }
20
20
  export declare type IDedicatedServerGameOptions = ICommonGameOptions;
21
+ export interface IJoinServerOptions {
22
+ joinProgrammatically: boolean;
23
+ enableAllMilestoneModifiers?: boolean;
24
+ }
21
25
  export declare enum GameMode {
22
26
  Hardcore = "Hardcore Mode",
23
27
  Casual = "Casual Mode",
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.11.1-beta.dev.20211231.1",
4
+ "version": "2.11.1-beta.dev.20220103.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -12,7 +12,8 @@
12
12
  "removeComments": true,
13
13
  "strict": true,
14
14
  "strictPropertyInitialization": false,
15
- "moduleResolution": "node",
15
+ // classic is required for auto imports to use the shortest path in vscode
16
+ "moduleResolution": "classic",
16
17
  "paths": {
17
18
  "*": [
18
19
  "node_modules/@wayward/types/definitions/game/*"
@@ -22,6 +23,15 @@
22
23
  ],
23
24
  "@hosts/*": [
24
25
  "node_modules/@wayward/types/definitions/hosts/*"
26
+ ],
27
+ // required when using classic module resolution
28
+ "@wayward/goodstream": [
29
+ "node_modules/@wayward/goodstream/Stream",
30
+ "node_modules/@wayward/types/node_modules/@wayward/goodstream/Stream"
31
+ ],
32
+ "@wayward/goodstream/*": [
33
+ "node_modules/@wayward/goodstream/*",
34
+ "node_modules/@wayward/types/node_modules/@wayward/goodstream/*"
25
35
  ]
26
36
  },
27
37
  "types": [],