Modify def without copying it all

Started by Alenerel, November 27, 2016, 03:45:17 PM

Previous topic - Next topic

Alenerel

I want to modify only a few properties of one def. Is it possible to just write that in the mod instead of copying the whole def?

For example the fine meal is:
  <ThingDef ParentName="MealRottable">
    <defName>MealSimple</defName>
    <label>simple meal</label>
    <description>A simple meal quickly cooked from a few ingredients.</description>
    <graphicData>
      <texPath>Things/Item/Meal/Simple</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <statBases>
      <DeteriorationRate>20</DeteriorationRate>
      <MarketValue>25</MarketValue>
      <WorkToMake>300</WorkToMake>
    </statBases>
    <ingestible>
      <preferability>MealSimple</preferability>
      <nutrition>0.85</nutrition>
      <ingestEffect>EatVegetarian</ingestEffect>
      <ingestSound>Meal_Eat</ingestSound>
    </ingestible>
  </ThingDef>


I want to do something like this to change its nutrition to 1 but leaving the rest untouched:
  <ThingDef ParentName="MealRottable">
    <defName>MealSimple</defName>
    <ingestible>
      <nutrition>1</nutrition>
    </ingestible>
  </ThingDef>


Is it possible with some command?

Thanks you

1000101

Short answer:  No.

Long answer:  Yes, but not without some form as assembly mod such as the "Override" mod which is explicitly designed for this purpose or a mod which allows "spot overrides" such as CCL.

If you write your own assembly (C#) then anything is possible.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Alenerel

Thanks for your answer.

Well shit. I barely know how to mod XMLs...

BTW my idea was to be able to use wood legs, basic legs and bionic legs, to 4 leg animals and birds, and also power claw to both front paws of 4 leg animals. And a denture too.

I can do it but replacing all of the def just for one thing seemed like the wrong way to go.

RawCode

Simplicity comes at price, instead of putting some kind of obscure statement, that will be used by game to generate 10 ribs, you copy\paste rib subdef 10 times.

With a bit of luck and some skill, you can implement handler, that will assemble string "4l2h1b87t" into 87type pawn, where 87 is bitflag enum defining links of bodyparts with 1 head 2 hands and 4 legs.

BUT, for everyone expect original author of such "innovation" it will be very hard to use.