@wayward/types 2.14.4-beta.dev.20250104.1 → 2.14.4-beta.dev.20250106.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.
@@ -19,7 +19,7 @@ import type Human from "@wayward/game/game/entity/Human";
19
19
  import type { IEntityConstructorOptions } from "@wayward/game/game/entity/IEntity";
20
20
  import { EntityType } from "@wayward/game/game/entity/IEntity";
21
21
  import { SkillType } from "@wayward/game/game/entity/IHuman";
22
- import { EquipType } from "@wayward/game/game/entity/IHuman";
22
+ import type { EquipType } from "@wayward/game/game/entity/IHuman";
23
23
  import { ActionType } from "@wayward/game/game/entity/action/IAction";
24
24
  import type Creature from "@wayward/game/game/entity/creature/Creature";
25
25
  import type Corpse from "@wayward/game/game/entity/creature/corpse/Corpse";
@@ -210,7 +210,7 @@ export default class Doodad extends EntityMovable<IDoodadDescription, DoodadType
210
210
  /**
211
211
  * Returns whether the doodad can be trampled
212
212
  */
213
- canTrample(): boolean | undefined;
213
+ canTrample(): boolean;
214
214
  /**
215
215
  * Trampling growing things.
216
216
  */
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Copyright 2011-2024 Unlok
3
+ * https://www.unlok.ca
4
+ *
5
+ * Credits & Thanks:
6
+ * https://www.unlok.ca/credits-thanks/
7
+ *
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
+ * https://github.com/WaywardGame/types/wiki
10
+ */
11
+ import type Doodad from "@wayward/game/game/doodad/Doodad";
12
+ import type { DoodadType } from "@wayward/game/game/doodad/IDoodad";
13
+ import { GrowingStage } from "@wayward/game/game/doodad/IDoodad";
14
+ import type Human from "@wayward/game/game/entity/Human";
15
+ declare namespace DoodadUtilities {
16
+ type DoodadIn = Doodad | DoodadType;
17
+ export function hasGrownEnoughIfCanGrow(doodad: Doodad, requiredGrowthStage: GrowingStage): boolean;
18
+ export function hasGrownEnoughIfCanGrow(doodad: DoodadIn, requiredGrowthStage: GrowingStage): undefined;
19
+ export function wouldWalkingOnDealFireDamage(doodad: DoodadIn, human?: Human): boolean;
20
+ export function wouldWalkingOnDealNormalDamage(doodad: DoodadIn, human?: Human): boolean;
21
+ export function isDangerous(doodad: DoodadIn, human?: Human): boolean;
22
+ export function canCauseStatus(doodad: DoodadIn): boolean;
23
+ export {};
24
+ }
25
+ export default DoodadUtilities;
@@ -528,6 +528,12 @@ export declare enum GrowingStage {
528
528
  Ripening = 5,
529
529
  Bare = 6
530
530
  }
531
+ export declare namespace Growth {
532
+ function isAtLeast(growth: GrowingStage | undefined, stage: GrowingStage): boolean;
533
+ function isAtMost(growth: GrowingStage | undefined, stage: GrowingStage): boolean;
534
+ function isMoreThan(growth: GrowingStage | undefined, stage: GrowingStage): boolean;
535
+ function isLessThan(growth: GrowingStage | undefined, stage: GrowingStage): boolean;
536
+ }
531
537
  export interface IHasBuilder {
532
538
  getBuilder(): Human | undefined;
533
539
  }
@@ -126,8 +126,6 @@ export declare abstract class InfoProvider extends EventEmitter.Host<IInfoProvid
126
126
  * Call when this info provider should be removed.
127
127
  */
128
128
  remove(): this;
129
- onStoppingPlay(): void;
130
- onPreMoveToIsland(): void;
131
129
  private _shouldDisplayWhenEmpty;
132
130
  protected shouldDisplayWhenEmpty(): boolean;
133
131
  setShouldDisplayWhenEmpty(shouldDisplayWhenEmpty?: boolean): this;
@@ -1852,7 +1852,8 @@ export declare enum ItemTypeGroup {
1852
1852
  ExcludedFromRandom = -9856,
1853
1853
  Leaves = -9855,
1854
1854
  Flute = -9854,
1855
- All = -9853
1855
+ InternalNoDropOnDoodadBreak = -9853,
1856
+ All = -9852
1856
1857
  }
1857
1858
  export type StillContainerBaseItemType = ItemType.Waterskin | ItemType.GlassBottle | ItemType.ClayJug | ItemType.CoconutContainer;
