Skip to content

Fix #9053: one-shot weapon cannot be fired after reloading, except if game is saved and reloaded#9112

Merged
IllianiBird merged 3 commits into
MegaMek:mainfrom
Sleet01:Fix_MHQ_9053_one-shot_cannot_be_fired_after_reload
May 27, 2026
Merged

Fix #9053: one-shot weapon cannot be fired after reloading, except if game is saved and reloaded#9112
IllianiBird merged 3 commits into
MegaMek:mainfrom
Sleet01:Fix_MHQ_9053_one-shot_cannot_be_fired_after_reload

Conversation

@Sleet01
Copy link
Copy Markdown
Collaborator

@Sleet01 Sleet01 commented May 27, 2026

We keep the OS launcher weapons mounted to their entities, and we never unset fired on One-Shot weapons during the game... so we never unset fired on OS weapons, period.

This adds a step to try to unset the fired state on all weapons when their ammo is reloaded.
Doing so is fine as all ammo-based weapons need setFired(false) before the next scenario, it's just that this is usually handled within the MegaMek client for non-OS weapons.

If, for some reason, the linking weapon for a bin can't be found, we'll print an error message.

Testing:

  • Ran all 3 projects' unit tests
  • Added a unit test for the new code

Fix #9053

@Sleet01 Sleet01 requested a review from a team as a code owner May 27, 2026 02:07
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 15.21%. Comparing base (a63433a) to head (a1be97c).
⚠️ Report is 97 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9112      +/-   ##
============================================
- Coverage     15.22%   15.21%   -0.01%     
- Complexity     9319     9343      +24     
============================================
  Files          1304     1308       +4     
  Lines        172662   173420     +758     
  Branches      26061    26220     +159     
============================================
+ Hits          26287    26386      +99     
- Misses       143328   143959     +631     
- Partials       3047     3075      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@IllianiBird IllianiBird merged commit b10f2e4 into MegaMek:main May 27, 2026
8 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.

Rocket Launchers reloaded in the Repair Bay can not be fired until you save and restart

2 participants