@wayward/types 2.12.0-beta.dev.20220903.1 → 2.12.0-beta.dev.20220904.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.
@@ -55,9 +55,11 @@ export declare enum SfxType {
55
55
  UiInput = 28,
56
56
  UiInvalid = 29,
57
57
  UiOpen = 30,
58
- UiSelect = 31,
59
- Walk = 32,
60
- Water = 33
58
+ UiProtect = 31,
59
+ UiSelect = 32,
60
+ UiUnprotect = 33,
61
+ Walk = 34,
62
+ Water = 35
61
63
  }
62
64
  export declare type SfxUi = Extract<keyof typeof SfxType, `Ui${string}`> extends `Ui${infer RESULT}` ? Lowercase<RESULT> : never;
63
65
  export declare enum Music {
@@ -18,8 +18,7 @@ import type Human from "game/entity/Human";
18
18
  import type { AttackType, EntityType } from "game/entity/IEntity";
19
19
  import type { EquipType, RestType, SkillType } from "game/entity/IHuman";
20
20
  import type NPC from "game/entity/npc/NPC";
21
- import type { MessageType } from "game/entity/player/IMessageManager";
22
- import { Source } from "game/entity/player/IMessageManager";
21
+ import type { IPackedMessage } from "game/entity/player/IMessageManager";
23
22
  import type { TurnTypeFlag } from "game/entity/player/IPlayer";
24
23
  import type Player from "game/entity/player/Player";
25
24
  import type { Quality } from "game/IObject";
@@ -31,8 +30,6 @@ import type { IPromptDescriptionBase, PromptDescriptionArgs } from "game/meta/pr
31
30
  import type { Milestone } from "game/milestones/IMilestone";
32
31
  import type { ITile } from "game/tile/ITerrain";
33
32
  import type TileEvent from "game/tile/TileEvent";
34
- import type Message from "language/dictionary/Message";
35
- import type Translation from "language/Translation";
36
33
  import type { IRGB } from "utilities/Color";
37
34
  import type { Direction } from "utilities/math/Direction";
38
35
  import type { IVector2, IVector3 } from "utilities/math/IVector";
@@ -176,22 +173,19 @@ export declare enum ActionDisplayLevel {
176
173
  }
177
174
  export interface IActionUsable {
178
175
  usable: true;
176
+ /**
177
+ * Whether this action is currently usable with the "use on move" feature. Defaults to `true`
178
+ */
179
+ usableOnMove?: boolean;
179
180
  displayLevel?: ActionDisplayLevel;
180
181
  }
181
- export interface IActionNotUsable {
182
+ export interface IActionNotUsable extends Partial<IPackedMessage> {
182
183
  usable: false;
183
184
  alreadyUsing?: true;
184
185
  errorDisplayLevel?: ActionDisplayLevel;
185
- message?: Message;
186
- args?: Translation | any[];
186
+ mobCheck?: IVector3;
187
187
  arg?: never;
188
- type?: MessageType;
189
- sources?: Source | Source[];
190
188
  source?: never;
191
- mobCheck?: IVector3;
192
- }
193
- export declare namespace IActionNotUsableUtilities {
194
- function sendMessage(result: IActionNotUsable, human?: Human): void;
195
189
  }
196
190
  export declare type AnyActionDescription = IActionDescription<Array<ActionArgument | ActionArgument[]>, Entity, any, IActionUsable, any[]>;
197
191
  export interface IActionDescription<A extends Array<ActionArgument | ActionArgument[]> = Array<ActionArgument | ActionArgument[]>, E extends Entity = Entity, R = void, CU extends IActionUsable = IActionUsable, AV extends any[] = ActionArgumentTupleTypes<A>> {
@@ -25,12 +25,9 @@ import type Message from "language/dictionary/Message";
25
25
  import { ActionTranslation } from "language/dictionary/Misc";
26
26
  import TranslationImpl from "language/impl/TranslationImpl";
27
27
  import Translation from "language/Translation";
28
- import { PathType } from "resource/IResourceLoader";
29
28
  import type Bindable from "ui/input/Bindable";
30
29
  import type { ItemDetailIconLocation } from "ui/screen/screens/game/component/Item";
31
- import type Tooltip from "ui/tooltip/Tooltip";
32
30
  import type { HighlightSelector } from "ui/util/IHighlight";
33
- import ImagePath from "ui/util/ImagePath";
34
31
  export interface IUsableActionRequirement<TYPE> {
35
32
  allowNone?: true;
36
33
  validate?(player: Player, value: TYPE): boolean;
@@ -101,7 +98,7 @@ export interface IUsableActionUsing<REQUIREMENTS extends IUsableActionRequiremen
101
98
  }
102
99
  export declare type UsableActionIconReference = ActionType | UsableActionType | UsableActionTypePlaceholder | (Omit<IIcon, "path"> & {
103
100
  action: ActionType | UsableActionType | UsableActionTypePlaceholder;
104
- });
101
+ }) | IIcon;
105
102
  export declare type ReturnableUsableActionUsability = IActionUsable | IActionNotUsable | boolean;
106
103
  export interface IUsableActionUsable<REQUIREMENTS extends IUsableActionRequirements> extends IActionUsable {
107
104
  using: IUsableActionUsing<REQUIREMENTS>;
@@ -151,10 +148,6 @@ export interface IUsableActionDefinitionBase<REQUIREMENTS extends IUsableActionR
151
148
  * because it's repairing this tool.
152
149
  */
153
150
  iconLocationOnItem?: ItemDetailIconLocation;
154
- /**
155
- * The tooltip this action should have, or an initialiser for it.
156
- */
157
- tooltip?: ActionType | ((tooltip: Tooltip) => any);
158
151
  /**
159
152
  * A handler for what this action will highlight when hovered with the mouse.
160
153
  * @param selectors The default selectors. The defaults can be removed, and/or additional selectors can be added.
@@ -174,11 +167,14 @@ export interface IUsableActionDefinitionBase<REQUIREMENTS extends IUsableActionR
174
167
  */
175
168
  displayLevel?: ActionDisplayLevel;
176
169
  /**
177
- * The display order of this action compared to other actions.
170
+ * Controls the display order of this action compared to other actions.
178
171
  * Generally you want to leave this as 0 (default) and just register your action in the correct place.
179
- * Order can be generated dynamically based on the given objects — item, doodad, etc.
172
+ * Priority can be generated dynamically based on the given objects — item, doodad, etc.
173
+ *
174
+ * Higher priority === appears first.
175
+ * Lower priority === appears last.
180
176
  */
181
- order?: number | ((using: IUsableActionPossibleUsing) => number | undefined);
177
+ priority?: number | ((using: IUsableActionPossibleUsing) => number | undefined);
182
178
  /**
183
179
  * Whether this action is currently usable — even if an action "makes sense" with the player and the objects they're using,
184
180
  * and the player can slot it and stuff, it might not currently be usable. For example, "harvest" having nothing to harvest.
@@ -261,11 +257,7 @@ declare class UsableAction<REQUIREMENTS extends IUsableActionRequirements = IUsa
261
257
  getDoodad(player: Player, provided?: IUsableActionPossibleUsing): false | Doodad | undefined;
262
258
  getCreature(player: Player, provided?: IUsableActionPossibleUsing): false | Creature | undefined;
263
259
  getNPC(player: Player, provided?: IUsableActionPossibleUsing): false | NPC | undefined;
264
- getIcon(provided: IUsableActionPossibleUsing): {
265
- path: ImagePath<PathType.Action>;
266
- width: number;
267
- height: number;
268
- } | undefined;
260
+ getIcon(provided: IUsableActionPossibleUsing): IIcon | undefined;
269
261
  getHighlightSelectors(using?: IUsableActionPossibleUsing): HighlightSelector[];
270
262
  private translator?;
271
263
  getTranslation(using?: IUsableActionUsing<REQUIREMENTS>, which?: ActionTranslation): Translation | undefined;
@@ -18,7 +18,7 @@ export interface IUsableActionDynamicDefinition {
18
18
  icon?: UsableActionIconReference;
19
19
  bindable: Bindable;
20
20
  displayLevel?: ActionDisplayLevel;
21
- order?: number;
21
+ priority?: number;
22
22
  }
23
23
  export interface IUsableActionsDynamicConfig<DEFINITION extends IUsableActionDynamicDefinition, REQUIREMENTS extends IUsableActionRequirements> {
24
24
  id: string;
@@ -27,7 +27,7 @@ export interface IUsableActionsDynamicConfig<DEFINITION extends IUsableActionDyn
27
27
  requirements?(action: ActionType, definition?: DEFINITION): REQUIREMENTS;
28
28
  isUsable(action: ActionType, player: Player, using: IUsableActionUsing<REQUIREMENTS>, definition?: DEFINITION): ReturnableUsableActionUsability;
29
29
  execute(action: ActionType, player: Player, using: IUsableActionUsing<REQUIREMENTS>, definition?: DEFINITION): any;
30
- order?(action: ActionType, using: IUsableActionPossibleUsing, definition?: DEFINITION): number | undefined;
30
+ priority?(action: ActionType, using: IUsableActionPossibleUsing, definition?: DEFINITION): number | undefined;
31
31
  }
32
32
  export default class UsableActionsDynamic<DEFINITION extends IUsableActionDynamicDefinition, REQUIREMENTS extends IUsableActionRequirements> extends UsableActionGenerator {
33
33
  constructor(config: IUsableActionsDynamicConfig<DEFINITION, REQUIREMENTS>);
@@ -13,8 +13,8 @@ declare const UsableActionsMain: UsableActionGenerator<[]>;
13
13
  export default UsableActionsMain;
14
14
  export declare enum UsableActionSet {
15
15
  /**
16
- * A set of usable action that appear before all other actions, unless {@link IUsableActionDefinitionBase.order} causes them to appear even earlier.
17
- * Note that `order` is used to sort "use item/doodad/npc" actions to the top — the actions that appear in {@link IItemDescription.use}.
16
+ * A set of usable action that appear before all other actions, unless {@link IUsableActionDefinitionBase.priority} causes them to appear even earlier.
17
+ * Note that `priority` is used to sort "use item/doodad/npc" actions to the top — the actions that appear in {@link IItemDescription.use}.
18
18
  */
19
19
  First = 0,
20
20
  Vehicle = 1,
@@ -8,11 +8,13 @@
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 { SfxType } from "audio/IAudio";
11
12
  import type { BiomeType } from "game/biome/IBiome";
12
13
  import type Doodad from "game/doodad/Doodad";
13
14
  import type Creature from "game/entity/creature/Creature";
14
15
  import type Human from "game/entity/Human";
15
16
  import type { AiType, DamageType, Defense, ICausesStatusEffect, IEntityEvents, MoveType } from "game/entity/IEntity";
17
+ import type { IPackedMessage } from "game/entity/player/IMessageManager";
16
18
  import type { ItemType, ItemTypeGroup } from "game/item/IItem";
17
19
  import type { LootGroupType } from "game/item/LootGroups";
18
20
  import type { ITemperatureDescription } from "game/temperature/ITemperature";
@@ -22,6 +24,7 @@ import type Message from "language/dictionary/Message";
22
24
  import type TranslationImpl from "language/impl/TranslationImpl";
23
25
  import type Translation from "language/Translation";
24
26
  import type { IModdable } from "mod/ModRegistry";
27
+ import type { StatNotificationType } from "renderer/notifier/INotifier";
25
28
  import type { IRGB } from "utilities/Color";
26
29
  export declare enum CreatureType {
27
30
  Slime = 0,
@@ -224,7 +227,6 @@ export interface IDamageOutcomeInput {
224
227
  target: Human | Creature;
225
228
  damageAmount: number;
226
229
  damageType: DamageType;
227
- onlyCalculating?: boolean;
228
230
  weaponName?: Message | TranslationImpl;
229
231
  yourWeaponName?: Translation;
230
232
  targetName?: Translation;
@@ -236,6 +238,10 @@ export interface IDamageOutcome {
236
238
  vulnerable: number;
237
239
  vulnerableTypes: DamageType[];
238
240
  noDamage: boolean;
241
+ regenerate: number[];
242
+ soundEffect?: SfxType;
243
+ statNotifications: Array<[StatNotificationType, number]>;
244
+ messages: IPackedMessage[];
239
245
  }
240
246
  export interface ICreatureEvents extends IEntityEvents {
241
247
  /**
@@ -102,6 +102,12 @@ export interface IMessage {
102
102
  type?: MessageType;
103
103
  message: ISerializedTranslation;
104
104
  }
105
+ export interface IPackedMessage {
106
+ message: Message;
107
+ args?: Translation | any[];
108
+ type?: MessageType;
109
+ sources?: Source | Source[];
110
+ }
105
111
  export interface IMessageManager {
106
112
  getMessageHistory(): Stream<IMessage>;
107
113
  clear(): this;
@@ -111,6 +117,7 @@ export interface IMessageManager {
111
117
  ifVisible(canSee?: IVector4): this;
112
118
  ifOnIsland(island: Island): this;
113
119
  send(message: Message | Translation, ...args: any[]): boolean;
120
+ sendPacked(pack: Partial<IPackedMessage>, ...extraSources: Source[]): boolean;
114
121
  pruneMessageHistory(): boolean;
115
122
  ifIs(human: Human): this;
116
123
  ifIsNot(human: Human): this;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import Stream from "@wayward/goodstream/Stream";
12
12
  import type Human from "game/entity/Human";
13
- import type { IMessage, IMessageHistoryItem, IMessageManager } from "game/entity/player/IMessageManager";
13
+ import type { IMessage, IMessageHistoryItem, IMessageManager, IPackedMessage } from "game/entity/player/IMessageManager";
14
14
  import { MessageType, Source } from "game/entity/player/IMessageManager";
15
15
  import type Player from "game/entity/player/Player";
16
16
  import type Island from "game/island/Island";
@@ -28,6 +28,7 @@ export declare class MessageManagerNoOp implements IMessageManager {
28
28
  ifIs(player: Player): this;
29
29
  ifIsNot(player: Player): this;
30
30
  send(): boolean;
31
+ sendPacked(): boolean;
31
32
  sentToAll(sentToAll?: boolean): this;
32
33
  pruneMessageHistory(): boolean;
33
34
  addToHistory(messageHistoryItem: IMessageHistoryItem): void;
@@ -114,6 +115,7 @@ export default class MessageManager implements IMessageManager {
114
115
  * Note: After sending a message, the message source, type, and human (if any) are reset.
115
116
  */
116
117
  send(message: Message | Translation, ...args: any[]): boolean;
118
+ sendPacked(pack: Partial<IPackedMessage>, ...extraSources: Source[]): boolean;
117
119
  addToHistory(messageHistoryItem: IMessageHistoryItem): void;
118
120
  /**
119
121
  * Signal that the message was sent to everyone
@@ -47,11 +47,11 @@ export interface IGetItemsOptions extends IGetItemOptions {
47
47
  }
48
48
  export interface IGetBestItemsOptions extends IGetItemsOptions {
49
49
  action: ActionType;
50
+ actionWith: Item;
50
51
  filterType: ItemType;
51
52
  filterGroup: ItemTypeGroup;
52
53
  filterConsumable: true;
53
54
  targetCreature: Creature;
54
- ammoItem: Item;
55
55
  filter(item: Item): any;
56
56
  }
57
57
  export declare enum CraftStatus {
@@ -45,7 +45,7 @@ export default class OldUi {
45
45
  syncDecayBar(item: Item, syncDamage?: boolean): void;
46
46
  syncItemElements(itemIds: number | number[], forceSyncDecay?: boolean): void;
47
47
  setEquipSlot(equip: EquipType, itemId: number, internal?: boolean): void;
48
- removeItemFromEquipSlot(equip: EquipType): void;
48
+ removeItemFromEquipSlot(equip: EquipType, itemId: number): void;
49
49
  shouldRefreshMods(): boolean;
50
50
  onGameEnd(): void;
51
51
  toggleUIDisplay(hide: boolean): void;
@@ -9,7 +9,7 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import type Doodad from "game/doodad/Doodad";
12
- import { EquipType } from "game/entity/IHuman";
12
+ import type { EquipType } from "game/entity/IHuman";
13
13
  import NPC from "game/entity/npc/NPC";
14
14
  import type { IContainer, IDismantleComponent } from "game/item/IItem";
15
15
  import { ItemType } from "game/item/IItem";
@@ -139,10 +139,8 @@ export default class InGameScreen extends BaseScreen {
139
139
  tooltipHide(): void;
140
140
  unSelectElements(): void;
141
141
  onSortableItemReceive(sortableEvent: ISortableEvent): void;
142
- getEquipSlotItemElement(equip: EquipType): JQuery;
143
- getItemIdInEquipSlot(equip: EquipType): number | undefined;
144
142
  setEquipSlot(equip: EquipType, itemId?: number, internal?: boolean): void;
145
- removeItemFromEquipSlot(equip: EquipType): void;
143
+ removeItemFromEquipSlot(equip: EquipType, itemId: number): void;
146
144
  updateCraftingDialog(craftableItemTypes: ItemType[], nonCraftableItemTypes: ItemType[]): void;
147
145
  updateDismantleTab(dismantleItems: IDismantleComponent, force?: boolean): void;
148
146
  createCraftItemElements(containerSortInfo: IContainerSortInfo): void;
@@ -9,14 +9,15 @@
9
9
  * https://github.com/WaywardGame/types/wiki
10
10
  */
11
11
  import type { Events, IEventEmitter } from "event/EventEmitter";
12
- import type UsableAction from "game/entity/action/usable/UsableAction";
13
- import type { ActionId, IUsableActionPossibleUsing } from "game/entity/action/usable/UsableAction";
12
+ import type { ActionId } from "game/entity/action/usable/UsableAction";
14
13
  import type { EquipType } from "game/entity/IHuman";
15
14
  import type { ItemType } from "game/item/IItem";
16
15
  import type Item from "game/item/Item";
17
16
  import Component from "ui/component/Component";
18
17
  import type ContextMenu from "ui/component/ContextMenu";
19
18
  import Bindable from "ui/input/Bindable";
19
+ import type ActionBar from "ui/screen/screens/game/static/ActionBar";
20
+ import type { ActionSlot } from "ui/screen/screens/game/static/ActionBar";
20
21
  import type { IDraggableComponent } from "ui/util/Draggable";
21
22
  import Draggable from "ui/util/Draggable";
22
23
  import Vector2 from "utilities/math/Vector2";
@@ -60,10 +61,21 @@ export interface IItemHandler {
60
61
  equipSlot?: EquipType;
61
62
  getItem?(): Item | undefined;
62
63
  getItemType?(): ItemType | undefined;
63
- getAction?(): UsableAction | undefined;
64
- getActionUsing?(): IUsableActionPossibleUsing | undefined;
64
+ getActionSlot?(): ActionSlot | undefined;
65
65
  getBindables?(bindables: Bindable[]): Bindable[];
66
66
  }
67
+ export declare enum ItemRefreshType {
68
+ ItemType = 1,
69
+ Durability = 2,
70
+ Decay = 4,
71
+ Quality = 8,
72
+ Magic = 16,
73
+ Protected = 32,
74
+ EquipSlot = 64,
75
+ MaybeSlottedInActionSlot = 128,
76
+ Action = 256,
77
+ All = 511
78
+ }
67
79
  export default class ItemComponent extends Component {
68
80
  protected readonly handler: IItemHandler;
69
81
  static registerSlot(slot: ItemSlot): void;
@@ -78,7 +90,12 @@ export default class ItemComponent extends Component {
78
90
  constructor(handler: IItemHandler);
79
91
  private lastItem?;
80
92
  private getItem;
81
- refresh(): void;
93
+ protected onSlotUpdate(actionBar: ActionBar, slot: ActionSlot): void;
94
+ protected onToggleProtected(): void;
95
+ protected onUpdateEquip(): void;
96
+ protected onUpdateItemType(): void;
97
+ protected onUpdateDurability(): void;
98
+ refresh(refreshType: ItemRefreshType): void;
82
99
  clone(): ItemComponent;
83
100
  setItemMenu(initialiser?: (contextMenu: ContextMenu<ActionId>) => any): this;
84
101
  private dragPreview?;
@@ -14,7 +14,7 @@ import Component from "ui/component/Component";
14
14
  import type { IBindHandlerApi } from "ui/input/Bind";
15
15
  import Dialog from "ui/screen/screens/game/component/Dialog";
16
16
  import type { IItemDropApi, ItemSlot } from "ui/screen/screens/game/component/Item";
17
- import ItemComponent from "ui/screen/screens/game/component/Item";
17
+ import ItemComponent, { ItemRefreshType } from "ui/screen/screens/game/component/Item";
18
18
  import EquipmentSlotTooltipHandler from "ui/screen/screens/game/dialog/equipment/EquipmentSlotTooltip";
19
19
  export declare enum EquipmentClasses {
20
20
  Main = "game-dialog-equipment",
@@ -41,7 +41,7 @@ export declare class EquipmentSlot extends ItemComponent {
41
41
  private overriddenItem?;
42
42
  equipItem(item: Item): Promise<void>;
43
43
  clear(): void;
44
- refresh(): void;
44
+ refresh(refreshType: ItemRefreshType): void;
45
45
  protected onEquipEvent(): void;
46
46
  protected onDrop(api: IItemDropApi, intoSlot?: ItemSlot): void;
47
47
  private isEquippable;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type { Events, IEventEmitter } from "event/EventEmitter";
12
12
  import type { IActionApi } from "game/entity/action/IAction";
13
- import type { IUsableActionRequirements, ReturnableUsableActionUsability } from "game/entity/action/usable/UsableAction";
13
+ import type { IUsableActionPossibleUsing, IUsableActionRequirements, ReturnableUsableActionUsability } from "game/entity/action/usable/UsableAction";
14
14
  import type Player from "game/entity/player/Player";
15
15
  import type Item from "game/item/Item";
16
16
  import Button from "ui/component/Button";
@@ -84,8 +84,8 @@ export default class ActionBar extends QuadrantComponent {
84
84
  private refreshSlots;
85
85
  }
86
86
  declare class ActionSlotSlottedContainer extends ItemComponent {
87
- slotData: IActionBarSlotData;
88
- constructor(slotData: IActionBarSlotData);
87
+ readonly slot: ActionSlot;
88
+ constructor(slot: ActionSlot);
89
89
  clone(): ActionSlotSlottedContainer;
90
90
  protected onEnter(reason: "mouse" | "focus"): void;
91
91
  }
@@ -121,5 +121,6 @@ export declare class ActionSlot extends Button implements IRefreshable {
121
121
  protected onLeave(reason: "mouse" | "focus"): void;
122
122
  private getTooltipLocation;
123
123
  getAction(): import("game/entity/action/usable/UsableAction").default<IUsableActionRequirements, import("game/entity/action/usable/UsableAction").IUsableActionDefinition<IUsableActionRequirements>> | undefined;
124
+ getUsing(): IUsableActionPossibleUsing;
124
125
  }
125
126
  export {};
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.0-beta.dev.20220903.1",
4
+ "version": "2.12.0-beta.dev.20220904.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",