/// <summary> /// Returns whether p can open the door without bashing. /// </summary> public virtual bool PawnCanOpen(Pawn p) { var lord = p.GetLord(); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) { return(true); } //This is to avoid situations where a wild man is stuck inside the colony forever right after having a mental break if (WildManUtility.WildManShouldReachOutsideNow(p)) { return(true); } //Door has no faction? if (Faction == null) { return(true); } if (p.guest != null && p.guest.Released) { return(true); } return(GenAI.MachinesLike(Faction, p)); }
public override bool Allows(Pawn pawn) { if (!enabled) { return(false); } if (pawn.IsColonist) { return(false); } Lord lord = LordUtility.GetLord(pawn); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(pawn)) { return(true); } if (pawn.Faction != null && FactionUtility.HostileTo(pawn.Faction, Faction.OfPlayer)) { return(false); } if (pawn.Faction == null && WildManUtility.NonHumanlikeOrWildMan(pawn) && (pawn.HostFaction != Faction.OfPlayer || pawn.IsPrisoner)) { return(false); } if (pawn.IsPrisoner && pawn.HostFaction == Faction.OfPlayer) { return(false); } return(true); }
public virtual bool PawnCanOpen(Pawn p) { if (Map != null && Map.Parent.doorsAlwaysOpenForPlayerPawns && p.Faction == Faction.OfPlayer) { return(true); } var lord = p.GetLord(); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) { return(true); } if (WildManUtility.WildManShouldReachOutsideNow(p)) { return(true); } if (p.RaceProps.FenceBlocked && !def.building.roamerCanOpen && (!p.roping.IsRopedByPawn || !PawnCanOpen(p.roping.RopedByPawn))) { return(false); } if (Faction == null) { return(true); } if (p.guest != null && p.guest.Released) { return(true); } return(GenAI.MachinesLike(Faction, p)); }
public static bool PawnCanOpen(Building_Door door, Pawn p) { Lord lord = p.GetLord(); bool canOpenAnyDoor = lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p); bool noFaction = door.Faction == null; bool specialGuest = WildManUtility.WildManShouldReachOutsideNow(p) || (p.guest != null && p.guest.Released); if (canOpenAnyDoor || noFaction || specialGuest) { return(true); } LockState respectedState; if (!p.IsPrisoner && !door.Faction.HostileTo(p.Faction) && !p.InMentalState) { respectedState = GetData(door).WantedState; } else { respectedState = GetData(door).CurrentState; } if (GetData(door).CurrentState.locked == false && p.RaceProps != null && p.RaceProps.intelligence >= Intelligence.Humanlike) { return(true); } if (p.Faction == null || p.Faction.HostileTo(door.Faction)) { return(false); } if (respectedState.Private && respectedState.petDoor && p.RaceProps != null && p.RaceProps.Animal && p.RaceProps.baseBodySize <= MaxPetSize && p.Faction == door.Faction) { return(true); } if (respectedState.Private && !respectedState.owners.Contains(p)) { return(false); } if (p.Faction == door.Faction && !p.IsPrisoner) { return(true); } bool guestCondition = !p.IsPrisoner || p.HostFaction != door.Faction; if (respectedState.mode == LockMode.Allies && guestCondition) { return(true); } return(false); }
public static bool PrepareToIngestToils_DispenserPrefix(ref JobDriver_Ingest __instance, ref IEnumerable <Toil> __result) { if (WildManUtility.AnimalOrWildMan(__instance.pawn)) // AnimalOrWildMan used to support Pawnmorpher sentient former humans { __result = PrepareToIngestToils_DispenserOverride(__instance.pawn); return(false); } return(true); }
public virtual bool PawnCanOpen(Pawn p) { Lord lord = p.GetLord(); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) { return(true); } if (WildManUtility.WildManShouldReachOutsideNow(p)) { return(true); } if (base.Faction == null) { return(true); } if (p.guest != null && p.guest.Released) { return(true); } return(GenAI.MachinesLike(base.Faction, p)); }
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 public static void CorrectLordForCamo(Pawn seer, Pawn target) { if (seer == null || target == null || (seer?.Map) == null || (target?.Map) == null || seer.Map != target.Map || seer.IsColonist) { return; } if (seer.RaceProps.IsMechanoid) { return; } if (!WildManUtility.AnimalOrWildMan(seer) || seer.RaceProps.FleshType != FleshTypeDefOf.Insectoid) { CamoAIUtility.CorrectLordForCamoAction(seer, target, seer.Map.IsPlayerHome); return; } if (seer != null) { Pawn_MindState mindState = seer.mindState; if (mindState != null) { _ = mindState.duty; } } }
protected override bool Satisfied(Pawn pawn) { return(WildManUtility.WildManShouldReachOutsideNow(pawn)); }
public static bool AnimalOrWildManOrHacked(Pawn pawn) { return(WildManUtility.AnimalOrWildMan(pawn) || pawn.IsHacked()); }
public static bool PawnCanOpen(ThingWithComps door, Pawn p) { Lord lord = p.GetLord(); bool canOpenAnyDoor = lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p); bool noFaction = door.Faction == null; bool specialGuest = WildManUtility.WildManShouldReachOutsideNow(p) || (p.guest != null && p.guest.Released); if (canOpenAnyDoor || noFaction || specialGuest) { return(true); } LockState respectedState; if (!p.IsPrisoner && !door.Faction.HostileTo(p.Faction) && !p.InMentalState) { respectedState = GetData(door).WantedState; } else { respectedState = GetData(door).CurrentState; } if (GetData(door).CurrentState.locked == false && p.RaceProps != null && p.RaceProps.intelligence >= Intelligence.Humanlike) { return(true); } if (respectedState.pensDoor && p.RaceProps.FenceBlocked && !door.def.building.roamerCanOpen && (!p.roping.IsRopedByPawn || !PawnCanOpen(door, p.roping.RopedByPawn))) { return(false); } if (p.Faction == null || p.Faction.HostileTo(door.Faction)) { return(false); } if (respectedState.Private && respectedState.petDoor && p.RaceProps != null && p.RaceProps.Animal && p.RaceProps.baseBodySize <= MaxPetSize && p.Faction == door.Faction) { return(true); } if (!respectedState.allowAnimals && p.RaceProps != null && p.RaceProps.Animal) { return(false); } if (respectedState.Private && !respectedState.owners.Contains(p)) { return(false); } if (p.Faction == door.Faction && !p.IsPrisoner && !p.IsSlave) { return(true); } if (respectedState.allowSlave && p.Faction == door.Faction && p.IsSlave) { return(true); } bool guestCondition = p.GuestStatus == GuestStatus.Guest || !p.IsPrisoner && !p.IsSlave && p.HostFaction != door.Faction; if (respectedState.mode == LockMode.Allies && guestCondition) { return(true); } if (door.Map != null && door.Map.Parent.doorsAlwaysOpenForPlayerPawns && p.Faction == Faction.OfPlayer && !p.IsPrisonerOfColony) { return(true); } return(false); }