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

Refitting Thunderbolt 5S with Artemis launchers results in customization error #2332

Closed
mjbroekman opened this issue Dec 29, 2020 · 6 comments
Assignees
Labels
Bug Needs Investigation This issue needs investigation and/or triage. Parts/Repair/Refit
Milestone

Comments

@mjbroekman
Copy link

mjbroekman commented Dec 29, 2020

Environment

What version of MekHQ does your issue apply to? 0.47.15
What operating system are you using? Windows, Mac, or Linux? Mac
What java version are you using? If unsure it will state your java version at the top of the mekhqlog.txt file.
Compiled on 2020-12-15T00:28:16Z
Today is 2020-12-28
Java vendor N/A
Java version 15.0.1
Platform Mac OS X 10.15.7 (x86_64)
Total memory available to MegaMek: 4,194,304 kB

Description

I am attempting to refit my Thunderbolt 5S with upgraded equipment (artemis FCS, double heat sinks, endo steel). When I click on "Begin Refit", it gives a customization error:
Screen Shot 2020-12-28 at 11 25 47 PM

Equipment layout:
Screen Shot 2020-12-28 at 11 24 55 PM

At first, I only had one Artemis FCS unit (in the head), but after seeing the construction rules, I added a second unit and placed them in the torsos with the launchers.

Files

Provide the .cpnx campaign file that this issue occurs in.
Vidarion30390225.cpnx.gz

And provide the megameklog.txt and mekhqlog.txt files for any NPE's or errors that MekHQ might be reporting.
megameklog.txt
mekhqlog.txt

@sixlettervariables sixlettervariables added Bug Needs Investigation This issue needs investigation and/or triage. Parts/Repair/Refit labels Dec 29, 2020
@sixlettervariables sixlettervariables added this to the 0.48-stable milestone Dec 29, 2020
@sixlettervariables
Copy link
Contributor

Error in megameklog suggests the name is already taken (or not a valid filename):

23:25:39,076 ERROR [mekhq.campaign.parts.Refit] {AWT-EventQueue-0} 
saveCustomization(), line 1584 : A file already exists with the custom name data/mechfiles/customs/Vidarion/Thunderbolt TDR-5V Mk II.mtf. Please choose a different name. (Unit name and/or model)
java.io.IOException: A file already exists with the custom name data/mechfiles/customs/Vidarion/Thunderbolt TDR-5V Mk II.mtf. Please choose a different name. (Unit name and/or model)
	at mekhq.campaign.parts.Refit.saveCustomization(Refit.java:1567)
	at mekhq.campaign.parts.Refit.begin(Refit.java:1022)
	at mekhq.gui.CampaignGUI.refitUnit(CampaignGUI.java:1661)
	at mekhq.gui.MekLabTab.lambda$initTab$0(MekLabTab.java:108)
	at 

@sixlettervariables
Copy link
Contributor

MekHQlog suggests the MTF file has an issue:

Error parsing null!
megamek.common.loaders.EntityLoadingException: Unable to match Artemis to launcher for Thunderbolt TDR-5V Mk II
	at megamek.common.MechFileParser.postLoadInit(MechFileParser.java:387)
	at megamek.common.MechFileParser.parse(MechFileParser.java:209)
	at megamek.common.MechFileParser.<init>(MechFileParser.java:88)
	at megamek.common.MechFileParser.<init>(MechFileParser.java:80)
	at megamek.common.MechSummaryCache.loadMechsFromDirectory(MechSummaryCache.java:568)
	at 

Can you zip the MTF that was created and attach it to this bug report?

@mjbroekman
Copy link
Author

I just checked and that MTF existed and was based off my initial, incorrect, build with the Artemis FCS in the head. I quit MekHQ, removed the file, started MekHQ again and tried the refit using the valid build (Artemis FCS in each torso) and it worked properly this time.

It seems like it saves the MTF before it checked the validity of the refit.

bad_tbolt.zip

@mjbroekman
Copy link
Author

Some potential "solutions" that have come to mind:

  1. Don't save the MTF if the refit is broken. This is probably only in very limited situations where two pieces of equipment need to be in the same location, like Artemis.
  2. Since these MTFs are in the player's (or campaign's?) customs directory, allow the player to overwrite them if they already exist. This might have issues if there are already mechs that have the "old" build applied to them, but I'm not sure.
  3. (Perhaps obvious) More informative error message about what, specifically, is wrong with the build in combination with not saving.
  4. Having something specific about Artemis where it pops up a dialogue for each FCS system asking which launcher it applies to.

... and probably many other things that you wonderful folks have more easily in mind.

@sixlettervariables
Copy link
Contributor

sixlettervariables commented Dec 29, 2020

Okay for your first point, I've got the proposed fix in #2334:

Error parsing null!
megamek.common.loaders.EntityLoadingException: Unable to match Artemis to launcher for Thunderbolt TDR-5S Mk II
	at megamek.common.MechFileParser.postLoadInit(MechFileParser.java:386)
	at megamek.common.MechFileParser.parse(MechFileParser.java:209)
	at megamek.common.MechFileParser.<init>(MechFileParser.java:88)
	at megamek.common.MechFileParser.<init>(MechFileParser.java:80)
	at megamek.common.MechSummaryCache.loadMechsFromDirectory(MechSummaryCache.java:568)
	at megamek.common.MechSummaryCache.loadMechsFromDirectory(MechSummaryCache.java:527)
	at megamek.common.MechSummaryCache.loadMechsFromDirectory(MechSummaryCache.java:527)
	at megamek.common.MechSummaryCache.loadMechData(MechSummaryCache.java:240)
	at megamek.common.MechSummaryCache.loadMechData(MechSummaryCache.java:179)
	at mekhq.campaign.parts.Refit.saveCustomization(Refit.java:1591)
	at mekhq.campaign.parts.Refit.begin(Refit.java:1022)
	at mekhq.gui.CampaignGUI.refitUnit(CampaignGUI.java:1660)
	at mekhq.gui.MekLabTab.lambda$0(MekLabTab.java:108)
...

15:03:49,520 ERROR [mekhq.campaign.parts.Refit] {AWT-EventQueue-0} 
saveCustomization(), line 1602 : Could not read back refit entity Thunderbolt TDR-5S Mk II
megamek.common.loaders.EntityLoadingException
	at mekhq.campaign.parts.Refit.saveCustomization(Refit.java:1597)
	at mekhq.campaign.parts.Refit.begin(Refit.java:1022)
	at mekhq.gui.CampaignGUI.refitUnit(CampaignGUI.java:1660)
	at mekhq.gui.MekLabTab.lambda$0(MekLabTab.java:108)
...

15:03:49,520 WARN [mekhq.campaign.parts.Refit] {AWT-EventQueue-0} 
saveCustomization(), line 1606 : Deleting invalid refit entity file data/mechfiles/customs/My Campaign/Thunderbolt TDR-5S Mk II.mtf

I was then able to recreate the refit with the appropriate setup and it saved correctly.

@sixlettervariables
Copy link
Contributor

I have a work in progress to make the validation occur before leaving MegaMekLab: MegaMek/megamek#2542

sixlettervariables added a commit that referenced this issue Dec 30, 2020
…-still-saves-file

Issue #2332: Delete refit file if unable to read it back when saving
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Investigation This issue needs investigation and/or triage. Parts/Repair/Refit
Projects
None yet
Development

No branches or pull requests

2 participants