FAForever / fa

Lua code for FAF
229 stars 234 forks source link

[Bug]: Moving the attack order while the Tempest charges its cannon cancels the shot but activates its reload time #6443

Open Basilisk3 opened 2 months ago

Basilisk3 commented 2 months ago

Describe the Bug

As per the title. Especially relevant when groundfiring but also when targeting units regularly.

Reproduce the bug

Groundfire a Tempest and move the attack order while it is in the process of charging its cannon.

Screenshots

No response

Additional context

No response

Hdt80bro commented 2 months ago

Sounds like this works as intended to me - can you elaborate?

Basilisk3 commented 2 months ago

I updated the title. The shot itself is cancelled, but the game appears to think that the unit fired (probably due to the charge-up animation). This results in the reload time being triggered even though the weapon did not shoot, forcing you to wait 10 seconds before trying again.

Hdt80bro commented 2 months ago

Ah, I see.

lL1l1 commented 2 months ago

This applies to every single unit that fires multiple projectiles per OnFire over a period of time. It also applies to units switching targets instantly due to AttackGroundTries. The engine simply doesn't keep track of how many projectiles were fired, it just fires the OnFire event when the aim is aligned within a tolerance of the firing solution.

I worked on a solution to this problem in #6166 by adding a salvo retargeting feature, but its a little tangled with other changes. Essentially it counts how many projectiles were actually fired and creates a thread allowing to bypass waiting for the engine's OnFire call when the weapon is aimed if not all projectiles of a rack were fired. I don't think it solves the issue with AttackGroundTries aiming the weapon away during the salvo though, but if I remember correctly you can adjust the fire rate to be slower so that the engine doesn't aim the weapon away when the third OnFire event is given (fire rate cooldown intervals should be longer than salvo firing times).