@wayward/types 2.13.0-beta.dev.20230512.1 → 2.13.1-beta.dev.20230513.2

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.
@@ -121,6 +121,7 @@ export default class Doodad extends Entity<IDoodadDescription, DoodadType, Dooda
121
121
  get asPlayer(): undefined;
122
122
  get asTileEvent(): undefined;
123
123
  get asItem(): undefined;
124
+ get asContainer(): this & IContainer | undefined;
124
125
  toString(): string;
125
126
  getRegistrarId(): number;
126
127
  /**
@@ -97,14 +97,16 @@ export interface IHumanEvents extends Events<EntityWithStats>, ISkillEvents {
97
97
  */
98
98
  canConsumeItem(itemType: ItemType, actionType: ActionType): boolean | undefined;
99
99
  /**
100
- * Called when an item is being dropped
101
- * @param item The item to be dropped
102
- * @param tile The tile the item will be dropped on
103
- * @param dropAll True if all items of this type will be dropped
104
- * @param dropAllQuality If not undefined, all items of this quality will be dropped
105
- * @returns True if the item can be dropped, false if the item can not be dropped, or undefined to use the default logic
100
+ * @deprecated Use filterDroppable
106
101
  */
107
102
  canDropItem(item: Item, tile: Tile, dropAll: boolean, dropAllQuality: Quality | undefined): boolean | undefined;
