@wayward/types 2.14.0-beta.dev.20240213.1 → 2.14.0-beta.dev.20240216.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.
Files changed (45) hide show
  1. package/definitions/game/game/Game.d.ts +1 -0
  2. package/definitions/game/game/IGame.d.ts +6 -0
  3. package/definitions/game/game/deity/AlignmentManager.d.ts +2 -2
  4. package/definitions/game/game/doodad/Doodad.d.ts +5 -1
  5. package/definitions/game/game/doodad/IDoodad.d.ts +4 -0
  6. package/definitions/game/game/entity/Entity.d.ts +9 -2
  7. package/definitions/game/game/entity/Human.d.ts +16 -5
  8. package/definitions/game/game/entity/IEntity.d.ts +34 -0
  9. package/definitions/game/game/entity/action/ActionsRegistration.d.ts +4 -4
  10. package/definitions/game/game/entity/action/actions/Craft.d.ts +1 -1
  11. package/definitions/game/game/entity/action/actions/CraftNew.d.ts +1 -1
  12. package/definitions/game/game/entity/action/actions/Exude.d.ts +1 -1
  13. package/definitions/game/game/entity/action/actions/SetCreatureAi.d.ts +1 -1
  14. package/definitions/game/game/entity/action/actions/Stack.d.ts +2 -2
  15. package/definitions/game/game/entity/action/usable/UsableActionType.d.ts +2 -1
  16. package/definitions/game/game/entity/action/usable/actions/UsableActionsWorld.d.ts +1 -1
  17. package/definitions/game/game/entity/creature/Creature.d.ts +5 -0
  18. package/definitions/game/game/entity/creature/corpse/Corpse.d.ts +13 -11
  19. package/definitions/game/game/entity/npc/npcs/Controllable.d.ts +1 -1
  20. package/definitions/game/game/entity/npc/npcs/Merchant.d.ts +2 -1
  21. package/definitions/game/game/inspection/handlers/TilePositionInspection.d.ts +1 -1
  22. package/definitions/game/game/inspection/infoProviders/skill/MagicalItemBonuses.d.ts +12 -0
  23. package/definitions/game/game/item/IItem.d.ts +10 -8
  24. package/definitions/game/game/item/Item.d.ts +3 -1
  25. package/definitions/game/game/item/ItemManager.d.ts +5 -4
  26. package/definitions/game/game/item/ItemRecipeRequirementChecker.d.ts +2 -2
  27. package/definitions/game/game/item/WorldContainer.d.ts +62 -0
  28. package/definitions/game/game/options/IGameOptions.d.ts +4 -0
  29. package/definitions/game/game/reference/IReferenceManager.d.ts +103 -103
  30. package/definitions/game/game/tile/ITerrain.d.ts +4 -3
  31. package/definitions/game/game/tile/Tile.d.ts +36 -8
  32. package/definitions/game/game/tile/TileEvent.d.ts +13 -8
  33. package/definitions/game/language/dictionary/Message.d.ts +805 -804
  34. package/definitions/game/language/dictionary/Misc.d.ts +2 -1
  35. package/definitions/game/language/dictionary/UiTranslation.d.ts +727 -723
  36. package/definitions/game/language/english/ui/UsableActionTypes.d.ts +1 -1
  37. package/definitions/game/ui/UiExperiments.d.ts +1 -2
  38. package/definitions/game/ui/input/Bindable.d.ts +2 -1
  39. package/definitions/game/ui/screen/screens/GameScreen.d.ts +1 -1
  40. package/definitions/game/ui/screen/screens/game/component/ItemComponent.d.ts +1 -1
  41. package/definitions/game/ui/screen/screens/game/dialog/ContainerDialog.d.ts +4 -0
  42. package/definitions/game/ui/screen/screens/game/dialog/EquipmentDialog.d.ts +1 -1
  43. package/definitions/game/ui/screen/screens/game/dialog/InventoryDialog.d.ts +2 -0
  44. package/package.json +1 -1
  45. package/definitions/game/game/item/TileItemContainer.d.ts +0 -25
