Skip to content

Commit

Permalink
Fix for Elder Thing vampires
Browse files Browse the repository at this point in the history
Short compatibility patch for Elder Things. Elder Thing Vampires should no longer show errors when spawning in the wild
  • Loading branch information
jecrell committed Nov 25, 2022
1 parent f156853 commit f987ec0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Binary file modified 1.4/Assemblies/Vampire.dll
Binary file not shown.
25 changes: 22 additions & 3 deletions Source/Code/Utilities/VampireGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,28 @@ public static bool TryGiveVampirismHediffFromSire(Pawn pawn, Pawn sire, bool fir

public static void AddFangsHediff(Pawn pawn)
{
var tongue = pawn.RaceProps.body.GetPartsWithDef(DefDatabase<BodyPartDef>.GetNamed("Tongue")).FirstOrDefault();
pawn.health.RestorePart(tongue);
pawn.health.AddHediff(pawn.VampComp().Bloodline.fangsHediff, tongue);
if (pawn != null)
{
if (pawn.RaceProps?.body?.GetPartsWithDef(DefDatabase<BodyPartDef>.
GetNamed("Tongue"))?.FirstOrDefault() is { } tongue)
{
pawn.health.RestorePart(tongue);
pawn.health.AddHediff(pawn.VampComp().Bloodline.fangsHediff, tongue);
}
//Elder things have an 'eating tube' instead of a tongue
else if (pawn.def.defName == "Alien_ElderThing_Race_Standard")
{
if (pawn.RaceProps?.body?.GetPartsWithDef(DefDatabase<BodyPartDef>.
GetNamed("ElderThing_EatingTube"))?.FirstOrDefault() is { } eatingTube)
{
pawn.health.RestorePart(eatingTube);
pawn.health.AddHediff(pawn.VampComp().Bloodline.fangsHediff, eatingTube);
}
else Log.Error("ROM Vampires Error - Unable to add fangs to Elder Thing: No '??? body part record for " + pawn.LabelShort);
}
else Log.Error("ROM Vampires Error - Unable to add fangs: No 'tongue' body part record for " + pawn.LabelShort);
}
else Log.Error("ROM Vampires Error - Unable to add fangs: Attempted to add fangs to non-existent pawn");
}

//public static void AddTongueHediff(Pawn pawn)
Expand Down

0 comments on commit f987ec0

Please sign in to comment.