Skip to content

Commit

Permalink
Check IsVampire before doing things
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Cavazos authored Apr 1, 2022
1 parent 0165ee9 commit 56b9f69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Vampires/HarmonyPatches/HarmonyPatches_Pathing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ public static void HarmonyPatches_Pathing(Harmony harmony)
// Verse.ReachabilityUtility
public static void CanReach_Vampire(ref bool __result, Pawn pawn, LocalTargetInfo dest, PathEndMode peMode, Danger maxDanger, bool canBashDoors = false, bool canBashFences = false, TraverseMode mode = TraverseMode.ByPawn)
{
if !(__result && pawn.IsVampire()) return;
var inBeastMentalState = pawn?.MentalStateDef == DefDatabase<MentalStateDef>.GetNamed("ROMV_VampireBeast");
var inRestrictedSunlightAIMode = pawn?.VampComp()?.CurrentSunlightPolicy == SunlightPolicy.Restricted;
var isDaylight = VampireUtility.IsDaylight(pawn);
var isPlayerCharacter = pawn?.Faction == Faction.OfPlayerSilentFail;
var isNotDrafted = !pawn?.Drafted ?? false;
var destIsNotRoofed = !dest.Cell.Roofed(pawn?.MapHeld ?? Find.CurrentMap);
if (__result && pawn.IsVampire() &&
(inRestrictedSunlightAIMode || inBeastMentalState) &&
if ((inRestrictedSunlightAIMode || inBeastMentalState) &&
isDaylight && isPlayerCharacter && isNotDrafted && destIsNotRoofed) __result = false;
}

Expand Down

0 comments on commit 56b9f69

Please sign in to comment.