@rpgjs/server 5.0.0-alpha.21 → 5.0.0-alpha.23

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.
@@ -496,18 +496,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
496
496
  _finishRoute: ((value: boolean) => void) | null = null;
497
497
  _isInfiniteRouteActive: boolean = false;
498
498
 
499
- /**
500
- * The player passes through the other players (or vice versa). But the player does not go through the events.
501
- *
502
- * ```ts
503
- * player.throughOtherPlayer = true
504
- * ```
505
- *
506
- * @title Go through to other player
507
- * @prop {boolean} player.throughOtherPlayer
508
- * @default true
509
- * @memberof MoveManager
510
- * */
511
499
  set throughOtherPlayer(value: boolean) {
512
500
  this._throughOtherPlayer.set(value);
513
501
  }
@@ -516,18 +504,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
516
504
  return this._throughOtherPlayer();
517
505
  }
518
506
 
519
- /**
520
- * The player goes through the event or the other players (or vice versa)
521
- *
522
- * ```ts
523
- * player.through = true
524
- * ```
525
- *
526
- * @title Go through the player
527
- * @prop {boolean} player.through
528
- * @default false
529
- * @memberof MoveManager
530
- * */
531
507
  set through(value: boolean) {
532
508
  this._through.set(value);
533
509
  }
@@ -536,35 +512,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
536
512
  return this._through();
537
513
  }
538
514
 
539
- /**
540
- * The frequency allows to put a stop time between each movement in the array of the moveRoutes() method.
541
- * The value represents a dwell time in milliseconds. The higher the value, the slower the frequency.
542
- *
543
- * ```ts
544
- * player.frequency = 400
545
- * ```
546
- *
547
- * You can use Frequency enum
548
- *
549
- * ```ts
550
- * import { Frequency } from '@rpgjs/server'
551
- * player.frequency = Frequency.Low
552
- * ```
553
- *
554
- * @title Change Frequency
555
- * @prop {number} player.speed
556
- * @enum {number}
557
- *
558
- * Frequency.Lowest | 600
559
- * Frequency.Lower | 400
560
- * Frequency.Low | 200
561
- * Frequency.High | 100
562
- * Frequency.Higher | 50
563
- * Frequency.Highest | 25
564
- * Frequency.None | 0
565
- * @default 0
566
- * @memberof MoveManager
567
- * */
568
515
  set frequency(value: number) {
569
516
  this._frequency.set(value);
570
517
  }
@@ -573,25 +520,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
573
520
  return this._frequency();
574
521
  }
575
522
 
576
- /**
577
- * Add a custom movement strategy to this entity
578
- *
579
- * Allows adding any custom MovementStrategy implementation.
580
- * Multiple strategies can be active simultaneously.
581
- *
582
- * @param strategy - The movement strategy to add
583
- *
584
- * @example
585
- * ```ts
586
- * // Add custom movement
587
- * const customMove = new LinearMove(5, 0, 1000);
588
- * player.addMovement(customMove);
589
- *
590
- * // Add multiple movements
591
- * player.addMovement(new Dash(8, { x: 1, y: 0 }, 200));
592
- * player.addMovement(new Oscillate({ x: 0, y: 1 }, 10, 1000));
593
- * ```
594
- */
595
523
  addMovement(strategy: MovementStrategy): void {
596
524
  const map = (this as unknown as PlayerWithMixins).getCurrentMap() as any;
597
525
  if (!map) return;
@@ -599,22 +527,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
599
527
  map.moveManager.add((this as unknown as PlayerWithMixins).id, strategy);
600
528
  }
601
529
 
602
- /**
603
- * Remove a specific movement strategy from this entity
604
- *
605
- * @param strategy - The strategy instance to remove
606
- * @returns True if the strategy was found and removed
607
- *
608
- * @example
609
- * ```ts
610
- * const dashMove = new Dash(8, { x: 1, y: 0 }, 200);
611
- * player.addMovement(dashMove);
612
- *
613
- * // Later, remove the specific movement
614
- * const removed = player.removeMovement(dashMove);
615
- * console.log('Movement removed:', removed);
616
- * ```
617
- */
618
530
  removeMovement(strategy: MovementStrategy): boolean {
619
531
  const map = (this as unknown as PlayerWithMixins).getCurrentMap() as any;
620
532
  if (!map) return false;
@@ -622,21 +534,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
622
534
  return map.moveManager.remove((this as unknown as PlayerWithMixins).id, strategy);
623
535
  }
