public static void FoodIngested(Pawn ingester, Thing foodSource, ThingDef foodDef) { properties.Clear(); if (ingester.RaceProps.Animal) { return; } ReligionSettings_Social settings = ingester.GetReligionComponent().Religion.GetSettings <ReligionSettings_Social>(SettingsTagDefOf.FoodTag); if (settings != null) { properties.Add(settings.GetPropertyByObject(ingester, foodDef)); CompIngredients comp = foodSource.TryGetComp <CompIngredients>(); if (comp != null) { foreach (ThingDef ingredient in comp.ingredients) { properties.Add(settings.GetPropertyByObject(ingester, ingredient)); } } foreach (ReligionProperty property in properties) { if (property != null) { PietyUtility.TryApplyOnPawn(property.Subject, ingester, property.GetObject().LabelCap); } } } }
private static void AppendForPawn(Pawn pawn, Pawn otherPawm, ReligionProperty property, bool isSubject) { if (property != null) { if (isSubject) { PietyUtility.TryApplyOnPawn(property.Subject, pawn, property.GetObject().LabelCap, otherPawm); } else { PietyUtility.TryApplyOnPawn(property.Witness, pawn, property.GetObject().LabelCap, otherPawm); } } }
private void ActivityEnd() { foreach (Pawn pawn in lord.ownedPawns) { if (pawn == data.Organizer) { PietyUtility.TryApplyOnPawn(data.OrganizerProperty, pawn, data.Task.Label); } else { PietyUtility.TryApplyOnPawn(data.СongregationProperty, pawn, data.Task.Label); } } data.Task.Notify_IterationCompleted(data.Organizer); }
protected override IEnumerable <Toil> MakeNewToils() { Toil relax; if (this.FromBed) { this.KeepLyingDown(TargetIndex.A); yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.A, TargetIndex.None)); yield return(Toils_Bed.GotoBed(TargetIndex.A)); relax = Toils_LayDown.LayDown(TargetIndex.A, true, false, true, true); relax.AddFailCondition(() => !this.pawn.Awake()); } else { yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell)); relax = new Toil(); relax.initAction = delegate { this.faceDir = ((!this.job.def.faceDir.IsValid) ? Rot4.Random : this.job.def.faceDir); }; relax.handlingFacing = true; } relax.defaultCompleteMode = ToilCompleteMode.Delay; relax.defaultDuration = this.job.def.joyDuration; relax.AddPreTickAction(delegate { if (this.faceDir.IsValid) { this.pawn.rotationTracker.FaceCell(this.pawn.Position + this.faceDir.FacingCell); } this.pawn.GainComfortFromCellIfPossible(); JoyUtility.JoyTickCheckEnd(this.pawn, JoyTickFullJoyAction.EndJob, 1f, null); PrayUtility.TickCheckEnd(pawn); }); yield return(relax); this.AddFinishAction(() => { ReligionProperty property = pawn.GetReligionComponent().Religion.GetSettings <ReligionSettings_Prayings>(SettingsTagDefOf.PrayingsTag).Property; PietyUtility.TryApplyOnPawn(property.Subject, pawn); }); }
protected override IEnumerable <Toil> MakeNewToils() { base.AddEndCondition(delegate { Thing thing = this.GetActor().jobs.curJob.GetTarget(TargetIndex.A).Thing; if (thing is Building && !thing.Spawned) { return(JobCondition.Incompletable); } return(JobCondition.Ongoing); }); this.FailOnBurningImmobile(TargetIndex.A); if (TargetC.HasThing) { yield return(Toils_Goto.GotoCell(TargetIndex.C, PathEndMode.OnCell)); } else { yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell)); } yield return(new Toil() { defaultCompleteMode = ToilCompleteMode.Never, tickAction = delegate { PrayUtility.TickCheckEnd(pawn); this.pawn.rotationTracker.FaceCell(base.TargetA.Cell); this.pawn.GainComfortFromCellIfPossible(); } }); this.AddFinishAction(() => { ReligionProperty property = pawn.GetReligionComponent().Religion.GetSettings <ReligionSettings_Prayings>(SettingsTagDefOf.PrayingsTag).Property; PietyUtility.TryApplyOnPawn(property.Subject, pawn); }); }