@wayward/types 2.13.0-beta.dev.20230331.1 → 2.13.0-beta.dev.20230401.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.
@@ -43,6 +43,10 @@ type UndefinedFromVoid<V> = V extends void ? undefined : V;
43
43
  export interface IEventEmitter<H = any, E = any> {
44
44
  event: IEventEmitter<this, IEventEmitterEvents<H, E>>;
45
45
  emit<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): H;
46
+ /**
47
+ * Emit an event only to the subscribers of this emitter instance.
48
+ */
49
+ emitSelf<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): H;
46
50
  emitFirst<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): UndefinedFromVoid<ReturnOf<E[K]>> | undefined;
47
51
  emitFirstDefault<K extends keyof E, D>(event: K, generateDefault: () => D, ...args: ArgsOf<E[K]>): Exclude<ReturnOf<E[K]>, null | undefined> | D;
48
52
  emitCollect<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): Array<ReturnOf<E[K]>>;
@@ -75,6 +79,7 @@ declare class EventEmitter<H, E> implements IEventEmitter<H, E> {
75
79
  get event(): IEventEmitter<this, IEventEmitterEvents<H, E>>;
76
80
  constructor(host: H);
77
81
  raw(): IEventEmitter<H, E>;
82
+ emitSelf<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): H;
78
83
  emit<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): H;
79
84
  emitFirst<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): any;
80
85
  emitFirstDefault<K extends keyof E, D>(event: K, generateDefault: () => D, ...args: ArgsOf<E[K]>): any;
@@ -89,7 +94,7 @@ declare class EventEmitter<H, E> implements IEventEmitter<H, E> {
89
94
  until(promise: Promise<any>): IUntilSubscriber<H, E>;
90
95
  hasHandlersForEvent(...events: Array<keyof E>): boolean;
91
96
  private copyFrom;
92
- private handlersForEvent;
97
+ protected handlersForEvent<K extends keyof E>(event: K, ignoreClassSubscriptions?: true): (string | Handler<any, any>)[];
93
98
  }
