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

  • 2 years later...

I know this is quite old, but I love the idea of being able to manipulate the Categories via Module Manager, especially in conjunction with VAB Organizer. Anyway, I'm having a bit of trouble. I was able to create one new (Probes) custom category, but only one.. I cannot figure out why the other category (Exotic Fuel Tanks) won't display in the VAB.

Spoiler

CUSTOM_CATEGORY             
{
    name = stratickus        // Not needed, but makes Module Manager manipulation easier

    category = Pods
    %category = Probes
    category = FuelTank
    %category = ExoticFuelTank
    category = Engine
    category = Control
    category = Structural
    category = Coupling
    category = Payload
    category = Aero
    category = Ground
    category = Thermal
    category = Electrical
    category = Communication
    category = Science
    category = Cargo
    category = Robotics
    category = Utility
                            
    SUB_CATEGORY
    {
        name = Probes
        icon = R&D_node_icon_largeprobes 
    }
    SUB_CATEGORY
    {
        name = ExoticFuelTank
        icon = ctt_icon_exoticFuelStorage
        displayName = Exotic Fuel Tanks
    }
}

Any help is appreciated.

EDIT:

I figured it out: a part needs to be assigned/unlocked in the new category for it to be displayed in the VAB. Additionally, resizing icons (an icon from CTT for instance) to 32x32 is necessary per the original post.

Cheers,

Edited by Stratickus
Link to comment
Share on other sites

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...