Quote from: mipen on January 08, 2015, 01:25:57 AM
I was wondering if it is possible to define a new definition type? So instead of having a ThingDef or Building, I could have a Def of type SuperAwesomeDef. Does anyone know if that is possible? It would make adding information into the game much much easier, instead of creating a custom ThingDef. Thanks
I created a custom def for my Scenarios mod. There's nothing to it, actually. Just derive your Def class from Verse.Def, and you're done:
Code Select
public class ScenarioDef: Verse.Def {
// Fields should be public. Their names will match the names of the XML elements
// in the def file. Look at some of the other def classes for reference.
public string title;
public string author;
public string thumbnail;
...
}I was surprised at how it easy it was and how well it works. When loading data from mods, the game finds all classes derived from Verse.Def and tries to load definitions for all of them (see RimWorld.PlayDataLoader if you're curious).
)