Пример #1
0
        public void FailConstruction(Pawn worker)
        {
            Map map = base.Map;

            this.Destroy(DestroyMode.FailConstruction);
            Blueprint_Build blueprint_Build = null;

            if (this.def.entityDefToBuild.blueprintDef != null)
            {
                blueprint_Build            = (Blueprint_Build)ThingMaker.MakeThing(this.def.entityDefToBuild.blueprintDef, null);
                blueprint_Build.stuffToUse = base.Stuff;
                blueprint_Build.SetFactionDirect(base.Faction);
                GenSpawn.Spawn(blueprint_Build, base.Position, map, base.Rotation, WipeMode.FullRefund, false);
            }
            Lord lord = worker.GetLord();

            if (lord != null)
            {
                lord.Notify_ConstructionFailed(worker, this, blueprint_Build);
            }
            MoteMaker.ThrowText(this.DrawPos, map, "TextMote_ConstructionFail".Translate(), 6f);
            if (base.Faction == Faction.OfPlayer && this.WorkToBuild > 1400f)
            {
                Messages.Message("MessageConstructionFailed".Translate(new object[]
                {
                    this.LabelEntityToBuild,
                    worker.LabelShort
                }), new TargetInfo(base.Position, map, false), MessageTypeDefOf.NegativeEvent, true);
            }
        }
