@rpgjs/server 5.0.0-alpha.4 → 5.0.0-alpha.41
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/dist/Gui/DialogGui.d.ts +5 -0
- package/dist/Gui/GameoverGui.d.ts +23 -0
- package/dist/Gui/Gui.d.ts +6 -0
- package/dist/Gui/MenuGui.d.ts +22 -3
- package/dist/Gui/NotificationGui.d.ts +1 -2
- package/dist/Gui/SaveLoadGui.d.ts +13 -0
- package/dist/Gui/ShopGui.d.ts +28 -3
- package/dist/Gui/TitleGui.d.ts +23 -0
- package/dist/Gui/index.d.ts +10 -1
- package/dist/Player/BattleManager.d.ts +34 -12
- package/dist/Player/ClassManager.d.ts +46 -13
- package/dist/Player/ComponentManager.d.ts +123 -0
- package/dist/Player/Components.d.ts +345 -0
- package/dist/Player/EffectManager.d.ts +86 -0
- package/dist/Player/ElementManager.d.ts +104 -0
- package/dist/Player/GoldManager.d.ts +22 -0
- package/dist/Player/GuiManager.d.ts +259 -0
- package/dist/Player/ItemFixture.d.ts +6 -0
- package/dist/Player/ItemManager.d.ts +450 -9
- package/dist/Player/MoveManager.d.ts +324 -69
- package/dist/Player/ParameterManager.d.ts +344 -14
- package/dist/Player/Player.d.ts +460 -8
- package/dist/Player/SkillManager.d.ts +197 -15
- package/dist/Player/StateManager.d.ts +89 -25
- package/dist/Player/VariableManager.d.ts +74 -0
- package/dist/RpgServer.d.ts +502 -64
- package/dist/RpgServerEngine.d.ts +2 -1
- package/dist/decorators/event.d.ts +46 -0
- package/dist/decorators/map.d.ts +287 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +21653 -20900
- package/dist/index.js.map +1 -1
- package/dist/logs/log.d.ts +2 -3
- package/dist/module.d.ts +43 -1
- package/dist/presets/index.d.ts +0 -9
- package/dist/rooms/BaseRoom.d.ts +132 -0
- package/dist/rooms/lobby.d.ts +10 -2
- package/dist/rooms/map.d.ts +1236 -17
- package/dist/services/save.d.ts +43 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/localStorage.d.ts +23 -0
- package/package.json +14 -10
- package/src/Gui/DialogGui.ts +19 -4
- package/src/Gui/GameoverGui.ts +39 -0
- package/src/Gui/Gui.ts +23 -1
- package/src/Gui/MenuGui.ts +155 -6
- package/src/Gui/NotificationGui.ts +1 -2
- package/src/Gui/SaveLoadGui.ts +60 -0
- package/src/Gui/ShopGui.ts +146 -16
- package/src/Gui/TitleGui.ts +39 -0
- package/src/Gui/index.ts +15 -2
- package/src/Player/BattleManager.ts +91 -49
- package/src/Player/ClassManager.ts +118 -50
- package/src/Player/ComponentManager.ts +425 -19
- package/src/Player/Components.ts +380 -0
- package/src/Player/EffectManager.ts +81 -44
- package/src/Player/ElementManager.ts +109 -86
- package/src/Player/GoldManager.ts +32 -35
- package/src/Player/GuiManager.ts +308 -150
- package/src/Player/ItemFixture.ts +4 -5
- package/src/Player/ItemManager.ts +774 -355
- package/src/Player/MoveManager.ts +1544 -774
- package/src/Player/ParameterManager.ts +546 -104
- package/src/Player/Player.ts +1163 -88
- package/src/Player/SkillManager.ts +520 -195
- package/src/Player/StateManager.ts +170 -182
- package/src/Player/VariableManager.ts +101 -63
- package/src/RpgServer.ts +525 -63
- package/src/core/context.ts +1 -0
- package/src/decorators/event.ts +61 -0
- package/src/decorators/map.ts +327 -0
- package/src/index.ts +11 -1
- package/src/logs/log.ts +10 -3
- package/src/module.ts +126 -3
- package/src/presets/index.ts +1 -10
- package/src/rooms/BaseRoom.ts +232 -0
- package/src/rooms/lobby.ts +25 -7
- package/src/rooms/map.ts +2502 -194
- package/src/services/save.ts +147 -0
- package/src/storage/index.ts +1 -0
- package/src/storage/localStorage.ts +76 -0
- package/tests/battle.spec.ts +375 -0
- package/tests/change-map.spec.ts +72 -0
- package/tests/class.spec.ts +274 -0
- package/tests/effect.spec.ts +219 -0
- package/tests/element.spec.ts +221 -0
- package/tests/event.spec.ts +80 -0
- package/tests/gold.spec.ts +99 -0
- package/tests/item.spec.ts +609 -0
- package/tests/module.spec.ts +38 -0
- package/tests/move.spec.ts +601 -0
- package/tests/player-param.spec.ts +28 -0
- package/tests/prediction-reconciliation.spec.ts +182 -0
- package/tests/random-move.spec.ts +65 -0
- package/tests/skill.spec.ts +658 -0
- package/tests/state.spec.ts +467 -0
- package/tests/variable.spec.ts +185 -0
- package/tests/world-maps.spec.ts +896 -0
- package/vite.config.ts +16 -0
- package/dist/Player/Event.d.ts +0 -0
- package/src/Player/Event.ts +0 -0
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlayerCtor, ProjectileType, RpgCommonPlayer, Direction, MovementStrategy, MovementOptions } from '../../../common/src';
|
|
2
2
|
import { RpgPlayer } from './Player';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
3
|
+
type CallbackTileMove = (player: RpgPlayer, map: any) => Direction[];
|
|
4
|
+
type CallbackTurnMove = (player: RpgPlayer, map: any) => string;
|
|
5
|
+
type Routes = (string | Promise<any> | Direction | Direction[] | Function)[];
|
|
6
|
+
export type { MovementOptions };
|
|
7
|
+
/**
|
|
8
|
+
* Options for moveRoutes method
|
|
9
|
+
*/
|
|
10
|
+
export interface MoveRoutesOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Callback function called when the player gets stuck (cannot move towards target)
|
|
13
|
+
*
|
|
14
|
+
* This callback is triggered when the player is trying to move but cannot make progress
|
|
15
|
+
* towards the target position, typically due to obstacles or collisions.
|
|
16
|
+
*
|
|
17
|
+
* @param player - The player instance that is stuck
|
|
18
|
+
* @param target - The target position the player was trying to reach
|
|
19
|
+
* @param currentPosition - The current position of the player
|
|
20
|
+
* @returns If true, the route will continue; if false, the route will be cancelled
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* await player.moveRoutes([Move.right()], {
|
|
25
|
+
* onStuck: (player, target, currentPos) => {
|
|
26
|
+
* console.log('Player is stuck!');
|
|
27
|
+
* return false; // Cancel the route
|
|
28
|
+
* }
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
onStuck?: (player: RpgPlayer, target: {
|
|
31
33
|
x: number;
|
|
32
34
|
y: number;
|
|
33
|
-
},
|
|
34
|
-
shootProjectile(type: ProjectileType, direction: {
|
|
35
|
+
}, currentPosition: {
|
|
35
36
|
x: number;
|
|
36
37
|
y: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
}) => boolean | void;
|
|
39
|
+
/**
|
|
40
|
+
* Time in milliseconds to wait before considering the player stuck (default: 500ms)
|
|
41
|
+
*
|
|
42
|
+
* The player must be unable to make progress for this duration before onStuck is called.
|
|
43
|
+
*/
|
|
44
|
+
stuckTimeout?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Minimum distance change in pixels to consider movement progress (default: 1 pixel)
|
|
47
|
+
*
|
|
48
|
+
* If the player moves less than this distance over the stuckTimeout period, they are considered stuck.
|
|
49
|
+
*/
|
|
50
|
+
stuckThreshold?: number;
|
|
42
51
|
}
|
|
43
|
-
type CallbackTileMove = (player: RpgPlayer, map: any) => Direction[];
|
|
44
|
-
type CallbackTurnMove = (player: RpgPlayer, map: any) => string;
|
|
45
|
-
type Routes = (string | Promise<any> | Direction | Direction[] | Function)[];
|
|
46
52
|
export declare enum Frequency {
|
|
47
53
|
Lowest = 600,
|
|
48
54
|
Lower = 400,
|
|
@@ -61,34 +67,39 @@ export declare enum Speed {
|
|
|
61
67
|
Faster = 7,
|
|
62
68
|
Fastest = 10
|
|
63
69
|
}
|
|
64
|
-
/**
|
|
65
|
-
* @title Move
|
|
66
|
-
* @enum {Object}
|
|
67
|
-
*
|
|
68
|
-
* Move.right(repeat=1) | Movement of a number of pixels on the right
|
|
69
|
-
* Move.left(repeat=1) | Movement of a number of pixels on the left
|
|
70
|
-
* Move.up(repeat=1) | Movement of a number of pixels on the up
|
|
71
|
-
* Move.down(repeat=1) | Movement of a number of pixels on the down
|
|
72
|
-
* Move.random(repeat=1) | Movement of a number of pixels in a random direction
|
|
73
|
-
* Move.towardPlayer(player, repeat=1) | Moves a number of pixels in the direction of the designated player
|
|
74
|
-
* Move.awayFromPlayer(player, repeat=1) | Moves a number of pixels in the opposite direction of the designated player
|
|
75
|
-
* Move.tileRight(repeat=1) | Movement of a number of tiles on the right
|
|
76
|
-
* Move.tileLeft(repeat=1) | Movement of a number of tiles on the left
|
|
77
|
-
* Move.tileUp(repeat=1) | Movement of a number of tiles on the up
|
|
78
|
-
* Move.tileDown(repeat=1) | Movement of a number of tiles on the down
|
|
79
|
-
* Move.tileRandom(repeat=1) | Movement of a number of tiles in a random direction
|
|
80
|
-
* Move.tileTowardPlayer(player, repeat=1) | Moves a number of tiles in the direction of the designated player
|
|
81
|
-
* Move.tileAwayFromPlayer(player, repeat=1) | Moves a number of tiles in the opposite direction of the designated player
|
|
82
|
-
* Move.turnRight() | Turn to the right
|
|
83
|
-
* Move.turnLeft() | Turn to the left
|
|
84
|
-
* Move.turnUp() | Turn to the up
|
|
85
|
-
* Move.turnDown() | Turn to the down
|
|
86
|
-
* Move.turnRandom() | Turn to random direction
|
|
87
|
-
* Move.turnAwayFromPlayer(player) | Turns in the opposite direction of the designated player
|
|
88
|
-
* Move.turnTowardPlayer(player) | Turns in the direction of the designated player
|
|
89
|
-
* @memberof Move
|
|
90
|
-
* */
|
|
91
70
|
declare class MoveList {
|
|
71
|
+
private static perlinNoise;
|
|
72
|
+
private static randomCounter;
|
|
73
|
+
private static callCounter;
|
|
74
|
+
private static playerMoveStates;
|
|
75
|
+
private static readonly STUCK_THRESHOLD;
|
|
76
|
+
/**
|
|
77
|
+
* Clears the movement state for a specific player
|
|
78
|
+
*
|
|
79
|
+
* Should be called when a player changes map or is destroyed to prevent
|
|
80
|
+
* memory leaks and stale stuck detection data.
|
|
81
|
+
*
|
|
82
|
+
* @param playerId - The ID of the player to clear state for
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // Clear state when player leaves map
|
|
87
|
+
* Move.clearPlayerState(player.id);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
static clearPlayerState(playerId: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Clears all player movement states
|
|
93
|
+
*
|
|
94
|
+
* Useful for cleanup during server shutdown or when resetting game state.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* // Clear all states on server shutdown
|
|
99
|
+
* Move.clearAllPlayerStates();
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
static clearAllPlayerStates(): void;
|
|
92
103
|
repeatMove(direction: Direction, repeat: number): Direction[];
|
|
93
104
|
private repeatTileMove;
|
|
94
105
|
right(repeat?: number): Direction[];
|
|
@@ -129,7 +140,7 @@ export declare const Move: MoveList;
|
|
|
129
140
|
* - **Strategy Management**: Add, remove, and query movement strategies
|
|
130
141
|
* - **Predefined Movements**: Quick access to common movement patterns
|
|
131
142
|
* - **Composite Movements**: Combine multiple strategies
|
|
132
|
-
* - **Physics Integration**: Seamless integration with
|
|
143
|
+
* - **Physics Integration**: Seamless integration with the deterministic @rpgjs/physic engine
|
|
133
144
|
*
|
|
134
145
|
* ## Available Movement Strategies
|
|
135
146
|
* - `LinearMove`: Constant velocity movement
|
|
@@ -173,5 +184,249 @@ export declare const Move: MoveList;
|
|
|
173
184
|
* }
|
|
174
185
|
* ```
|
|
175
186
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Move Manager Mixin
|
|
189
|
+
*
|
|
190
|
+
* Provides comprehensive movement management capabilities to any class. This mixin handles
|
|
191
|
+
* various types of movement including pathfinding, physics-based movement, route following,
|
|
192
|
+
* and advanced movement strategies like dashing, knockback, and projectile movement.
|
|
193
|
+
*
|
|
194
|
+
* @param Base - The base class to extend with movement management
|
|
195
|
+
* @returns Extended class with movement management methods
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* class MyPlayer extends WithMoveManager(BasePlayer) {
|
|
200
|
+
* constructor() {
|
|
201
|
+
* super();
|
|
202
|
+
* this.frequency = Frequency.High;
|
|
203
|
+
* }
|
|
204
|
+
* }
|
|
205
|
+
*
|
|
206
|
+
* const player = new MyPlayer();
|
|
207
|
+
* player.moveTo({ x: 100, y: 100 });
|
|
208
|
+
* player.dash({ x: 1, y: 0 }, 8, 200);
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export declare function WithMoveManager<TBase extends PlayerCtor>(Base: TBase): PlayerCtor;
|
|
212
|
+
/**
|
|
213
|
+
* Interface for Move Manager functionality
|
|
214
|
+
*
|
|
215
|
+
* Provides comprehensive movement management capabilities including pathfinding,
|
|
216
|
+
* physics-based movement, route following, and advanced movement strategies.
|
|
217
|
+
* This interface defines the public API of the MoveManager mixin.
|
|
218
|
+
*/
|
|
219
|
+
export interface IMoveManager {
|
|
220
|
+
/**
|
|
221
|
+
* Whether the player passes through other players
|
|
222
|
+
*
|
|
223
|
+
* When `true`, the player can walk through other player entities without collision.
|
|
224
|
+
* This is useful for busy areas where players shouldn't block each other.
|
|
225
|
+
*
|
|
226
|
+
* @default true
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* // Disable player-to-player collision
|
|
231
|
+
* player.throughOtherPlayer = true;
|
|
232
|
+
*
|
|
233
|
+
* // Enable player-to-player collision
|
|
234
|
+
* player.throughOtherPlayer = false;
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
throughOtherPlayer: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Whether the player goes through all characters (players and events)
|
|
240
|
+
*
|
|
241
|
+
* When `true`, the player can walk through all character entities (both players and events)
|
|
242
|
+
* without collision. Walls and obstacles still block movement.
|
|
243
|
+
* This takes precedence over `throughOtherPlayer` and `throughEvent`.
|
|
244
|
+
*
|
|
245
|
+
* @default false
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* // Enable ghost mode - pass through all characters
|
|
250
|
+
* player.through = true;
|
|
251
|
+
*
|
|
252
|
+
* // Disable ghost mode
|
|
253
|
+
* player.through = false;
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
through: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Whether the player passes through events (NPCs, objects)
|
|
259
|
+
*
|
|
260
|
+
* When `true`, the player can walk through event entities without collision.
|
|
261
|
+
* This is useful for NPCs that shouldn't block player movement.
|
|
262
|
+
*
|
|
263
|
+
* @default false
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* // Allow passing through events
|
|
268
|
+
* player.throughEvent = true;
|
|
269
|
+
*
|
|
270
|
+
* // Block passage through events
|
|
271
|
+
* player.throughEvent = false;
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
throughEvent: boolean;
|
|
275
|
+
/** Frequency for movement timing (milliseconds between movements) */
|
|
276
|
+
frequency: number;
|
|
277
|
+
/** Whether direction changes are locked (prevents automatic direction changes) */
|
|
278
|
+
directionFixed: boolean;
|
|
279
|
+
/** Whether animation changes are locked (prevents automatic animation changes) */
|
|
280
|
+
animationFixed: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Add a custom movement strategy to this entity
|
|
283
|
+
*
|
|
284
|
+
* Returns a Promise that resolves when the movement completes.
|
|
285
|
+
*
|
|
286
|
+
* @param strategy - The movement strategy to add
|
|
287
|
+
* @param options - Optional callbacks for movement lifecycle events
|
|
288
|
+
* @returns Promise that resolves when the movement completes
|
|
289
|
+
*/
|
|
290
|
+
addMovement(strategy: MovementStrategy, options?: MovementOptions): Promise<void>;
|
|
291
|
+
/**
|
|
292
|
+
* Remove a specific movement strategy from this entity
|
|
293
|
+
*
|
|
294
|
+
* @param strategy - The strategy instance to remove
|
|
295
|
+
* @returns True if the strategy was found and removed
|
|
296
|
+
*/
|
|
297
|
+
removeMovement(strategy: MovementStrategy): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Remove all active movement strategies from this entity
|
|
300
|
+
*/
|
|
301
|
+
clearMovements(): void;
|
|
302
|
+
/**
|
|
303
|
+
* Check if this entity has any active movement strategies
|
|
304
|
+
*
|
|
305
|
+
* @returns True if entity has active movements
|
|
306
|
+
*/
|
|
307
|
+
hasActiveMovements(): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Get all active movement strategies for this entity
|
|
310
|
+
*
|
|
311
|
+
* @returns Array of active movement strategies
|
|
312
|
+
*/
|
|
313
|
+
getActiveMovements(): MovementStrategy[];
|
|
314
|
+
/**
|
|
315
|
+
* Move toward a target player or position using AI pathfinding
|
|
316
|
+
*
|
|
317
|
+
* @param target - Target player or position to move toward
|
|
318
|
+
*/
|
|
319
|
+
moveTo(target: RpgCommonPlayer | {
|
|
320
|
+
x: number;
|
|
321
|
+
y: number;
|
|
322
|
+
}): void;
|
|
323
|
+
/**
|
|
324
|
+
* Stop the current moveTo behavior
|
|
325
|
+
*/
|
|
326
|
+
stopMoveTo(): void;
|
|
327
|
+
/**
|
|
328
|
+
* Perform a dash movement in the specified direction
|
|
329
|
+
*
|
|
330
|
+
* The total speed is calculated by adding the player's base speed to the additional speed.
|
|
331
|
+
* Returns a Promise that resolves when the dash completes.
|
|
332
|
+
*
|
|
333
|
+
* @param direction - Normalized direction vector
|
|
334
|
+
* @param additionalSpeed - Extra speed added on top of base speed (default: 4)
|
|
335
|
+
* @param duration - Duration in milliseconds (default: 200)
|
|
336
|
+
* @param options - Optional callbacks for movement lifecycle events
|
|
337
|
+
* @returns Promise that resolves when the dash completes
|
|
338
|
+
*/
|
|
339
|
+
dash(direction: {
|
|
340
|
+
x: number;
|
|
341
|
+
y: number;
|
|
342
|
+
}, additionalSpeed?: number, duration?: number, options?: MovementOptions): Promise<void>;
|
|
343
|
+
/**
|
|
344
|
+
* Apply knockback effect in the specified direction
|
|
345
|
+
*
|
|
346
|
+
* The force is scaled by the player's base speed for consistent behavior.
|
|
347
|
+
* Returns a Promise that resolves when the knockback completes.
|
|
348
|
+
*
|
|
349
|
+
* @param direction - Normalized direction vector
|
|
350
|
+
* @param force - Force multiplier applied to base speed (default: 5)
|
|
351
|
+
* @param duration - Duration in milliseconds (default: 300)
|
|
352
|
+
* @param options - Optional callbacks for movement lifecycle events
|
|
353
|
+
* @returns Promise that resolves when the knockback completes
|
|
354
|
+
*/
|
|
355
|
+
knockback(direction: {
|
|
356
|
+
x: number;
|
|
357
|
+
y: number;
|
|
358
|
+
}, force?: number, duration?: number, options?: MovementOptions): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* Follow a sequence of waypoints
|
|
361
|
+
*
|
|
362
|
+
* Speed is calculated from the player's base speed multiplied by the speedMultiplier.
|
|
363
|
+
*
|
|
364
|
+
* @param waypoints - Array of x,y positions to follow
|
|
365
|
+
* @param speedMultiplier - Multiplier applied to base speed (default: 0.5)
|
|
366
|
+
* @param loop - Whether to loop back to start (default: false)
|
|
367
|
+
*/
|
|
368
|
+
followPath(waypoints: Array<{
|
|
369
|
+
x: number;
|
|
370
|
+
y: number;
|
|
371
|
+
}>, speedMultiplier?: number, loop?: boolean): void;
|
|
372
|
+
/**
|
|
373
|
+
* Apply oscillating movement pattern
|
|
374
|
+
*
|
|
375
|
+
* @param direction - Primary oscillation axis (normalized)
|
|
376
|
+
* @param amplitude - Maximum distance from center (default: 50)
|
|
377
|
+
* @param period - Time for complete cycle in ms (default: 2000)
|
|
378
|
+
*/
|
|
379
|
+
oscillate(direction: {
|
|
380
|
+
x: number;
|
|
381
|
+
y: number;
|
|
382
|
+
}, amplitude?: number, period?: number): void;
|
|
383
|
+
/**
|
|
384
|
+
* Apply ice movement physics
|
|
385
|
+
*
|
|
386
|
+
* Max speed is calculated from the player's base speed multiplied by the speedFactor.
|
|
387
|
+
*
|
|
388
|
+
* @param direction - Target movement direction
|
|
389
|
+
* @param speedFactor - Factor multiplied with base speed for max speed (default: 1.0)
|
|
390
|
+
*/
|
|
391
|
+
applyIceMovement(direction: {
|
|
392
|
+
x: number;
|
|
393
|
+
y: number;
|
|
394
|
+
}, speedFactor?: number): void;
|
|
395
|
+
/**
|
|
396
|
+
* Shoot a projectile in the specified direction
|
|
397
|
+
*
|
|
398
|
+
* Speed is calculated from the player's base speed multiplied by the speedFactor.
|
|
399
|
+
*
|
|
400
|
+
* @param type - Type of projectile trajectory
|
|
401
|
+
* @param direction - Normalized direction vector
|
|
402
|
+
* @param speedFactor - Factor multiplied with base speed (default: 50)
|
|
403
|
+
*/
|
|
404
|
+
shootProjectile(type: ProjectileType, direction: {
|
|
405
|
+
x: number;
|
|
406
|
+
y: number;
|
|
407
|
+
}, speedFactor?: number): void;
|
|
408
|
+
/**
|
|
409
|
+
* Give an itinerary to follow using movement strategies
|
|
410
|
+
*
|
|
411
|
+
* @param routes - Array of movement instructions to execute
|
|
412
|
+
* @param options - Optional configuration including onStuck callback
|
|
413
|
+
* @returns Promise that resolves when all routes are completed
|
|
414
|
+
*/
|
|
415
|
+
moveRoutes(routes: Routes, options?: MoveRoutesOptions): Promise<boolean>;
|
|
416
|
+
/**
|
|
417
|
+
* Give a path that repeats itself in a loop to a character
|
|
418
|
+
*
|
|
419
|
+
* @param routes - Array of movement instructions to repeat infinitely
|
|
420
|
+
*/
|
|
421
|
+
infiniteMoveRoute(routes: Routes): void;
|
|
422
|
+
/**
|
|
423
|
+
* Stop an infinite movement
|
|
424
|
+
*
|
|
425
|
+
* @param force - Forces the stop of the infinite movement immediately
|
|
426
|
+
*/
|
|
427
|
+
breakRoutes(force?: boolean): void;
|
|
428
|
+
/**
|
|
429
|
+
* Replay an infinite movement
|
|
430
|
+
*/
|
|
431
|
+
replayRoutes(): void;
|
|
432
|
+
}
|