624
536
 
625
- /**
626
- * Remove all active movement strategies from this entity
627
- *
628
- * Stops all current movements immediately.
629
- *
630
- * @example
631
- * ```ts
632
- * // Stop all movements when player dies
633
- * player.clearMovements();
634
- *
635
- * // Clear movements before applying new ones
636
- * player.clearMovements();
637
- * player.dash({ x: 1, y: 0 });
638
- * ```
639
- */
640
537
  clearMovements(): void {
641
538
  const map = (this as unknown as PlayerWithMixins).getCurrentMap() as any;
642
539
  if (!map) return;
@@ -644,24 +541,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
644
541
  map.moveManager.clear((this as unknown as PlayerWithMixins).id);
645
542
  }
646
543
 
647
- /**
648
- * Check if this entity has any active movement strategies
649
- *
650
- * @returns True if entity has active movements
651
- *
652
- * @example
653
- * ```ts
654
- * // Don't accept input while movements are active
655
- * if (!player.hasActiveMovements()) {
656
- * player.dash(inputDirection);
657
- * }
658
- *
659
- * // Check before adding new movement
660
- * if (player.hasActiveMovements()) {
661
- * player.clearMovements();
662
- * }
663
- * ```
664
- */
665
544
  hasActiveMovements(): boolean {
666
545
  const map = (this as unknown as PlayerWithMixins).getCurrentMap() as any;
667
546
  if (!map) return false;
@@ -669,21 +548,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
669
548
  return map.moveManager.hasActiveStrategies((this as unknown as PlayerWithMixins).id);
670
549
  }
671
550
 
672
- /**
673
- * Get all active movement strategies for this entity
674
- *
675
- * @returns Array of active movement strategies
676
- *
677
- * @example
678
- * ```ts
679
- * // Check what movements are currently active
680
- * const movements = player.getActiveMovements();
681
- * console.log(`Player has ${movements.length} active movements`);
682
- *
683
- * // Find specific movement type
684
- * const hasDash = movements.some(m => m instanceof Dash);
685
- * ```
686
- */
687
551
  getActiveMovements(): MovementStrategy[] {
688
552
  const map = (this as unknown as PlayerWithMixins).getCurrentMap() as any;
689
553
  if (!map) return [];
@@ -691,27 +555,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
691
555
  return map.moveManager.getStrategies((this as unknown as PlayerWithMixins).id);
692
556
  }
693
557
 
694
- /**
695
- * Move toward a target player or position using AI pathfinding
696
- *
697
- * Uses SeekAvoid strategy for intelligent pathfinding with obstacle avoidance.
698
- * The entity will seek toward the target while avoiding obstacles.
699
- *
700
- * @param target - Target player or position to move toward
701
- *
702
- * @example
703
- * ```ts
704
- * // Move toward another player
705
- * const targetPlayer = game.getPlayer('player2');
706
- * player.moveTo(targetPlayer);
707
- *
708
- * // Move toward a specific position
709
- * player.moveTo({ x: 300, y: 200 });
710
- *
711
- * // Stop the movement later
712
- * player.stopMoveTo();
713
- * ```
714
- */
715
558
  moveTo(target: RpgCommonPlayer | { x: number, y: number }): void {
716
559
  const map = (this as unknown as PlayerWithMixins).getCurrentMap() as any;
717
560
  if (!map) return;
@@ -739,22 +582,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
739
582
  );
740
583
  }
741
584
 
742
- /**
743
- * Stop the current moveTo behavior
744
- *
745
- * Removes any active SeekAvoid strategies.
746
- *
747
- * @example
748
- * ```ts
749
- * // Start following a target
750
- * player.moveTo(targetPlayer);
751
- *
752
- * // Stop following when target is reached
753
- * if (distanceToTarget < 10) {
754
- * player.stopMoveTo();
755
- * }
756
- * ```
757
- */
758
585
  stopMoveTo(): void {
759
586
  const map = (this as unknown as PlayerWithMixins).getCurrentMap() as any;
760
587
  if (!map) return;
@@ -767,152 +594,26 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
767
594
  });
768
595
  }
769
596
 
