// Token: 0x06000084 RID: 132 RVA: 0x0000525C File Offset: 0x0000345C
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            bool flag = t.Faction != pawn.Faction;
            Job  result;

            if (flag)
            {
                result = null;
            }
            else
            {
                Frame frame = t as Frame;
                bool  flag2 = frame == null;
                if (flag2)
                {
                    result = null;
                }
                else
                {
                    bool flag3 = WPGenConstruct.FirstBlockingThing(frame, pawn) != null;
                    if (flag3)
                    {
                        result = WPGenConstruct.HandleBlockingThingJob(frame, pawn, false);
                    }
                    else
                    {
                        bool flag4 = !WPGenConstruct.CanConstruct(frame, pawn, forced);
                        if (flag4)
                        {
                            result = null;
                        }
                        else
                        {
                            bool flag5 = !pawn.CanReserve(t, 1, -1, null, false);
                            if (flag5)
                            {
                                result = null;
                            }
                            else
                            {
                                bool flag6 = !pawn.CanReserveAndReach(t, PathEndMode.Touch, Danger.Deadly, 1, -1, null, forced);
                                if (flag6)
                                {
                                    result = null;
                                }
                                else
                                {
                                    result = base.ResourceDeliverJobFor(pawn, frame, true);
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #2
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);
        }
        // Token: 0x060000E6 RID: 230 RVA: 0x00007CD8 File Offset: 0x00005ED8
        public static Job HandleBlockingThingJob(Thing constructible, Pawn worker, bool forced = false)
        {
            Thing thing = WPGenConstruct.FirstBlockingThing(constructible, worker);
            bool  flag  = thing == null;
            Job   result;

            if (flag)
            {
                result = null;
            }
            else
            {
                bool flag2 = thing.def.category == ThingCategory.Plant;
                if (flag2)
                {
                    LocalTargetInfo target    = thing;
                    PathEndMode     peMode    = PathEndMode.ClosestTouch;
                    Danger          maxDanger = worker.NormalMaxDanger();
                    bool            flag3     = worker.CanReserveAndReach(target, peMode, maxDanger, 1, -1, null, forced);
                    if (flag3)
                    {
                        return(new Job(JobDefOf.CutPlant, thing));
                    }
                }
                else
                {
                    bool flag4 = thing.def.category == ThingCategory.Item;
                    if (flag4)
                    {
                        bool everHaulable = thing.def.EverHaulable;
                        if (everHaulable)
                        {
                            return(HaulAIUtility.HaulAsideJobFor(worker, thing));
                        }
                        Log.ErrorOnce(string.Concat(new object[]
                        {
                            "Never haulable ",
                            thing,
                            " blocking ",
                            constructible.ToStringSafe <Thing>(),
                            " at ",
                            constructible.Position
                        }), 6429262, false);
                    }
                    else
                    {
                        bool flag5 = thing.def.category == ThingCategory.Building;
                        if (flag5)
                        {
                            LocalTargetInfo target2    = thing;
                            PathEndMode     peMode2    = PathEndMode.Touch;
                            Danger          maxDanger2 = worker.NormalMaxDanger();
                            bool            flag6      = worker.CanReserveAndReach(target2, peMode2, maxDanger2, 1, -1, null, forced) && worker.RaceProps.Animal;
                            if (flag6)
                            {
                                return(new Job(WPJobDefOf.WPDeconstruct, thing)
                                {
                                    ignoreDesignations = true
                                });
                            }
                            bool flag7 = worker.CanReserveAndReach(target2, peMode2, maxDanger2, 1, -1, null, forced) && !worker.RaceProps.Animal;
                            if (flag7)
                            {
                                return(new Job(JobDefOf.Deconstruct, thing)
                                {
                                    ignoreDesignations = true
                                });
                            }
                        }
                    }
                }
                result = null;
            }
            return(result);
        }