103
+ /**
104
+ * Called in `Drop.canUse()`
105
+ * @param items The items that will be dropped
106
+ * @param tile The tile the items will be dropped on
107
+ * @returns an `Item[]` if filtering, `undefined` to allow all of these items to be dropped
108
+ */
109
+ filterDroppable(items: Item[], tile: Tile): Item[] | undefined;
108
110
  /**
109
111
  * Called before an npc attacks
110
112
  * @param weapon The weapon used to attack
@@ -41,7 +41,12 @@ export declare const actionDescriptionsSlow: {
41
41
  }, [import("../../item/Item").default]>;
42
42
  62: import("./Action").Action<[], import("../Human").default<number>, void, import("game/entity/action/actions/DrinkInFront").IDrinkInFrontCanUse, []>;
43
43
  8: import("./Action").Action<[import("game/entity/action/IAction").ActionArgument.ItemNearby], import("../Human").default<number>, void, import("./actions/ConsumeItem").IConsumeItemCanUse, [import("../../item/Item").default]>;
44
- 56: import("./Action").Action<[import("game/entity/action/IAction").ActionArgument.ItemNearby, [import("game/entity/action/IAction").ActionArgument.Boolean, import("game/entity/action/IAction").ActionArgument.Undefined], [import("game/entity/action/IAction").ActionArgument.Boolean, import("game/entity/action/IAction").ActionArgument.Undefined], [import("game/entity/action/IAction").ActionArgument.String, import("game/entity/action/IAction").ActionArgument.Undefined]], import("../Human").default<number>, void, import("game/entity/action/IAction").IActionUsable, [import("../../item/Item").default, (boolean | undefined)?, (boolean | undefined)?, (string | undefined)?]>;
44
+ 56: import("./Action").Action<[[import("game/entity/action/IAction").ActionArgument.Undefined, import("game/entity/action/IAction").ActionArgument.ItemNearby, import("game/entity/action/IAction").ActionArgument.ItemArrayNearby, import("game/entity/action/IAction").ActionArgument.ItemType], [import("game/entity/action/IAction").ActionArgument.Undefined, import("game/entity/action/IAction").ActionArgument.Quality], [import("game/entity/action/IAction").ActionArgument.Undefined, import("game/entity/action/IAction").ActionArgument.String], [import("game/entity/action/IAction").ActionArgument.Undefined, import("game/entity/action/IAction").ActionArgument.Integer32], [import("game/entity/action/IAction").ActionArgument.Undefined, import("game/entity/action/IAction").ActionArgument.Container]], import("../Human").default<number>, void, {
45
+ usable: true;
46
+ items: import("../../item/Item").default[];
47
+ into: import("../../item/IItem").IContainer | undefined;
48
+ tile: import("../../tile/Tile").default;
49
+ }, [(import("../../item/Item").default | import("../../item/IItem").ItemType | import("../../item/Item").default[] | undefined)?, (import("../../IObject").Quality | undefined)?, (string | undefined)?, (number | undefined)?, (import("../../item/IItem").IContainer | undefined)?]>;
45
50
  7: import("./Action").Action<[import("game/entity/action/IAction").ActionArgument.ItemNearby], import("../Human").default<number>, void, import("./actions/ConsumeItem").IConsumeItemCanUse, [import("../../item/Item").default]>;
46
51
  83: import("./Action").Action<[import("game/entity/action/IAction").ActionArgument.ItemNearby, [import("game/entity/action/IAction").ActionArgument.ItemNearby, import("game/entity/action/IAction").ActionArgument.Undefined]], import("../Human").default<number>, void, import("game/entity/action/actions/Enchant").IEnchantCanUse, [import("../../item/Item").default, (import("../../item/Item").default | undefined)?]>;
47
52
  93: import("./Action").Action<[import("game/entity/action/IAction").ActionArgument.ItemInventory, [import("game/entity/action/IAction").ActionArgument.ItemInventory, import("game/entity/action/IAction").ActionArgument.Undefined]], import("../Human").default<number>, void, import("game/entity/action/actions/Enhance").IEnhanceCanUse, [import("../../item/Item").default, (import("../../item/Item").default | undefined)?]>;
@@ -8,8 +8,27 @@
8
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
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
+ import type { Quality } from "game/IObject";
12
+ import type Human from "game/entity/Human";
11
13
  import { Action } from "game/entity/action/Action";
12
14
  import { ActionArgument } from "game/entity/action/IAction";
15
+ import type { IContainer } from "game/item/IItem";
13
16
  import type Item from "game/item/Item";
14
- declare const _default: Action<[ActionArgument.ItemNearby, [ActionArgument.Boolean, ActionArgument.Undefined], [ActionArgument.Boolean, ActionArgument.Undefined], [ActionArgument.String, ActionArgument.Undefined]], import("../../Human").default<number>, void, import("game/entity/action/IAction").IActionUsable, [Item, (boolean | undefined)?, (boolean | undefined)?, (string | undefined)?]>;
17
+ import type Tile from "game/tile/Tile";
18
+ export declare enum DropAllowProtected {
19
+ Disallow = 0,
20
+ AllowSafe = 1,
21
+ AllowDangerous = 2
22
+ }
23
+ export interface IDropCanUse {
24
+ items: Item[];
25
+ tile: Tile;
26
+ into?: IContainer;
27
+ }
28
+ declare const _default: Action<[[ActionArgument.Undefined, ActionArgument.ItemNearby, ActionArgument.ItemArrayNearby, ActionArgument.ItemType], [ActionArgument.Undefined, ActionArgument.Quality], [ActionArgument.Undefined, ActionArgument.String], [ActionArgument.Undefined, ActionArgument.Integer32], [ActionArgument.Undefined, ActionArgument.Container]], Human<number>, void, {
29
+ usable: true;
30
+ items: Item[];
31
+ into: IContainer | undefined;
32
+ tile: Tile;
33
+ }, [(Item | import("game/item/IItem").ItemType | Item[] | undefined)?, (Quality | undefined)?, (string | undefined)?, (number | undefined)?, (IContainer | undefined)?]>;
15
34
  export default _default;
@@ -40,6 +40,7 @@ export interface IUsableActionRequirement<TYPE> {
40
40
  export interface IUsableActionItemRequirement extends Omit<IUsableActionRequirement<Item>, "find"> {
41
41
  allowOnlyItemType?(player: Player, type: ItemType): boolean;
42
42
  finder?(player: Player): ItemFinder | undefined;
43
+ requiresQuality?: true;
43
44
  }
44
45
  export declare namespace IUsableActionRequirement {
45
46
  interface Maybe<TYPE> {
@@ -66,7 +67,7 @@ export interface IUsableActionPossibleUsing {
66
67
  export interface IUsableActionUsing<REQUIREMENTS extends IUsableActionRequirements> {
67
68
  item: ((REQUIREMENTS["item"] extends true ? Item : never) | (undefined extends REQUIREMENTS["item"] ? undefined : never) | (REQUIREMENTS["item"] extends {
68
69
  allowNone: true;
69
- } ? undefined : never) | (REQUIREMENTS["item"] extends {
70
+ } ? Item | undefined : never) | (REQUIREMENTS["item"] extends {
70
71
  validate(player: Player, value: Item): boolean;
71
72
  } ? Item : never) | (REQUIREMENTS["item"] extends {
72
73
  finder: ItemFinder;
@@ -74,14 +75,23 @@ export interface IUsableActionUsing<REQUIREMENTS extends IUsableActionRequiremen
74
75
  allowOnlyItemType(player: Player, type: ItemType): boolean;
75
76
  } ? undefined : never));
76
77
  itemType: ((REQUIREMENTS["item"] extends true ? ItemType : never) | (undefined extends REQUIREMENTS["item"] ? undefined : never) | (REQUIREMENTS["item"] extends {
77
- allowNone: true;
78
- } ? undefined : never) | (REQUIREMENTS["item"] extends {
78
+ allowOnlyItemType(player: Player, type: ItemType): boolean;
79
+ } ? ItemType : never) | (REQUIREMENTS["item"] extends {
79
80
  validate(player: Player, value: Item): boolean;
80
81
  } ? ItemType | undefined : never) | (REQUIREMENTS["item"] extends {
81
82
  finder: ItemFinder;
82
83
  } ? ItemType : never) | (REQUIREMENTS["item"] extends {
84
+ allowNone: true;
85
+ } ? undefined : never));
86
+ itemQuality: ((REQUIREMENTS["item"] extends true ? Quality : never) | (undefined extends REQUIREMENTS["item"] ? undefined : never) | (REQUIREMENTS["item"] extends {
87
+ allowNone: true;
88
+ } ? undefined : never) | (REQUIREMENTS["item"] extends {
89
+ validate(player: Player, value: Item): boolean;
90
+ } ? Quality | undefined : never) | (REQUIREMENTS["item"] extends {
91
+ finder: ItemFinder;
92
+ } ? Quality : never) | (REQUIREMENTS["item"] extends {
83
93
  allowOnlyItemType(player: Player, type: ItemType): boolean;
84
- } ? ItemType : never));
94
+ } ? Quality : never));
85
95
  doodad: ((REQUIREMENTS["doodad"] extends true ? Doodad : never) | (undefined extends REQUIREMENTS["doodad"] ? undefined : never) | (REQUIREMENTS["doodad"] extends {
86
96
  allowNone: true;
87
97
  } ? undefined : never) | (REQUIREMENTS["doodad"] extends {
@@ -123,8 +133,9 @@ export declare namespace IUsableActionNotUsable {
123
133
  }
124
134
  export type UsableActionUsability<REQUIREMENTS extends IUsableActionRequirements = IUsableActionRequirements> = IUsableActionUsable<REQUIREMENTS> | IUsableActionNotUsable;
125
135
  export declare enum UsableActionExecutionContext {
126
- ContextMenu = 0,
127
- ActionBar = 1
136
+ Generic = 0,
137
+ ContextMenu = 1,
138
+ ActionBar = 2
128
139
  }
129
140
  export interface IUsableActionExecutionContext {
130
141
  context: UsableActionExecutionContext;
@@ -193,7 +204,7 @@ export interface IUsableActionDefinitionBase<REQUIREMENTS extends IUsableActionR
193
204
  * @param player The player executing this action. This isn't always the local player!
194
205
  * @param using What the player is using — items, doodads, etc.
195
206
  */
