Fix silos with delay before firing being able to fire twice#7010
Fix silos with delay before firing being able to fire twice#7010BlackYps merged 15 commits intoFAForever:developfrom
Conversation
UEF sub had 1 second when it was not busy in which you could queue a new launch order that would take effect once it re-entered the idle state due to how the engine understands busy state in the manual weapon/counted projectile firing cycle.
engine xref: .text:0060B319
This reverts commit b666da8.
This reverts commit 84a99b6.
The engine only allows these types of weapons to be used in launch orders. It also doesn't allow manual fire weapons to ever fire outside of OC or lua functions.
📝 WalkthroughWalkthroughPrevents creating multiple nuke/tactical projectiles from a single ammo unit by gating projectile creation on silo/ammo availability and adjusts busy-state gating to require ManualFire and not OverchargeWeapon. Adds changelog and expanded inline documentation clarifying firing prerequisites and ammo checks. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@lua/sim/weapons/DefaultProjectileWeapon.lua`:
- Around line 1060-1066: The conditional in DefaultProjectileWeapon.lua around
CreateProjectileAtMuzzle suffers from Lua operator-precedence: the tactical ammo
check is not gated by the weapon being non-nuke; fix by grouping the ammo checks
so nuke ammo is required for bp.NukeWeapon and tactical ammo only applies when
not a nuke, e.g. change the condition for calling CreateProjectileAtMuzzle to
explicitly combine (bp.NukeWeapon and self.unit:GetNukeSiloAmmoCount() > 0) or
(not bp.NukeWeapon and self.unit:GetTacticalSiloAmmoCount() > 0) while
preserving the existing not countedProjectile branch and still calling
CreateProjectileAtMuzzle(muzzle) when that combined condition is true.
…le at 0 nuke ammo Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…r#7010) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Description of the proposed changes
Fixes discord report of uef nuke sub and uef nuke launcher firing double missiles.
After a lot of digging around in the engine and learning RE, I've learned how manual fire silo weapons and overcharge weapons work. I attempt to fix the root cause of the bug with the busy state not being set correctly in the FireReadyState, and I documented what I've learned.
Add a failsafe ammo check before creating a projectile.
Testing done on the proposed changes
To make the UEF nuke sub fire double missiles, give a nuke order when you have ammo, cancel it by giving a move order, then give another nuke order within the 1 second charge delay of the firing sequence. This works because it will stack 2 nuke tasks on top of each other with the first being in the "finishing firing" state and the second in the "finished building ammo" state. When the unit busy state toggles, the finishing firing task expires and the finished building ammo task moves on to firing.
Additional Context
I annotated the lua files but will submit a separate pr.
Checklist
Summary by CodeRabbit
Bug Fixes
Documentation