770
- /**
771
- * Perform a dash movement in the specified direction
772
- *
773
- * Applies high-speed movement for a short duration.
774
- *
775
- * @param direction - Normalized direction vector
776
- * @param speed - Movement speed (default: 8)
777
- * @param duration - Duration in milliseconds (default: 200)
778
- *
779
- * @example
780
- * ```ts
781
- * // Dash right
782
- * player.dash({ x: 1, y: 0 });
783
- *
784
- * // Dash diagonally with custom speed and duration
785
- * player.dash({ x: 0.7, y: 0.7 }, 12, 300);
786
- *
787
- * // Dash in input direction
788
- * player.dash(inputDirection, 10, 150);
789
- * ```
790
- */
791
597
  dash(direction: { x: number, y: number }, speed: number = 8, duration: number = 200): void {
792
598
  this.addMovement(new Dash(speed, direction, duration));
793
599
  }
794
600
 
795
- /**
796
- * Apply knockback effect in the specified direction
797
- *
798
- * Creates a push effect that gradually decreases over time.
799
- *
800
- * @param direction - Normalized direction vector
801
- * @param force - Initial knockback force (default: 5)
802
- * @param duration - Duration in milliseconds (default: 300)
803
- *
804
- * @example
805
- * ```ts
806
- * // Knockback from explosion
807
- * const explosionDir = { x: -1, y: 0 };
808
- * player.knockback(explosionDir, 8, 400);
809
- *
810
- * // Light knockback from attack
811
- * player.knockback(attackDirection, 3, 200);
812
- * ```
813
- */
814
601
  knockback(direction: { x: number, y: number }, force: number = 5, duration: number = 300): void {
815
602
  this.addMovement(new Knockback(direction, force, duration));
816
603
  }
817
604
 
818
- /**
819
- * Follow a sequence of waypoints
820
- *
821
- * Entity will move through each waypoint in order.
822
- *
823
- * @param waypoints - Array of x,y positions to follow
824
- * @param speed - Movement speed (default: 2)
825
- * @param loop - Whether to loop back to start (default: false)
826
- *
827
- * @example
828
- * ```ts
829
- * // Create a patrol route
830
- * const patrolPoints = [
831
- * { x: 100, y: 100 },
832
- * { x: 300, y: 100 },
833
- * { x: 300, y: 300 },
834
- * { x: 100, y: 300 }
835
- * ];
836
- * player.followPath(patrolPoints, 3, true);
837
- *
838
- * // One-time path to destination
839
- * player.followPath([{ x: 500, y: 200 }], 4);
840
- * ```
841
- */
842
605
  followPath(waypoints: Array<{ x: number, y: number }>, speed: number = 2, loop: boolean = false): void {
843
606
  this.addMovement(new PathFollow(waypoints, speed, loop));
844
607
  }
845
608
 
846
- /**
847
- * Apply oscillating movement pattern
848
- *
849
- * Entity moves back and forth along the specified axis.
850
- *
851
- * @param direction - Primary oscillation axis (normalized)
852
- * @param amplitude - Maximum distance from center (default: 50)
853
- * @param period - Time for complete cycle in ms (default: 2000)
854
- *
855
- * @example
856
- * ```ts
857
- * // Horizontal oscillation
858
- * player.oscillate({ x: 1, y: 0 }, 100, 3000);
859
- *
860
- * // Vertical oscillation
861
- * player.oscillate({ x: 0, y: 1 }, 30, 1500);
862
- *
863
- * // Diagonal oscillation
864
- * player.oscillate({ x: 0.7, y: 0.7 }, 75, 2500);
865
- * ```
866
- */
867
609
  oscillate(direction: { x: number, y: number }, amplitude: number = 50, period: number = 2000): void {
868
610
  this.addMovement(new Oscillate(direction, amplitude, period));
869
611
  }
870
612
 
871
- /**
872
- * Apply ice movement physics
873
- *
874
- * Creates slippery movement with gradual acceleration and inertia.
875
- * Perfect for ice terrains or slippery surfaces.
876
- *
877
- * @param direction - Target movement direction
878
- * @param maxSpeed - Maximum speed when fully accelerated (default: 4)
879
- *
880
- * @example
881
- * ```ts
882
- * // Apply ice physics when on ice terrain
883
- * if (onIceTerrain) {
884
- * player.applyIceMovement(inputDirection, 5);
885
- * }
886
- *
887
- * // Update direction when input changes
888
- * iceMovement.setTargetDirection(newDirection);
889
- * ```
890
- */
891
613
  applyIceMovement(direction: { x: number, y: number }, maxSpeed: number = 4): void {
892
614
  this.addMovement(new IceMovement(direction, maxSpeed));
893
615
  }
