Auto attack support - #1820
Merged
Merged
Conversation
The client sends the defaultAction command when a toolbar slot is chosen as the default attack, carrying the ability name, or nothing at all when the choice is cleared. The choice is kept on the CreatureObject, because the client only sends it when a toolbar slot is ctrl-clicked or when it starts up, and so has to survive logging out. AutoAttackService queues that command at the player's look-at target while they are in combat, paced by the weapon's modified attack speed. Clearing the choice stops the attacks, as does logging out or running out of action or mind, for which CommandQueueService now reports a failed combat command. Attacking again resumes them. The client discards a command timer whose sequence id is zero, so a command the server started on its own continues the client's own sequence, otherwise no cooldown is drawn on the toolbar.
Josh-Larson
reviewed
Sep 7, 2026
Josh-Larson
reviewed
Sep 7, 2026
Josh-Larson
reviewed
Sep 7, 2026
currentTimeMillis follows the system clock and jumps around with NTP, so an adjustment could delay or skip an attack. nanoTime is monotonic.
One map per creature instead of two. The sequence id now shares the combat queue's lifetime, so it restarts whenever the player leaves combat or deselects their target.
Josh-Larson
reviewed
Sep 7, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #750.
The client sends the
defaultActioncommand when a toolbar slot is chosen as the default attack, carrying the ability name, or nothing at all when the choice is cleared. The choice is kept on theCreatureObject, because the client only sends it when a toolbar slot is ctrl-clicked or when it starts up, and so has to survive logging out.AutoAttackServicequeues that command at the player's look-at target while they are in combat, paced by the weapon's modified attack speed. Clearing the choice stops the attacks, as does logging out or running out of action or mind, for whichCommandQueueServicenow reports a failed combat command. Attacking again resumes them.The client discards a command timer whose sequence id is zero, so a command the server started on its own continues the client's own sequence, otherwise no cooldown is drawn on the toolbar.