196
- isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>): ReturnableUsableActionUsability;
207
+ isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>, context: UsableActionExecutionContext | IUsableActionExecutionContext): ReturnableUsableActionUsability;
197
208
  /**
198
209
  * Marks this "action" as a submenu container instead of an executable. Is a generator for the submenu.
199
210
  * @param registrar The registrar that submenu actions should be appended to.
@@ -215,22 +226,28 @@ export interface IUsableActionDefinitionBase<REQUIREMENTS extends IUsableActionR
215
226
  * @param using What the player is using — items, doodads, etc.
216
227
  * @param context Context to do with this action execution — where it's executed from, etc.
217
228
  */
218
- execute?(player: Player, using: IUsableActionUsing<REQUIREMENTS>, context: IUsableActionExecutionContext): any;
229
+ execute?(player: Player, using: IUsableActionUsing<REQUIREMENTS>, context: UsableActionExecutionContext | IUsableActionExecutionContext): any;
219
230
  /**
220
231
  * Marks this usable action as only executable client-side. This disables support for "use when moving" in action slots.
221
232
  */
222
233
  clientSide?: true;
223
234
  /**
224
235
  * Marks this usable action as, when slotted in the action bar on an item, the item should be ignored and instead the type should be used.
236
+ * Compatible with onlySlotItemQuality
225
237
  */
