public override void Notify_IterationCompleted(Pawn billDoer, List <Thing> ingredients)
        {
            base.Notify_IterationCompleted(billDoer, ingredients);

            Building_AquacultureBasin aquacultureBasin = this.billStack.billGiver as Building_AquacultureBasin;

            if (aquacultureBasin != null)
            {
                if ((aquacultureBasin.BillStack.Count == 0) ||
                    (aquacultureBasin.BillStack.Bills.First().recipe != this.recipe))
                {
                    return;
                }

                // Get the supplied species def and start a new breed cycle in the aquaculture basin.
                Thing fishCorpse = ingredients.First();
                if (fishCorpse != null)
                {
                    PawnKindDef fishKind           = null;
                    string      fishCorpseAsString = fishCorpse.ToString();
                    if (fishCorpseAsString.Contains("Mashgon"))
                    {
                        fishKind = Util_FishIndustry.MashgonPawnKindDef;
                    }
                    else if (fishCorpseAsString.Contains("Blueblade"))
                    {
                        fishKind = Util_FishIndustry.BluebladePawnKindDef;
                    }
                    else if (fishCorpseAsString.Contains("Tailteeth"))
                    {
                        fishKind = Util_FishIndustry.TailteethPawnKindDef;
                    }
                    if (fishKind != null)
                    {
                        aquacultureBasin.StartNewBreedingCycle(fishKind);
                    }
                    else
                    {
                        Log.Warning("FishIndustry: this fish is not handled for breeding (" + fishCorpseAsString + ").");
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Building_AquacultureBasin aquacultureBasin = this.TargetThingA as Building_AquacultureBasin;

            yield return(Toils_Goto.GotoThing(aquacultureBasinIndex, PathEndMode.InteractionCell).FailOn(() =>
                                                                                                         (aquacultureBasin.powerComp.PowerOn == false) ||
                                                                                                         (aquacultureBasin.desiredSpeciesDef == null)));

            yield return(Toils_General.Wait(600).WithProgressBarToilDelay(aquacultureBasinIndex).FailOn(() =>
                                                                                                        (aquacultureBasin.powerComp.PowerOn == false) ||
                                                                                                        (aquacultureBasin.desiredSpeciesDef == null)));

            Toil changeAquacultureBasinBredSpecies = new Toil()
            {
                initAction = () =>
                {
                    aquacultureBasin.StartNewBreedingCycle();
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            yield return(changeAquacultureBasinBredSpecies);
        }