Esempio n. 1
0
        public override IEnumerable <IntVec3> PotentialWorkCellsGlobal(Pawn pawn)
        {
            Danger          maxDanger = pawn.NormalMaxDanger();
            List <Building> bList     = pawn.Map.listerBuildings.allBuildingsColonist;

            for (int k = 0; k < bList.Count; k++)
            {
                Building_PlantGrower b = bList[k] as Building_PlantGrower;
                if (b != null && ExtraRequirements(b, pawn) && !b.IsForbidden(pawn) && pawn.CanReach(b, PathEndMode.OnCell, maxDanger) && !b.IsBurning())
                {
                    CellRect.CellRectIterator cri = b.OccupiedRect().GetIterator();
                    if (!cri.Done())
                    {
                        yield return(cri.Current);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                    wantedPlantDef = null;
                }
            }
            wantedPlantDef = null;
            List <Zone> zonesList = pawn.Map.zoneManager.AllZones;

            for (int j = 0; j < zonesList.Count; j++)
            {
                Zone_Growing growZone = zonesList[j] as Zone_Growing;
                if (growZone != null)
                {
                    if (growZone.cells.Count == 0)
                    {
                        Log.ErrorOnce("Grow zone has 0 cells: " + growZone, -563487);
                    }
                    else if (ExtraRequirements(growZone, pawn) && !growZone.ContainsStaticFire && pawn.CanReach(growZone.Cells[0], PathEndMode.OnCell, maxDanger))
                    {
                        int i = 0;
                        if (i < growZone.cells.Count)
                        {
                            yield return(growZone.cells[i]);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                        wantedPlantDef = null;
                    }
                }
            }
            wantedPlantDef = null;
        }
        // Token: 0x060000A5 RID: 165 RVA: 0x00005A0B File Offset: 0x00003C0B
        public override IEnumerable <IntVec3> PotentialWorkCellsGlobal(Pawn pawn)
        {
            Danger          maxDanger = pawn.NormalMaxDanger();
            List <Building> bList     = pawn.Map.listerBuildings.allBuildingsColonist;
            int             num;

            for (int i = 0; i < bList.Count; i = num + 1)
            {
                Building_PlantGrower building_PlantGrower = bList[i] as Building_PlantGrower;
                bool flag = building_PlantGrower != null && this.ExtraRequirements(building_PlantGrower, pawn) && !building_PlantGrower.IsForbidden(pawn) && pawn.CanReach(building_PlantGrower, PathEndMode.OnCell, maxDanger, false, TraverseMode.ByPawn) && !building_PlantGrower.IsBurning();
                if (flag)
                {
                    foreach (IntVec3 intVec in building_PlantGrower.OccupiedRect())
                    {
                        yield return(intVec);
                    }
                    WorkGiver_WPGrower.wantedPlantDef = null;
                }
                building_PlantGrower = null;
                num = i;
            }
            WorkGiver_WPGrower.wantedPlantDef = null;
            List <Zone> zonesList = pawn.Map.zoneManager.AllZones;

            for (int j = 0; j < zonesList.Count; j = num + 1)
            {
                Zone_Growing growZone = zonesList[j] as Zone_Growing;
                bool         flag2    = growZone != null;
                if (flag2)
                {
                    bool flag3 = growZone.cells.Count == 0;
                    if (flag3)
                    {
                        string       str          = "Grow zone has 0 cells: ";
                        Zone_Growing zone_Growing = growZone;
                        Log.ErrorOnce(str + ((zone_Growing != null) ? zone_Growing.ToString() : null), -563487, false);
                    }
                    else
                    {
                        bool flag4 = this.ExtraRequirements(growZone, pawn);
                        if (flag4)
                        {
                            bool flag5 = !growZone.ContainsStaticFire;
                            if (flag5)
                            {
                                bool flag6 = pawn.CanReach(growZone.Cells[0], PathEndMode.OnCell, maxDanger, false, TraverseMode.ByPawn);
                                if (flag6)
                                {
                                    for (int k = 0; k < growZone.cells.Count; k = num + 1)
                                    {
                                        yield return(growZone.cells[k]);

                                        num = k;
                                    }
                                    WorkGiver_WPGrower.wantedPlantDef = null;
                                }
                            }
                        }
                    }
                }
                growZone = null;
                num      = j;
            }
            WorkGiver_WPGrower.wantedPlantDef = null;
            yield break;
            yield break;
        }
Esempio n. 3
0
        public override IEnumerable <IntVec3> PotentialWorkCellsGlobal(Pawn pawn)
        {
            Profiler.BeginSample("Grow find cell");
            Danger          maxDanger = pawn.NormalMaxDanger();
            List <Building> bList     = pawn.Map.listerBuildings.allBuildingsColonist;

            for (int i = 0; i < bList.Count; i++)
            {
                Building_PlantGrower b = bList[i] as Building_PlantGrower;
                if (b != null)
                {
                    if (this.ExtraRequirements(b, pawn))
                    {
                        if (!b.IsForbidden(pawn))
                        {
                            if (pawn.CanReach(b, PathEndMode.OnCell, maxDanger, false, TraverseMode.ByPawn))
                            {
                                if (!b.IsBurning())
                                {
                                    CellRect.CellRectIterator cri = b.OccupiedRect().GetIterator();
                                    while (!cri.Done())
                                    {
                                        yield return(cri.Current);

                                        cri.MoveNext();
                                    }
                                    WorkGiver_Grower.wantedPlantDef = null;
                                }
                            }
                        }
                    }
                }
            }
            WorkGiver_Grower.wantedPlantDef = null;
            List <Zone> zonesList = pawn.Map.zoneManager.AllZones;

            for (int j = 0; j < zonesList.Count; j++)
            {
                Zone_Growing growZone = zonesList[j] as Zone_Growing;
                if (growZone != null)
                {
                    if (growZone.cells.Count == 0)
                    {
                        Log.ErrorOnce("Grow zone has 0 cells: " + growZone, -563487, false);
                    }
                    else if (this.ExtraRequirements(growZone, pawn))
                    {
                        if (!growZone.ContainsStaticFire)
                        {
                            if (pawn.CanReach(growZone.Cells[0], PathEndMode.OnCell, maxDanger, false, TraverseMode.ByPawn))
                            {
                                for (int k = 0; k < growZone.cells.Count; k++)
                                {
                                    yield return(growZone.cells[k]);
                                }
                                WorkGiver_Grower.wantedPlantDef = null;
                            }
                        }
                    }
                }
            }
            WorkGiver_Grower.wantedPlantDef = null;
            Profiler.EndSample();
            yield break;
        }
Esempio n. 4
0
        public override IEnumerable <IntVec3> PotentialWorkCellsGlobal(Pawn pawn)
        {
            Danger          maxDanger = pawn.NormalMaxDanger();
            List <Building> bList     = pawn.Map.listerBuildings.allBuildingsColonist;

            for (int k = 0; k < bList.Count; k++)
            {
                Building_PlantGrower building_PlantGrower = bList[k] as Building_PlantGrower;
                if (building_PlantGrower != null && ExtraRequirements(building_PlantGrower, pawn) && !building_PlantGrower.IsForbidden(pawn) && pawn.CanReach(building_PlantGrower, PathEndMode.OnCell, maxDanger) && !building_PlantGrower.IsBurning())
                {
                    foreach (IntVec3 item in building_PlantGrower.OccupiedRect())
                    {
                        yield return(item);
                    }
                    wantedPlantDef = null;
                }
            }
            wantedPlantDef = null;
            List <Zone> zonesList = pawn.Map.zoneManager.AllZones;

            for (int k = 0; k < zonesList.Count; k++)
            {
                Zone_Growing growZone = zonesList[k] as Zone_Growing;
                if (growZone == null)
                {
                    continue;
                }
                if (growZone.cells.Count == 0)
                {
                    Log.ErrorOnce("Grow zone has 0 cells: " + growZone, -563487);
                }
                else if (ExtraRequirements(growZone, pawn) && !growZone.ContainsStaticFire && pawn.CanReach(growZone.Cells[0], PathEndMode.OnCell, maxDanger))
                {
                    for (int i = 0; i < growZone.cells.Count; i++)
                    {
                        yield return(growZone.cells[i]);
                    }
                    wantedPlantDef = null;
                }
            }
            wantedPlantDef = null;
        }