Difference between revisions of "Modding Tutorials/Custom Comp Classes"
Jump to navigation
Jump to search
(Creation, xml) |
m (Fixed formatting :p) |
||
Line 10: | Line 10: | ||
=== Basic outline === | === Basic outline === | ||
You will have some custom def and it will have something like this: | You will have some custom def and it will have something like this: | ||
− | + | <ThingDef ...> | |
− | <ThingDef ...> | + | ... |
− | + | ... | |
− | + | <comps> | |
− | + | <<nowiki>li</nowiki> Class="MyNamespace.MyCompProperties"> | |
− | + | <myCustomCompProperty>some value</myCustomCompProperty> | |
− | + | <mySecondCompProp>4</mySecondCompProp> | |
− | + | </<nowiki>li</nowiki>> | |
− | + | <<nowiki>li</nowiki>> | |
− | + | ''<<nowiki>!--</nowiki> this is kind of like <tag>MN.MyCustomTag</tag>:-->'' | |
− | + | <compClass>MyNamespace.MyCustomThingComp</compClass> | |
− | + | </<nowiki>li</nowiki>> | |
− | + | </comps> | |
− | + | </ThingDef> | |
− | </ThingDef | ||
− | |||
[[Category:Modding tutorials]][[Category:Modding]][[Category:Defs]] | [[Category:Modding tutorials]][[Category:Modding]][[Category:Defs]] |
Revision as of 16:17, 29 November 2018
Creating a custom comp class is a convenient way to add new functionality to RimWorld.
Prerequisites
- You need to have set up your editor and environment
- You need to know how to write custom code
- You should probably understand Defs at least somewhat.
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>