// Token: 0x0600007B RID: 123 RVA: 0x00004EE8 File Offset: 0x000030E8
        protected Job RemoveExistingFloorJob(Pawn pawn, Blueprint blue)
        {
            bool flag = !WorkGiver_WPConstructDeliverResources.ShouldRemoveExistingFloorFirst(pawn, blue);
            Job  result;

            if (flag)
            {
                result = null;
            }
            else
            {
                bool flag2 = !pawn.CanReserve(blue.Position, 1, -1, ReservationLayerDefOf.Floor, false);
                if (flag2)
                {
                    result = null;
                }
                else
                {
                    Job job = JobMaker.MakeJob(JobDefOf.RemoveFloor, blue.Position);
                    job.ignoreDesignations = true;
                    result = job;
                }
            }
            return(result);
        }
        // Token: 0x06000078 RID: 120 RVA: 0x00004C7C File Offset: 0x00002E7C
        private HashSet <Thing> FindNearbyNeeders(Pawn pawn, ThingDefCountClass need, IConstructible c, int resTotalAvailable, bool canRemoveExistingFloorUnderNearbyNeeders, out int neededTotal, out Job jobToMakeNeederAvailable)
        {
            neededTotal = need.count;
            HashSet <Thing> hashSet = new HashSet <Thing>();
            Thing           thing   = (Thing)c;

            foreach (Thing thing2 in GenRadial.RadialDistinctThingsAround(thing.Position, thing.Map, 8f, true))
            {
                bool flag = neededTotal >= resTotalAvailable;
                if (flag)
                {
                    break;
                }
                bool flag2 = this.IsNewValidNearbyNeeder(thing2, hashSet, c, pawn);
                if (flag2)
                {
                    Blueprint blueprint = thing2 as Blueprint;
                    bool      flag3     = blueprint == null || !WorkGiver_WPConstructDeliverResources.ShouldRemoveExistingFloorFirst(pawn, blueprint);
                    if (flag3)
                    {
                        int  num   = GenConstruct.AmountNeededByOf((IConstructible)thing2, need.thingDef);
                        bool flag4 = num > 0;
                        if (flag4)
                        {
                            hashSet.Add(thing2);
                            neededTotal += num;
                        }
                    }
                }
            }
            Blueprint blueprint2 = c as Blueprint;
            bool      flag5      = blueprint2 != null && blueprint2.def.entityDefToBuild is TerrainDef && canRemoveExistingFloorUnderNearbyNeeders && neededTotal < resTotalAvailable;

            if (flag5)
            {
                foreach (Thing thing3 in GenRadial.RadialDistinctThingsAround(thing.Position, thing.Map, 3f, false))
                {
                    bool flag6 = this.IsNewValidNearbyNeeder(thing3, hashSet, c, pawn);
                    if (flag6)
                    {
                        Blueprint blueprint3 = thing3 as Blueprint;
                        bool      flag7      = blueprint3 != null;
                        if (flag7)
                        {
                            Job  job   = this.RemoveExistingFloorJob(pawn, blueprint3);
                            bool flag8 = job != null;
                            if (flag8)
                            {
                                jobToMakeNeederAvailable = job;
                                return(hashSet);
                            }
                        }
                    }
                }
            }
            jobToMakeNeederAvailable = null;
            return(hashSet);
        }
コード例 #3
0
        // Token: 0x06000080 RID: 128 RVA: 0x00005088 File Offset: 0x00003288
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            bool flag = t.Faction != pawn.Faction;
            Job  result;

            if (flag)
            {
                result = null;
            }
            else
            {
                Blueprint blueprint = t as Blueprint;
                bool      flag2     = blueprint == null;
                if (flag2)
                {
                    result = null;
                }
                else
                {
                    bool flag3 = WPGenConstruct.FirstBlockingThing(blueprint, pawn) != null;
                    if (flag3)
                    {
                        result = WPGenConstruct.HandleBlockingThingJob(blueprint, pawn, false);
                    }
                    else
                    {
                        bool flag4 = !WPGenConstruct.CanConstruct(blueprint, pawn, forced);
                        if (flag4)
                        {
                            result = null;
                        }
                        else
                        {
                            bool flag5 = !pawn.CanReserve(blueprint, 1, -1, null, false);
                            if (flag5)
                            {
                                result = null;
                            }
                            else
                            {
                                bool flag6 = !pawn.CanReserve(t, 1, -1, null, false);
                                if (flag6)
                                {
                                    result = null;
                                }
                                else
                                {
                                    bool flag7 = WorkGiver_WPConstructDeliverResources.ShouldRemoveExistingFloorFirst(pawn, blueprint);
                                    if (flag7)
                                    {
                                        result = null;
                                    }
                                    else
                                    {
                                        Job  job   = base.RemoveExistingFloorJob(pawn, blueprint);
                                        bool flag8 = job != null;
                                        if (flag8)
                                        {
                                            result = job;
                                        }
                                        else
                                        {
                                            Job  job2  = base.ResourceDeliverJobFor(pawn, blueprint, true);
                                            bool flag9 = job2 != null;
                                            if (flag9)
                                            {
                                                result = job2;
                                            }
                                            else
                                            {
                                                bool flag10 = this.def.workType != WorkTypeDefOf.Hauling;
                                                if (flag10)
                                                {
                                                    Job  job3   = this.NoCostFrameMakeJobFor(pawn, blueprint);
                                                    bool flag11 = job3 != null;
                                                    if (flag11)
                                                    {
                                                        return(job3);
                                                    }
                                                }
                                                result = null;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }