@wayward/types 2.13.2-beta.dev.20230603.1 → 2.13.2-beta.dev.20230604.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.
@@ -36,6 +36,7 @@ import "utilities/typesglobal/Iterables";
36
36
  import "utilities/typesglobal/Misc";
37
37
  import "utilities/typesglobal/Objects";
38
38
  import "utilities/typesglobal/Types";
39
+ import type Version from "utilities/Version";
39
40
  declare global {
40
41
  let audio: WAudio | undefined;
41
42
  let game: Game;
@@ -50,7 +51,7 @@ declare global {
50
51
  let saveData: SaveData;
51
52
  let saveDataGlobal: SaveDataGlobal;
52
53
  let ui: Ui;
53
- const gameVersion: string;
54
+ const gameVersion: Version.String;
54
55
  const gameVersionStage: string;
55
56
  const gameVersionMajor: number;
56
57
  const gameVersionMinor: number;
@@ -49,6 +49,7 @@ import { Uninit } from "Uninit";
49
49
  import type { IVector2 } from "utilities/math/IVector";
50
50
  import type { Random } from "utilities/random/Random";
51
51
  import type { IVersionInfo } from "utilities/Version";
52
+ import Version from "utilities/Version";
52
53
  import { WebWorkerManager } from "webWorker/WebWorkerManager";
53
54
  export declare class Game extends EventEmitter.Host<IGameEvents> {
54
55
  get isChallenge(): boolean;
@@ -57,7 +58,7 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
57
58
  difficulty: GameMode;
58
59
  gameplayModifierData: Record<number, any>;
59
60
  replay: ReplayManager | undefined;
60
- saveVersion: string;
61
+ saveVersion: Version.String;
61
62
  shouldUpdateTablesAndWeight: boolean;
62
63
  tickSpeed: number;
63
64
  time: TimeManager;
@@ -68,7 +69,7 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
68
69
  /**
69
70
  * The version the save was originally created on
70
71
  */
71
- version: string;
72
+ version: Version.String;
72
73
  readonly interval = 16.6666;
73
74
  readonly autoSave: AutoSave;
74
75
  readonly commandManager: CommandManager;
@@ -30,6 +30,7 @@ import type { IReplayLogEntry } from "replay/IReplayLogEntry";
30
30
  import type { IHighscoreOld, IOptions } from "save/data/ISaveDataGlobal";
31
31
  import type { IVector2, IVector3 } from "utilities/math/IVector";
32
32
  import type { IRange } from "utilities/math/Range";
33
+ import type Version from "utilities/Version";
33
34
  export interface IGameEvents {
34
35
  /**
35
36
  * Called when the game is starting
@@ -128,7 +129,7 @@ export type IGameOld = Partial<Game> & Partial<{
128
129
  monsters: Creature[];
129
130
  tamedCreatures: number[];
130
131
  options: IOptions;
131
- lastPlayedVersion: string | undefined;
132
+ lastPlayedVersion: Version.String | undefined;
132
133
  highscores: IHighscoreOld[];
133
134
  playedCount: number;
134
135
  dailyChallenge: boolean;
@@ -275,8 +275,8 @@ export declare enum DoodadType {
275
275
  Cotton = 26,
276
276
  PricklyPears = 27,
277
277
  Tumbleweed = 28,
278
- GraniteWaterStill = 29,
279
- LitGraniteWaterStill = 30,
278
+ TinWaterStill = 29,
279
+ LitTinWaterStill = 30,
280
280
  GraniteCampfire = 31,
281
281
  LitGraniteCampfire = 32,
282
282
  SandstoneKiln = 33,
@@ -301,14 +301,14 @@ export declare enum DoodadType {
301
301
  LitClayCampfire = 52,
302
302
  ClayFurnace = 53,
303
303
  LitClayFurnace = 54,
304
- ClayWaterStill = 55,
305
- LitClayWaterStill = 56,
304
+ CopperWaterStill = 55,
305
+ LitCopperWaterStill = 56,
306
306
  SandstoneCampfire = 57,
307
307
  LitSandstoneCampfire = 58,
308
308
  SandstoneFurnace = 59,
309
309
  LitSandstoneFurnace = 60,
310
- SandstoneWaterStill = 61,
311
- LitSandstoneWaterStill = 62,
310
+ WroughtIronWaterStill = 61,
311
+ LitWroughtIronWaterStill = 62,
312
312
  GraniteKiln = 63,
313
313
  LitGraniteKiln = 64,
314
314
  WroughtIronAnvil = 65,
@@ -384,8 +384,8 @@ export declare enum DoodadType {
384
384
  BronzeMinecart = 135,
385
385
  BasaltWall = 136,
386
386
  SetBasaltDeadfall = 137,
387
- BasaltWaterStill = 138,
388
- LitBasaltWaterStill = 139,
387
+ IronWaterStill = 138,
388
+ LitIronWaterStill = 139,
389
389
  BasaltCampfire = 140,
390
390
  LitBasaltCampfire = 141,
391
391
  BasaltFurnace = 142,
@@ -411,7 +411,9 @@ export declare enum DoodadType {
411
411
  GraniteDripstone = 162,
412
412
  SandstoneDripstone = 163,
413
413
  BasaltDripstone = 164,
414
- ClayDripstone = 165
414
+ ClayDripstone = 165,
415
+ BronzeWaterStill = 166,
416
+ LitBronzeWaterStill = 167
415
417
  }
416
418
  export declare enum DoodadTypeExtra {
417
419
  None = 999,
@@ -450,7 +452,8 @@ export declare enum DoodadTypeGroup {
450
452
  Lighthouse = 416,
451
453
  LitLighthouse = 417,
452
454
  Dripstone = 418,
453
- Last = 419
455
+ WaterStill = 419,
456
+ Last = 420
454
457
  }
455
458
  export declare enum DoorOrientation {
456
459
  Default = 0,
@@ -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/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)[];
166
+ get(): (import("../../language/impl/TranslationImpl").default | import("../../language/dictionary/UiTranslation").default | import("../../language/ITranslation").ISerializedTranslation | (() => import("../../language/impl/TranslationImpl").default | import("../../language/dictionary/UiTranslation").default | import("../../language/ITranslation").ISerializedTranslation | import("../../utilities/string/Interpolator").IStringSection[] | undefined) | InfoProvider)[];
167
167
  add(...translations: Array<TranslationGenerator | InfoProvider | Falsy>): this;
168
168
  onlyIfHasContents(): this | undefined;
169
169
  addInfoGetter(provider: () => InfoProvider | undefined): this;
@@ -44,6 +44,7 @@ import TimeManager from "game/time/TimeManager";
44
44
  import Translation from "language/Translation";
45
45
  import World from "renderer/world/World";
46
46
  import type { IPostSerializeCallback, IPreSerializeCallback, ISerializer } from "save/serializer/ISerializer";
47
+ import type Version from "utilities/Version";
47
48
  import type { IVersionInfo } from "utilities/Version";
48
49
  import { Direction } from "utilities/math/Direction";
49
50
  import type { IVector2, IVector3 } from "utilities/math/IVector";
@@ -75,14 +76,14 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
75
76
  readonly time: TimeManager;
76
77
  readonly world: World;
77
78
  saveBuildTime?: number;
78
- saveVersion: string;
79
+ saveVersion: Version.String;
79
80
  biomeType: BiomeTypes;
80
81
  civilizationScore: number;
81
82
  civilizationScoreTiles: Record<number, number>;
82
83
  contaminatedWater: IWaterContamination[];
83
84
  creatureSpawnTimer: number;
84
85
  loadCount: number;
85
- mapGenVersion: string;
86
+ mapGenVersion: Version.String;
86
87
  name?: string;
87
88
  position: IVector2;
88
89
  readonly mapSize: number;
@@ -91,7 +92,7 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
91
92
  referenceId?: number;
92
93
  templateBiomeOptions: ITemplateBiomeOptions | undefined;
93
94
  tileContainers: ITileContainer[];
94
- version: string;
95
+ version: Version.String;
95
96
  tileData: SaferNumberIndexedObject<SaferNumberIndexedObject<SaferNumberIndexedObject<ITileData[]>>>;
96
97
  readonly seeds: ISeeds;
97
98
  readonly seededRandom: Random<LegacySeededGenerator | PCGSeededGenerator>;
@@ -899,7 +899,7 @@ export declare enum ItemType {
899
899
  WroughtIronTongs = 200,
900
900
  SheetOfGlass = 201,
901
901
  SolarStill = 202,
902
- GraniteWaterStill = 203,
902
+ TinWaterStill = 203,
903
903
  GraniteSundial = 204,
904
904
  LitTallowTorch = 205,
905
905
  Sinew = 206,
@@ -993,10 +993,10 @@ export declare enum ItemType {
993
993
  ClayKiln = 294,
994
994
  ClayCampfire = 295,
995
995
  ClayFurnace = 296,
996
- ClayWaterStill = 297,
996
+ CopperWaterStill = 297,
997
997
  SandstoneCampfire = 298,
998
998
  SandstoneFurnace = 299,
999
- SandstoneWaterStill = 300,
999
+ WroughtIronWaterStill = 300,
1000
1000
  GraniteKiln = 301,
1001
1001
  WroughtIronAnvil = 302,
1002
1002
  IronAnvil = 303,
@@ -1396,7 +1396,7 @@ export declare enum ItemType {
1396
1396
  BasaltHammer = 697,
1397
1397
  BasaltAnvil = 698,
1398
1398
  BasaltDeadfall = 699,
1399
- BasaltWaterStill = 700,
1399
+ IronWaterStill = 700,
1400
1400
  BasaltSundial = 701,
1401
1401
  BasaltBullet = 702,
1402
1402
  BasaltKnife = 703,
@@ -1453,7 +1453,8 @@ export declare enum ItemType {
1453
1453
  GraniteDripstone = 754,
1454
1454
  SandstoneDripstone = 755,
1455
1455
  BasaltDripstone = 756,
1456
- ClayDripstone = 757
1456
+ ClayDripstone = 757,
1457
+ BronzeWaterStill = 758
1457
1458
  }
1458
1459
  export declare enum ItemTypeExtra {
1459
1460
  None = 999,
@@ -14,9 +14,10 @@ import type Island from "game/island/Island";
14
14
  import type { MapGenVersions } from "game/mapgen/IMapGen";
15
15
  import type { ITemplate, TileTemplateType } from "game/tile/ITerrain";
16
16
  import type Tile from "game/tile/Tile";
17
+ import Version from "utilities/Version";
17
18
  export declare module MapGenHelpers {
18
- function pickBasedOnVersion<T>(version: string, versions: MapGenVersions<T>): {
19
- version: string;
19
+ function pickBasedOnVersion<T>(version: Version.String, versions: MapGenVersions<T>): {
20
+ version: Version.String;
20
21
  selection: T;
21
22
  };
22
23
  function startLoading(): Promise<void>;
@@ -8,6 +8,7 @@
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 type Version from "utilities/Version";
11
12
  export declare enum MultiplayerCompatibility {
12
13
  Clientside = "clientside",
13
14
  Serverside = "serverside",
@@ -23,7 +24,7 @@ export interface IModConfig {
23
24
  readonly unloadable?: boolean;
24
25
  readonly tags?: string[];
25
26
  readonly dependencies?: string[];
26
- readonly waywardVersion?: string;
27
+ readonly waywardVersion?: Version.StringSemVer;
27
28
  readonly multiplayer?: MultiplayerCompatibility;
28
29
  readonly languages?: string[];
29
30
  readonly stylesheets?: string[];
@@ -9,6 +9,7 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import type { SavePropertyFlag } from "save/serializer/ISerializer";
12
+ import type Version from "utilities/Version";
12
13
  export declare const SLOT_MIN = 0;
13
14
  export declare const SLOT_GLOBAL = -1;
14
15
  export declare const SLOT_MULTIPLAYER = -2;
@@ -38,7 +39,7 @@ export declare enum CompressionType {
38
39
  }
39
40
  export declare const defaultCompressionType = CompressionType.PakoDeflate;
40
41
  export interface ISaveObject {
41
- version: string;
42
+ version: Version.String;
42
43
  compressionType: CompressionType;
43
44
  data: Record<string, any>;
44
45
  }
@@ -48,8 +49,8 @@ export interface ISerializeProperty {
48
49
  enableStats?: boolean;
49
50
  skipCompression?: boolean;
50
51
  savePropertyFlag?: SavePropertyFlag;
51
- shouldSerialize?(version: string): boolean;
52
- shouldDeserialize?(version: string): boolean;
52
+ shouldSerialize?(version: Version.String): boolean;
53
+ shouldDeserialize?(version: Version.String): boolean;
53
54
  }
54
55
  export interface ISaveManagerEvents {
55
56
  /**
@@ -15,10 +15,11 @@ import type { IHighscore, IOptions } from "save/data/ISaveDataGlobal";
15
15
  import type { IDialogInfo } from "ui/old/IOldUi";
16
16
  import type { ISavedCharacter } from "ui/screen/screens/menu/menus/character/Character";
17
17
  import type EnumInfo from "utilities/enum/EnumInfo";
18
+ import type Version from "utilities/Version";
18
19
  export default class SaveDataGlobal {
19
20
  static defaultOptions: IOptions;
20
21
  gameCrafted: Record<number, ICrafted>;
21
- gameLastPlayedVersion: string;
22
+ gameLastPlayedVersion: Version.String;
22
23
  gameHighscores: IHighscore[];
23
24
  gamePlayedCount: number;
24
25
  options: IOptions;
@@ -9,9 +9,10 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import type { Game } from "game/Game";
12
+ import type Version from "utilities/Version";
12
13
  export interface ISerializer {
13
14
  readonly game: Game;
14
- readonly version: string;
15
+ readonly version: Version.String;
15
16
  readonly metadata: Map<SerializerMetadataKey, any>;
16
17
  readonly dataView: DataView;
17
18
  byteOffset: number;
@@ -33,7 +34,7 @@ export declare enum SerializerMetadataKey {
33
34
  StringStats = 3
34
35
  }
35
36
  export interface ISerializerOptions {
36
- version: string;
37
+ version: Version.String;
37
38
  includeFlags?: SavePropertyFlag;
38
39
  emptyObjectMode?: boolean;
39
40
  disableJitDeserialization?: boolean;
@@ -12,6 +12,7 @@ import type { Game } from "game/Game";
12
12
  import type { ISerializer, ISerializerOptions } from "save/serializer/ISerializer";
13
13
  import { SavePropertyFlag, SerializerMetadataKey, Types } from "save/serializer/ISerializer";
14
14
  import StringTokenizer from "save/serializer/StringTokenizer";
15
+ import type Version from "utilities/Version";
15
16
  export default class Serializer implements ISerializer {
16
17
  readonly game: Game;
17
18
  private readonly options;
@@ -23,7 +24,7 @@ export default class Serializer implements ISerializer {
23
24
  readonly metadata: Map<SerializerMetadataKey, any>;
24
25
  dataView: DataView;
25
26
  byteOffset: number;
26
- readonly version: string;
27
+ readonly version: Version.String;
27
28
  private readonly includeFlags;
28
29
  private readonly emptyObjectMode;
29
30
  private readonly disableJitDeserialization;
@@ -10,8 +10,8 @@
10
10
  */
11
11
  import type Player from "game/entity/player/Player";
12
12
  import type { Game } from "game/Game";
13
- import type { IVersionInfo } from "utilities/Version";
14
- export default function upgradePlayer(game: Game, player: Player, saveVersion: IVersionInfo, isLocalPlayer: boolean): string[];
13
+ import Version from "utilities/Version";
14
+ export default function upgradePlayer(game: Game, player: Player, saveVersion: Version.Info, isLocalPlayer: boolean): string[];
15
15
  /**
16
16
  * Called after loading item & tile references
17
17
  */
@@ -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/impl/TranslationImpl").default | import("../../../../../language/ITranslation").ISerializedTranslation | import("../../../../../language/dictionary/UiTranslation").default | undefined;
19
+ getName(): import("../../../../../language/impl/TranslationImpl").default | import("../../../../../language/dictionary/UiTranslation").default | import("../../../../../language/ITranslation").ISerializedTranslation | undefined;
20
20
  openBook(item: Item): void;
21
21
  private getText;
22
22
  protected onInventoryItemRemove(_: any, itemOrItems: Item | Item[]): void;
@@ -8,9 +8,10 @@
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 TranslationImpl from "language/impl/TranslationImpl";
11
12
  export interface IVersionInfo {
12
- str: string;
13
- strSemver: string;
13
+ str: Version.String;
14
+ strSemver: Version.StringSemVer;
14
15
  stage: "beta" | "release";
15
16
  major: number;
16
17
  minor: number;
@@ -23,28 +24,73 @@ export interface IVersionInfo {
23
24
  update?: number;
24
25
  }
25
26
  declare module Version {
27
+ export type Stage = "beta" | "release";
28
+ export type String = `${Stage}${bigint}.${bigint}.${bigint}` | `${Stage}${bigint}.${bigint}` | `${Stage}${bigint}`;
29
+ export type StringSemVer = `${bigint}.${bigint}.${bigint}-${Stage}` | `${bigint}.${bigint}.${bigint}`;
30
+ export type Month = "jan" | "feb" | "mar" | "apr" | "may" | "jun" | "jul" | "aug" | "sep" | "oct" | "nov" | "dec";
31
+ export type DateString = `${Month} ${bigint} ${bigint} ${bigint}:${bigint | "00"}`;
26
32
  export const versionInfoRegExp: RegExp;
27
33
  export const versionInfoRegExpSemver: RegExp;
28
34
  /**
29
35
  * Returns whether the given version is compatible with the game's version. This is used to check, for example,
30
36
  * if a mod is compatible with the game's version.
37
+ *
38
+ * - Compatible versions in "beta" stage require identical stage, major, minor, and a patch less than or equal to the current patch.
39
+ * - Compatible versions in "release" stage require identical stage and major, and a minor and patch less than or equal to the current minor and patch.
31
40
  */
32
- export function isCompatible(version: IVersionInfo | string): boolean;
41
+ export function isCompatible(version: IVersionInfo | Version.String | Version.StringSemVer): boolean;
33
42
  /**
34
43
  * Returns whether the given `version` is `atLeast` another version. This can be used, for example,
35
44
  * to see if a save or mod was created/edited after a specific thing was implemented.
36
45
  */
37
- export function isAtLeast(version: IVersionInfo | string, atLeast: IVersionInfo | string): boolean;
38
- export function create(stage: "beta" | "release", major: number, minor: number, patch?: number, date?: Date): IVersionInfo;
39
- export function getVersionInfo(version: string): IVersionInfo;
46
+ export function isAtLeast(version: IVersionInfo | Version.String | Version.StringSemVer, atLeast: IVersionInfo | Version.String | Version.StringSemVer): boolean;
47
+ /**
48
+ * Returns if `checkVersion` is older than `isBefore`
49
+ */
50
+ export function isBefore(checkVersion: IVersionInfo | Version.String | Version.StringSemVer, isBefore: IVersionInfo | Version.String | Version.StringSemVer): boolean;
51
+ export function createRawVersionInfo(stage: Version.Stage, major: number, minor: number, patch?: number, date?: Date): IVersionInfo;
52
+ export function convertStringToRawInfo(version: Version.String | Version.StringSemVer): IVersionInfo;
53
+ export function create(stage: Version.Stage, major: number, minor: number, patch?: number, date?: Date): Info;
54
+ export function getVersionInfo(version: IVersionInfo | Version.String | Version.StringSemVer): Info;
40
55
  export function isSameVersion(version: IVersionInfo, compareVersion: IVersionInfo): boolean;
41
- export function getVersionDisplayString(version?: string | IVersionInfo, development?: boolean): string;
42
- export function getUpdateDisplayString(version?: string | IVersionInfo): string | undefined;
56
+ export function getVersionDisplayTranslation(version?: Version.String | Version.StringSemVer | IVersionInfo, development?: boolean): TranslationImpl;
57
+ export function getUpdateDisplayTranslation(version?: Version.String | Version.StringSemVer | IVersionInfo): TranslationImpl | undefined;
43
58
  const timezones: {
44
59
  nz: string;
45
60
  build: string;
46
61
  };
47
- export function isBefore(date: Date, dateStr: `${string} ${number} ${number} ${number}:${number}`, timezone: keyof typeof timezones): boolean;
62
+ export function isTimeBefore(date: Date, dateStr: DateString, timezone: keyof typeof timezones): boolean;
63
+ export interface Info extends IVersionInfo {
64
+ }
65
+ export class Info {
66
+ constructor(info: IVersionInfo | Version.String | Version.StringSemVer);
67
+ /**
68
+ * Returns whether this version is compatible with the game's version. This is used to check, for example,
69
+ * if a mod is compatible with the game's version.
70
+ *
71
+ * - Compatible versions in "beta" stage require identical stage, major, minor, and a patch less than or equal to the current patch.
72
+ * - Compatible versions in "release" stage require identical stage and major, and a minor and patch less than or equal to the current minor and patch.
73
+ */
74
+ isCompatible(): boolean;
75
+ /**
76
+ * Returns whether this version is greater than or equal to the given version. This can be used, for example,
77
+ * to see if a save or mod was created/edited after a specific thing was implemented.
78
+ */
79
+ isAtLeast(version: IVersionInfo | Version.String | Version.StringSemVer): boolean;
80
+ /**
81
+ * Returns whether this version is older than the given version.
82
+ */
83
+ isBefore(version: IVersionInfo | Version.String | Version.StringSemVer): boolean;
84
+ /**
85
+ * Returns whether this version is older than the given build time.
86
+ *
87
+ * **Note:** Always returns `true` if this version object doesn't have a date set.
88
+ */
89
+ isBefore(dateStr: DateString, timezone: keyof typeof timezones): boolean;
90
+ equals(version: IVersionInfo | Version.String | Version.StringSemVer): boolean;
91
+ getTranslation(): TranslationImpl;
92
+ getUpdateTranslation(): TranslationImpl | undefined;
93
+ }
48
94
  export {};
49
95
  }
50
96
  export default Version;
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.2-beta.dev.20230603.1",
4
+ "version": "2.13.2-beta.dev.20230604.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",