ThingDef/WhateverDef inheritance etc.

Started by anikaiful, June 05, 2014, 05:32:54 AM

Previous topic - Next topic

anikaiful

I'm tinkering with a lil' cooking mod, and came across a bit of a dilemma (mod compatibility-wise). Is there a way to "extend" already existing items (e.g. Cooking Stove) capabilities without rewriting the whole shebang, i.e. expand their menu of craftable items etc.?

Justin C

If you just copy the CookStove XML and give it a different defName, it will be added to the game without replacing the existing one, which should help you avoid any compatibility issues. Then you can add your own recipes to your custom stove, or a new texture, or whatever else you want to change.

anikaiful

#2
Well, there's that route, but would prefer one where you don't need to create a new custom workbench and just extend (or modify) capabilities of already existing ones, for example something like:

<ThingDef Extends="CookStove">
   <extend_recipes>
      <li>NewRecipeOne</li>
      <li>NewRecipeTwo</li>
      <!-- and so on -->
   </extend_recipes>
</ThingDef>


...and that'd be all what'd be required to cram new stuff into old oven...

Doable currently?

Justin C

Quote from: anikaiful on June 05, 2014, 06:53:15 AM
Well, there's that route, but would prefer one where you don't need to create a new custom workbench and just extend (or modify) capabilities of already existing ones, for example something like:

<ThingDef Extends="CookStove">
   <extend_recipes>
      <li>NewRecipeOne</li>
      <li>NewRecipeTwo</li>
      <!-- and so on -->
   </extend_recipes>
</ThingDef>


...and that'd be all what'd be required to cram new stuff into old oven...

Doable currently?
Yup. Just copy the XML for the old CookStove exactly, throw it in your Defs folder, and make your own modifications. The game will load your mod's CookStove instead of the Core one.

anikaiful

Quote from: Justin C on June 05, 2014, 08:18:35 AM
Quote from: anikaiful on June 05, 2014, 06:53:15 AM
Doable currently?
Yup. Just copy the XML for the old CookStove exactly, throw it in your Defs folder, and make your own modifications. The game will load your mod's CookStove instead of the Core one.
Did that, was just wondering if there was a true inheritance mechanic - apparently not, and hopefully that'll change later.

Cala13er

Are you trying to add recipes to the Cooking Stove without actually overriding the Cooking Stove itself?

anikaiful

#6
Quote from: Cala13er on June 05, 2014, 03:17:32 PM
Are you trying to add recipes to the Cooking Stove without actually overriding the Cooking Stove itself?
Indeed, that would be the preferred goal over rewriting the whole shebang (which is what I did before started this thread).