Пример #2
0
        public static IEnumerable <Blueprint_Build> PlaceBlueprints(IntVec3 placeCenter, Map map, Faction placeFaction, float points)
        {
            SiegeBlueprintPlacer.center  = placeCenter;
            SiegeBlueprintPlacer.faction = placeFaction;
            using (IEnumerator <Blueprint_Build> enumerator = SiegeBlueprintPlacer.PlaceSandbagBlueprints(map).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Blueprint_Build blue2 = enumerator.Current;
                    yield return(blue2);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            using (IEnumerator <Blueprint_Build> enumerator2 = SiegeBlueprintPlacer.PlaceArtilleryBlueprints(points, map).GetEnumerator())
            {
                if (enumerator2.MoveNext())
                {
                    Blueprint_Build blue = enumerator2.Current;
                    yield return(blue);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_0166:
            /*Error near IL_0167: Unexpected return in MoveNext()*/;
        }
Пример #3
0
 public override void Notify_ConstructionFailed(Pawn pawn, Frame frame, Blueprint_Build newBlueprint)
 {
     base.Notify_ConstructionFailed(pawn, frame, newBlueprint);
     if (frame.Faction == this.lord.faction && newBlueprint != null)
     {
         this.Data.blueprints.Add(newBlueprint);
     }
 }
        public static Blueprint_Build PlaceBlueprintForBuild(BuildableDef sourceDef, IntVec3 center, Map map, Rot4 rotation, Faction faction, ThingDef stuff)
        {
            Blueprint_Build blueprint_Build = (Blueprint_Build)ThingMaker.MakeThing(sourceDef.blueprintDef, null);

            blueprint_Build.SetFactionDirect(faction);
            blueprint_Build.stuffToUse = stuff;
            GenSpawn.Spawn(blueprint_Build, center, map, rotation, WipeMode.Vanish, false);
            return(blueprint_Build);
        }
Пример #5
0
        public static Blueprint_Build PlaceBlueprintForBuild(BuildableDef sourceDef, IntVec3 center, Map map, Rot4 rotation, Faction faction, ThingDef stuff)
        {
            Blueprint_Build obj = (Blueprint_Build)ThingMaker.MakeThing(sourceDef.blueprintDef);

            obj.SetFactionDirect(faction);
            obj.stuffToUse = stuff;
            GenSpawn.Spawn(obj, center, map, rotation);
            return(obj);
        }
Пример #6
0
        private static IEnumerable <Blueprint_Build> PlaceSandbagBlueprints(Map map)
        {
            SiegeBlueprintPlacer.placedSandbagLocs.Clear();
            int numSandbags = SiegeBlueprintPlacer.NumSandbagRange.RandomInRange;
            int i           = 0;

            while (i < numSandbags)
            {
                IntVec3 bagRoot = SiegeBlueprintPlacer.FindSandbagRoot(map);
                if (bagRoot.IsValid)
                {
                    Rot4 growDirA = (bagRoot.x <= SiegeBlueprintPlacer.center.x) ? Rot4.East : Rot4.West;
                    Rot4 growDirB = (bagRoot.z <= SiegeBlueprintPlacer.center.z) ? Rot4.North : Rot4.South;
                    using (IEnumerator <Blueprint_Build> enumerator = SiegeBlueprintPlacer.MakeSandbagLine(bagRoot, map, growDirA, SiegeBlueprintPlacer.SandbagLengthRange.RandomInRange).GetEnumerator())
                    {
                        if (enumerator.MoveNext())
                        {
                            Blueprint_Build bag2 = enumerator.Current;
                            yield return(bag2);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                    }
                    bagRoot += growDirB.FacingCell;
                    using (IEnumerator <Blueprint_Build> enumerator2 = SiegeBlueprintPlacer.MakeSandbagLine(bagRoot, map, growDirB, SiegeBlueprintPlacer.SandbagLengthRange.RandomInRange).GetEnumerator())
                    {
                        if (enumerator2.MoveNext())
                        {
                            Blueprint_Build bag = enumerator2.Current;
                            yield return(bag);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                    }
                    i++;
                    continue;
                }
                break;
            }
            yield break;
IL_0271:
            /*Error near IL_0272: Unexpected return in MoveNext()*/;
        }
Пример #7
0
        public void FailConstruction(Pawn worker)
        {
            Map map = base.Map;

            Destroy(DestroyMode.FailConstruction);
            Blueprint_Build blueprint_Build = null;

            if (def.entityDefToBuild.blueprintDef != null)
            {
                blueprint_Build            = (Blueprint_Build)ThingMaker.MakeThing(def.entityDefToBuild.blueprintDef);
                blueprint_Build.stuffToUse = base.Stuff;
                blueprint_Build.SetFactionDirect(base.Faction);
                GenSpawn.Spawn(blueprint_Build, base.Position, map, base.Rotation, WipeMode.FullRefund);
            }
            worker.GetLord()?.Notify_ConstructionFailed(worker, this, blueprint_Build);
            MoteMaker.ThrowText(DrawPos, map, "TextMote_ConstructionFail".Translate(), 6f);
            if (base.Faction == Faction.OfPlayer && WorkToBuild > 1400f)
            {
                Messages.Message("MessageConstructionFailed".Translate(LabelEntityToBuild, worker.LabelShort, worker.Named("WORKER")), new TargetInfo(base.Position, map), MessageTypeDefOf.NegativeEvent);
            }
        }
Пример #8
0
        private static IEnumerable <Blueprint_Build> PlaceSandbagBlueprints(Map map)
        {
            placedSandbagLocs.Clear();
            int numSandbags = NumSandbagRange.RandomInRange;

            for (int i = 0; i < numSandbags; i++)
            {
                IntVec3 bagRoot2 = FindSandbagRoot(map);
                if (!bagRoot2.IsValid)
                {
                    break;
                }
                Rot4 growDirA = (bagRoot2.x <= center.x) ? Rot4.East : Rot4.West;
                Rot4 growDirB = (bagRoot2.z <= center.z) ? Rot4.North : Rot4.South;
                using (IEnumerator <Blueprint_Build> enumerator = MakeSandbagLine(bagRoot2, map, growDirA, SandbagLengthRange.RandomInRange).GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        Blueprint_Build bag2 = enumerator.Current;
                        yield return(bag2);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
                bagRoot2 += growDirB.FacingCell;
                using (IEnumerator <Blueprint_Build> enumerator2 = MakeSandbagLine(bagRoot2, map, growDirB, SandbagLengthRange.RandomInRange).GetEnumerator())
                {
                    if (enumerator2.MoveNext())
                    {
                        Blueprint_Build bag = enumerator2.Current;
                        yield return(bag);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            yield break;
IL_0271:
            /*Error near IL_0272: Unexpected return in MoveNext()*/;
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    SiegeBlueprintPlacer.center  = placeCenter;
                    SiegeBlueprintPlacer.faction = placeFaction;
                    enumerator = SiegeBlueprintPlacer.PlaceSandbagBlueprints(map).GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_E9;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        blue          = enumerator.Current;
                        this.$current = blue;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                enumerator2 = SiegeBlueprintPlacer.PlaceArtilleryBlueprints(points, map).GetEnumerator();
                num         = 4294967293u;
                try
                {
IL_E9:
                    switch (num)
                    {
                    }
                    if (enumerator2.MoveNext())
                    {
                        blue2         = enumerator2.Current;
                        this.$current = blue2;
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator2 != null)
                        {
                            enumerator2.Dispose();
                        }
                    }
                }
                this.$PC = -1;
                return(false);
            }