94
99
  declare module EventEmitter {
95
100
  class Host<E> implements IEventEmitterHost<E> {
@@ -20,7 +20,7 @@ import { EquipType, RestCancelReason, SkillType } from "game/entity/IHuman";
20
20
  import type { IStat } from "game/entity/IStats";
21
21
  import { Stat } from "game/entity/IStats";
22
22
  import type { IMessageManager } from "game/entity/player/IMessageManager";
23
- import type { IMobCheck, IMovementIntent, IWalkPath } from "game/entity/player/IPlayer";
23
+ import type { IMovementIntent, IWalkPath } from "game/entity/player/IPlayer";
24
24
  import { PlayerState, TurnTypeFlag, WeightStatus } from "game/entity/player/IPlayer";
25
25
  import type { INoteManager } from "game/entity/player/note/NoteManager";
26
26
  import PlayerDefense from "game/entity/player/PlayerDefense";
@@ -30,7 +30,7 @@ import type { StatChangeTimerFactory } from "game/entity/StatFactory";
30
30
  import { StatChangeCurrentTimerStrategy } from "game/entity/StatFactory";
31
31
  import { FireType } from "game/IGame";
32
32
  import type { Quality } from "game/IObject";
33
- import type { IMoveToIslandOptions, IslandId } from "game/island/IIsland";
33
+ import type { IMobCheck, IMoveToIslandOptions, IslandId } from "game/island/IIsland";
34
34
  import type Island from "game/island/Island";
35
35
  import type { EquipEffectByType, EquipEffects, IContainer, IRanged, RecipeLevel } from "game/item/IItem";
36
36
  import { EquipEffect, ItemType, ItemTypeGroup } from "game/item/IItem";
@@ -10,10 +10,8 @@
10
10
  */
11
11
  import type { Events } from "event/EventEmitter";
12
12
  import type Doodad from "game/doodad/Doodad";
13
- import type Creature from "game/entity/creature/Creature";
14
13
  import type Human from "game/entity/Human";
15
14
  import type { HairColor, HairStyle, SkinColor } from "game/entity/IHuman";
16
- import type NPC from "game/entity/npc/NPC";
17
15
  import type { IMessage } from "game/entity/player/IMessageManager";
18
16
  import type MessageManager from "game/entity/player/MessageManager";
19
17
  import type { INote } from "game/entity/player/note/NoteManager";
@@ -21,7 +19,6 @@ import type Player from "game/entity/player/Player";
21
19
  import { ItemType } from "game/item/IItem";
22
20
  import type { Prompt } from "game/meta/prompt/IPrompt";
23
21
  import type { Milestone } from "game/milestones/IMilestone";
24
- import type Tile from "game/tile/Tile";
25
22
  import type InterruptChoice from "language/dictionary/InterruptChoice";
26
23
  import { Direction } from "utilities/math/Direction";
27
24
  import type { IVector2, IVector3 } from "utilities/math/IVector";
@@ -177,20 +174,6 @@ export interface IStatOld {
177
174
  regen: number;
178
175
  regenBase: number;
179
176
  }
180
- export interface IMobCheck extends IVector3 {
181
- tile: Tile;
182
- creature?: Creature;
183
- player?: Human;
184
- npc?: NPC;
185
- obstacle?: boolean;
186
- water?: boolean;
187
- freshWater?: boolean;
188
- shallowWater?: boolean;
189
- swampWater?: boolean;
190
- noTile?: boolean;
191
- waterTiles?: number;
192
- voidTiles?: number;
193
- }
194
177
  export declare const setupSpawnItems: ItemType[];
195
178
  export declare const setupWaterItems: ItemType[];
196
179
  export declare const setupToolItems: ItemType[];
@@ -10,7 +10,9 @@
10
10
  */
11
11
  import type { BiomeType } from "game/biome/IBiome";
12
12
  import type Doodad from "game/doodad/Doodad";
13
+ import type Creature from "game/entity/creature/Creature";
13
14
  import type Human from "game/entity/Human";
15
+ import type NPC from "game/entity/npc/NPC";
14
16
  import type { IIslandTemplate, TickFlag, TileUpdateType } from "game/IGame";
15
17
  import type { MultiplayerLoadingDescription } from "game/meta/Loading";
16
18
  import type { TerrainType } from "game/tile/ITerrain";
@@ -157,3 +159,17 @@ export interface IIslandPort {
157
159
  name: string | ISerializedTranslation;
158
160
  position: IVector3;
159
161
  }
162
+ export interface IMobCheck extends IVector3 {
163
+ tile: Tile;
164
+ creature?: Creature;
165
+ player?: Human;
166
+ npc?: NPC;
167
+ obstacle?: boolean;
168
+ water?: boolean;
169
+ freshWater?: boolean;
170
+ shallowWater?: boolean;
171
+ swampWater?: boolean;
172
+ noTile?: boolean;
173
+ waterTiles?: number;
174
+ voidTiles?: number;
175
+ }
@@ -25,7 +25,7 @@ import type { Game } from "game/Game";
25
25
  import type { IGameOld } from "game/IGame";
26
26
  import { TickFlag, TileUpdateType } from "game/IGame";
27
27
  import { Quality } from "game/IObject";
28
- import type { IIslandEvents, IIslandLoadOptions, IIslandPort, ISeeds, IslandId, IWaterContamination, IWaterFill, IWell } from "game/island/IIsland";
28
+ import type { IIslandEvents, IIslandLoadOptions, IIslandPort, IMobCheck, ISeeds, IslandId, IWaterContamination, IWaterFill, IWell } from "game/island/IIsland";
29
29
  import { WaterType } from "game/island/IIsland";
30
30
  import type { ILiquidGather } from "game/item/IItem";
31
31
  import type { IRequirementInfo } from "game/item/IItemManager";
@@ -216,6 +216,7 @@ export default class Island extends EventEmitter.Host<IIslandEvents> implements
216
216
  */
217
217
  calculateTileLightLevel(tile: Tile): number;
218
218
  getLightSourceAt(x: number, y: number, z: number): number;
219
+ checkForTargetInRange(tile: Tile, direction: Direction.Cardinal, range: number, includePlayers?: boolean): IMobCheck;
219
220
  fireBreath(x: number, y: number, z: number, facingDirection: Direction, itemName?: Translation, player?: boolean): void;
220
221
  coolFires(requirements: IRequirementInfo, human: Human): void;
221
222
  /**
@@ -73,11 +73,16 @@ export interface IContainable {
73
73
  containerType?: ContainerType;
74
74
  [SYMBOL_CONTAINER_CACHED_REFERENCE]?: ContainerReference;
75
75
  }
76
- export interface IContainer extends IContainable {
77
- containedItems: Item[];
76
+ interface IBaseContainer extends IContainable {
78
77
  transientItems?: Item[];
79
78
  itemOrders?: number[];
80
79
  }
80
+ export interface IContainer extends IBaseContainer {
81
+ containedItems: Item[];
82
+ }
83
+ export interface IMaybeContainer extends IBaseContainer {
84
+ containedItems?: Item[];
85
+ }
81
86
  export interface IItemDisassembleResult {
82
87
  items: IItemDisassembly[];
83
88
  itemsBroken: number;
@@ -33,7 +33,14 @@ import Vector2 from "utilities/math/Vector2";
33
33
  export declare const TEMPERATURE_BOUNDARY_MIN_VEC2: Vector2;
34
34
  export declare const TEMPERATURE_INVALID = 255;
35
35
  export interface ITemperatureManagerEvents {
36
+ /**
37
+ * Note: This event can only be listened for by subscribing directly to `temperatureManager.event`
38
+ */
36
39
  updateProducedTile(tile: Tile, invalidateRange?: number): any;
40
+ /**
41
+ * Note: This event can only be listened for by subscribing directly to `temperatureManager.event`
42
+ */
43
+ recalculate(x: number, y: number, z: number, type: TempType): any;
37
44
  }
38
45
  export default class TemperatureManager extends EventEmitter.Host<ITemperatureManagerEvents> implements IPreSerializeCallback {
39
46
  private readonly island;
@@ -16,7 +16,7 @@ import type { SkillType } from "game/entity/IHuman";
16
16
  import type { IDecayTemperatureRange } from "game/IGame";
17
17
  import type { Quality } from "game/IObject";
18
18
  import type { WaterType } from "game/island/IIsland";
19
- import type { IContainer, ItemType } from "game/item/IItem";
19
+ import type { IContainer, IMaybeContainer, ItemType } from "game/item/IItem";
20
20
  import type Item from "game/item/Item";
21
21
  import type MagicalPropertyManager from "game/magic/MagicalPropertyManager";
22
22
  import type { MapTile } from "game/mapping/IMapTile";
@@ -146,6 +146,7 @@ export interface ITileOld {
146
146
  event?: TileEvent[];
147
147
  }
148
148
  export type ITileContainer = IContainer & IVector3;
149
+ export type IMaybeTileContainer = IMaybeContainer & IVector3;
149
150
  export interface ITileData {
150
151
  type: TerrainType;
151
152
  minDur?: number;
@@ -18,9 +18,8 @@ import type { IMessageManager } from "game/entity/player/IMessageManager";
18
18
  import { FireType } from "game/IGame";
19
19
  import { Quality } from "game/IObject";
20
20
  import type { IslandId } from "game/island/IIsland";
21
- import type { IContainer } from "game/item/IItem";
22
21
  import type Item from "game/item/Item";
23
- import type { IOverlayInfo, ITerrainDescription, ITileContainer, ITileData } from "game/tile/ITerrain";
22
+ import type { IMaybeTileContainer, IOverlayInfo, ITerrainDescription, ITileContainer, ITileData } from "game/tile/ITerrain";
24
23
  import { TerrainType } from "game/tile/ITerrain";
25
24
  import type TileEvent from "game/tile/TileEvent";
26
25
  import { WorldZ } from "game/WorldZ";
@@ -103,10 +102,19 @@ export default class Tile implements IVector4, Partial<ITileContainer>, IFieldOf
103
102
  set doodadAnimationDisabled(value: boolean);
104
103
  get variation(): number;
105
104
  get isMapEdge(): boolean;
105
+ /**
106
+ * Check if this Tile containers some items
107
+ */
108
+ get hasTileContainer(): boolean;
106
109
  /**
107
110
  * Gets/creates tile container
108
111
  */
109
- get tileContainer(): IContainer;
112
+ get tileContainer(): ITileContainer;
113
+ /**
114
+ * Gets a tile container.
115
+ * It will not create one when called.
116
+ */
117
+ get maybeTileContainer(): IMaybeTileContainer;
110
118
  /**
111
119
  * Checks for:
112
120
  * Passable
@@ -11,10 +11,9 @@
11
11
  import type { ILootItem } from "game/ILoot";
12
12
  import type { Quality } from "game/IObject";
13
13
  import type Island from "game/island/Island";
14
- import type { IContainer } from "game/item/IItem";
15
14
  import { ItemType } from "game/item/IItem";
16
15
  import type Item from "game/item/Item";
17
- import type { ITileContainer } from "game/tile/ITerrain";
16
+ import type Tile from "game/tile/Tile";
18
17
  import type TileEvent from "game/tile/TileEvent";
19
18
  export declare enum FireStage {
20
19
  Extinguished = 0,
@@ -33,7 +32,7 @@ export declare module FireStage {
33
32
  function getTemperature(stage: FireStage, min: number, max: number): number;
34
33
  }
35
34
  export declare module IFire {
36
- function dissassemblyBurn(island: Island, item: Item, container: ITileContainer, disassembly: boolean): Item[];
37
- function harvestGatherBurn(step: number, resources: ILootItem[] | undefined, container: IContainer, quality: Quality | undefined, tileEvent: TileEvent): void;
38
- function burnsLike(burnsLikeItem: ItemType, tileEvent: TileEvent, tileContainer: IContainer, quality: Quality | undefined): Item[];
35
+ function dissassemblyBurn(island: Island, item: Item, tile: Tile, disassembly: boolean): Item[];
36
+ function harvestGatherBurn(step: number, resources: ILootItem[] | undefined, tile: Tile, quality: Quality | undefined, tileEvent: TileEvent): void;
37
+ function burnsLike(burnsLikeItem: ItemType, tileEvent: TileEvent, tile: Tile, quality: Quality | undefined): Item[];
39
38
  }
@@ -12,7 +12,6 @@
12
12
  * Used for ordering a list of items by "priority". Higher priorities come before lower priorities.
13
13
  */
14
14
  export declare class PriorityMap<T> {
15
- static orderMultiple2<T extends Iterable<any>>(lists: Array<PriorityMap<T>>): T[];
16
15
  static orderMultiple<T extends Iterable<any>>(lists: Array<PriorityMap<T>>): T[];
17
16
  private readonly priorities;
18
17
  private readonly map;
@@ -38,7 +37,7 @@ export declare class PriorityMap<T> {
38
37
  * Returns an iterator of the items in this list.
39
38
  */
40
39
  stream(direction?: PriorityListStreamDirection): import("@wayward/goodstream").default<T>;
41
- array(): (T extends readonly (infer InnerArr)[] ? InnerArr : T)[];
40
+ array(direction?: PriorityListStreamDirection): T[];
42
41
  getInternalMap(): Record<number, T>;
43
42
  }
44
43
  export declare enum PriorityListStreamDirection {
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.20230331.1",
4
+ "version": "2.13.0-beta.dev.20230401.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",