894
616
 
895
- /**
896
- * Shoot a projectile in the specified direction
897
- *
898
- * Creates projectile movement with various trajectory types.
899
- *
900
- * @param type - Type of projectile trajectory
901
- * @param direction - Normalized direction vector
902
- * @param speed - Projectile speed (default: 200)
903
- *
904
- * @example
905
- * ```ts
906
- * // Shoot arrow
907
- * player.shootProjectile(ProjectileType.Straight, { x: 1, y: 0 }, 300);
908
- *
909
- * // Throw grenade with arc
910
- * player.shootProjectile(ProjectileType.Arc, { x: 0.7, y: 0.7 }, 150);
911
- *
912
- * // Bouncing projectile
913
- * player.shootProjectile(ProjectileType.Bounce, { x: 1, y: 0 }, 100);
914
- * ```
915
- */
916
617
  shootProjectile(type: ProjectileType, direction: { x: number, y: number }, speed: number = 200): void {
917
618
  const config = {
918
619
  speed,
@@ -927,49 +628,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
927
628
  this.addMovement(new ProjectileMovement(type, config));
928
629
  }
929
630
 
930
- /**
931
- * Give an itinerary to follow using movement strategies
932
- *
933
- * Executes a sequence of movements and actions in order. Each route can be:
934
- * - A Direction enum value for basic movement
935
- * - A string starting with "turn-" for direction changes
936
- * - A function that returns directions or actions
937
- * - A Promise for async operations
938
- *
939
- * The method processes routes sequentially, respecting the entity's frequency
940
- * setting for timing between movements.
941
- *
942
- * @param routes - Array of movement instructions to execute
943
- * @returns Promise that resolves when all routes are completed
944
- *
945
- * @example
946
- * ```ts
947
- * // Basic directional movements
948
- * await player.moveRoutes([
949
- * Direction.Right,
950
- * Direction.Up,
951
- * Direction.Left
952
- * ]);
953
- *
954
- * // Mix of movements and turns
955
- * await player.moveRoutes([
956
- * Direction.Right,
957
- * 'turn-' + Direction.Up,
958
- * Direction.Up
959
- * ]);
960
- *
961
- * // Using functions for dynamic behavior
962
- * const customMove = (player, map) => [Direction.Right, Direction.Down];
963
- * await player.moveRoutes([customMove]);
964
- *
965
- * // With async operations
966
- * await player.moveRoutes([
967
- * Direction.Right,
968
- * new Promise(resolve => setTimeout(resolve, 1000)), // Wait 1 second
969
- * Direction.Left
970
- * ]);
971
- * ```
972
- */
973
631
  moveRoutes(routes: Routes): Promise<boolean> {
974
632
  let count = 0;
975
633
  let frequence = 0;
@@ -1102,13 +760,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
1102
760
  });
1103
761
  }
1104
762
 
