public IEnumerable <YieldResult> New_SowAndCareForTrees()
        {
            GrowingSpotModule module = this.InteractionTarget.GetPrimaryHolder <Furniture>().GetModule <GrowingSpotModule>();

            if (module.GetFieldValue <int>("currentPhase") < 0)
            {
                subTask = new YieldMicroInteraction(new InteractionInfo(Interaction.Sow,
                                                                        this.InteractionTarget, this.InteractionInfo.restrictions, this.InteractionInfo.issuedByAI,
                                                                        this.InteractionInfo.priority, this.InteractionInfo.urgent,
                                                                        this.InteractionInfo.shouldBeFinished, true), this.human);
            }
            else
            {
                subTask = new YieldMicroInteraction(new InteractionInfo(Interaction.Care,
                                                                        this.InteractionTarget, this.InteractionInfo.restrictions, this.InteractionInfo.issuedByAI,
                                                                        this.InteractionInfo.priority, this.InteractionInfo.urgent,
                                                                        this.InteractionInfo.shouldBeFinished, true), this.human);
            }

            subTask = subTask.Handle();
            yield return(YieldResult.WaitFrame);

            StopCurrentSubtask();
            yield return(YieldResult.Completed);
        }
Пример #2
0
        public static void GrowingSpotModule_GetInteractions_Postfix(GrowingSpotModule __instance, ref IEnumerable <InteractionRestricted> __result)
        {
            List <InteractionRestricted> list = new List <InteractionRestricted>();

            if (__instance.GetFieldValue <int>("currentPhase") >= 0)
            {
                list.Add(new InteractionRestricted(Interaction.RemovePlant, new InteractionRestrictionSkill(__instance.requiredSkill)));
            }

            list.Add(new InteractionRestricted(Specialization.SowAndCareForTrees, new InteractionRestrictionCareForTrees(
                                                   __instance.requiredSkill, Time.time + __instance.GetFieldValue <float>("timeUntilNextCareInteraction"))));

            __result = list;
        }