Remove hediff from whole body

Started by BigNBoss, June 25, 2018, 01:45:24 PM

Previous topic - Next topic

BigNBoss

Hello everybody,

I'm making a mod where you can give blood to someone.
I have made this with a removehediff, but the problem with that is that it only works on body parts, not the whole body.
If I give the hediff (bloodloss) through DEV mode on a body part, it works just fine.

Here's the code:
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
  <RecipeDef ParentName="SurgeryFlesh">
<defName>TakeBloodBag</defName>
<label>take blood bag</label>
<description>Take bloodbag.</description>
<workerClass>Recipe_RemoveHediff</workerClass>
<jobString>Take bloodbag.</jobString>
<workAmount>500</workAmount>
<removesHediff>BloodLoss</removesHediff>
    <successfullyRemovedHediffMessage>{0} has successfully given a blood bag to {1}.</successfullyRemovedHediffMessage>
    <surgerySuccessChanceFactor>10</surgerySuccessChanceFactor>
    <deathOnFailedSurgeryChance>0.005</deathOnFailedSurgeryChance>
<skillRequirements>
<Medicine>5</Medicine>
</skillRequirements>
<ingredients>
<li>
<filter>
<categories>
<li>Medicine</li>
</categories>
</filter>
<count>1</count>
</li>
<li>
<filter>
<thingDefs>
<li>BloodBag</li>
</thingDefs>
</filter>
<count>1</count>
</li>
</ingredients>
<fixedIngredientFilter>
      <categories>
        <li>Medicine</li>
      </categories>
      <exceptedThingDefs>
        <li>Medicine</li>
      </exceptedThingDefs>
</fixedIngredientFilter>
  </RecipeDef>
</Defs>


Does anybody know a solution for that?

BigNBoss
Check out my mods:
-Cigarettes mod

jamaicancastle

One option is to make the blood... adding... part (is there a word for that?) into an ingestible or usable item (like the healer mech serum) rather than a recipe. Either of these can use a ThingComp to run pretty much arbitrary code when ingested/used.

Unfortunately your other option is to get rather deep into the recipe code and write a patch for this specific scenario, which is tougher.