예제 #1
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (t.Faction != pawn.Faction)
            {
                return(false);
            }
            Building building = t as Building;

            if (building == null)
            {
                return(false);
            }
            if (building.IsForbidden(pawn))
            {
                return(false);
            }
            LocalTargetInfo target = building;

            if (!pawn.CanReserve(target, 1, -1, null, forced))
            {
                return(false);
            }
            CompDeepDrill compDeepDrill = building.TryGetComp <CompDeepDrill>();

            return(compDeepDrill.CanDrillNow() && !building.IsBurning());
        }
예제 #2
0
        // Token: 0x0600004C RID: 76 RVA: 0x00004148 File Offset: 0x00002348
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnBurningImmobile(TargetIndex.A);
            this.FailOn(delegate()
            {
                CompDeepDrill compDeepDrill = this.job.targetA.Thing.TryGetComp <CompDeepDrill>();
                return(!compDeepDrill.CanDrillNow());
            });
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            Toil work = new Toil();

            work.tickAction = delegate()
            {
                Pawn          actor    = work.actor;
                Building      building = (Building)actor.CurJob.targetA.Thing;
                CompDeepDrill comp     = building.GetComp <CompDeepDrill>();
                comp.DrillWorkDone(actor);
            };
            work.defaultCompleteMode = ToilCompleteMode.Never;
            work.WithEffect(EffecterDefOf.Drill, TargetIndex.A);
            work.FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell);
            yield return(work);

            yield break;
        }
예제 #3
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
                    this.FailOnBurningImmobile(TargetIndex.A);
                    this.FailOn(delegate()
                    {
                        CompDeepDrill compDeepDrill = this.job.targetA.Thing.TryGetComp <CompDeepDrill>();
                        return(!compDeepDrill.CanDrillNow());
                    });
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    < MakeNewToils > c__AnonStorey.work            = new Toil();
                    < MakeNewToils > c__AnonStorey.work.tickAction = delegate()
                    {
                        Pawn          actor    = < MakeNewToils > c__AnonStorey.work.actor;
                        Building      building = (Building)actor.CurJob.targetA.Thing;
                        CompDeepDrill comp     = building.GetComp <CompDeepDrill>();
                        comp.DrillWorkDone(actor);
                        actor.skills.Learn(SkillDefOf.Mining, 0.065f, false);
                    };
        protected override IEnumerable <Toil> MakeNewToils()
        {
            _003CMakeNewToils_003Ec__Iterator0 _003CMakeNewToils_003Ec__Iterator = (_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0036: stateMachine*/;

            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnBurningImmobile(TargetIndex.A);
            this.FailOn(delegate
            {
                CompDeepDrill compDeepDrill = _003CMakeNewToils_003Ec__Iterator._0024this.job.targetA.Thing.TryGetComp <CompDeepDrill>();
                return(!compDeepDrill.CanDrillNow());
            });
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            /*Error: Unable to find new state assignment for yield return*/;
        }
예제 #5
0
        // Token: 0x06000092 RID: 146 RVA: 0x00005550 File Offset: 0x00003750
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            bool flag = t.Faction != pawn.Faction;
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                Building building = t as Building;
                bool     flag2    = building == null;
                if (flag2)
                {
                    result = false;
                }
                else
                {
                    bool flag3 = building.IsForbidden(pawn);
                    if (flag3)
                    {
                        result = false;
                    }
                    else
                    {
                        LocalTargetInfo target = building;
                        bool            flag4  = !pawn.CanReserve(target, 1, -1, null, forced);
                        if (flag4)
                        {
                            result = false;
                        }
                        else
                        {
                            CompDeepDrill compDeepDrill = building.TryGetComp <CompDeepDrill>();
                            result = (compDeepDrill.CanDrillNow() && !building.IsBurning());
                        }
                    }
                }
            }
            return(result);
        }
예제 #6
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (t.Faction != pawn.Faction)
            {
                return(false);
            }
            Building building = t as Building;

            if (building == null)
            {
                return(false);
            }
            if (building.IsForbidden(pawn))
            {
                return(false);
            }
            LocalTargetInfo target = building;
            bool            ignoreOtherReservations = forced;

            if (!pawn.CanReserve(target, 1, -1, null, ignoreOtherReservations))
            {
                return(false);
            }
            CompDeepDrill compDeepDrill = building.TryGetComp <CompDeepDrill>();

            if (!compDeepDrill.CanDrillNow())
            {
                return(false);
            }
            if (building.Map.designationManager.DesignationOn(building, DesignationDefOf.Uninstall) != null)
            {
                return(false);
            }
            if (building.IsBurning())
            {
                return(false);
            }
            return(true);
        }