8000 Improvement: #6867 Added Weapons as a separate autologistics category by psikomonkie · Pull Request #6943 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improvement: #6867 Added Weapons as a separate autologistics category #6943

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

Merged
merged 8 commits into from
May 10, 2025

Conversation

psikomonkie
Copy link
Collaborator
@psikomonkie psikomonkie commented May 9, 2025

Fixes #6867

Weapons on units were part of the "Other" category. A player wanting to keep a stock of backup weapons would need to manually change the value for each weapon they use, or change the default for "other". This adds "Weapons" as its own category of autologistics.

@psikomonkie psikomonkie requested a review from a team as a code owner May 9, 2025 18:22
@psikomonkie psikomonkie added (RFE) Enhancement Requests for Enhancement, new features or implementations Parts/Repair/Refit Logistics For Logistics Module issues/RFEs labels May 9, 2025
@psikomonkie
Copy link
Collaborator Author
psikomonkie commented May 9, 2025

Should infantry small arms be excluded? Currently they're counted as weapons and will be restocked with this change. Should they stay as other? See #6867 (comment) They already are in the nightly. They only showed in my test save because I have some in the warehouse. Despite having infantry "using" those guns, they show as 0 parts in use - the intended behavior for infantry weapons.

Copy link
codecov bot commented May 9, 2025

Codecov Report

Attention: Patch coverage is 15.00000% with 34 lines in your changes missing coverage. Please review.

Project coverage is 11.98%. Comparing base (b5fe746) to head (e289ca7).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
...paignOptions/contents/EquipmentAndSuppliesTab.java 0.00% 20 Missing ⚠️
MekHQ/src/mekhq/campaign/CampaignOptions.java 23.52% 13 Missing ⚠️
MekHQ/src/mekhq/campaign/Campaign.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #6943   +/-   ##
=========================================
  Coverage     11.97%   11.98%           
- Complexity     6789     6793    +4     
=========================================
  Files          1101     1101           
  Lines        141489   141474   -15     
  Branches      21915    21918    +3     
=========================================
+ Hits          16950    16952    +2     
+ Misses       122741   122717   -24     
- Partials       1798     1805    +7     

☔ 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
Copy link
Collaborator

Infantry equipment should be already excluded. If it isn't, it should be.

@psikomonkie
Copy link
Collaborator Author
psikomonkie commented May 9, 2025

Infantry equipment should be already excluded. If it isn't, it should be.

Stuff like their basic rifles, yeah. It’s being included now as a weapon. I’ll make an update to this to keep them as ‘other’ & add a test for that

Edit: I'll double check what the table shows for in use. I feel like they might only be showing because I have them in my warehouse & they aren't counted as parts in use, therefore none'll be ordered. If that's the case I'll keep it so if we ever track it it'll just need updated in the parts in use method.

@psikomonkie
Copy link
Collaborator Author

All's good regarding infantry weapons. They only showed on the table because I had some in the warehouse - it's an old save :) This is ready for review.

Copy link
Collaborator
@IllianiBird IllianiBird left a comment

Choose a reason for hiding this comment

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

One small point of feedback, but not a deal breaker

@psikomonkie psikomonkie merged commit 5e4f221 into MegaMek:master May 10, 2025
6 checks passed
@HammerGS HammerGS requested a review from Copilot May 10, 2025 19:16
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR separates Weapons from the “Other” autologistics category, allowing players to manage weapon stock levels independently.

  • Added new tests for getting and setting weapon autologistics values
  • Integrated a new Weapons field into CampaignOptions, Campaign, and the UI panel
  • Updated the CampaignOptions XML handling and properties file to include the new Weapons category

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
MekHQ/unittests/mekhq/campaign/CampaignTest.java Added tests for weapon stock level operations
MekHQ/src/mekhq/gui/campaignOptions/contents/EquipmentAndSuppliesTab.java Integrated new UI components for weapon restock settings
MekHQ/src/mekhq/campaign/CampaignOptions.java Introduced new getter/setter and XML handling for weapons
MekHQ/src/mekhq/campaign/Campaign.java Updated default stock percent logic to differentiate Weapons
MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties Added labels and tooltips for weapon restock option

initialAllPercents = getAllDefaultStockPercents();

// Let's change it and make sure that it uses the new value
when(mockCampaignOptions.getAutoLogisticsWeapons()).thenReturn(DESIRED_STOCK_LEVEL); //TODO
Copy link
Preview
Copilot AI May 10, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider removing or resolving the TODO comment once the intended behavior for weapon autologistics is finalized.

Suggested change
when(mockCampaignOptions.getAutoLogisticsWeapons()).thenReturn(DESIRED_STOCK_LEVEL); //TODO
// Mock the campaign options to return the desired stock level for weapon autologistics
when(mockCampaignOptions.getAutoLogisticsWeapons()).thenReturn(DESIRED_STOCK_LEVEL);

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ha, it's nice to see Copilot bullying someone else for a change! :P

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No that was actually something I missed. The //TODO tag itself just needed removed. It was originally commented out during the development process. I left the //TODO flag so I'd uncomment it once it's implemented it. Just forgot to remove the todo :clown:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Logistics For Logistics Module issues/RFEs Parts/Repair/Refit (RFE) Enhancement Requests for Enhancement, new features or implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFE] Add a weapons category to AutoLogistics and improve default settings values
2 participants
0