1105
- /**
1106
- * Utility method to flatten nested route arrays
1107
- *
1108
- * @private
1109
- * @param routes - Routes array that may contain nested arrays
1110
- * @returns Flattened array of routes
1111
- */
1112
763
  private flattenRoutes(routes: Routes): Routes {
1113
764
  return routes.reduce((acc: Routes, item) => {
1114
765
  if (Array.isArray(item)) {
@@ -1118,43 +769,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
1118
769
  }, []);
1119
770
  }
1120
771
 
1121
- /**
1122
- * Give a path that repeats itself in a loop to a character
1123
- *
1124
- * Creates an infinite movement pattern that continues until manually stopped.
1125
- * The routes will repeat in a continuous loop, making it perfect for patrol
1126
- * patterns, ambient movements, or any repetitive behavior.
1127
- *
1128
- * You can stop the movement at any time with `breakRoutes()` and replay it
1129
- * with `replayRoutes()`.
1130
- *
1131
- * @param routes - Array of movement instructions to repeat infinitely
1132
- *
1133
- * @example
1134
- * ```ts
1135
- * // Create an infinite random movement pattern
1136
- * player.infiniteMoveRoute([Move.random()]);
1137
- *
1138
- * // Create a patrol route
1139
- * player.infiniteMoveRoute([
1140
- * Direction.Right,
1141
- * Direction.Right,
1142
- * Direction.Down,
1143
- * Direction.Left,
1144
- * Direction.Left,
1145
- * Direction.Up
1146
- * ]);
1147
- *
1148
- * // Mix movements and rotations
1149
- * player.infiniteMoveRoute([
1150
- * Move.turnRight(),
1151
- * Direction.Right,
1152
- * Move.wait(1),
1153
- * Move.turnLeft(),
1154
- * Direction.Left
1155
- * ]);
1156
- * ```
1157
- */
1158
772
  infiniteMoveRoute(routes: Routes): void {
1159
773
  this._infiniteRoutes = routes;
1160
774
  this._isInfiniteRouteActive = true;
@@ -1179,29 +793,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
1179
793
  executeInfiniteRoute();
1180
794
  }
1181
795
 
1182
- /**
1183
- * Stop an infinite movement
1184
- *
1185
- * Works only for infinite movements created with `infiniteMoveRoute()`.
1186
- * This method stops the current route execution and prevents the next
1187
- * iteration from starting.
1188
- *
1189
- * @param force - Forces the stop of the infinite movement immediately
1190
- *
1191
- * @example
1192
- * ```ts
1193
- * // Start infinite movement
1194
- * player.infiniteMoveRoute([Move.random()]);
1195
- *
1196
- * // Stop it when player enters combat
1197
- * if (inCombat) {
1198
- * player.breakRoutes(true);
1199
- * }
1200
- *
1201
- * // Gentle stop (completes current route first)
1202
- * player.breakRoutes();
1203
- * ```
1204
- */
1205
796
  breakRoutes(force: boolean = false): void {
1206
797
  this._isInfiniteRouteActive = false;
1207
798
 
@@ -1217,32 +808,6 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
1217
808
  }
1218
809
  }
1219
810
 
