Esempio n. 1
0
        public static IEnumerable <string> LaunchFailReasons(Building rootBuilding)
        {
            List <Building> shipParts = ArchotechUtility.ShipBuildingsAttachedTo(rootBuilding).ToList <Building>();

            foreach (KeyValuePair <ThingDef, int> partDef in ArchotechUtility.RequiredParts())
            {
                int shipPartCount = shipParts.Count((Building pa) => pa.def == partDef.Key);
                if (shipPartCount < partDef.Value)
                {
                    yield return(string.Format("{0}: {1}x {2} ({3} {4})", new object[]
                    {
                        "ShipReportMissingPart".Translate(),
                        partDef.Value - shipPartCount,
                        partDef.Key.label,
                        "ShipReportMissingPartRequires".Translate(),
                        partDef.Value
                    }));
                }
            }

            foreach (Building part in shipParts)
            {
                CompHibernatable hibernatable = part.TryGetComp <CompHibernatable>();
                if (hibernatable != null && hibernatable.State == HibernatableStateDefOf.Hibernating)
                {
                    yield return(string.Format("{0}: {1}", "ShipReportHibernating".Translate(), part.LabelCap));
                }
                if (hibernatable != null && !hibernatable.Running)
                {
                    yield return(string.Format("{0}: {1}", "ShipReportNotReady".Translate(), part.LabelCap));
                }
            }
        }
Esempio n. 2
0
        public static void StartupHibernatingParts(Building rootBuilding)
        {
            List <Building> list = ArchotechUtility.ShipBuildingsAttachedTo(rootBuilding).ToList <Building>();

            foreach (Building current in list)
            {
                CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
                if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Hibernating)
                {
                    compHibernatable.Startup();
                }
            }
        }
Esempio n. 3
0
        private static void CountdownEnded()
        {
            List <Building> list           = ArchotechUtility.ShipBuildingsAttachedTo(ArchotechCountdown.shipRoot).ToList <Building>();
            StringBuilder   stringBuilder  = new StringBuilder();
            Pawn            theFutureTamer = null;

            foreach (Pawn current in PawnsFinder.AllMaps_FreeColonistsSpawned)
            {
                stringBuilder.AppendLine("   " + current.LabelCap);
                theFutureTamer = current;
            }

            foreach (Building current in list)
            {
                if (current.def.defName == "GR_ArchotechPlatform")
                {
                    Map     mapToPlaceAt      = current.Map;
                    IntVec3 positionToPlaceAt = current.Position;
                    current.Destroy(DestroyMode.Vanish);
                    Building new_Platform = (Building)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("GR_SpentArchotechPlatform", true));
                    new_Platform.SetFaction(Faction.OfPlayer);
                    GenSpawn.Spawn(new_Platform, positionToPlaceAt, mapToPlaceAt);

                    PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDef.Named("GR_ArchotechCentipede"), Faction.OfPlayer, PawnGenerationContext.NonPlayer, -1, false, true, false, false, true, false, 1f, false, true, true, false, false);
                    Pawn pawn = PawnGenerator.GeneratePawn(request);
                    pawn.training.Train(TrainableDefOf.Obedience, theFutureTamer, true);
                    pawn.training.Train(TrainableDefOf.Release, theFutureTamer, true);


                    PawnUtility.TrySpawnHatchedOrBornPawn(pawn, new_Platform);
                }
            }
            string victoryText = "GR_GameOverArchotech".Translate(stringBuilder.ToString());

            GameVictoryUtility.ShowCredits(victoryText);
        }