1858
1859
  export interface IItemMovementResult {
@@ -53,5 +53,5 @@ export default class ReferenceManager {
53
53
  private resolveInternal;
54
54
  inspect<REFTYPE extends ReferenceType>(reference: Reference<REFTYPE>, context?: InfoProviderContext): Inspection<any> | undefined;
55
55
  inspect(reference: Reference, context?: InfoProviderContext): Inspection<any> | undefined;
56
- tooltip(reference: Reference, initializer?: (tooltip: Tooltip, handler: ReferenceTooltipHandler) => any, context?: InfoProviderContext): (tooltip: Tooltip) => Promise<void>;
56
+ tooltip(reference: Reference, initializer?: (tooltip: Tooltip, handler: ReferenceTooltipHandler) => any, context?: InfoProviderContext): (tooltip: Tooltip) => Promise<boolean>;
57
57
  }
@@ -94,7 +94,6 @@ export default class Component<E extends HTMLElement = HTMLElement> extends Even
94
94
  */
95
95
  get selectable(): SelectableLayer | false;
96
96
  constructor(elementType?: string, namespace?: Namespace);
97
- toString(): string;
98
97
  /**
99
98
  * Alias of `.element.addEventListener`, except it returns `this` instead and prevents memory leaks
100
99
  */
@@ -20,7 +20,7 @@ export default class IslandDropdown<OTHER_OPTIONS extends string = never> extend
20
20
  protected getTranslation(islandId: IslandId): TranslationImpl;
21
21
  protected sortEnumOptions(o1: IDropdownSortableOption<string>, o2: IDropdownSortableOption<string>): number;
22
22
  protected getGroupName(biome: BiomeType): string;
23
- protected optionTooltipInitializer: (tooltip: Tooltip, option: string) => Promise<void> | undefined;
23
+ protected optionTooltipInitializer: (tooltip: Tooltip, option: string) => Promise<boolean> | undefined;
24
24
  protected shouldIncludeOtherOptionsInGroupFilter(): boolean;
25
25
  protected isInGroup(islandId: IslandId, biome: BiomeType): boolean;
26
26
  protected getGroups(): BiomeType[];
@@ -74,6 +74,7 @@ export declare class GlobalMouseInfo extends EventEmitter.Host<IGlobalMouseInfoE
74
74
  * @param recalcTarget Whether to recalculate the target before this operation. Defaults to `false`
75
75
  */
76
76
  isTarget<W extends Component | Element | string | undefined>(what?: W, recalcTarget?: boolean): (W extends Component ? W : HTMLElement) | undefined;
77
+ clearTarget(target?: Element): void;
77
78
  private _updateTarget;
78
79
  }
