@wayward/types 2.13.0-beta.dev.20230330.1 → 2.13.0-beta.dev.20230331.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.
@@ -72,7 +72,7 @@ export interface IDoodadEvents extends IEntityEvents {
72
72
  durabilityChange(durability: number, oldDurability: number): any;
73
73
  durabilityMaxChange(durability: number, oldDurability: number): any;
74
74
  }
75
- export default class Doodad extends Entity<DoodadType, DoodadTag> implements IUnserializedCallback, IObject<DoodadType>, IDoodadOptions, Partial<IContainer>, IHasInsulation, IHasBuilder, IHasMagic {
75
+ export default class Doodad extends Entity<IDoodadDescription, DoodadType, DoodadTag> implements IUnserializedCallback, IObject<DoodadType>, IDoodadOptions, Partial<IContainer>, IHasInsulation, IHasBuilder, IHasMagic {
76
76
  static is(value: any): value is Doodad;
77
77
  get constructorFunction(): typeof Doodad;
78
78
  static getRegistrarId(): number;
@@ -104,7 +104,6 @@ export default class Doodad extends Entity<DoodadType, DoodadTag> implements IUn
104
104
  stillContainer?: Item;
105
105
  tradedFrom?: string[];
106
106
  weight?: number;
107
- private _description?;
108
107
  private _tileId?;
109
108
  /**
110
109
  * Separate property just for wells because isInGroup is still expensive for processWell()
@@ -133,7 +132,7 @@ export default class Doodad extends Entity<DoodadType, DoodadTag> implements IUn
133
132
  * - `doodad.getName(undefined, 3)` // "stone furnaces"
134
133
  */
135
134
  getName(article?: false | "definite" | "indefinite", count?: number): import("../../language/impl/TranslationImpl").default;
136
- description(): IDoodadDescription | undefined;
135
+ protected getDescription(): IDoodadDescription | undefined;
137
136
  updateTile(tileUpdateType: TileUpdateType): void;
138
137
  changeType(doodadType: DoodadType): void;
139
138
  isValid(): boolean;
@@ -34,7 +34,7 @@ import type EntityWithStats from "game/entity/EntityWithStats";
34
34
  import type Tile from "game/tile/Tile";
35
35
  import type EntityMovable from "game/entity/EntityMovable";
36
36
  import type { RenderSource, UpdateRenderFlag } from "renderer/IRenderer";
37
- export default abstract class Entity<TypeType extends number = number, TagType = unknown, CounterType = unknown> extends EventEmitter.Host<IEntityEvents> implements IReferenceable, IInspector, ITemperatureSource, INotificationLocation, IVector3 {
37
+ export default abstract class Entity<DescriptionType = unknown, TypeType extends number = number, TagType = unknown, CounterType = unknown> extends EventEmitter.Host<IEntityEvents> implements IReferenceable, IInspector, ITemperatureSource, INotificationLocation, IVector3 {
38
38
  abstract readonly entityType: EntityType;
39
39
  abstract readonly tileUpdateType: TileUpdateType;
40
40
  id: number;
@@ -58,14 +58,23 @@ export default abstract class Entity<TypeType extends number = number, TagType =
58
58
  * This should be cleared when x,y,z is changing.
59
59
  */
60
60
  private _tilesAround;
61
+ protected _description?: DescriptionType;
61
62
  constructor(entityOptions?: IEntityConstructorOptions<TypeType>);
62
63
  get island(): import("../island/Island").default;
63
64
  get reference(): Reference | undefined;
65
+ /**
66
+ * Get the entities description
67
+ */
68
+ get description(): DescriptionType | undefined;
64
69
  /**
65
70
  * Adds a referenceId to the entity if it doesn't already have one
66
71
  */
67
72
  addReferenceId(): void;
68
73
  abstract getName(): Translation;
74
+ /**
75
+ * Called when filling out the entities description for the first time
76
+ */
77
+ protected abstract getDescription(): DescriptionType | undefined;
69
78
  toString(): string;
70
79
  getInspectionId(): string;
71
80
  /**
@@ -81,7 +90,7 @@ export default abstract class Entity<TypeType extends number = number, TagType =
81
90
  get tilesAround(): Tile[] | undefined;
82
91
  protected setCachedTile(tile: Tile): void;
83
92
  clearTileCache(): void;
84
- isNearby(entity: Entity): boolean;
93
+ isNearby(entity: Entity<DescriptionType>): boolean;
85
94
  isInFov(): boolean;
86
95
  setInFov(inFov: boolean): void;
87
96
  isOnFire(): FireType;
@@ -96,9 +105,9 @@ export default abstract class Entity<TypeType extends number = number, TagType =
96
105
  addTag(tag: TagType): void;
97
106
  removeTag(tag: TagType): void;
98
107
  abstract isValid(): boolean;
99
- get asEntity(): Entity<TypeType, TagType>;
100
- get asEntityMovable(): EntityMovable<TypeType, TagType> | undefined;
101
- get asEntityWithStats(): EntityWithStats<TypeType, TagType> | undefined;
108
+ get asEntity(): Entity<DescriptionType, TypeType, TagType>;
109
+ get asEntityMovable(): EntityMovable<DescriptionType, TypeType, TagType> | undefined;
110
+ get asEntityWithStats(): EntityWithStats<DescriptionType, TypeType, TagType> | undefined;
102
111
  abstract get asCorpse(): Corpse | undefined;
103
112
  abstract get asCreature(): Creature | undefined;
104
113
  abstract get asDoodad(): Doodad | undefined;
@@ -39,7 +39,7 @@ export interface IEntityMovableEvents extends IEntityEvents {
39
39
  /**
40
40
  * Entity class that allows movement
41
41
  */
42
- export default abstract class EntityMovable<TypeType extends number = number, TagType = unknown, CounterType = unknown> extends Entity<TypeType, TagType, CounterType> implements IRendererOrigin {
42
+ export default abstract class EntityMovable<DescriptionType = unknown, TypeType extends number = number, TagType = unknown, CounterType = unknown> extends Entity<DescriptionType, TypeType, TagType, CounterType> implements IRendererOrigin {
43
43
  event: IEventEmitter<this, IEntityMovableEvents>;
44
44
  /**
45
45
  * Not guaranteed to be synced between the server and client for Human entities
@@ -83,7 +83,7 @@ export default abstract class EntityMovable<TypeType extends number = number, Ta
83
83
  * @returns False to block the move
84
84
  */
85
85
  protected abstract updateTile(fromTile: Tile, toTile: Tile): boolean;
86
- get asEntityMovable(): EntityMovable<TypeType, TagType>;
86
+ get asEntityMovable(): EntityMovable<DescriptionType, TypeType, TagType>;
87
87
  /**
88
88
  * Regular entities don't have a direction so this will be the same as getTile()
89
89
  */
@@ -31,7 +31,7 @@ export interface IEntityWithStatsEvents extends IEntityMovableEvents, IStatEvent
31
31
  * Entity class that includes stats/status system.
32
32
  * Note: We're assuming something with stats is also movable!
33
33
  */
34
- export default abstract class EntityWithStats<TypeType extends number = number, TagType = unknown> extends EntityMovable<TypeType, TagType> implements IStatHost {
34
+ export default abstract class EntityWithStats<DescriptionType = unknown, TypeType extends number = number, TagType = unknown> extends EntityMovable<DescriptionType, TypeType, TagType> implements IStatHost {
35
35
  event: IEventEmitter<this, IEntityWithStatsEvents>;
36
36
  stats: IStats;
37
37
  status: IStatus;
@@ -39,7 +39,7 @@ export default abstract class EntityWithStats<TypeType extends number = number,
39
39
  private readonly statusHandlers;
40
40
  constructor(entityOptions?: IEntityConstructorOptions<TypeType>);
41
41
  protected getApplicableStatusEffects(): Set<StatusType> | undefined;
42
- get asEntityWithStats(): EntityWithStats<TypeType, TagType>;
42
+ get asEntityWithStats(): EntityWithStats<DescriptionType, TypeType, TagType>;
43
43
  /**
44
44
  * Returns whether the entity has the given `StatusType`
45
45
  * @param status The status to check
@@ -55,7 +55,7 @@ import type { IVector2, IVector3 } from "utilities/math/IVector";
55
55
  import Vector2 from "utilities/math/Vector2";
56
56
  import type { IVector4 } from "utilities/math/Vector4";
57
57
  export declare const REPUTATION_MAX = 64000;
58
- export default abstract class Human<TypeType extends number = number> extends EntityWithStats<TypeType> implements IHasInsulation {
58
+ export default abstract class Human<TypeType extends number = number> extends EntityWithStats<unknown, TypeType> implements IHasInsulation {
59
59
  static getNameTranslation(): import("../../language/impl/TranslationImpl").default;
60
60
  event: IEventEmitter<this, IHumanEvents>;
61
61
  anim: number;
@@ -119,6 +119,7 @@ export default abstract class Human<TypeType extends number = number> extends En
119
119
  protected gameOptionsCached?: IGameOptionsPlayer;
120
120
  protected cachedMovementPenalty?: number;
121
121
  constructor(entityOptions?: IEntityConstructorOptions<TypeType>);
122
+ protected getDescription(): void;
122
123
  abstract createNoteManager(): INoteManager;
123
124
  abstract createMessageManager(): IMessageManager;
124
125
  abstract createQuestManager(): IQuestManager;
@@ -30,7 +30,7 @@ export default class ActionExecutor<A extends Array<ActionArgument | ActionArgum
30
30
  * Note: Prefer `IActionApi.get` if you're calling this from within another action.
31
31
  */
32
32
  static get<D extends AnyActionDescription>(action: D): D extends IActionDescription<infer A, infer E, infer R, infer CU, infer AV> ? ActionExecutor<A, E, R, CU, AV> : never;
33
- static executeMultiplayer(packet: ActionPacket, executor?: Entity<number, unknown, unknown> | undefined, nonMpActionExecutor?: ActionExecutor<Array<ActionArgument | ActionArgument[]>, Entity, any, any, any[]>): any;
33
+ static executeMultiplayer(packet: ActionPacket, executor?: Entity<unknown, number, unknown, unknown> | undefined, nonMpActionExecutor?: ActionExecutor<Array<ActionArgument | ActionArgument[]>, Entity, any, any, any[]>): any;
34
34
  get executor(): E;
35
35
  get actionStack(): ActionType[];
36
36
  get lastAction(): ActionType;
@@ -26,7 +26,7 @@ import type { IUnserializedCallback } from "save/serializer/ISerializer";
26
26
  import { Direction } from "utilities/math/Direction";
27
27
  import type { IVector3 } from "utilities/math/IVector";
28
28
  import Vector2 from "utilities/math/Vector2";
29
- export default class Creature extends EntityWithStats<CreatureType> implements IUnserializedCallback, IObject<CreatureType> {
29
+ export default class Creature extends EntityWithStats<ICreatureDescription, CreatureType> implements IUnserializedCallback, IObject<CreatureType> {
30
30
  static is(value: any): value is Creature;
31
31
  get entityType(): EntityType.Creature;
32
32
  get tileUpdateType(): TileUpdateType;
@@ -57,7 +57,6 @@ export default class Creature extends EntityWithStats<CreatureType> implements I
57
57
  respawned?: number;
58
58
  shouldSkipNextUpdate?: true;
59
59
  tameTime?: number;
60
- private _description;
61
60
  spawnAnimationTime: IMovementTime | undefined;
62
61
  constructor(entityOptions?: IEntityConstructorOptions<CreatureType>, aberrant?: boolean);
63
62
  /**
@@ -74,7 +73,7 @@ export default class Creature extends EntityWithStats<CreatureType> implements I
74
73
  * - `creature.getName(undefined, 3)` // "acid spitter demons"
75
74
  */
76
75
  getName(article?: false | "definite" | "indefinite", count?: number): Translation;
77
- description(): ICreatureDescription | undefined;
76
+ protected getDescription(): ICreatureDescription | undefined;
78
77
  hasAi(aiType: AiType): boolean;
79
78
  isHidden(): boolean;
80
79
  isRetaliator(): boolean;
@@ -35,7 +35,7 @@ export interface ICorpseEvents extends IEntityEvents {
35
35
  /**
36
36
  * TODO: extends Entity?
37
37
  */
38
- export default class Corpse extends Entity<CreatureType> implements IObject<CreatureType> {
38
+ export default class Corpse extends Entity<ICorpseDescription, CreatureType> implements IObject<CreatureType> {
39
39
  static is(value: any): value is Corpse;
40
40
  get entityType(): EntityType.Corpse;
41
41
  get tileUpdateType(): TileUpdateType;
@@ -46,7 +46,6 @@ export default class Corpse extends Entity<CreatureType> implements IObject<Crea
46
46
  respawned?: number;
47
47
  startingDecay?: number;
48
48
  step?: number | undefined;
49
- private _description;
50
49
  private _creatureDescription;
51
50
  constructor(entityOptions?: IEntityConstructorOptions<CreatureType>, decay?: number);
52
51
  get asCorpse(): Corpse | undefined;
@@ -71,7 +70,7 @@ export default class Corpse extends Entity<CreatureType> implements IObject<Crea
71
70
  * - `corpse.getName(undefined, 3)` // "acid spitter demons"
72
71
  */
73
72
  getName(article?: false | "definite" | "indefinite", count?: number): Translation;
74
- description(): ICorpseDescription | undefined;
73
+ protected getDescription(): ICorpseDescription | undefined;
75
74
  creatureDescription(): ICreatureDescription | undefined;
76
75
  isValid(): boolean;
77
76
  getDecayAtStart(): number;
@@ -23,9 +23,9 @@ export interface IDescribed {
23
23
  referenceId?: number;
24
24
  quality?: Quality;
25
25
  island: Island;
26
- description(): any;
26
+ description: any;
27
27
  }
28
- export type DescribedDescription<T extends IDescribed> = Exclude<ReturnType<T["description"]>, undefined>;
28
+ export type DescribedDescription<T extends IDescribed> = Exclude<T["description"], undefined>;
29
29
  export interface IUseInfoBase<T extends IDescribed, A extends ActionType> {
30
30
  entityType: T["entityType"];
31
31
  value?: T;
@@ -69,7 +69,7 @@ export interface IItemEvents extends IEntityMovableEvents {
69
69
  durabilityChange(durability: number, oldDurability: number): any;
70
70
  durabilityMaxChange(durabilityMax: number, oldDurabilityMax: number): any;
71
71
  }
72
- export default class Item extends EntityMovable<ItemType, ItemTag, ItemCounter> implements Partial<IContainer>, IContainable, IUnserializedCallback, IObject<ItemType>, IObjectOptions, IContainable, Partial<IContainer>, IHasInsulation, IHasMagic {
72
+ export default class Item extends EntityMovable<IItemDescription, ItemType, ItemTag, ItemCounter> implements Partial<IContainer>, IContainable, IUnserializedCallback, IObject<ItemType>, IObjectOptions, IContainable, Partial<IContainer>, IHasInsulation, IHasMagic {
73
73
  get entityType(): EntityType.Item;
74
74
  get tileUpdateType(): TileUpdateType;
75
75
  readonly event: IEventEmitter<this, IItemEvents>;
@@ -107,7 +107,6 @@ export default class Item extends EntityMovable<ItemType, ItemTag, ItemCounter>
107
107
  offsetY?: number;
108
108
  [SYMBOL_CONTAINER_CACHED_REFERENCE]?: ContainerReference;
109
109
  private _movementOptions?;
110
- private _description;
111
110
  constructor(itemType?: ItemType | undefined, islandId?: IslandId, quality?: Quality, human?: Human);
112
111
  get asCorpse(): undefined;
113
112
  get asCreature(): undefined;
@@ -162,7 +161,7 @@ export default class Item extends EntityMovable<ItemType, ItemTag, ItemCounter>
162
161
  * - `item.getName(undefined, 3)` // "stone axes"
163
162
  */
164
163
  getName(article?: false | "definite" | "indefinite", count?: number, showCount?: boolean, showQuality?: boolean, showRenamedQuotes?: boolean, showMagicalType?: boolean): import("../../language/impl/TranslationImpl").default;
165
- description(): IItemDescription | undefined;
164
+ protected getDescription(): IItemDescription | undefined;
166
165
  isTransient(): boolean;
167
166
  isValid(): boolean;
168
167
  isProtected(): boolean;
@@ -48,7 +48,7 @@ export default class Crafter {
48
48
  * @param includeCrafterTile Whether the tile the crafter is on should be included. Defaults to `true`.
49
49
  */
50
50
  tilesAroundCrafter(includeCrafterTile?: boolean): Stream<any>;
51
- getCrafter(): Entity<number, unknown, unknown>;
51
+ getCrafter(): Entity<unknown, number, unknown, unknown>;
52
52
  getUsable<R extends RecipeRequirementType>(type: R, requirement: InstanceType<RecipeRequirementClass<R>>): Set<RecipeInputType<R>>;
53
53
  getUsed<R extends RecipeRequirementType>(type: R, requirement?: InstanceType<RecipeRequirementClass<R>>): Stream<RecipeInputType<R>>;
54
54
  /**
@@ -82,7 +82,7 @@ export default class Tile implements IVector4, Partial<ITileContainer>, IFieldOf
82
82
  */
83
83
  constructor(island: Island, x: number, y: number, z: number, id: number);
84
84
  get point(): IVector3;
85
- description(): ITerrainDescription | undefined;
85
+ get description(): ITerrainDescription | undefined;
86
86
  toString(): string;
87
87
  get type(): TerrainType;
88
88
  /**
@@ -28,7 +28,7 @@ export interface ITileEventEvents extends IEntityMovableEvents {
28
28
  */
29
29
  fireUpdate(tile: Tile, stage: FireStage | undefined): any;
30
30
  }
31
- export default class TileEvent extends EntityMovable<TileEventType> implements IObject<TileEventType> {
31
+ export default class TileEvent extends EntityMovable<ITileEventDescription, TileEventType> implements IObject<TileEventType> {
32
32
  static is(value: any): value is TileEvent;
33
33
  get entityType(): EntityType.TileEvent;
34
34
  get tileUpdateType(): TileUpdateType;
@@ -48,7 +48,6 @@ export default class TileEvent extends EntityMovable<TileEventType> implements I
48
48
  */
49
49
  fuel?: number;
50
50
  private fireStage?;
51
- private _description;
52
51
  constructor(entityOptions?: IEntityConstructorOptions<TileEventType>);
53
52
  isValid(): boolean;
54
53
  get asCorpse(): undefined;
@@ -63,7 +62,7 @@ export default class TileEvent extends EntityMovable<TileEventType> implements I
63
62
  get point(): IVector3;
64
63
  get tile(): Tile;
65
64
  toString(): string;
66
- description(): ITileEventDescription | undefined;
65
+ protected getDescription(): ITileEventDescription | undefined;
67
66
  getName(article?: false | "definite" | "indefinite", count?: number): import("../../language/impl/TranslationImpl").default;
68
67
  getProducedTemperature(): number | undefined;
69
68
  updateFire(tile: Tile): void;
@@ -99,7 +99,8 @@ export declare enum MusicPlaylist {
99
99
  export declare enum TooltipVisibilityOption {
100
100
  HiddenUnlessBind = 0,
101
101
  ShowMoreInformationWithBind = 1,
102
- AlwaysShowMoreInformation = 2
102
+ AlwaysShowMoreInformation = 2,
103
+ Default = 1
103
104
  }
104
105
  export type IOptionsOld = Partial<Pick<IOptions, "bindings">> & Partial<{
105
106
  alwaysShowMoreInformation: boolean;
@@ -42,7 +42,6 @@ export declare enum ItemDetailIconLocation {
42
42
  export declare enum ItemClasses {
43
43
  Main = "item-component",
44
44
  Icon = "item-component-icon",
45
- ItemIcon = "item-component-icon-item",
46
45
  ItemIconIsReal = "item-component-icon-item-is-real",
47
46
  ActionIcon = "item-component-icon-action",
48
47
  ActionIconHasItem = "item-component-icon-action-has-item",
@@ -90,7 +89,6 @@ export default class ItemComponent extends Component {
90
89
  protected readonly handler: IItemHandler;
91
90
  static registerSlot(slot: ItemSlot): void;
92
91
  event: IEventEmitter<this, Events<IDraggableComponent> & IItemSlotEvents>;
93
- readonly itemIcon: Component<HTMLElement>;
94
92
  readonly magicalIcon: Component<HTMLElement>;
95
93
  readonly protectedIcon: Component<HTMLElement>;
96
94
  readonly actionIcon: Component<HTMLElement> | undefined;
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.20230330.1",
4
+ "version": "2.13.0-beta.dev.20230331.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",