public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill) { RecipeOutcomeProperties props = ingredients?.FirstOrDefault()?.def.GetModExtension <RecipeOutcomeProperties>() ?? null; if (props != null) { Thing genomeSequence = GenomeUtility.MakeGenomeSequence(pawn, props.outputThingDef); GenPlace.TryPlaceThing(genomeSequence, billDoer.Position, billDoer.Map, ThingPlaceMode.Near); } }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedNullOrForbidden(TargetIndex.A); this.FailOnDestroyedNullOrForbidden(TargetIndex.B); yield return(Toils_Reserve.Reserve(TargetIndex.A)); yield return(Toils_Reserve.Reserve(TargetIndex.B)); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.OnCell)); yield return(Toils_Haul.StartCarryThing(TargetIndex.B, subtractNumTakenFromJobCount: true)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch)); yield return(Toils_General.WaitWith(TargetIndex.A, 600, true)); yield return(new Toil() { initAction = delegate() { //Destroy tool. TargetThingB.Destroy(); //Roughly 60% chance to succeed. Modified by the medical surgery chance. if (!Rand.Chance(0.6f * pawn.GetStatValue(StatDefOf.MedicalSurgerySuccessChance, true))) { return; } RecipeOutcomeProperties props = job.def.GetModExtension <RecipeOutcomeProperties>() ?? null; if (props != null) { Corpse corpse = TargetThingA as Corpse; Thing genomeSequence = GenomeUtility.MakeGenomeSequence(corpse.InnerPawn, props.outputThingDef); GenPlace.TryPlaceThing(genomeSequence, pawn.Position, pawn.Map, ThingPlaceMode.Near); } } }); }