79
80
  interface IInputInfoEvents {
@@ -106,6 +107,7 @@ declare class InputManager extends EventEmitter.Host<IInputManagerEvents> {
106
107
  register(component: Component): this;
107
108
  deregister(): this;
108
109
  isRegistered(): boolean;
110
+ private didReset;
109
111
  reset(): void;
110
112
  /**
111
113
  * @param disabler Each `disableUntil` call should be given a unique `disabler`,
@@ -37,7 +37,7 @@ declare namespace Macros {
37
37
  function getCurrent(): Macro;
38
38
  function getTouch(): Macro;
39
39
  function reset(): void;
40
- function setHandled(): void;
40
+ function setHandled(input: IInput): void;
41
41
  function setIsolated(_isolated?: boolean): void;
42
42
  function didRequestIsolation(): boolean;
43
43
  function handleInput(input: IInput, api: IBindHandlerApi): Macro | undefined;
@@ -28,7 +28,11 @@ export interface IInspectionsTooltipHandlerEvents<INSPECTIONS_LIST extends Inspe
28
28
  export default abstract class InspectionsTooltipHandler<INSPECTIONS_LIST extends InspectionsList, TOOLTIP_ARGS extends any[] = []> extends EventEmitter.Host<IInspectionsTooltipHandlerEvents<INSPECTIONS_LIST, TOOLTIP_ARGS>> {
29
29
  protected current: IInspectionsTooltipHandlerCurrent<INSPECTIONS_LIST, TOOLTIP_ARGS> | undefined;
30
30
  private lastMousePosition?;
31
- initializeTooltip(tooltip: Tooltip, ...args: TOOLTIP_ARGS): Promise<void>;
31
+ /**
32
+ * Initializes tooltips
33
+ * @returns True if the tooltip was initialized. False if it was removed or replaced before so.
34
+ */
35
+ initializeTooltip(tooltip: Tooltip, ...args: TOOLTIP_ARGS): Promise<boolean>;
32
36
  remove(tooltip?: IInspectionsTooltipHandlerCurrent<INSPECTIONS_LIST, TOOLTIP_ARGS> | undefined): void;
33
37
  onInitInspections(handler: (inspections: INSPECTIONS_LIST) => any): void;
34
38
  protected abstract initializeInspections(...args: TOOLTIP_ARGS): INSPECTIONS_LIST | undefined;
@@ -21,7 +21,7 @@ export default class ReferenceTooltipHandler extends InspectionsTooltipHandler<R
21
21
  private readonly reference;
22
22
  private readonly initializer?;
23
23
  constructor(context: InfoProviderContext, reference: Reference, initializer?: ((tooltip: Tooltip, handler: ReferenceTooltipHandler) => any) | undefined);
24
- initializeTooltip(tooltip: Tooltip): Promise<void>;
24
+ initializeTooltip(tooltip: Tooltip): Promise<boolean>;
25
25
  protected initializeInspections(): ReferenceInspectionsList;
26
26
  protected initializeHints(hints: InspectionTooltipHints): void;
27
27
  }
@@ -69,6 +69,11 @@ export declare enum ItemRefreshType {
69
69
  export interface IItemComponentEvents extends Events<Component>, IDraggableEvents, IItemSlotEvents, ISortableDraggableEvents {
70
70
  deregisterHighlights(): any;
71
71
  refresh(type: ItemRefreshType): any;
72
+ /**
73
+ * Called when the item (within the item component) is changing.
74
+ * Usually during a refresh.
75
+ */
76
+ itemChange(): any;
72
77
  }
73
78
  export interface IItemComponentStaticEvents {
74
79
  update(type: ItemRefreshType): any;
@@ -24,7 +24,7 @@ export declare enum EquipmentSlotTooltipClasses {
24
24
  Hints = "game-dialog-equipment-slot-tooltip-hints"
25
25
  }
26
26
  export default class EquipmentSlotTooltipHandler extends InspectionsTooltipHandler<EquipmentSlotInspectionsList, [slot: EquipType]> {
27
- initializeTooltip(tooltip: Tooltip, slot: EquipType): Promise<void>;
27
+ initializeTooltip(tooltip: Tooltip, slot: EquipType): Promise<boolean>;
28
28
  protected initializeInspections(slot: EquipType): EquipmentSlotInspectionsList;
29
29
  protected initializeHints(hints: InspectionTooltipHints, slot: EquipType): void;
30
30
  private onSlotChanged;
@@ -129,11 +129,35 @@ declare namespace Log {
129
129
  * @param sources A list of sources to log to.
130
130
  */
131
131
  function trace(...sources: string[]): (...args: any[]) => void;
132
+ /**
133
+ * Warns about an occurrence of something, due to a specific caller, once per session.
134
+ * @param skip Number of callsites to skip. Automatically skips this function and its caller.
135
+ * If this is called from a function that is registered in `Errors.ts` as a skipped callsite, you might have to pass `-1`.
136
+ * @param id The ID of this warning. Can be `Log.simplify` strings.
137
+ */
138
+ function warnForCaller(skip: number, id: ArrayOr<string | SimplifyString>, ...message: any[]): void;
132
139
  /**
133
140
  * Warn about something once per session based on unique warning ids.
134
141
  * This is like how node.js does warnings in console.
135
142
  */
136
- function warnOncePerSession(warningId: string | string[], ...message: any[]): void;
143
+ function warnOncePerSession(warningId: ArrayOr<string | SimplifyString>, ...message: any[]): void;
144
+ interface SimplifyString extends String {
145
+ simplified: string;
146
+ }
147
+ namespace SimplifyString {
148
+ function is(value: unknown): value is SimplifyString;
149
+ function get(value: unknown): string;
150
+ }
151
+ function simplify(segments: TemplateStringsArray, ...interpolations: unknown[]): SimplifyString;
152
+ function simplify(mainLog: string, simplified: string): SimplifyString;
153
+ /**
154
+ * Returns a combination of the object's constructor and the result of calling `toString` on it.
155
+ *
156
+ * If the `toString` result is redundant or useless, it is omitted.
157
+ *
158
+ * The resulting string will be automatically simplified when reported to the error server.
159
+ */
160
+ function objectToString(object?: object): string;
137
161
  }
138
162
  declare class NullLog extends BaseLog {
139
163
  setup(): void;
@@ -25,7 +25,8 @@ declare global {
25
25
  toggle(value: T, includes?: boolean): void;
26
26
  awaitAll(): Promise<Array<Awaited<T>>>;
27
27
  layerSort(sortInitializer: (sorter: ISorter<T>) => any): T[];
28
- groupBy<GROUP>(grouper: (value: T, index: number, obj: T[]) => GROUP): Array<[GROUP, T[]]>;
28
+ groupBy<GROUP>(grouper: (value: T, index: number, array: T[]) => GROUP): Array<[GROUP, T[]]>;
29
+ groupBy<GROUP, R>(grouper: (value: T, index: number, array: T[]) => GROUP, mapper: (values: T[], group: GROUP) => R): Array<[GROUP, R]>;
29
30
  /**
30
31
  * Alias of `.toSet().toArray()`
31
32
  */
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.14.4-beta.dev.20250104.1",
4
+ "version": "2.14.4-beta.dev.20250106.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",