Adding entirely new defs using Xpath.

Started by ExoticButts, May 03, 2018, 02:34:17 PM

Previous topic - Next topic

ExoticButts

As usual, my title says it all. How does one achieve this? Let's say I have my example code here;
https://pastebin.com/xGZmaEZU

Now, this is all placed after a bunch of code-that actually works-that adds segments to existing defs, which is all well and good, but only half of the versatility I need in this particular case.

Am I simply doing something wrong, or can you not add whole new defs (note, not Defs, their child nodes, such as ThingDef, RecipeDef, etc.) using xpath patching?

Karthas077

You don't need to use XPath at all. Just create a new Def and specify ParentName="OtherModDefBase". Unless the mod author wrote some really specific C# code to look for hardcoded defNames, the inheritance should do all the work for you.