@wayward/types 2.12.1-beta.dev.20221027.1 → 2.12.1-beta.dev.20221028.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.
@@ -69,6 +69,7 @@ export default class Corpse extends EventEmitter.Host<ICorpseEvents> implements
69
69
  getTile(): ITile;
70
70
  isValid(): boolean;
71
71
  getDecayAtStart(): number;
72
+ addToTile(tile: ITile): void;
72
73
  update(): void;
73
74
  getResources(clientSide?: boolean): ItemType[];
74
75
  protected onCreated(): void;
@@ -99,6 +99,13 @@ export interface IPlayerEvents extends Events<Human> {
99
99
  * @param newId The new id for the player
100
100
  * @param isAbsentPlayer True if the player is absent
101
101
  */
102
+ idChanging(currentId: number, newId: number, isAbsentPlayer: boolean): any;
103
+ /**
104
+ * Called when the players id has changed
105
+ * @param currentId The players current id
106
+ * @param newId The new id for the player
107
+ * @param isAbsentPlayer True if the player is absent
108
+ */
102
109
  idChanged(currentId: number, newId: number, isAbsentPlayer: boolean): any;
103
110
  }
104
111
  export declare enum TurnTypeFlag {
@@ -64,6 +64,7 @@ export default class Player extends Human implements IUnserializedCallback {
64
64
  addMilestone(milestone: Milestone, data?: number | string, update?: boolean): void;
65
65
  updateMovementIntent(movementIntent: IMovementIntent): boolean;
66
66
  load(): void;
67
+ unload(): void;
67
68
  setup(spawnPoint: IVector3): void;
68
69
  protected onNoInput(): void;
69
70
  updateTables(source: string, options?: Partial<{
@@ -65,18 +65,12 @@ interface IMagicalPropertyOld {
65
65
  stat?: Stat;
66
66
  }
67
67
  export declare const SYMBOL_CONTAINER_CACHED_REFERENCE: unique symbol;
68
- export declare const SYMBOL_CONTAINER_TEMPERATURE: unique symbol;
69
- export declare const SYMBOL_CONTAINER_ITEMS_TEMPERATURE: unique symbol;
70
- export declare const SYMBOL_CONTAINER_TILE_TEMPERATURE: unique symbol;
71
68
  export interface IContainable {
72
69
  containedWithin?: IContainer;
73
70
  containerType?: ContainerType;
74
71
  [SYMBOL_CONTAINER_CACHED_REFERENCE]?: ContainerReference;
75
72
  }
76
73
  export interface IContainer extends IContainable {
77
- [SYMBOL_CONTAINER_TEMPERATURE]?: number;
78
- [SYMBOL_CONTAINER_ITEMS_TEMPERATURE]?: number;
79
- [SYMBOL_CONTAINER_TILE_TEMPERATURE]?: number;
80
74
  containedItems: Item[];
81
75
  transientItems?: Item[];
82
76
  itemOrders?: number[];
@@ -128,7 +128,7 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
128
128
  resolveContainer(container?: IContainer): Doodad | Item | Player | NPC | IContainer | ITile | undefined;
129
129
  getContainerReference(containable: IContainable | undefined, source: ContainerReferenceSource | undefined): ContainerReference;
130
130
  derefenceContainerReference(containerReference: ContainerReference, showWarnings?: boolean): IContainable | undefined;
131
- hashContainer(containable: IContainable): string;
131
+ hashContainer(containable: IContainable, containerReferenceSource?: ContainerReferenceSource): string;
132
132
  hashContainerReference(containerReference: ContainerReference): string;
133
133
  updateContainedWithin(containable: IContainable, containedWithin: IContainer | undefined): void;
134
134
  addToContainerInternal(item: Item, container: IContainer, options?: IAddToContainerOptions): boolean;
@@ -12,6 +12,7 @@ import EventEmitter from "event/EventEmitter";
12
12
  import type Doodad from "game/doodad/Doodad";
13
13
  import type { DoodadType } from "game/doodad/IDoodad";
14
14
  import type Entity from "game/entity/Entity";
15
+ import type Player from "game/entity/player/Player";
15
16
  import type Island from "game/island/Island";
16
17
  import type { IContainer } from "game/item/IItem";
17
18
  import type Item from "game/item/Item";
@@ -32,15 +33,30 @@ export default class TemperatureManager extends EventEmitter.Host<ITempManagerEv
32
33
  private readonly island;
33
34
  encodedCalculatedCache: Map<number, Map<number, Uint32Array>>;
34
35
  encodedProducedCache: Map<number, Map<number, Uint32Array>>;
36
+ private readonly containerTemperatureCache;
37
+ private readonly containerTileTemperatureCache;
38
+ private readonly containerItemsTemperatureCache;
35
39
  private readonly scheduledUpdates;
36
40
  private readonly scheduledContainerInvalidations;
37
41
  private readonly cacheCalculated;
38
42
  private readonly cacheProduced;
39
43
  constructor(island: Island);
44
+ /**
45
+ * Clears all container caches
46
+ */
47
+ clearContainerCaches(): void;
40
48
  addLayer(z: WorldZ): void;
41
49
  delete(): void;
42
50
  preSerializeObject(): void;
43
51
  onUnserialized(): void;
52
+ /**
53
+ * Clears temperature caching for the container
54
+ */
55
+ clearContainerCache(container: IContainer): void;
56
+ /**
57
+ * Clears temperature caching for the container
58
+ */
59
+ clearContainerCacheByHash(containerHash: string): void;
44
60
  /**
45
61
  * Returns the current temperature for a container, calculated by combining the tile temperature and the combined temperature of the items inside
46
62
  */
@@ -51,11 +67,11 @@ export default class TemperatureManager extends EventEmitter.Host<ITempManagerEv
51
67
  * containers with no insulation return the exact temperature they produce, while containers with maximum insulation return
52
68
  * `Temperature.Neutral`
53
69
  */
54
- getContainerProducedTemperature(container: IContainer, applyInsulation?: boolean): number;
70
+ getContainerProducedTemperature(container: IContainer, containerHash?: string, applyInsulation?: boolean): number;
55
71
  /**
56
72
  * Get the combined temperature of the items in the container.
57
73
  */
58
- getContainerItemsTemperature(container: IContainer): number;
74
+ getContainerItemsTemperature(container: IContainer, containerHash?: string): number;
59
75
  private getContainerBaseTemperature;
60
76
  private getContainerInsulation;
61
77
  /**
@@ -104,6 +120,8 @@ export default class TemperatureManager extends EventEmitter.Host<ITempManagerEv
104
120
  protected onDpodadFireUpdate(object: Doodad, tile: ITile, stage?: FireStage): void;
105
121
  protected onTileEventFireUpdate(object: TileEvent, tile: ITile, stage?: FireStage): void;
106
122
  protected onDoodadTransformed(object: Doodad, newType: DoodadType, oldType: DoodadType): void;
123
+ protected onPlayerSpawnOrRemove(_: any, player: Player): void;
124
+ protected onPlayerIdChanged(player: Player): void;
107
125
  protected onCreateOrRemoveObject(_: any, object: Doodad | TileEvent | Entity): void;
108
126
  protected onEntityMove(object: Entity, lastX: number, lastY: number, lastZ: number, lastTile: ITile, x: number, y: number, z: number, tile: ITile): void;
109
127
  protected onUpdateTile(island: Island, x: number, y: number, z: number, tile: ITile, oldType: TerrainType): void;
@@ -148,10 +148,16 @@ export interface ITerrainDescription extends IModdable {
148
148
  useDoodadLikeAdaptor?: boolean;
149
149
  }
150
150
  export interface ITile extends Partial<ITileContainer> {
151
+ /**
152
+ * Note: corpses must be ordered by id asc
153
+ */
151
154
  corpses?: Corpse[];
152
155
  creature?: Creature;
153
156
  data: number;
154
157
  doodad?: Doodad;
158
+ /**
159
+ * Note: tile events must be ordered by id asc
160
+ */
155
161
  events?: TileEvent[];
156
162
  npc?: NPC;
157
163
  overlays?: IOverlayInfo[];
@@ -57,7 +57,7 @@ export default class Multiplayer extends EventEmitter.Host<IMultiplayerEvents> {
57
57
  private _syncCheckStack;
58
58
  private _disconnectingFromSyncIssue;
59
59
  private _reportedSyncHashMismatch;
60
- private readonly _autojoinEnabled;
60
+ private readonly _autoJoinOptions;
61
61
  private _ipAddress;
62
62
  private readonly _matchmakingSecret;
63
63
  constructor();
@@ -12,7 +12,7 @@
12
12
  import type { IMatchmakingServer, INapiDiscordPresenceInfo, IRemoteFile, ISteamFriend, ISteamId, ISteamworksNetworking, IWaywardPreload, IWorkshopItem, LobbyType } from "@hosts/shared/interfaces";
13
13
  import EventEmitter from "event/EventEmitter";
14
14
  import { ModType } from "mod/IModInfo";
15
- import type { ServerInfo } from "multiplayer/IMultiplayer";
15
+ import type { IJoinServerOptions, ServerInfo } from "multiplayer/IMultiplayer";
16
16
  import type { IBuild, IDedicatedServerInfo, IModPath, ISteamworksEvents } from "steamworks/ISteamworks";
17
17
  export default class Steamworks extends EventEmitter.Host<ISteamworksEvents> {
18
18
  protected initialized: boolean;
@@ -134,9 +134,9 @@ export default class Steamworks extends EventEmitter.Host<ISteamworksEvents> {
134
134
  saveFile(fileName: string, blob: Blob): Promise<void>;
135
135
  hasServerToJoin(): boolean;
136
136
  getServerToJoin(): ServerInfo | undefined;
137
- setServerToJoin(serverToJoin: ServerInfo, automatic?: boolean): void;
137
+ setServerToJoin(serverToJoin: ServerInfo, automatic?: Partial<IJoinServerOptions>): void;
138
138
  clearServerToJoin(): void;
139
- shouldAutomaticallyJoinServer(): boolean | undefined;
139
+ shouldAutomaticallyJoinServer(): Partial<IJoinServerOptions> | undefined;
140
140
  processDedicatedServerBackups(force?: boolean): Promise<boolean>;
141
141
  protected onGlobalSlotLoaded(): void;
142
142
  writeBackup(slot: number, data: Uint8Array): Promise<string | undefined>;
@@ -94,6 +94,7 @@ export interface ISteamworks {
94
94
  showFloatingGamepadTextInput(nTextFieldXPosition: number, nTextFieldYPosition: number, nTextFieldWidth: number, nTextFieldHeight: number): boolean;
95
95
  dismissFloatingGamepadTextInput(): boolean;
96
96
  setFloatingGamepadTextInputDismissedCallback(cb: () => void): void;
97
+ getInputType(): SteamInputType;
97
98
  }
98
99
  export interface ISteamworksNetworking {
99
100
  initRelayNetworkAccess(): undefined;
@@ -263,3 +264,22 @@ export declare enum LobbyType {
263
264
  Public = 2,
264
265
  Invisible = 3
265
266
  }
267
+ export declare enum SteamInputType {
268
+ k_ESteamInputType_Unknown = 0,
269
+ k_ESteamInputType_SteamController = 1,
270
+ k_ESteamInputType_XBox360Controller = 2,
271
+ k_ESteamInputType_XBoxOneController = 3,
272
+ k_ESteamInputType_GenericGamepad = 4,
273
+ k_ESteamInputType_PS4Controller = 5,
274
+ k_ESteamInputType_AppleMFiController = 6,
275
+ k_ESteamInputType_AndroidController = 7,
276
+ k_ESteamInputType_SwitchJoyConPair = 8,
277
+ k_ESteamInputType_SwitchJoyConSingle = 9,
278
+ k_ESteamInputType_SwitchProController = 10,
279
+ k_ESteamInputType_MobileTouch = 11,
280
+ k_ESteamInputType_PS3Controller = 12,
281
+ k_ESteamInputType_PS5Controller = 13,
282
+ k_ESteamInputType_SteamDeckController = 14,
283
+ k_ESteamInputType_Count = 15,
284
+ k_ESteamInputType_MaximumPossibleValue = 255
285
+ }
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.12.1-beta.dev.20221027.1",
4
+ "version": "2.12.1-beta.dev.20221028.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",