Jump to content

[1.12.x] Custom Categories (v1.0.0) - Module Manager driven exclusive VAB Categories


Coldrifting

Recommended Posts

Download via CKAN

Manual Install: Download from GitHub

5TzJSfE.png

This mod allows you to create custom categories for sorting parts in the VAB and SPH. You can create new categories, give categories new icons, and change the display name of existing categories. Unlike other category mods, categories created in this mod are exclusive, so each part only exists in a single category.

Why use this mod vs the CommunityCategoryKit or FilterExtensions? When using the CCK to move parts to new categories, they become unsearchable. You can get around this by using the FilterExtensions mod, but you lose the ability to use Module Manager to create categories, and creating exclusive categories can become quite complex very quickly.

This mod provides a very simply way to define new categories. If you define a categoryCustom tag inside a part (usually via a Module Manager patch), the mod will move that part to the defined category, creating that category if it does not already exist. Otherwise, the stock category value will be used. All parts are still searchable

Here's an example of a possible config file:

Spoiler
CUSTOM_CATEGORY
{
    // The order of these category nodes determines the order in-game
    // If you wish to insert categories in-between default categories,
    // you should define all default categories here along with new ones 
    category = Pods
    category = Resources // New category
    category = FuelTank // Actual name of the Fuel Tanks category
  
    // These are optional
    SUB_CATEGORY
    {
      name = Resources // Used to map a subcategory node to a category. It doesn't have to be defined above
      icon = stockIcon_Utility // Use a stock icon
    }
  
    SUB_CATEGORY
    {
      name = FuelTank
      icon = customFuelTankIcon // Use a custom 32x32 pixel somewhere in the GameData folder
      displayName = Fuel Tanks // Override existing category names so that they show up with spaces in-game
    }
}

And a small module manager patch to assign a part to a new custom category:

@PART[oreTank]
{
    %categoryCustom = Resources // Use the category name, not the display name
}

 

Please note that if you don't have a config file defined, the mod should still work just fine and all vanilla categories should function as they usually do.

I have not tested it, but this mod is very likely incompatible with the FilterExtensions and CommunityCategoryKit mods, since they do the same thing as this mod.
Please let me know if you encounter any issues with this mod.

Thanks to the FilterExtensions and CommunityCategoryKit authors for posting their code online, it made it much easier to create this mod. I'd also like to give a shout out to the Kramax Plugin Reload mod, which let me rapidly test code changes without restarting the game.

Edited by Coldrifting
Link to comment
Share on other sites

  • 1 month later...
55 minutes ago, theonegalen said:

This looks great, but there doesn't seem to be an easy way to migrate configs from CCK to this besides just redoing them, if I am correct?

Actually there is an easy way. You just need to know the regex replace string command. This is my image of how this looks. I have not tested it.

@PART:HAS[#tags[*cck-lifesupport*]]
{
	@tags ^= :cck-lifesupport:: // delete "cck-lifesupport" but not every value of this key. Structure = :<old value>:<new value>: colon-delimited so allows for spaces and funky characters.
	%categoryCustom = Resources
}

 

It would be nice if there was a proper representation of subcategories other than going into advanced mode in the part picker (and having written the tedious configs for that). Stock part configs tend to have "subcategory = 0" and there are no exmaples for how it works, if it even works.

Edited by JadeOfMaar
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...