@@ -174,6 +174,7 @@ export declare class Game extends EventEmitter.Host<IGameEvents> {
174
174
  getGameMode(): GameMode;
175
175
  getGameOptionsBeforeModifiers(): IGameOptions;
176
176
  getGameOptions(): IGameOptions;
177
+ uncacheGameOptions(): void;
177
178
  updateGameOptions(gameOptions: IGameOptions): void;
178
179
  initializeGameOptions(seed: string | number, mode?: GameMode, options?: IGameOptions, milestoneModifiers?: Set<Milestone>): void;
179
180
  initializeModifiers(): void;
@@ -33,6 +33,12 @@ import type Version from "@wayward/game/utilities/Version";
33
33
  import type { IVector2, IVector3 } from "@wayward/game/utilities/math/IVector";
34
34
  import type { IRange } from "@wayward/utilities/math/Range";
35
35
  export interface IGameEvents {
36
+ /**
37
+ * Called when game options are first processed, after modifiers are applied.
38
+ *
39
+ * You can use this combined with `game.uncacheGameOptions()` to dynamically modify game options.
40
+ */
41
+ getGameOptions(gameOptions: IGameOptions): IGameOptions;
36
42
  /**
37
43
  * Called when the game is starting
38
44
  * @param isLoadingSave True if a save game was loaded
@@ -53,7 +53,7 @@ export declare class Alignment implements IReadableAlignment {
53
53
  /**
54
54
  * Reduce the "good" of the player. The value will be rounded and clamped.
55
55
  */
56
- reduceGood(value: number, check?: boolean): this;
56
+ reduceGood(value: number, capCheck?: boolean): this;
57
57
  get goodCap(): number;
58
58
  /**
59
59
  * The current "evil" of the player. A positive integer from 0 to maximum value.
@@ -71,7 +71,7 @@ export declare class Alignment implements IReadableAlignment {
71
71
  /**
72
72
  * Reduce the "evil" of the player. The value will be rounded and clamped.
73
73
  */
74
- reduceEvil(value: number, check?: boolean): this;
74
+ reduceEvil(value: number, capCheck?: boolean): this;
75
75
  get evilCap(): number;
76
76
  get fraction(): number;
77
77
  get deity(): number;
@@ -27,7 +27,7 @@ import type NPC from "@wayward/game/game/entity/npc/NPC";
27
27
  import type Player from "@wayward/game/game/entity/player/Player";
28
28
  import type { IWell } from "@wayward/game/game/island/IIsland";
29
29
  import { LiquidType } from "@wayward/game/game/island/IIsland";
30
- import type { ContainerSort, DisplayableItemType, IContainer, IItemVehicle, ILiquidGather, ItemTypeExtra } from "@wayward/game/game/item/IItem";
30
+ import type { ContainerSort, DisplayableItemType, IContainer, IItemVehicle, ILiquidGather, IUncastableContainer, ItemTypeExtra } from "@wayward/game/game/item/IItem";
31
31
  import { ItemType } from "@wayward/game/game/item/IItem";
32
32
  import type Item from "@wayward/game/game/item/Item";
33
33
  import type { IHasMagic } from "@wayward/game/game/magic/MagicalPropertyManager";
@@ -137,6 +137,7 @@ export default class Doodad extends EntityMovable<IDoodadDescription, DoodadType
137
137
  get asPlayer(): undefined;
138
138
  get asTileEvent(): undefined;
139
139
  get asItem(): undefined;
140
+ get asTile(): undefined;
140
141
  get asContainer(): this & IContainer | undefined;
141
142
  isCorpse(): this is Corpse;
142
143
  isCreature(): this is Creature;
@@ -147,6 +148,8 @@ export default class Doodad extends EntityMovable<IDoodadDescription, DoodadType
147
148
  isPlayer(): this is Player;
148
149
  isTileEvent(): this is TileEvent;
149
150
  isItem(): this is Item;
151
+ isTile(): this is Tile;
152
+ isContainer(): this is IUncastableContainer;
150
153
  toString(): string;
151
154
  getRegistrarId(): number;
152
155
  /**
@@ -281,6 +284,7 @@ export default class Doodad extends EntityMovable<IDoodadDescription, DoodadType
281
284
  * @param growthBonus The bonus that is applied (on top of a default of 10) to the plants decay (so it grows faster).
282
285
  */
283
286
  healOrHarmPlant(liquid: LiquidType, growthBonus?: number): void;
287
+ initializeMagicalPropertyManager(): MagicalPropertyManager;
284
288
  isLitAndCanRevert(): boolean;
285
289
  /**
286
290
  * Reverts lit doodads if they provide fire and have a revert doodad type set.
@@ -138,6 +138,10 @@ export interface IDoodadDescription extends IObjectDescription, IModdable, ICaus
138
138
  tileOverLayerType?: TileLayerType;
139
139
  trapDamage?: number;
140
140
  waterStill?: boolean;
141
+ /**
142
+ * Whether magical properties have no effect on this doodad.
143
+ */
144
+ magicInert?: true;
141
145
  /**
142
146
  * The region where items are stacked.
143
147
  * The default region is { xMin: 0, xMax: 0, yMin: 1, yMax: 1 }
@@ -15,7 +15,7 @@ import type Doodad from "@wayward/game/game/doodad/Doodad";
15
15
  import type EntityMovable from "@wayward/game/game/entity/EntityMovable";
16
16
  import type EntityWithStats from "@wayward/game/game/entity/EntityWithStats";
17
17
  import type Human from "@wayward/game/game/entity/Human";
18
- import type { IEntityConstructorOptions, IEntityEvents } from "@wayward/game/game/entity/IEntity";
18
+ import type { ICastable, IEntityConstructorOptions, IEntityEvents } from "@wayward/game/game/entity/IEntity";
19
19
  import { EntityType } from "@wayward/game/game/entity/IEntity";
20
20
  import type { IHumanBound } from "@wayward/game/game/entity/IEntityManager";
21
21
  import type { ActionType } from "@wayward/game/game/entity/action/IAction";
@@ -26,6 +26,7 @@ import type Player from "@wayward/game/game/entity/player/Player";
26
26
  import type { IInspector } from "@wayward/game/game/inspection/IInfoProvider";
27
27
  import type { IslandId } from "@wayward/game/game/island/IIsland";
28
28
  import type Island from "@wayward/game/game/island/Island";
29
+ import type { IUncastableContainer } from "@wayward/game/game/item/IItem";
29
30
  import type Item from "@wayward/game/game/item/Item";
30
31
  import type { EntityReferenceTypes, IReferenceable, Reference } from "@wayward/game/game/reference/IReferenceManager";
31
32
  import type { ITemperatureSource } from "@wayward/game/game/temperature/ITemperature";
@@ -39,7 +40,7 @@ import type { IVector3 } from "@wayward/game/utilities/math/IVector";
39
40
  import type { IVector4 } from "@wayward/game/utilities/math/Vector4";
40
41
  import EventEmitter from "@wayward/utilities/event/EventEmitter";
41
42
  import type { WorldZ } from "@wayward/utilities/game/WorldZ";
42
- export default abstract class Entity<DescriptionType = unknown, TypeType extends number = number, EntityReferenceType extends EntityReferenceTypes = EntityReferenceTypes, TagType = unknown> extends EventEmitter.Host<IEntityEvents> implements IReferenceable, IInspector, ITemperatureSource, INotificationLocation, IVector4 {
43
+ export default abstract class Entity<DescriptionType = unknown, TypeType extends number = number, EntityReferenceType extends EntityReferenceTypes = EntityReferenceTypes, TagType = unknown> extends EventEmitter.Host<IEntityEvents> implements IReferenceable, IInspector, ITemperatureSource, INotificationLocation, IVector4, ICastable {
43
44
  abstract readonly entityType: EntityType;
44
45
  abstract readonly tileUpdateType: TileUpdateType;
45
46
  id: number;
@@ -157,6 +158,8 @@ export default abstract class Entity<DescriptionType = unknown, TypeType extends
157
158
  abstract get asPlayer(): Player | undefined;
158
159
  abstract get asTileEvent(): TileEvent | undefined;
159
160
  abstract get asItem(): Item | undefined;
161
+ abstract get asTile(): Tile | undefined;
162
+ abstract get asContainer(): (this & IUncastableContainer) | undefined;
160
163
  abstract isCorpse(): this is Corpse;
161
164
  abstract isCreature(): this is Creature;
162
165
  abstract isDoodad(): this is Doodad;
@@ -166,5 +169,9 @@ export default abstract class Entity<DescriptionType = unknown, TypeType extends
166
169
  abstract isPlayer(): this is Player;
167
170
  abstract isTileEvent(): this is TileEvent;
168
171
  abstract isItem(): this is Item;
172
+ abstract isTile(): this is Tile;
173
+ abstract isContainer(): this is IUncastableContainer;
174
+ isEntity(): this is Entity;
169
175
  asType(type: TypeType): this | undefined;
176
+ get asUnion(): Player | NPC | Creature | TileEvent | Item | Corpse | Doodad;
170
177
  }
@@ -36,7 +36,7 @@ import type { ISkillAttribute } from "@wayward/game/game/entity/skill/ISkills";
36
36
  import SkillManager from "@wayward/game/game/entity/skill/SkillManager";
37
37
  import type { IMobCheck, IMoveToIslandOptions, IslandId } from "@wayward/game/game/island/IIsland";
38
38
  import type Island from "@wayward/game/game/island/Island";
39
- import type { EquipEffectByType, EquipEffects, IContainer, IRanged, RecipeLevel } from "@wayward/game/game/item/IItem";
39
+ import type { ContainerSort, ContainerType, EquipEffectByType, EquipEffects, IContainer, IRanged, IUncastableContainer, RecipeLevel } from "@wayward/game/game/item/IItem";
40
40
  import { EquipEffect, ItemType, ItemTypeGroup } from "@wayward/game/game/item/IItem";
41
41
  import type Item from "@wayward/game/game/item/Item";
42
42
  import ItemReference from "@wayward/game/game/item/ItemReference";
@@ -55,6 +55,7 @@ import Message from "@wayward/game/language/dictionary/Message";
55
55
  import type TranslationImpl from "@wayward/game/language/impl/TranslationImpl";
56
56
  import type { FieldOfView } from "@wayward/game/renderer/fieldOfView/FieldOfView";
57
57
  import { CanASeeBType } from "@wayward/game/renderer/fieldOfView/IFieldOfView";
58
+ import type { SortDirection } from "@wayward/game/save/ISaveManager";
58
59
  import type { IOptions } from "@wayward/game/save/data/ISaveDataGlobal";
59
60
  import { Direction } from "@wayward/game/utilities/math/Direction";
60
61
  import type { IVector2, IVector3 } from "@wayward/game/utilities/math/IVector";
@@ -65,7 +66,7 @@ interface IEquip {
65
66
  item: Item;
66
67
  equipType: EquipType;
67
68
  }
68
- export default abstract class Human<TypeType extends number = number, EntityReferenceType extends ReferenceType.Player | ReferenceType.NPC = ReferenceType.Player | ReferenceType.NPC> extends EntityWithStats<unknown, TypeType, EntityReferenceType> implements IHasInsulation {
69
+ export default abstract class Human<TypeType extends number = number, EntityReferenceType extends ReferenceType.Player | ReferenceType.NPC = ReferenceType.Player | ReferenceType.NPC> extends EntityWithStats<unknown, TypeType, EntityReferenceType> implements IHasInsulation, IContainer {
69
70
  static getNameTranslation(): TranslationImpl;
70
71
  event: IEventEmitter<this, IHumanEvents>;
71
72
  anim: number;
@@ -88,7 +89,6 @@ export default abstract class Human<TypeType extends number = number, EntityRefe
88
89
  equippedReferences: Map<EquipType, ItemReference>;
89
90
  flyingDelay?: number;
90
91
  handEquippedToLast: EquipType.OffHand | EquipType.MainHand;
91
- inventory: IContainer;
92
92
  isConnecting: boolean;
93
93
  lastAttackedByReference?: Reference;
94
94
  manualTickActionDelay?: number;
@@ -108,6 +108,9 @@ export default abstract class Human<TypeType extends number = number, EntityRefe
108
108
  vehicleItemReference: ItemReference | undefined;
109
109
  connectedVehicleId?: number;
110
110
  walkSoundCounter: number;
111
+ containedItems: Item[];
112
+ sort?: ContainerSort;
113
+ sortDirection?: SortDirection;
111
114
  readonly movementIntent: IMovementIntent;
112
115
  walkPath?: IWalkPath;
113
116
  identifier: string;
@@ -115,7 +118,10 @@ export default abstract class Human<TypeType extends number = number, EntityRefe
115
118
  quests: IQuestManager;
116
119
  messages: IMessageManager;
117
120
  notes: INoteManager;
121
+ /** @deprecated (use the entity itself) */
122
+ readonly inventory: IContainer;
118
123
  private readonly privateStore;
124
+ containerType?: ContainerType;
119
125
  nextMoveTime: number;
120
126
  nextMoveDirection?: Direction.Cardinal | Direction.None;
121
127
  private lastVehicleMoveDirection?;
@@ -131,7 +137,7 @@ export default abstract class Human<TypeType extends number = number, EntityRefe
131
137
  protected gameOptionsCached?: IGameOptionsPlayer;
132
138
  protected cachedMovementPenalty?: number;
133
139
  constructor(entityOptions?: IEntityConstructorOptions<TypeType>);
134
- protected getDescription(): void;
140
+ protected getDescription(): undefined;
135
141
  abstract createNoteManager(): INoteManager;
136
142
  abstract createMessageManager(): IMessageManager;
137
143
  abstract createQuestManager(): IQuestManager;
@@ -452,15 +458,20 @@ export default abstract class Human<TypeType extends number = number, EntityRefe
452
458
  get asCorpse(): undefined;
453
459
  get asCreature(): undefined;
454
460
  get asDoodad(): undefined;
455
- get asHuman(): Human;
461
+ get asHuman(): this;
462
+ get asGenericHuman(): Human;
456
463
  get asTileEvent(): undefined;
457
464
  get asItem(): undefined;
465
+ get asTile(): undefined;
466
+ get asContainer(): this & IUncastableContainer;
458
467
  isCorpse(): this is Corpse;
459
468
  isCreature(): this is Creature;
460
469
  isDoodad(): this is Doodad;
461
470
  isHuman(): this is Human;
462
471
  isTileEvent(): this is TileEvent;
463
472
  isItem(): this is Item;
473
+ isTile(): this is Tile;
474
+ isContainer(): this is IUncastableContainer;
464
475
  get point(): IVector3;
465
476
  get tile(): Tile;
466
477
  /**
@@ -11,10 +11,17 @@
11
11
  import type { IMovementTime } from "@wayward/game/game/IGame";
12
12
  import type Doodad from "@wayward/game/game/doodad/Doodad";
13
13
  import type Entity from "@wayward/game/game/entity/Entity";
14
+ import type Human from "@wayward/game/game/entity/Human";
14
15
  import type { Delay, MovingState, SkillType } from "@wayward/game/game/entity/IHuman";
15
16
  import type { ActionType } from "@wayward/game/game/entity/action/IAction";
17
+ import type Creature from "@wayward/game/game/entity/creature/Creature";
18
+ import type Corpse from "@wayward/game/game/entity/creature/corpse/Corpse";
19
+ import type NPC from "@wayward/game/game/entity/npc/NPC";
20
+ import type Player from "@wayward/game/game/entity/player/Player";
21
+ import type { IUncastableContainer } from "@wayward/game/game/item/IItem";
16
22
  import type Item from "@wayward/game/game/item/Item";
17
23
  import type Tile from "@wayward/game/game/tile/Tile";
24
+ import type TileEvent from "@wayward/game/game/tile/TileEvent";
18
25
  import type { Direction } from "@wayward/game/utilities/math/Direction";
19
26
  export interface IEntityEvents {
20
27
  /**
@@ -42,6 +49,33 @@ export interface IEntityConstructorOptions<TypeType extends number> {
42
49
  tile: Tile;
43
50
  }
44
51
  export declare function asEntity(value?: unknown): Entity | undefined;
52
+ export interface ICastable {
53
+ get asEntity(): Entity | undefined;
54
+ get asUnion(): Corpse | Creature | Doodad | Human | NPC | Player | TileEvent | Item | Tile | undefined;
55
+ get asCorpse(): Corpse | undefined;
56
+ get asCreature(): Creature | undefined;
57
+ get asDoodad(): Doodad | undefined;
58
+ get asHuman(): Human | undefined;
59
+ get asNPC(): NPC | undefined;
60
+ get asPlayer(): Player | undefined;
61
+ get asLocalPlayer(): Player | undefined;
62
+ get asTileEvent(): TileEvent | undefined;
63
+ get asItem(): Item | undefined;
64
+ get asTile(): Tile | undefined;
65
+ get asContainer(): (this & IUncastableContainer) | undefined;
66
+ isEntity(): this is Entity;
67
+ isCorpse(): this is Corpse;
68
+ isCreature(): this is Creature;
69
+ isDoodad(): this is Doodad;
70
+ isHuman(): this is Human;
71
+ isNPC(): this is NPC;
72
+ isPlayer(): this is Player;
73
+ get isLocalPlayer(): boolean;
74
+ isTileEvent(): this is TileEvent;
75
+ isItem(): this is Item;
76
+ isTile(): this is Tile;
77
+ isContainer(): this is IUncastableContainer;
78
+ }
45
79
  export declare enum StatusEffectChangeReason {
46
80
  Gained = 0,
47
81
  Passed = 1,