[BUG] Custom Category causing issues
zer0Kerbal opened this issue ยท 2 comments
From SpaceYCorp created by zer0Kerbal: zer0Kerbal/SpaceYCorp#47
- [Custom Category causing issues
Pull Request applied.
Theory of operation: When the user creates their own custom categories, KSP happily saves the whole shebang on the file <ksp_root>/GameData/Squad/PartList/PartCategories.cfg
.
Problem: this file is injected into the GameDatabase as usual. However, while loading the game again with the PartCategories.cfg
file already with the data, KSP merges the original confignode (or patch) with the PartCategories.cfg
one. On every boot (or, better, on every time ModuleManager rebuilts the ConfigCache - what it does every time the PartCaregories.cfg
changes).
A Module Manager patch will solve the situation, but MM has a catch: :HAS
can't be used on 'including" root nodes (i.e., patches that start with "+" or Nodes without sufixes), and so there's no way to use ModuleManager to conditionally add the Node CUSTOM_PARTLIST_CATEGORY
for SpaceY. Could not use %
neither.
The solution, so, is to use :NEEDS
. This one can be used on root nodes. And the code from #109 checks at startup if the thing is already on the GameDatabase and only tells MM to apply that :NEEDS
when it's not, effectively preventing double patching on this node.
The PR doesn't automate the deployment, right now you need to manually copy the DLL from the bin
folder into the destination (I suggest GameData/SpaceY/SpaceYLifters/Plugins
).
The thing was compiled using .NET 3.5 and KSP 1.2.2 assemblies, and it will work on anything from 1.2.2. to the latest, 1.12.5. But if you don't care about allowing the thing to work on older KSP versions, you can retarget it to .NET 4.5 and KSP 1.12.5 assemblies - you will artificially reduce your potential audience, though.
You will need to adjust the Assemblies' paths to your rig before compiling. Don't forget to execute the T4 script Version.tt
everytime you change the SpaceYLifters.version
file (VisualStudio only does it when opening the project).