@wayward/types 2.14.4-beta.dev.20250119.1 → 2.14.4-beta.dev.20250121.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.
@@ -147,7 +147,13 @@ export default class Creature extends EntityWithStats<ICreatureDescription, Crea
147
147
  getOwner(): Human | undefined;
148
148
  damage(damageInfo: IDamageInfo): number | undefined;
149
149
  damage(damageInfo: IDamageInfo, creatureX?: number, creatureY?: number, creatureZ?: number): number | undefined;
150
- offer(items: Item[]): Item | undefined;
150
+ /**
151
+ * Called when we offer a creature an item using the "Offer" action or when a creature walks over an item to see if it tames them.
152
+ * @param items Items to offer or check to see if they are accepted.
153
+ * @param human Human that offered it (if not set, it's on the ground and we check for crafterIdentifier).
154
+ * @returns The item it accepted.
155
+ */
156
+ offer(items: Item[], human?: Human): Item | undefined;
151
157
  processSpecialAbilities(enemy: Human | Creature | undefined, bypass?: boolean): boolean;
152
158
  increaseWaste(item: Item): void;
153
159
  onUnserialized(): void;
@@ -202,6 +202,10 @@ export interface ICreatureDescription extends IModdable, ITemperatureDescription
202
202
  */
203
203
  runeChance?: RuneChance;
204
204
  waterAnimations?: boolean;
205
+ /**
206
+ * We set this for all creatures that are tamable through the the taming skill directly.
207
+ * - Some creatures are exempt from this and tamed only through items (Living Rock, Time Skitters).
208
+ */
205
209
  tamingDifficulty?: number;
206
210
  acceptedItems?: Array<ItemType | ItemTypeGroup>;
207
211
  lightSource?: boolean;
@@ -450,6 +454,7 @@ export declare const settableAiTypes: Set<AiType>;
450
454
  export declare const CREATURE_MAX_HEALTH_BONUS_TAME = 1.1;
451
455
  export declare const CREATURE_MAX_HEALTH_BONUS_OFFER = 1.05;
452
456
  export declare const CREATURE_MAX_HEALTH_BONUS_PET = 1.01;
457
+ export declare const CREATURE_DEFAULT_TAME_DIFFICULTY_UNSET = 25;
453
458
  export interface ICreatureAttackOutcomeBase {
454
459
  enemy?: Human | Creature;
455
460
  willAttack: boolean;
@@ -36,6 +36,7 @@ import type { IPlaceOnTileOptions } from "@wayward/game/game/item/IItemManager";
36
36
  import ItemMapManager from "@wayward/game/game/item/ItemMapManager";
37
37
  import type { MagicalSubPropertySubTypes } from "@wayward/game/game/magic/IMagicalProperty";
38
38
  import type { IHasMagic } from "@wayward/game/game/magic/IMagicalProperty";
39
+ import type { IMagicalPropertyManagerEvents } from "@wayward/game/game/magic/MagicalPropertyManager";
39
40
  import MagicalPropertyManager from "@wayward/game/game/magic/MagicalPropertyManager";
40
41
  import MagicalPropertyType from "@wayward/game/game/magic/MagicalPropertyType";
41
42
  import type { Reference, ReferenceType } from "@wayward/game/game/reference/IReferenceManager";
@@ -50,7 +51,10 @@ import type { IUnserializedCallback } from "@wayward/game/save/serializer/ISeria
50
51
  import type { Direction } from "@wayward/game/utilities/math/Direction";
51
52
  import type { IVector3 } from "@wayward/game/utilities/math/IVector";
52
53
  import type { IEventEmitter } from "@wayward/utilities/event/EventEmitter";
53
- export interface IItemEvents extends IEntityMovableEvents, IQualityEvents {
54
+ type ItemMagicEvents = {
55
+ [EVENT in keyof IMagicalPropertyManagerEvents as `magic${Capitalize<EVENT>}`]: IMagicalPropertyManagerEvents[EVENT];
56
+ };
57
+ export interface IItemEvents extends IEntityMovableEvents, IQualityEvents, ItemMagicEvents {
54
58
  toggleProtected(isProtected: boolean): any;
55
59
  containerChange(newContainer: IContainer, oldContainer?: IContainer): any;
56
60
  fireUpdate(stage?: FireStage): any;
@@ -245,6 +249,7 @@ export default class Item extends EntityMovable<IItemDescription, ItemType, Refe
245
249
  * Note: This is not called by clients joining a mp game.
246
250
  */
247
251
  verifyAndFixItem(): void;
252
+ protected pipeMagicalPropertyManagerEvents(magic: MagicalPropertyManager): void;
248
253
  verifyAndFixMagic(): void;
249
254
  /**
250
255
  * @param source A string representing the reason for this damage. Used for multiplayer debugging. Just put a unique string of characters here
@@ -499,3 +504,4 @@ export default class Item extends EntityMovable<IItemDescription, ItemType, Refe
499
504
  private checkIfItemsMatch;
500
505
  private checkIfItemArraysMatch;
501
506
  }
507
+ export {};
@@ -138,6 +138,8 @@ export default class ContainerBucketItemList extends Component implements ISorta
138
138
  protected onRemoveItem(manager: ItemManager, items: Item[], container?: IContainer, containerTile?: Tile): void;
139
139
  protected onAddItemDidNotSort(manager: ItemManager, container: IContainer): void;
140
140
  protected onTransformItem(item: Item, newType: ItemType, oldType: ItemType): void;
141
+ private filterItem;
142
+ protected onMagicalPropertyChange(item: Item): void;
141
143
  protected onStack(manager: ItemManager, container: IContainer, type: ItemType): void;
142
144
  protected onUnstack(manager: ItemManager, container: IContainer, type: ItemType): void;
143
145
  protected onTick(): void;
@@ -49,6 +49,7 @@ type Handler<H, F> = (host: H, ...args: ArgsOf<F>) => ReturnOf<F>;
49
49
  type WeakHandler<H, F> = WeakRef<Handler<H, F>>;
50
50
  type UndefinedFromVoid<V> = V extends void ? undefined : V;
51
51
  export interface IEventEmitter<H = any, E = any> {
52
+ readonly closed?: true;
52
53
  emit<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): H;
53
54
  /**
54
55
  * Emit an event only to the subscribers of this emitter instance.
@@ -105,7 +106,12 @@ declare class EventEmitter<H, E> {
105
106
  private subscriptions?;
106
107
  private cachedEmitSelfHandlers?;
107
108
  private cachedClassHandlers?;
108
- private closed?;
109
+ /**
110
+ * Set to true when the event emitted is closed.
111
+ * This means no more events will be emitted and no more subscriptions can be made.
112
+ * Public so that the interface can expose a readonly version of this.
113
+ */
114
+ closed?: true;
109
115
  constructor(host: H);
110
116
  /**
111
117
  * Closes an event emitter, which will prevent any further subscriptions from being made.
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.20250119.1",
4
+ "version": "2.14.4-beta.dev.20250121.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",