@wayward/types 2.13.0-beta.dev.20230326.2 → 2.13.0-beta.dev.20230328.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.
@@ -22,7 +22,7 @@ import { MessageManagerNoOp } from "game/entity/player/MessageManager";
22
22
  import { NoteManagerNoOp } from "game/entity/player/note/NoteManager";
23
23
  import { QuestManagerNoOp } from "game/entity/player/quest/QuestManager";
24
24
  import { TileUpdateType } from "game/IGame";
25
- import type { ItemType } from "game/item/IItem";
25
+ import type { IContainer, ItemType } from "game/item/IItem";
26
26
  import type Item from "game/item/Item";
27
27
  import type Tile from "game/tile/Tile";
28
28
  import Translation from "language/Translation";
@@ -83,6 +83,7 @@ export default abstract class NPC extends Human<NPCType> {
83
83
  isWaiting(): boolean;
84
84
  getDamageModifier(): number;
85
85
  makeHostile(): void;
86
+ getPublicContainer(): IContainer | undefined;
86
87
  /**
87
88
  * The actions available to use with this npc
88
89
  */
@@ -15,6 +15,7 @@ import { EquipType } from "game/entity/IHuman";
15
15
  import type { INPCConstructorOptions } from "game/entity/npc/INPC";
16
16
  import NPC from "game/entity/npc/NPC";
17
17
  import type Player from "game/entity/player/Player";
18
+ import type { IContainer } from "game/item/IItem";
18
19
  import { ItemType } from "game/item/IItem";
19
20
  import type Item from "game/item/Item";
20
21
  export interface IMerchantBuyPrice {
@@ -28,6 +29,7 @@ export default class MerchantNPC extends NPC {
28
29
  getCustomerCredit(customer: Human): number;
29
30
  modifyCustomerCredit(customer: Human, creditChange: number): number;
30
31
  getActions(): ActionType[] | undefined;
32
+ getPublicContainer(): IContainer | undefined;
31
33
  getSellPrice(player: Player, item: Item): number | undefined;
32
34
  getBuyPrice(player: Player, item: Item): IMerchantBuyPrice | undefined;
33
35
  /**
@@ -30,6 +30,7 @@ export default class ShipperNPC extends NPC {
30
30
  * Closes container dialogs
31
31
  */
32
32
  closeContainerDialogs(): void;
33
+ getPublicContainer(): IContainer | undefined;
33
34
  protected getReputationChangeOnDeath(): number;
34
35
  protected getDefaultName(): import("../../../../language/impl/TranslationImpl").default;
35
36
  protected initializeStats(): void;
@@ -39,6 +39,7 @@ export default class TemperatureManager extends EventEmitter.Host<ITemperatureMa
39
39
  private readonly island;
40
40
  encodedCalculatedCache: Map<number, Map<number, Uint32Array>>;
41
41
  encodedProducedCache: Map<number, Map<number, Uint32Array>>;
42
+ encodedGuaranteedCorrectCache: Map<number, Map<number, Uint32Array>>;
42
43
  private readonly containerTemperatureCache;
43
44
  private readonly containerTileTemperatureCache;
44
45
  private readonly containerItemsTemperatureCache;
@@ -46,6 +47,7 @@ export default class TemperatureManager extends EventEmitter.Host<ITemperatureMa
46
47
  private readonly scheduledContainerInvalidations;
47
48
  private cacheCalculated;
48
49
  private cacheProduced;
50
+ private cacheGuaranteedCorrect;
49
51
  private temperatureBoundaryMax;
50
52
  temperatureBoundaryMaxVector: Vector2;
51
53
  constructor(island: Island);
@@ -95,16 +97,18 @@ export default class TemperatureManager extends EventEmitter.Host<ITemperatureMa
95
97
  /**
96
98
  * Returns the base temperature.
97
99
  */
98
- getBase(): number;
100
+ getBiomeBase(): number;
99
101
  /**
100
102
  * Returns the temperature modifier at the given time.
101
103
  */
102
- getTime(time?: TimeManager): number;
104
+ getBiomeTimeModifier(time?: TimeManager): number;
103
105
  getBiomeRange(): Readonly<IRange>;
104
106
  /**
105
107
  * Returns the temperature modifier of the given layer, at the given time.
106
108
  */
107
109
  getLayer(z: WorldZ, time?: TimeManager): number;
110
+ getLayerBase(z: WorldZ): number;
111
+ getLayerTimeModifier(z: WorldZ, time?: TimeManager): number;
108
112
  getLayerRange(z: WorldZ): IRange;
109
113
  private resolveTimeModifier;
110
114
  /**
@@ -157,7 +161,7 @@ export default class TemperatureManager extends EventEmitter.Host<ITemperatureMa
157
161
  private calculateRange;
158
162
  /**
159
163
  * Starting from the middle, set the calculated value of the tile to the maximum of all surrounding tiles minus the diffusion rate
160
- * For each tile where the value is updated, update all surrounding tiles
164
+ * For each tile where the value is updated, update all surrounding tiles:
161
165
  * ```
162
166
  * - - 0 - - - - 0 - - - - 1 - - - - 1 - - - - 1 - - - - 1 - -
163
167
  * - 0 0 0 - - 0 3 0 - - 0 3 0 - - 0 3 1 - - 1 3 1 - - 1 3 1 -
@@ -174,7 +178,8 @@ export default class TemperatureManager extends EventEmitter.Host<ITemperatureMa
174
178
  * - 0 0 0 - - 0 0 0 -
175
179
  * - - 0 - - - - 0 - -
176
180
  * ```
177
- * When this happens, if we allow the tiles to continue updating each other, it'll progress as such:
181
+ * If cascading skipped previously touched tiles, the temperature from the 9 wouldn't spread out to the full distance.
182
+ * Instead, if we allow the tiles to continue updating each other, it'll progress as such:
178
183
  * ```
179
184
  * - - 1 - - - - 1 - - - - 1 - - - - 1 - - - - 1 - - - - 1 - -
180
185
  * - 1 3 7 9 - 1 3 7 9 - 1 3 7 9 - 1 3 7 9 - 1 3 7 9 - 1 3 7 9
@@ -188,7 +193,7 @@ export default class TemperatureManager extends EventEmitter.Host<ITemperatureMa
188
193
  * - 1 3 3 - - 1 3 3 - - 1 3 3 -
189
194
  * - - 1 - - - - 1 - - - - 1 - -
190
195
  * ```
191
- * By not cascading updates if a tile's value wasn't actually updated, the algorithm actually makes itself more efficient.
196
+ * Instead we stop cascading updates to adjacent tiles *only* if a tile's value wasn't actually updated.
192
197
  */
193
198
  private recalculate;
194
199
  private calculateTile;
@@ -123,7 +123,8 @@ export declare enum RenderSource {
123
123
  StartGame = 61,
124
124
  Steamworks = 62,
125
125
  Thumbnail = 63,
126
- WorldLayerRendererFlush = 64
126
+ WorldLayerRendererFlush = 64,
127
+ GenericOverlay = 65
127
128
  }
128
129
  export declare function calculateAmbientLightLevel(origin: IFieldOfViewOrigin, z: number): number;
129
130
  export declare const ZOOM_LEVEL_MIN = 1;
@@ -24,5 +24,5 @@ export default class RendererContext {
24
24
  get isWebGl2(): boolean;
25
25
  get origin(): IRendererOrigin;
26
26
  get viewport(): IVector2;
27
- createSpriteBatch(capacity: number, depthOffset?: number, yOffset?: number): SpriteBatch2 | SpriteBatch1;
27
+ createSpriteBatch(capacity: number, depthOffset?: number, yOffset?: number, enableAlphaMultiplcation?: boolean): SpriteBatch2 | SpriteBatch1;
28
28
  }
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Copyright 2011-2021 Unlok
3
+ * https://www.unlok.ca
4
+ *
5
+ * Credits & Thanks:
6
+ * https://www.unlok.ca/credits-thanks/
7
+ *
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
+ * https://github.com/WaywardGame/types/wiki
10
+ */
11
+ import type { IOverlayInfo } from "game/tile/ITerrain";
12
+ import type Tile from "game/tile/Tile";
13
+ export default abstract class GenericOverlay<OVERLAY extends IOverlayInfo = IOverlayInfo, PARAMS extends any[] = []> {
14
+ private readonly overlay;
15
+ protected alpha: number;
16
+ getDefaultAlpha(): number;
17
+ show(): void;
18
+ hide(): void;
19
+ addOrUpdate(tile: Tile, ...params: PARAMS): void;
20
+ protected abstract generateOverlayInfo(tile: Tile, ...params: PARAMS): OVERLAY | undefined;
21
+ protected updateOverlayAlpha(tile: Tile, overlay: OVERLAY, alpha: number): OVERLAY | undefined;
22
+ clear(): void;
23
+ private updateAlpha;
24
+ }
@@ -20,6 +20,7 @@ export default class SpriteBatch1 implements ISpriteBatch {
20
20
  readonly capacity: number;
21
21
  private readonly depthOffset;
22
22
  private readonly yOffset;
23
+ private readonly enableAlphaMultiplcation;
23
24
  private readonly shaderProgram;
24
25
  texSprites: WebGLTexture | undefined;
25
26
  inverseSpriteTextureSize: Vector2 | undefined;
@@ -31,7 +32,7 @@ export default class SpriteBatch1 implements ISpriteBatch {
31
32
  private begun;
32
33
  private _setup;
33
34
  static initializePrograms(webGlContext: WebGlContext): Promise<void>;
34
- constructor(context: RendererContext, capacity: number, depthOffset?: number, yOffset?: number);
35
+ constructor(context: RendererContext, capacity: number, depthOffset?: number, yOffset?: number, enableAlphaMultiplcation?: boolean);
35
36
  setup(): void;
36
37
  delete(): void;
37
38
  clear(): void;
@@ -20,6 +20,7 @@ export default class SpriteBatch2 implements ISpriteBatch {
20
20
  readonly capacity: number;
21
21
  private readonly depthOffset;
22
22
  private readonly yOffset;
23
+ private readonly enableAlphaMultiplcation;
23
24
  private readonly shaderProgram;
24
25
  texSprites: WebGLTexture | undefined;
25
26
  inverseSpriteTextureSize: Vector2 | undefined;
@@ -33,7 +34,7 @@ export default class SpriteBatch2 implements ISpriteBatch {
33
34
  private readonly vertexArray;
34
35
  private _setup;
35
36
  static initializePrograms(webGlContext: WebGlContext): Promise<void>;
36
- constructor(context: RendererContext, capacity: number, depthOffset?: number, yOffset?: number);
37
+ constructor(context: RendererContext, capacity: number, depthOffset?: number, yOffset?: number, enableAlphaMultiplcation?: boolean);
37
38
  setup(): void;
38
39
  delete(): void;
39
40
  clear(): void;
@@ -14,6 +14,9 @@ export interface IVector2 {
14
14
  x: number;
15
15
  y: number;
16
16
  }
17
+ export declare namespace IVector2 {
18
+ function hash(v2: IVector2): number;
19
+ }
17
20
  export interface IVector3 extends IVector2 {
18
21
  z: WorldZ;
19
22
  }
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.20230326.2",
4
+ "version": "2.13.0-beta.dev.20230328.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,13 +0,0 @@
1
- /*!
2
- * Copyright 2011-2021 Unlok
3
- * https://www.unlok.ca
4
- *
5
- * Credits & Thanks:
6
- * https://www.unlok.ca/credits-thanks/
7
- *
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
- * https://github.com/WaywardGame/types/wiki
10
- */
11
- import type RendererContext from "renderer/context/RendererContext";
12
- import type ISpriteBatch from "renderer/spriteBatch/ISpriteBatch";
13
- export declare function createSpriteBatch(context: RendererContext, capacity: number, depthOffset?: number, yOffset?: number): ISpriteBatch;