protected override Job TryGiveJob(Pawn pawn) { MentalState_CorpseObsession mentalState_CorpseObsession = pawn.MentalState as MentalState_CorpseObsession; if (mentalState_CorpseObsession == null || mentalState_CorpseObsession.corpse == null || mentalState_CorpseObsession.alreadyHauledCorpse) { return(null); } Corpse corpse = mentalState_CorpseObsession.corpse; Building_Grave building_Grave = mentalState_CorpseObsession.corpse.ParentHolder as Building_Grave; if (building_Grave != null) { if (!pawn.CanReserveAndReach(building_Grave, PathEndMode.InteractionCell, Danger.Deadly)) { return(null); } } else if (!pawn.CanReserveAndReach(corpse, PathEndMode.Touch, Danger.Deadly)) { return(null); } Job job = JobMaker.MakeJob(JobDefOf.HaulCorpseToPublicPlace, corpse, building_Grave); job.count = 1; return(job); }
protected override Job TryGiveJob(Pawn pawn) { MentalState_CorpseObsession mentalState_CorpseObsession = pawn.MentalState as MentalState_CorpseObsession; Job result; if (mentalState_CorpseObsession == null || mentalState_CorpseObsession.corpse == null) { result = null; } else { Corpse corpse = mentalState_CorpseObsession.corpse; Building_Grave building_Grave = mentalState_CorpseObsession.corpse.ParentHolder as Building_Grave; if (building_Grave != null) { if (!pawn.CanReserveAndReach(building_Grave, PathEndMode.InteractionCell, Danger.Deadly, 1, -1, null, false)) { return(null); } } else if (!pawn.CanReserveAndReach(corpse, PathEndMode.Touch, Danger.Deadly, 1, -1, null, false)) { return(null); } result = new Job(JobDefOf.HaulCorpseToPublicPlace, corpse, building_Grave) { count = 1 }; } return(result); }
private void <ForbidAndNotifyMentalStateToil> m__1() { Corpse corpse = this.Corpse; if (corpse != null) { corpse.SetForbidden(true, true); } MentalState_CorpseObsession mentalState_CorpseObsession = this.pawn.MentalState as MentalState_CorpseObsession; if (mentalState_CorpseObsession != null) { mentalState_CorpseObsession.Notify_CorpseHauled(); } }
private Toil ForbidAndNotifyMentalStateToil() { Toil toil = new Toil(); toil.initAction = delegate { Corpse corpse = this.Corpse; if (corpse != null) { corpse.SetForbidden(true, true); } MentalState_CorpseObsession mentalState_CorpseObsession = base.pawn.MentalState as MentalState_CorpseObsession; if (mentalState_CorpseObsession != null) { mentalState_CorpseObsession.Notify_CorpseHauled(); } }; toil.atomicWithPrevious = true; return(toil); }
private Toil ForbidAndNotifyMentalStateToil() { return(new Toil { initAction = delegate() { Corpse corpse = this.Corpse; if (corpse != null) { corpse.SetForbidden(true, true); } MentalState_CorpseObsession mentalState_CorpseObsession = this.pawn.MentalState as MentalState_CorpseObsession; if (mentalState_CorpseObsession != null) { mentalState_CorpseObsession.Notify_CorpseHauled(); } }, atomicWithPrevious = true }); }