Skip to content
Snippets Groups Projects
Commit aea910d3 authored by Ed86's avatar Ed86
Browse files

hidded restraints/cocoon operation if those hediffs not present

parent 8844c45c
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@
<workSkill>Medicine</workSkill>
<workSkillLearnFactor>1</workSkillLearnFactor>
<hideBodyPartNames>true</hideBodyPartNames>
<targetsBodyPart>false</targetsBodyPart>
<targetsBodyPart>true</targetsBodyPart>
</RecipeDef>
<RecipeDef Abstract="True" ParentName="RJW_RemoveEnemyImplants" Name="RJW_RemoveInsectEgg">
......@@ -153,7 +153,7 @@
<defName>RJW_RemoveRestraints</defName>
<label>remove restraints</label>
<description>Removes restraints.</description>
<workerClass>Recipe_RemoveHediff</workerClass>
<workerClass>rjw.Recipe_RemoveRestraints</workerClass>
<jobString>Removing restraints.</jobString>
<workAmount>1000</workAmount>
<removesHediff>RJW_Restraints</removesHediff>
......@@ -178,7 +178,7 @@
<defName>RJW_RemoveCocoon</defName>
<label>remove cocoon</label>
<description>Removes cocoon.</description>
<workerClass>Recipe_RemoveHediff</workerClass>
<workerClass>rjw.Recipe_RemoveRestraints</workerClass>
<jobString>Removing cocoon.</jobString>
<workAmount>1000</workAmount>
<removesHediff>RJW_Cocoon</removesHediff>
......
using RimWorld;
using System.Collections.Generic;
using Verse;
namespace rjw
{
/// <summary>
/// Removes heddifs (restraints/cocoon)
/// </summary>
public class Recipe_RemoveRestraints : Recipe_RemoveHediff
{
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{
List<Hediff> allHediffs = pawn.health.hediffSet.hediffs;
int i = 0;
while (true)
{
if (i >= allHediffs.Count)
{
yield break;
}
if (allHediffs[i].def == recipe.removesHediff && allHediffs[i].Visible)
{
break;
}
i++;
}
yield return allHediffs[i].Part;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment