Skip to content

Auto attack support - #1820

Merged
Josh-Larson merged 6 commits into
ProjectSWGCore:masterfrom
madsboddum:autoattack
Sep 8, 2026
Merged

Auto attack support#1820
Josh-Larson merged 6 commits into
ProjectSWGCore:masterfrom
madsboddum:autoattack

Conversation

@madsboddum

Copy link
Copy Markdown
Member

Closes #750.

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.

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.
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
Josh-Larson merged commit 1ac22d2 into ProjectSWGCore:master Sep 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default attack (Ctrl+Left Click)

2 participants