Modding Tutorials/Custom Comp Classes

From RimWorld Wiki
Revision as of 16:17, 29 November 2018 by Lilwhitemouse (talk | contribs) (Fixed formatting :p)
Jump to navigation Jump to search

Creating a custom comp class is a convenient way to add new functionality to RimWorld.

Prerequisites

def (xml) and C# structure

Basic outline

You will have some custom def and it will have something like this:

 <ThingDef ...>
   ...
   ...
   <comps>
     <li Class="MyNamespace.MyCompProperties">
       <myCustomCompProperty>some value</myCustomCompProperty>
       <mySecondCompProp>4</mySecondCompProp>
     </li>
     <li>
       <!-- this is kind of like <tag>MN.MyCustomTag</tag>:-->
       <compClass>MyNamespace.MyCustomThingComp</compClass>
     </li>
   </comps>
 </ThingDef>