Пример #1
0
        private static IEnumerable <Toil> Postfix(IEnumerable <Toil> values, JobDriver_FoodDeliver __instance)
        {
            FieldInfo efi = AccessTools.Field(typeof(JobDriver_FoodDeliver), "eatingFromInventory");
            bool      eatingFromInventory = (bool)efi.GetValue(__instance);
            FieldInfo unpd = AccessTools.Field(typeof(JobDriver_FoodDeliver), "usingNutrientPasteDispenser");
            bool      usingNutrientPasteDispenser = (bool)unpd.GetValue(__instance);
            int       numToilsBeforeGoto;

            if (eatingFromInventory)
            {
                numToilsBeforeGoto = 1;
            }
            else if (usingNutrientPasteDispenser)
            {
                numToilsBeforeGoto = 2;
            }
            else
            {
                numToilsBeforeGoto = 3;
            }

            foreach (Toil toil in HeatMealInjector.InjectHeat(values, __instance, numToilsBeforeGoto))
            {
                yield return(toil);
            }
            yield break;
        }
 private static IEnumerable<Toil> Postfix(IEnumerable<Toil> values, JobDriver_FoodFeedPatient __instance)
 {
     int numToilsBeforeGoto = 2;
     if (__instance.pawn.inventory != null && __instance.pawn.inventory.Contains(__instance.job.targetA.Thing))
     {
         numToilsBeforeGoto--;
     }
     foreach (Toil toil in HeatMealInjector.InjectHeat(values, __instance, numToilsBeforeGoto))
     {
         yield return toil;
     }
     yield break;
 }
        private static IEnumerable <Toil> Postfix(IEnumerable <Toil> values, JobDriver_SocialRelax __instance)
        {
            if (!__instance.job.GetTarget(TargetIndex.C).HasThing)
            {
                foreach (Toil value in values)
                {
                    yield return(value);
                }
                yield break;
            }

            int numToilsBeforeGoto = 2;

            foreach (Toil toil in HeatMealInjector.InjectHeat(values, __instance, numToilsBeforeGoto, foodIndex: TargetIndex.C, finalLocation: TargetIndex.B))
            {
                yield return(toil);
            }
            yield break;
        }