public static bool HostileTo(this Thing t, Faction fac) { if (t.Destroyed) { return(false); } Pawn pawn = t as Pawn; if (pawn != null) { MentalState mentalState = pawn.MentalState; if (mentalState != null && mentalState.ForceHostileTo(fac)) { return(true); } if (GenHostility.IsPredatorHostileTo(pawn, fac)) { return(true); } if (pawn.HostFaction == fac && PrisonBreakUtility.IsPrisonBreaking(pawn)) { return(true); } if (pawn.HostFaction == fac) { return(false); } if (pawn.HostFaction != null && !pawn.HostFaction.HostileTo(fac) && !PrisonBreakUtility.IsPrisonBreaking(pawn)) { return(false); } } return(t.Faction != null && t.Faction.HostileTo(fac)); }
public static bool HostileTo(this Thing t, Faction fac) { if (t.Destroyed) { return(false); } if (fac == null) { return(false); } Pawn pawn = t as Pawn; if (pawn != null) { MentalState mentalState = pawn.MentalState; if (mentalState != null && mentalState.ForceHostileTo(fac)) { return(true); } if (IsPredatorHostileTo(pawn, fac)) { return(true); } if (pawn.HostFaction == fac && PrisonBreakUtility.IsPrisonBreaking(pawn)) { return(true); } if (pawn.HostFaction == fac) { return(false); } if (pawn.HostFaction != null && !pawn.HostFaction.HostileTo(fac) && !PrisonBreakUtility.IsPrisonBreaking(pawn)) { return(false); } if (fac.IsPlayer && pawn.mindState.WillJoinColonyIfRescued) { return(false); } if (fac.def.hostileToFactionlessHumanlikes && pawn.Faction == null && pawn.RaceProps.Humanlike) { return(true); } } else if (t.Faction == null && t.TryGetComp <CompCauseGameCondition>() != null) { return(true); } if (t.Faction == null) { return(false); } return(t.Faction.HostileTo(fac)); }
public static bool HostileTo(this Thing t, Faction fac) { if (t.Destroyed) { return(false); } Pawn pawn = t as Pawn; if (pawn != null) { MentalState mentalState = pawn.MentalState; if (mentalState != null && mentalState.ForceHostileTo(fac)) { return(true); } if (IsPredatorHostileTo(pawn, fac)) { return(true); } if (pawn.HostFaction == fac && PrisonBreakUtility.IsPrisonBreaking(pawn)) { return(true); } if (pawn.HostFaction == fac) { return(false); } if (pawn.HostFaction != null && !pawn.HostFaction.HostileTo(fac) && !PrisonBreakUtility.IsPrisonBreaking(pawn)) { return(false); } if (fac.IsPlayer && pawn.mindState.WillJoinColonyIfRescued) { return(false); } } if (t.Faction == null) { return(false); } return(t.Faction.HostileTo(fac)); }