Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AttackGroundTries and Othuy Lightning Storm #6166

Draft
wants to merge 26 commits into
base: deploy/fafdevelop
Choose a base branch
from

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented May 10, 2024

Description of the proposed changes

Fixes the ability of AttackGroundTries for bombers and fixes an off by one issue for other units. Annotates the field.
As a bonus, fixes lightning storm spawned from Ythotha too (cheat menu spawn and Ythotha spawn act differently).

Testing done on the proposed changes

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

lL1l1 added 9 commits May 8, 2024 23:40
Fixes lightning storm ground attacking
Previous commit prevents Scathis state locking up when losing target when in firing state that required this target check
fix for custom base class not being called, needed for lightning storm to work
needs testing for IdleState OnFire, which is rarely called but is possible
Fixes their tracking of how many ground attacks they've done
@lL1l1 lL1l1 added area: sim Area that is affected by the Simulation of the Game feature: weapon firing cycle related to the weapon firing cycle labels May 10, 2024
@@ -898,7 +899,7 @@ DefaultProjectileWeapon = ClassWeapon(Weapon) {

-- wait reload time + 2 seconds, then force the weapon to recheck its target
WaitSeconds((1 / self.Blueprint.RateOfFire) + 3)
self:ResetTarget()
self:ResetTarget() -- this breaks AttackGroundTries for bombers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great find!

@lL1l1
Copy link
Contributor Author

lL1l1 commented May 25, 2024

The main change is the salvo retargeting feature.
An issue that was being solved before this PR is that salvos can be restarted from shot 0 if you cancel the firing through OnLostTarget in the middle of the FiringState.
Timeline:

  1. Before this PR, HaltFireOrdered solved restarting salvos, but that causes AttackGroundTries to be off by one since the last shot isn't fired because it goes ReadyState.OnFire -> FiringState.OnLostTarget immediately (halt fire is ordered immediately) so the firing state doesn't get time to shoot.
  2. In the state at 039dfe7, this isn't possible, but an issue that pops up is that salvos will keep shooting even if the target is lost.
  3. This makes me create the salvo retargeting feature which has to:
  • keep track of how much of a salvo has been fired across states
  • if there's an incomplete salvo, allow the weapon to restart the salvo immediately when it is allowed to fire instead of waiting for OnFire
  • To be honest I'm not sure if tracking targets in lua is required by the retargeting feature. I think I implemented that because before FAF's target resetting fix weapons were allowed to stay in FireReadyState forever. FAF's fix uses ResetTarget which calls OnLostTarget which changes the weapon state to idle/packing, unlike the vanilla behavior. That state change can happen constantly if the weapon has a target in tracking radius but not firing range, which I suppose can lead to unexpected animation or FX.

The retargeting feature does solve being able to restart salvos while still shooting on the last shot of AttackGroundTries. It also allows cool retargeting in the middle of a salvo with different orders, so you can't lose an entire salvo to a misclick (for example scathis).
The only remaining issue is that weapons do not call OnLostTarget when they retarget due to target priorities or the target dying. This causes a ravager to not stop firing when it switches from a striker tank to another striker tank (because the old one died) or to an Othuum (because the othuum has higher priority). I think it's a pretty minor issue though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sim Area that is affected by the Simulation of the Game feature: weapon firing cycle related to the weapon firing cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants