@wayward/types 2.14.4-beta.dev.20250330.1 → 2.14.4-beta.dev.20250404.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.
- package/definitions/game/game/ILoot.d.ts +1 -0
- package/definitions/game/game/doodad/Doodad.d.ts +1 -1
- package/definitions/game/game/entity/EntityManager.d.ts +10 -3
- package/definitions/game/game/entity/creature/CreatureManager.d.ts +2 -1
- package/definitions/game/game/item/IItemManager.d.ts +2 -1
- package/definitions/game/language/dictionary/Message.d.ts +2 -1
- package/definitions/utilities/event/EventEmitter.d.ts +10 -2
- package/package.json +1 -1
@@ -253,7 +253,7 @@ export default class Doodad extends EntityMovable<IDoodadDescription, DoodadType
|
|
253
253
|
setOffTrap(human?: Human, withMessage?: boolean, damage?: boolean): void;
|
254
254
|
getGrowthParticles(): IRGB | undefined;
|
255
255
|
/**
|
256
|
-
* Increased the fertility (spread) of a plant/growing doodad.
|
256
|
+
* Increased the fertility (spread) of a plant/growing doodad when its ripening.
|
257
257
|
* @param bypassChange Set to true if you just want to check if fertility can be increased.
|
258
258
|
* @returns True or false depending on if it increased in fertility or not.
|
259
259
|
*/
|
@@ -24,7 +24,10 @@ export interface IEntityCanCreateOptions {
|
|
24
24
|
allowOverDooadsAndTileEvents?: boolean;
|
25
25
|
blockOnScarecrow?: boolean;
|
26
26
|
}
|
27
|
-
export
|
27
|
+
export interface IEntityRemoveOptions {
|
28
|
+
keepMarker?: boolean;
|
29
|
+
}
|
30
|
+
export default abstract class EntityManager<T extends Entity, RemoveOptions extends IEntityRemoveOptions = IEntityRemoveOptions> extends ObjectManager<T, IEntityManagerEvents<T>> implements IEntityManager<T> {
|
28
31
|
/**
|
29
32
|
* Indicates if objects should be re-registered to the memory leak detector after loading
|
30
33
|
*/
|
@@ -34,10 +37,14 @@ export default abstract class EntityManager<T extends Entity, IRemoveOptions = u
|
|
34
37
|
* @param entity Entity to remove
|
35
38
|
* @returns Return true if this method handled tile updates
|
36
39
|
*/
|
37
|
-
protected abstract onRemove(entity: T, options?:
|
40
|
+
protected abstract onRemove(entity: T, options?: RemoveOptions & IEntityRemoveOptions): boolean;
|
38
41
|
protected abstract loadEntity?(entity: T): void;
|
39
42
|
load(): void;
|
40
|
-
|
43
|
+
/**
|
44
|
+
* Restores a previous removed entity
|
45
|
+
*/
|
46
|
+
restore(entity: T): void;
|
47
|
+
remove(entity: T, options?: RemoveOptions): void;
|
41
48
|
updateFov(humanBounds: IHumanBound[]): void;
|
42
49
|
/**
|
43
50
|
* Checks if the target position is a good spot for a new entity
|
@@ -12,6 +12,7 @@ import CombatStrengthManager from "@wayward/game/game/entity/CombatStrengthManag
|
|
12
12
|
import Creature from "@wayward/game/game/entity/creature/Creature";
|
13
13
|
import type { ICreatureCheckMoveOptions } from "@wayward/game/game/entity/creature/ICreature";
|
14
14
|
import { CreatureType, TileGroup } from "@wayward/game/game/entity/creature/ICreature";
|
15
|
+
import type { IEntityRemoveOptions } from "@wayward/game/game/entity/EntityManager";
|
15
16
|
import EntityManager from "@wayward/game/game/entity/EntityManager";
|
16
17
|
import type Human from "@wayward/game/game/entity/Human";
|
17
18
|
import { MoveType } from "@wayward/game/game/entity/IEntity";
|
@@ -30,7 +31,7 @@ export interface ICreatureManagerEvents extends Events<EntityManager<Creature>>
|
|
30
31
|
*/
|
31
32
|
canSpawn(type: CreatureType, tile: Tile, aberrant: boolean): boolean | undefined;
|
32
33
|
}
|
33
|
-
export default class CreatureManager extends EntityManager<Creature, {
|
34
|
+
export default class CreatureManager extends EntityManager<Creature, IEntityRemoveOptions & {
|
34
35
|
remainTamed?: boolean;
|
35
36
|
}> {
|
36
37
|
protected readonly name = "CreatureManager";
|
@@ -12,6 +12,7 @@ import type { Quality } from "@wayward/game/game/IObject";
|
|
12
12
|
import type Doodad from "@wayward/game/game/doodad/Doodad";
|
13
13
|
import type DoodadManager from "@wayward/game/game/doodad/DoodadManager";
|
14
14
|
import type { DoodadType, DoodadTypeGroup } from "@wayward/game/game/doodad/IDoodad";
|
15
|
+
import type { IEntityRemoveOptions } from "@wayward/game/game/entity/EntityManager";
|
15
16
|
import type { ActionType, IActionNotUsable } from "@wayward/game/game/entity/action/IAction";
|
16
17
|
import type ActionContext from "@wayward/game/game/entity/action/IActionContext";
|
17
18
|
import type { DropAllowProtected } from "@wayward/game/game/entity/action/actions/Drop";
|
@@ -28,7 +29,7 @@ import type { Direction } from "@wayward/game/utilities/math/Direction";
|
|
28
29
|
/**
|
29
30
|
* Options when removing an item
|
30
31
|
*/
|
31
|
-
export interface IItemRemoveOptions {
|
32
|
+
export interface IItemRemoveOptions extends IEntityRemoveOptions {
|
32
33
|
/**
|
33
34
|
* Defaults to false
|
34
35
|
*/
|
@@ -49,7 +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?:
|
52
|
+
readonly closed?: boolean;
|
53
53
|
emit<K extends keyof E>(event: K, ...args: ArgsOf<E[K]>): H;
|
54
54
|
/**
|
55
55
|
* Emit an event only to the subscribers of this emitter instance.
|
@@ -80,6 +80,10 @@ export interface IEventEmitter<H = any, E = any> {
|
|
80
80
|
until<E2>(emitter: IEventEmitterHost<E2>, ...events: Array<keyof E2>): IUntilSubscriber<H, E>;
|
81
81
|
until(promise: Promise<any>): IUntilSubscriber<H, E>;
|
82
82
|
hasHandlersForEvent(...events: Array<keyof E>): boolean;
|
83
|
+
/**
|
84
|
+
* Re-opens a closed event emitter
|
85
|
+
*/
|
86
|
+
open(): void;
|
83
87
|
/**
|
84
88
|
* Closes an event emitter, which will prevent any further subscriptions from being made.
|
85
89
|
*/
|
@@ -111,8 +115,12 @@ declare class EventEmitter<H, E> {
|
|
111
115
|
* This means no more events will be emitted and no more subscriptions can be made.
|
112
116
|
* Public so that the interface can expose a readonly version of this.
|
113
117
|
*/
|
114
|
-
closed?:
|
118
|
+
closed?: boolean;
|
115
119
|
constructor(host: H);
|
120
|
+
/**
|
121
|
+
* Re-opens a closed event emitter
|
122
|
+
*/
|
123
|
+
open(): void;
|
116
124
|
/**
|
117
125
|
* Closes an event emitter, which will prevent any further subscriptions from being made.
|
118
126
|
*/
|
package/package.json
CHANGED