226
238
  onlySlotItemType?: true;
239
+ /**
240
+ * Marks this usable action as, when slotted in the action bar on an item, the item should be ignored and instead the quality should be used.
241
+ * Compatible with onlySlotItemType
242
+ */
243
+ onlySlotItemQuality?: true;
227
244
  tooltip?(tooltip: Tooltip): any;
228
245
  forceDisplayWhenEmpty?: true;
229
246
  }
230
247
  export interface IUsableActionDefinitionSubmenu<REQUIREMENTS extends IUsableActionRequirements = IUsableActionRequirements> extends IUsableActionDefinitionBase<REQUIREMENTS> {
231
248
  submenu(registrar: UsableActionRegistrar, using: IUsableActionUsing<REQUIREMENTS>): UsableActionRegistrar | void;
232
249
  execute?: undefined;
233
- isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>): ReturnableUsableActionUsability;
250
+ isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>, context: IUsableActionExecutionContext): ReturnableUsableActionUsability;
234
251
  slottable?: undefined;
235
252
  forceDisplayWhenEmpty?: true;
236
253
  }
@@ -240,7 +257,7 @@ export interface IUsableActionDefinitionExecutable<REQUIREMENTS extends IUsableA
240
257
  submenu?: undefined;
241
258
  forceDisplayWhenEmpty?: undefined;
242
259
  execute(player: Player, using: IUsableActionUsing<REQUIREMENTS>, context: IUsableActionExecutionContext): any;
243
- isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>): ReturnableUsableActionUsability;
260
+ isUsable?(player: Player, using: IUsableActionUsing<REQUIREMENTS>, context: IUsableActionExecutionContext): ReturnableUsableActionUsability;
244
261
  }
245
262
  export type IUsableActionDefinition<REQUIREMENTS extends IUsableActionRequirements = IUsableActionRequirements> = IUsableActionDefinitionSubmenu<REQUIREMENTS> | IUsableActionDefinitionExecutable<REQUIREMENTS>;
246
263
  export type ActionId = string | ActionType | UsableActionType;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import EventEmitter from "event/EventEmitter";
12
12
  import type { ActionId, IUsableActionDefinition, IUsableActionDefinitionExecutable, IUsableActionExecutionContext, IUsableActionPossibleUsing, IUsableActionRequirements, IUsableActionUsing, UsableActionUsability } from "game/entity/action/usable/IUsableAction";
13
- import { IUsableActionNotUsable, UsableActionDisplayContext } from "game/entity/action/usable/IUsableAction";
13
+ import { IUsableActionNotUsable, UsableActionDisplayContext, UsableActionExecutionContext } from "game/entity/action/usable/IUsableAction";
14
14
  import UsableActionRegistrar from "game/entity/action/usable/UsableActionRegistrar";
15
15
  import type { ActionWhichTranslation } from "game/entity/action/usable/UsableActionTranslator";
16
16
  import type Player from "game/entity/player/Player";
@@ -43,9 +43,9 @@ declare class UsableAction<REQUIREMENTS extends IUsableActionRequirements = IUsa
43
43
  id: ActionId;
