public static Corpse GetClosestCorpseToDigUp(Pawn pawn)
        {
            if (!pawn.Spawned)
            {
                return(null);
            }
            Building_Grave building_Grave = (Building_Grave)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Grave), PathEndMode.InteractionCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, delegate(Thing x)
            {
                Building_Grave building_Grave2 = (Building_Grave)x;
                return(building_Grave2.HasCorpse && CorpseObsessionMentalStateUtility.IsCorpseValid(building_Grave2.Corpse, pawn, true));
            }, null, 0, -1, false, RegionType.Set_Passable, false);

            return((building_Grave == null) ? null : building_Grave.Corpse);
        }
        public override void MentalStateTick()
        {
            bool flag = false;

            if (this.pawn.IsHashIntervalTick(500) && !CorpseObsessionMentalStateUtility.IsCorpseValid(this.corpse, this.pawn, false))
            {
                this.corpse = CorpseObsessionMentalStateUtility.GetClosestCorpseToDigUp(this.pawn);
                if (this.corpse == null)
                {
                    base.RecoverFromState();
                    flag = true;
                }
            }
            if (!flag)
            {
                base.MentalStateTick();
            }
        }
            internal bool <> m__0(Thing x)
            {
                Building_Grave building_Grave = (Building_Grave)x;

                return(building_Grave.HasCorpse && CorpseObsessionMentalStateUtility.IsCorpseValid(building_Grave.Corpse, this.pawn, true));
            }
 public override void PostStart(string reason)
 {
     base.PostStart(reason);
     this.corpse = CorpseObsessionMentalStateUtility.GetClosestCorpseToDigUp(this.pawn);
 }
Esempio n. 5
0
 public override bool StateCanOccur(Pawn pawn)
 {
     return(base.StateCanOccur(pawn) && CorpseObsessionMentalStateUtility.GetClosestCorpseToDigUp(pawn) != null);
 }