MadModsBattletech / BourbonVanillaEnhanced

MIT License
3 stars 1 forks source link

HeadshotWeaponLimit - crash #1

Closed Cat-Lady closed 4 years ago

Cat-Lady commented 4 years ago

Hello Mad, Using github version of HeadshotWeaponLimit with latest version of Battletech, I'm getting following crash (that gets properly avoided if disabling this, and only this particular mod):

KeyNotFoundException: No AbilityDef entry in 'AbilityDefs' with id: 'TraitDefHeadshotsImprove'
  at HBS.Data.DictionaryStore`1[T].Get (System.String id) [0x000a8] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.SimGameState.InitAbilityTree () [0x00118] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.SimGameState.InitializeDataFromDefs () [0x0051e] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.SimGameState._OnDefsLoadComplete () [0x00000] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.SimGameState.RespondToDefsLoadComplete (BattleTech.Data.LoadRequest request) [0x0000b] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.Data.LoadRequest.Finish () [0x00024] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.Data.LoadRequest.FlushCompleteRequests (System.Single deltaTime) [0x000ac] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.Data.DataManager.CheckRequestsComplete (System.Single deltaTime) [0x0001d] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.Data.DataManager.Update (System.Single deltaTime) [0x00112] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.GameInstance.Update (System.Single deltaTime) [0x0006e] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 
  at BattleTech.UnityGameInstance.Update () [0x00013] in <1a492b01dc4142479b77fcfea5a4a4b7>:0 

The mods of yours that I am using together are:

DemandingJumps
DynamicCompanyMorale
SimpleEjectionSystem
BuffMasterTactician
DontShootTheDead
EvenTheOdds
MeleeMover
SoftExperienceCap
DropCosts
HeadshotWeaponLimit <- crash
WorthwhileKnockdowns

Apart from that, I'm using just 3 other mods:

3025RimwardPeriphery   <- https://www.nexusmods.com/battletech/mods/580
HyadesRim <- https://www.nexusmods.com/battletech/mods/473
CareerLeopardStart <- https://www.nexusmods.com/battletech/mods/518

In theory, none of those should conflict.

In any case, after brief analysis of mod's AbilityDefs/TraitDefHeadshotsImprove.json and AbilityDefs/TraitDefHeadshotsMaster.json, I have no idea why it complains about the former, but not about the latter. I hope you will have some ideas.

Cheers, /CatLady

mad2342 commented 4 years ago

Hm, i never experienced that error and i do play with this mod collection all the time, although without any other mods. I assume you're using ModTek?

I just uploaded a new release that includes some minor changes (but does not touch HeadshotWeaponLimit at all), you could try that and see if sth. changes.. There could be the unlikely issue that as you're not using this mod collection as a whole but a subset, that somewhere there's a hidden dependency to one of the removed submods. If you got the time you could fire up the game with the collection as is and see if the error persists, then we go from there.

Thx again for feedback, best regards, Mad

Cat-Lady commented 4 years ago

Yes, I am using ModTek. I will try new version and your suggestion to check with whole pack.

mad2342 commented 4 years ago

Any news on this?

Cat-Lady commented 4 years ago

Hello Mad, Sorry that it took so long to reply on this - testing with whole modpack installed haven't changed the results, and given you couldn't reproduce the issue easily (and I had no idea how to reproduce it on installations that were unaffected) I wasn't willing to waste your time on this unless I get some leads. So, I was just banging my head on this issue and the: https://github.com/MadModsBattletech/BourbonVanillaEnhanced/issues/2

...without results, every time I got some idea to test - up to right now.

I think that I've, finally, narrowed down the cause for the problems. Namely, the only modules that are affected, are ones that have, in their mod.json, lines like that: "Manifest": [ { "Type": "AbilityDef", "Path": "AbilityDefs\\" }

Specifically, I think that the formatting of directory path in form of AbilityDefs\\ is the cause of the problem - the dual backslashes on the end. It is the windows-only formatting, and Battletech builds on other OSes seems to fail to traverse the directory tree, when provided with such (Now, as I've mentioned earlier, I'm using Battletech under linux, native builds.)

Exactly same thing affects "EvenTheOdds", resulting in the failure to load the mech/pilot definitions. I suppose that other modules which need definition to traverse ability directories from mods.json definition - if any - are suffering from same issue.

At this very moment, I am investigating a formatting that will work for sure on all system architectures. I will keep you updated.

Cheers, /CatLady

Cat-Lady commented 4 years ago

Success - I've determined that the syntax looking like that: "Path": "AbilityDefs/"

...is working for every version of Battletech - all the errors and crashes are gone. Furthermore, the \\ trailing slashes is, in fact, not conforming to .json standard (sadly, still included in the front page instructions of ModTek :( ). It seems that Battletech (and/or ModTek) .json parser is just more lax and allowing the faulty directory trailing markups, and least on the windows version.

If you would be willing to fix those Path: description on all your modules that define some, it would ensure compatibility with every OS version of Battletech. In any case, I am very glad that the issue got resolved. I like your changes very much, and why some of them were failing for me was like an irritating itch that you are unable to scratch. Until now :)

Cheers, /CatLady

mad2342 commented 4 years ago

Hi Cat-Lady, Thx for your input! I updated to 1.9.1-005R where all paths should be fixed according to your findings. I'll also update the relevant standalone mods and this collection on nexus, that may take a while due to my current work-life balance... :-) I'm looking forward to your feedback as you probably never experienced Bourbon as intended. I assume that many changes got lost for you due to this bug... Thx again, best regards, Mad

Cat-Lady commented 4 years ago

Thank you! Between reporting the bug and your fix, I went ahead and replaced the paths to the correct ones locally - I'll compare it with your changes in case I've missed something, and swap to your "mainstream" one entirely. Indeed, many things are working differently (and much better) now, with the real content of the mod.

Out of curiosity - the changes required were in the mod.json files only, or the paths requiring fixing were also somewhere deeper in the mod files hierarchy? I looked for those, too, but everything inside directories seemed to already have proper / directory separators.

Cheers, /CatLady

mad2342 commented 4 years ago

Hi Cat-Lady, I only changed the paths of the various mod.jsons, everything else is done by ModTek internally.. Potential external paths that are needed in code are resolved with platform-aware methods.. Best regards, Mad