-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: auto-turn to selected target (#1588)
* feat: auto-turn to selected target * Implements a new targeting game setting that allows players to auto-turn to the selected target when enabled. * Player will auto-turn to their currently selected target (by clicking on them or switching targets) only when not moving and if the direction needs to be changed from the current one. * The feature can be toggled by the server config as well. When disabled, it will make it so the feature no longer works for the client and the checkbox within the game settings is disabled and unchecked. * Minor chore at DrawTargets() : reduced nesting by merging and inverting if(s) and used conditional en.Value != null within the foreach loops required for this feature. * Special thanks to Daywalkr (Middle Ages: Online), took (and changed a bit) the implementation from his repository. * Panda's review (I) * Panda's review (II) * panda's review. * created an entity property (long) "AutoTargetingTime" to limit down the direction change packet sender in order to prevent burst packets from the client (tested with a non-admin character to reproduce the packet flood). * the delay added by AutoTargetingTime also allows to prevent a visual glitch encountered while testing with two clients and a walking/targeting player: now, when auto-targeting right after the player stops walking, the extra delay allows the character to turn around to it's target more naturally (to every player view - local and other clients) when they stop moving. * checks if the current facing direction is the direction towards the target, in which case (if true), returns (stops the loop) without further processing in order to prevent unnecessary burst of packets and processing from the client. * chore: adds server configurable property for delay * Also fixed some typos and re-structured AutoTurnToTarget(); a bit. * Panda's review (III)
- Loading branch information
Showing
6 changed files
with
152 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters