Beispiel #1
0
		protected override IEnumerable<Toil> MakeNewToils()
		{
			this.FailOnDespawnedOrNull(TargetIndex.A);
			this.FailOnAggroMentalState(TargetIndex.A);
			this.FailOn(() => !StrippableUtility.CanBeStrippedByColony(this.$this.TargetThingA));
			Toil gotoThing = new Toil();
			gotoThing.initAction = delegate
			{
				this.$this.pawn.pather.StartPath(this.$this.TargetThingA, PathEndMode.ClosestTouch);
			};
			gotoThing.defaultCompleteMode = ToilCompleteMode.PatherArrival;
			gotoThing.FailOnDespawnedNullOrForbidden(TargetIndex.A);
			yield return gotoThing;
			yield return Toils_General.Wait(60, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
			yield return new Toil
			{
				initAction = delegate
				{
					Thing thing = this.$this.job.targetA.Thing;
					Designation designation = this.$this.Map.designationManager.DesignationOn(thing, DesignationDefOf.Strip);
					if (designation != null)
					{
						designation.Delete();
					}
					IStrippable strippable = thing as IStrippable;
					if (strippable != null)
					{
						strippable.Strip();
					}
					this.$this.pawn.records.Increment(RecordDefOf.BodiesStripped);
				},
				defaultCompleteMode = ToilCompleteMode.Instant
			};
		}
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            this.FailOnAggroMentalState(TargetIndex.A);
            this.FailOn(() => !StrippableUtility.CanBeStrippedByColony(base.TargetThingA));
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                pawn.pather.StartPath(base.TargetThingA, PathEndMode.ClosestTouch);
            };
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            toil.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(toil);

            yield return(Toils_General.Wait(60).WithProgressBarToilDelay(TargetIndex.A));

            Toil toil2 = new Toil();

            toil2.initAction = delegate
            {
                Thing thing = job.targetA.Thing;
                base.Map.designationManager.DesignationOn(thing, DesignationDefOf.Strip)?.Delete();
                (thing as IStrippable)?.Strip();
                pawn.records.Increment(RecordDefOf.BodiesStripped);
            };
            toil2.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(toil2);
        }
Beispiel #3
0
 public override AcceptanceReport CanDesignateThing(Thing t)
 {
     if (base.Map.designationManager.DesignationOn(t, Designation) != null)
     {
         return(false);
     }
     return(StrippableUtility.CanBeStrippedByColony(t));
 }
        public static TargetingParameters ForStrip(Pawn p)
        {
            TargetingParameters targetingParameters = new TargetingParameters();

            targetingParameters.canTargetPawns = true;
            targetingParameters.canTargetItems = true;
            targetingParameters.mapObjectTargetsMustBeAutoAttackable = false;
            targetingParameters.validator = ((TargetInfo targ) => targ.HasThing && StrippableUtility.CanBeStrippedByColony(targ.Thing));
            return(targetingParameters);
        }
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (t.Map.designationManager.DesignationOn(t, DesignationDefOf.Strip) == null)
            {
                return(false);
            }
            LocalTargetInfo target = t;

            return(pawn.CanReserve(target, 1, -1, null, forced) && StrippableUtility.CanBeStrippedByColony(t));
        }
Beispiel #6
0
 public static TargetingParameters ForStrip(Pawn p)
 {
     return(new TargetingParameters
     {
         canTargetPawns = true,
         canTargetItems = true,
         mapObjectTargetsMustBeAutoAttackable = false,
         validator = (TargetInfo targ) => targ.HasThing && StrippableUtility.CanBeStrippedByColony(targ.Thing)
     });
 }
        // Token: 0x0600337C RID: 13180 RVA: 0x0012740A File Offset: 0x0012560A
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            this.FailOnAggroMentalState(TargetIndex.A);
            this.FailOn(() => !StrippableUtility.CanBeStrippedByColony(base.TargetThingA));
            Toil toil = new Toil();

            toil.initAction = delegate()
            {
                this.pawn.pather.StartPath(base.TargetThingA, PathEndMode.ClosestTouch);
            };
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            toil.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(toil);

            yield return(Toils_General.Wait(60, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));

            yield return(new Toil
            {
                initAction = delegate()
                {
                    Thing thing = job.targetA.Thing;
                    Corpse corpse = thing as Corpse;
                    Pawn pawn;
                    if (corpse == null)
                    {
                        pawn = thing as Pawn;
                    }
                    else
                    {
                        pawn = corpse.InnerPawn;
                    }
                    //
                    if (pawn == null)
                    {
                        Log.Error("target pawn is null");
                    }

                    foreach (ThingWithComps thingWithComps in pawn.equipment.AllEquipmentListForReading)
                    {
                        if (thingWithComps.def.IsWeapon)
                        {
                            ThingWithComps tmp;
                            pawn.equipment.TryDropEquipment(thingWithComps, out tmp, thing.Position);
                            break;
                        }
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
Beispiel #8
0
        public override AcceptanceReport CanDesignateThing(Thing t)
        {
            AcceptanceReport result;

            if (base.Map.designationManager.DesignationOn(t, this.Designation) != null)
            {
                result = false;
            }
            else
            {
                result = StrippableUtility.CanBeStrippedByColony(t);
            }
            return(result);
        }
        public static void DrawThingRow(Pawn pawn, ref float y, ref float width, Thing thing, ref bool inventory)
        {
            Corpse corpse = pawn.Corpse;

            inventory = inventory && corpse == null;

            //if (pawn.Downed || corpse != null || pawn.IsPrisoner && pawn.guest.PrisonerIsSecure)
            //if(StrippableUtility.CanBeStrippedByColony(pawn))
            if (corpse != null || StrippableUtility.CanBeStrippedByColony(pawn))
            {
                CompStripChecker c = CompStripChecker.GetChecker(thing, false);
                if (c == null)
                {
                    width -= 24f;
                    return;
                }

                ThingWithComps holder = corpse == null ? pawn : (ThingWithComps)corpse;
                Rect           rect   = new Rect(0f, y, width, 28f);

                Rect rect2 = new Rect(rect.width - 24f, y, 24f, 24f);

                if (c.ShouldStrip)
                {
                    TooltipHandler.TipRegion(rect2, "StripThingCancel".Translate());

                    //weird shenanigans with colors
                    var cl = GUI.color;
                    if (Widgets.ButtonImage(rect2, ContentFinder <Texture2D> .Get("UI/Icons/Strip_Thing_Cancel"), hColor))
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                        SetShouldStrip(false, c, pawn, holder);
                    }
                    GUI.color = cl;
                }
                else
                {
                    TooltipHandler.TipRegion(rect2, "StripThing".Translate());
                    if (Widgets.ButtonImage(rect2, ContentFinder <Texture2D> .Get("UI/Icons/Strip_Thing")))
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                        SetShouldStrip(true, c, pawn, holder);
                    }
                }
                width -= 24f;
            }
            return;
        }
 public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
 {
     if (t.Map.designationManager.DesignationOn(t, DesignationDefOf.Strip) == null)
     {
         return(false);
     }
     if (!pawn.CanReserve(t, 1, -1, null, forced))
     {
         return(false);
     }
     if (!StrippableUtility.CanBeStrippedByColony(t))
     {
         return(false);
     }
     return(true);
 }
Beispiel #11
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            this.FailOnAggroMentalState(TargetIndex.A);
            this.FailOn(() => !StrippableUtility.CanBeStrippedByColony(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0049: stateMachine*/)._0024this.TargetThingA));
            Toil gotoThing = new Toil
            {
                initAction = delegate
                {
                    ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_006c: stateMachine*/)._0024this.pawn.pather.StartPath(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_006c: stateMachine*/)._0024this.TargetThingA, PathEndMode.ClosestTouch);
                },
                defaultCompleteMode = ToilCompleteMode.PatherArrival
            };

            gotoThing.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(gotoThing);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Beispiel #12
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (t.Map.designationManager.DesignationOn(t, DesignationDefOf.Strip) == null)
            {
                return(false);
            }
            LocalTargetInfo target = t;
            bool            ignoreOtherReservations = forced;

            if (!pawn.CanReserve(target, 1, -1, null, ignoreOtherReservations))
            {
                return(false);
            }
            if (!StrippableUtility.CanBeStrippedByColony(t))
            {
                return(false);
            }
            return(true);
        }
 private static bool <ForStrip> m__1(TargetInfo targ)
 {
     return(targ.HasThing && StrippableUtility.CanBeStrippedByColony(targ.Thing));
 }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOnDespawnedOrNull(TargetIndex.A);
                    this.FailOnAggroMentalState(TargetIndex.A);
                    this.FailOn(() => !StrippableUtility.CanBeStrippedByColony(base.TargetThingA));
                    gotoThing            = new Toil();
                    gotoThing.initAction = delegate()
                    {
                        this.pawn.pather.StartPath(base.TargetThingA, PathEndMode.ClosestTouch);
                    };
                    gotoThing.defaultCompleteMode = ToilCompleteMode.PatherArrival;
                    gotoThing.FailOnDespawnedNullOrForbidden(TargetIndex.A);
                    this.$current = gotoThing;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$current = Toils_General.Wait(60, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                {
                    Toil strip = new Toil();
                    strip.initAction = delegate()
                    {
                        Thing       thing       = this.job.targetA.Thing;
                        Designation designation = base.Map.designationManager.DesignationOn(thing, DesignationDefOf.Strip);
                        if (designation != null)
                        {
                            designation.Delete();
                        }
                        IStrippable strippable = thing as IStrippable;
                        if (strippable != null)
                        {
                            strippable.Strip();
                        }
                        this.pawn.records.Increment(RecordDefOf.BodiesStripped);
                    };
                    strip.defaultCompleteMode = ToilCompleteMode.Instant;
                    this.$current             = strip;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);
                }

                case 3u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }