Skip to content
Igor Zavoychinskiy edited this page Dec 3, 2016 · 3 revisions

Intro

CommunityCategoryKit is a mod that allows creating part filters in the editor. The main idea is standardize filters that different mods use to reduce total number of different filters. Though, CCK also allows third-party mods to extend filter definitions via ModuleManager. I.e. third-party mod may ask CCK to create a filter even though the filter is not common.

Concept

In order to put a part into a filter there should be a tag assigned to the part. Each tag is a unique identifier of a filter. Part may have multiple tags, so same part may be assigned into several filters.

For now the following common filters are supported by CCK:

  • cck-containers. Filter for parts that can hold other parts, and it's their primary function. Payload parts may be containers as well but usually they are not.
  • cck-lifesupport. Filter for the parts related to life support oriented gameplay.

All common filters are defined in common-filters.cfg. See it for more details but don't change either via Github or ModuleManager. This file is reserved for CCK owners only. Once owners decided to introduce a new common filter they will do it by extending this file.

Custom filters

Third-party mods may use CCK to create new filters quick and easy. Definition of the custom filter(s) should be added dynamically via ModuleManager. New descriptions are added into special file extra-filters.cfg, and CCK will create the filters in the game.

When handling this file CCK checks for duplicated tags. If there ones found then only one filter is created. This way multiple mods may define same tags to have all the part to go into the same filter.

Tag naming convention assumes using prefix cck- but it's not a strict requirement. Tags without this prefix will work.

Filter item format

Item
{
	name = <User friendly name>
	tag = <Tag name>
	normalIcon = <URL to texture for the unselected filter>
	selectedIcon = <Optional: URL to texture for the selected filter>
	usedByMod = <Optional: name of the mod that uses the tag>
}

If field selectedIcon omitted then KSP will create selected icon automatically from normalIcon. It depends on KSP how exactly it's done. If your normal icon is drawn in white on a transparent background you may expect good result of this auto-generation.

Patching via ModuleManager

Best way to extend a config in KSP is using ModuleManager. Here is how patch file may look like for a new custom filter:

@CCKExtraFilterConfig
{
	Item
	{
		name = Cool Mod Things
		tag = cck-cool-mod
		normalIcon = CoolMod/Textures/FilterIcon
		usedByMod = Cool Mod
	}
}

Introducing a new common filter

The best way is suggesting a new common filter by posting on the forum. A rule of thumb is simple: there must be at least two independent mods that will use the proposed tag. Moreover, the cooperating authors may start using new tag proactively by following "Custom filters" approach described above. Once the tag is turned into common CCK will automatically start using common definition instead of the custom one. Then, the author would just drop their patches in the new version with no rush.

Clone this wiki locally