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

Parts - minor refactoring and better information #5066

Merged
merged 25 commits into from
Oct 21, 2024

Conversation

WeaverThree
Copy link
Collaborator

@WeaverThree WeaverThree commented Oct 19, 2024

This is a fairly hefty scrub and tuning of campaign/parts/*.java, particularly the string and UI-related bits. It fixes a number of minor bugs and nuisances as it goes.

Original Goal:

  • Display unit tonnage of parts that it matters for (locations, sensors, jump jets, MASC, etc) prominently in the repair bay and generally enhance the repair experience.
  • Display available stores on replacement items so you know if you're using the last one on a repair and such.
  • Get any other useful information in front of the user.

Major points:

  • Parts now rely more on their parent (usually Part) for getDetails information, some of them losing their own implementation completely.
  • More robust generic getDetails in major classes, particularly Part
  • This ends up fixing or improving the shop descriptions of numerous items as well
  • General code cleanup of campaign/parts/*.java, especially regrading string handling functions.

Along the way:

  • Only show damage on parts that are actually damaged
  • Turrets and Rotors now show the tonnage they're for
  • Turrets now get said tonnage applied properly in the parts store
  • Superchargers now show all their relevant stats in empty omnipods.
  • Superchargers in omnipods are now the correct price instead of way cheaper (missing zero in math).
  • Empty omnipods now show the tech base of the part they're made for.
  • Make missing parts display how many you have in stock and make the display of transit parts nicer there.
  • Updated deprecated campaign.getPart()s in PodSpace
  • Update lots of things to use ReportingTools and StringBuilders
  • Drop Part.getOrderTransitStringForDetails because this is also done by a function in PartInventory, changed the places it was used to the other one.
  • Some pluralization tweaks and other minor grammar stuff.
  • Show parentheses around item details on Command Center tab.
  • Mek locations show cost now too; minor cost function refactoring.
  • Show Tech SPAs on the Tech Panel. Probably should have been a separate PR but got mixed in here and I don't know how to separate it.

There isn't a whole lot to see but here are a few examples of stuff that you can:

2024-10-18_182625
2024-10-18_182704
2024-10-18_190011
2024-10-18_190025
2024-10-18_190045
2024-10-19_134742
2024-10-19_134725
2024-10-20_160336
2024-10-18_183125

@WeaverThree
Copy link
Collaborator Author

I'll sort out the failed test after this headache x.x

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.43%. Comparing base (0b4d2c4) to head (43aeea3).
Report is 38 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##             master    #5066    +/-   ##
==========================================
  Coverage     10.42%   10.43%            
- Complexity     6033     6037     +4     
==========================================
  Files           953      953            
  Lines        134106   134264   +158     
  Branches      19434    19456    +22     
==========================================
+ Hits          13986    14004    +18     
- Misses       118772   118917   +145     
+ Partials       1348     1343     -5     

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

@WeaverThree
Copy link
Collaborator Author

I fixed the tests for the new format of MekLocation details (mainly, adding tons and leaving off damage unless damaged). This also led me to some other errors I had made with that one, which are now fixed.

I also realized that I had not gotten to PodSpace's getDetails, and I also stumbled into something that regexes the resulting string in TaskTableModel, so I'm not touching that for now. I haven't played with omnimechs and I do not understand how pods work very well from my experiments.

Copy link
Collaborator

@IllianiCBT IllianiCBT left a comment

Choose a reason for hiding this comment

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

I don't know enough about the systems being touched to review this. So it might be in the queue for a little longer than normal.

@WeaverThree
Copy link
Collaborator Author

Found one thing I missed, mek locations need to show their repair costs as well. Not that these values are relevant to any game situations given the scale of money, all parts should show it if they have it.

@WeaverThree
Copy link
Collaborator Author

2024-10-20_095900
I ran into an issue, and fixed it ^^

Copy link
Member

@HammerGS HammerGS left a comment

Choose a reason for hiding this comment

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

Tested and seems to work.

@HammerGS HammerGS merged commit 7069aeb into MegaMek:master Oct 21, 2024
4 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.

4 participants