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

fix for error when removing parts

parent ad089038
No related branches found
Tags tag_pregmod_0.9.9.6_v38
No related merge requests found
...@@ -17,9 +17,10 @@ namespace rjw ...@@ -17,9 +17,10 @@ namespace rjw
public bool is_harvest(Pawn p, BodyPartRecord part) public bool is_harvest(Pawn p, BodyPartRecord part)
{ {
foreach (Hediff hed in p.health.hediffSet.hediffs) foreach (Hediff hed in p.health.hediffSet.hediffs)
if ((hed.Part.def == part.def) && hed.def.isBad && (hed.Severity >= 0.70f)) {
if ((hed.Part?.def == part.def) && hed.def.isBad && (hed.Severity >= 0.70f))
return false; return false;
}
return true; return true;
} }
...@@ -41,9 +42,15 @@ namespace rjw ...@@ -41,9 +42,15 @@ namespace rjw
if (har) if (har)
{ {
if (!p.Dead) if (!p.Dead)
{
//Log.Message("alive harvest " + part);
ThoughtUtility.GiveThoughtsForPawnOrganHarvested(p); ThoughtUtility.GiveThoughtsForPawnOrganHarvested(p);
}
else else
{
//Log.Message("dead harvest " + part);
ThoughtUtility.GiveThoughtsForPawnExecuted(p, PawnExecutionKind.OrganHarvesting); ThoughtUtility.GiveThoughtsForPawnExecuted(p, PawnExecutionKind.OrganHarvesting);
}
} }
} }
......
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