1220
- /**
1221
- * Replay an infinite movement
1222
- *
1223
- * Works only for infinite movements that were previously created with
1224
- * `infiniteMoveRoute()`. If the route was stopped with `breakRoutes()`,
1225
- * you can restart it with this method using the same route configuration.
1226
- *
1227
- * @example
1228
- * ```ts
1229
- * // Create infinite movement
1230
- * player.infiniteMoveRoute([Move.random()]);
1231
- *
1232
- * // Stop it temporarily
1233
- * player.breakRoutes(true);
1234
- *
1235
- * // Resume the same movement pattern
1236
- * player.replayRoutes();
1237
- *
1238
- * // Stop and start with different conditions
1239
- * if (playerNearby) {
1240
- * player.breakRoutes();
1241
- * } else {
1242
- * player.replayRoutes();
1243
- * }
1244
- * ```
1245
- */
1246
811
  replayRoutes(): void {
1247
812
  if (this._infiniteRoutes && !this._isInfiniteRouteActive) {
1248
813
  this.infiniteMoveRoute(this._infiniteRoutes);
@@ -1254,7 +819,145 @@ export function WithMoveManager<TBase extends PlayerCtor>(Base: TBase) {
1254
819
  }
1255
820
 
1256
821
  /**
1257
- * Type helper to extract the interface from the WithMoveManager mixin
1258
- * This provides the type without duplicating method signatures
822
+ * Interface for Move Manager functionality
823
+ *
824
+ * Provides comprehensive movement management capabilities including pathfinding,
825
+ * physics-based movement, route following, and advanced movement strategies.
826
+ * This interface defines the public API of the MoveManager mixin.
1259
827
  */
1260
- export type IMoveManager = InstanceType<ReturnType<typeof WithMoveManager>>;
828
+ export interface IMoveManager {
829
+ /** Whether the player passes through other players */
830
+ throughOtherPlayer: boolean;
831
+
832
+ /** Whether the player goes through events or other players */
833
+ through: boolean;
834
+
835
+ /** Frequency for movement timing (milliseconds between movements) */
836
+ frequency: number;
837
+
838
+ /**
839
+ * Add a custom movement strategy to this entity
840
+ *
841
+ * @param strategy - The movement strategy to add
842
+ */
843
+ addMovement(strategy: MovementStrategy): void;
844
+
845
+ /**
846
+ * Remove a specific movement strategy from this entity
847
+ *
848
+ * @param strategy - The strategy instance to remove
849
+ * @returns True if the strategy was found and removed
850
+ */
851
+ removeMovement(strategy: MovementStrategy): boolean;
852
+
853
+ /**
854
+ * Remove all active movement strategies from this entity
855
+ */
856
+ clearMovements(): void;
857
+
858
+ /**
859
+ * Check if this entity has any active movement strategies
860
+ *
861
+ * @returns True if entity has active movements
862
+ */
863
+ hasActiveMovements(): boolean;
864
+
865
+ /**
866
+ * Get all active movement strategies for this entity
867
+ *
868
+ * @returns Array of active movement strategies
869
+ */
870
+ getActiveMovements(): MovementStrategy[];
871
+
872
+ /**
873
+ * Move toward a target player or position using AI pathfinding
874
+ *
875
+ * @param target - Target player or position to move toward
876
+ */
877
+ moveTo(target: RpgCommonPlayer | { x: number, y: number }): void;
878
+
879
+ /**
880
+ * Stop the current moveTo behavior
881
+ */
882
+ stopMoveTo(): void;
883
+
884
+ /**
885
+ * Perform a dash movement in the specified direction
886
+ *
887
+ * @param direction - Normalized direction vector
888
+ * @param speed - Movement speed (default: 8)
889
+ * @param duration - Duration in milliseconds (default: 200)
890
+ */
891
+ dash(direction: { x: number, y: number }, speed?: number, duration?: number): void;
892
+
893
+ /**
894
+ * Apply knockback effect in the specified direction
895
+ *
896
+ * @param direction - Normalized direction vector
897
+ * @param force - Initial knockback force (default: 5)
898
+ * @param duration - Duration in milliseconds (default: 300)
899
+ */
900
+ knockback(direction: { x: number, y: number }, force?: number, duration?: number): void;
901
+
902
+ /**
903
+ * Follow a sequence of waypoints
904
+ *
905
+ * @param waypoints - Array of x,y positions to follow
906
+ * @param speed - Movement speed (default: 2)
907
+ * @param loop - Whether to loop back to start (default: false)
908
+ */
909
+ followPath(waypoints: Array<{ x: number, y: number }>, speed?: number, loop?: boolean): void;
910
+
911
+ /**
912
+ * Apply oscillating movement pattern
913
+ *
914
+ * @param direction - Primary oscillation axis (normalized)
915
+ * @param amplitude - Maximum distance from center (default: 50)
916
+ * @param period - Time for complete cycle in ms (default: 2000)
917
+ */
918
+ oscillate(direction: { x: number, y: number }, amplitude?: number, period?: number): void;
919
+
920
+ /**
921
+ * Apply ice movement physics
922
+ *
923
+ * @param direction - Target movement direction
924
+ * @param maxSpeed - Maximum speed when fully accelerated (default: 4)
925
+ */
926
+ applyIceMovement(direction: { x: number, y: number }, maxSpeed?: number): void;
927
+
928
+ /**
929
+ * Shoot a projectile in the specified direction
930
+ *
931
+ * @param type - Type of projectile trajectory
932
+ * @param direction - Normalized direction vector
933
+ * @param speed - Projectile speed (default: 200)
934
+ */
935
+ shootProjectile(type: ProjectileType, direction: { x: number, y: number }, speed?: number): void;
936
+
937
+ /**
938
+ * Give an itinerary to follow using movement strategies
939
+ *
940
+ * @param routes - Array of movement instructions to execute
941
+ * @returns Promise that resolves when all routes are completed
942
+ */
943
+ moveRoutes(routes: Routes): Promise<boolean>;
944
+
945
+ /**
946
+ * Give a path that repeats itself in a loop to a character
947
+ *
948
+ * @param routes - Array of movement instructions to repeat infinitely
949
+ */
950
+ infiniteMoveRoute(routes: Routes): void;
951
+
952
+ /**
953
+ * Stop an infinite movement
954
+ *
955
+ * @param force - Forces the stop of the infinite movement immediately
956
+ */
957
+ breakRoutes(force?: boolean): void;
958
+
959
+ /**
960
+ * Replay an infinite movement
961
+ */
962
+ replayRoutes(): void;
963
+ }