44
44
  constructor(requirements: REQUIREMENTS, definition: DEFINITION);
45
45
  isExecutable(): this is UsableAction<REQUIREMENTS, IUsableActionDefinitionExecutable<REQUIREMENTS>>;
46
- execute(player: Player, provided: IUsableActionUsing<REQUIREMENTS>, context: IUsableActionExecutionContext): boolean;
46
+ execute(player: Player, provided: IUsableActionUsing<REQUIREMENTS>, context: UsableActionExecutionContext | IUsableActionExecutionContext): boolean;
47
47
  resolveUsing(player: Player, using: IUsableActionUsing<REQUIREMENTS>): false | IUsableActionUsing<REQUIREMENTS>;
48
- isUsable(player: Player, provided: IUsableActionUsing<REQUIREMENTS>): UsableActionUsability<REQUIREMENTS>;
48
+ isUsable(player: Player, provided: IUsableActionUsing<REQUIREMENTS>, context: UsableActionExecutionContext | IUsableActionExecutionContext): UsableActionUsability<REQUIREMENTS>;
49
49
  isApplicable(player: Player, provided?: IUsableActionPossibleUsing, fullUsabilityCheck?: boolean): provided is IUsableActionUsing<REQUIREMENTS>;
50
50
  private isItemApplicable;
51
51
  private isDoodadApplicable;
@@ -9,15 +9,15 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import type { IEventEmitter } from "event/EventEmitter";
12
- import { CreatureType } from "game/entity/creature/ICreature";
12
+ import { TileUpdateType } from "game/IGame";
13
13
  import Human from "game/entity/Human";
14
14
  import { EntityType } from "game/entity/IEntity";
15
15
  import { SkillType } from "game/entity/IHuman";
16
+ import { CreatureType } from "game/entity/creature/ICreature";
16
17
  import type { IMovementIntent, IPlayerEvents } from "game/entity/player/IPlayer";
17
18
  import MessageManager from "game/entity/player/MessageManager";
18
19
  import NoteManager from "game/entity/player/note/NoteManager";
19
20
  import QuestManager from "game/entity/player/quest/QuestManager";
20
- import { TileUpdateType } from "game/IGame";
21
21
  import type { IslandId } from "game/island/IIsland";
22
22
  import type { IContainer } from "game/item/IItem";
23
23
  import { ItemType } from "game/item/IItem";
@@ -103,6 +103,7 @@ export interface IMoveItemOptions {
103
103
  skipWeightChecks?: boolean;
104
104
  suspendNotifier?: boolean;
105
105
  moveToTileOptions?: IMoveToTileOptions;
106
+ dryRun?: true;
106
107
  }
107
108
  export interface IPlaceOnTileOptions {
108
109
  force?: boolean;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type { BiomeType } from "game/biome/IBiome";
12
12
  import Doodad from "game/doodad/Doodad";
13
- import type { IActionHandlerApi } from "game/entity/action/IAction";
13
+ import type { IActionHandlerApi, IActionNotUsable } from "game/entity/action/IAction";
14
14
  import { ActionType } from "game/entity/action/IAction";
15
15
  import Human from "game/entity/Human";
16
16
  import type NPC from "game/entity/npc/NPC";
@@ -168,6 +168,7 @@ export default class ItemManager extends ObjectManager<Item, IItemManagerEvents>
168
168
  * @returns Result that tells you what moved
169
169
  */
170
170
  moveItemsToContainer(human: Human | undefined, items: Item[], toContainer: IContainer, options?: IMoveItemOptions): IAddToContainerResult;
171
+ tryMoveItemsToContainer(human: Human | undefined, items: Item[], toContainer: IContainer, options?: IMoveItemOptions): IAddToContainerResult | IActionNotUsable;
171
172
  removeContainerItems(container: IContainer, removeContainedItems?: boolean): void;
172
173
  exists(item: Item): boolean;
173
174
  remove(item: Item, removeContainedItems?: boolean, extinguishTorches?: boolean): void;