Skip to content

Architect Subcategories

Neronix17 edited this page Mar 21, 2023 · 1 revision

Some of you may have already seen that I've been using a new thing in Outland and Outer Rim to split a single architect menu into many subcategories so as not to overflow the screen with buildings. Well that's a fairly easy thing to make use of, all you need is a few short bits of XML.

First you need to add this TabulaRasa.Designator_SubCategory to the DesignationCategoryDef of your architect category like so:

<DesignationCategoryDef>
	<defName>OuterRim_ArchitectHypertech</defName>
	<label>Hypertech</label>
	<order>500</order>
	<specialDesignatorClasses>
		<li>Designator_Cancel</li>
		<li>Designator_Deconstruct</li>
		<li>TabulaRasa.Designator_SubCategory</li>
	</specialDesignatorClasses>
</DesignationCategoryDef>

Then you can create your subcategories using a new def:

<TabulaRasa.DesignatorSubCategoryDef>
	<defName>OuterRim_SubCatStructural</defName>
	<label>Structural</label>
	<!-- iconPath is for an icon to display when that subcategory is selected, inside the selector gizmo. -->
	<iconPath>Toolbox/UI/CategoryStructural</iconPath>
	<!-- designationCategory should be your DesignationCategoryDef above -->
	<designationCategory>OuterRim_ArchitectHypertech</designationCategory>
</TabulaRasa.DesignatorSubCategoryDef>

And finally on every item in that architect category you need this modExtension:

<modExtensions>
	<li Class="TabulaRasa.DefModExt_SubCategoryBuilding">
		<!-- This should match the DesignatorSubCategoryDef you want it to show up in. -->
		<subCategory>OuterRim_SubCatProduction</subCategory>
		<!-- If this is set to true, it'll only display when the subcategory is selected, 
                     otherwise when no subcat is selected it'll show up. Useful for allowing specific 
                     commonly used buildings to display in the "no category selected" group. -->
		<showOnlyInCategory>true</showOnlyInCategory>
	</li>
</modExtensions>

Anything without the modExtension in that category will display regardless of if a subcategory is selected or not. Good practice to get into is making an abstract base for buildings in each subcategory, so you can put this in the abstract and not have to worry about attaching it to every single building individually, but either way works.

In the case where another mod or a mistaken placement moves a building from your category into another without subcategories, it'll display like normal, again to prevent things becoming unusable and hidden. Vanilla UI Expanded allows users to move things around so that's one case this'd prevent issues.

Known issues:

  • Currently if a large number of stuffable buildings are in subcategories, some fps lag can sometimes occur after heavy use, simply reloading the game fixes it immediately. Personally I think being able to see what you're doing is more important than some dropped frames with the category open, but of course if I find ways to optimize it further I will.

Clone this wiki locally