private static void CountdownEnded() { StringBuilder stringBuilder = new StringBuilder(); Pawn theFutureTamer = null; foreach (Pawn current in PawnsFinder.AllMaps_FreeColonistsSpawned) { stringBuilder.AppendLine(" " + current.LabelCap); theFutureTamer = current; } PawnGenerationRequest request = new PawnGenerationRequest(InternalDefOf.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, womb); string victoryText = "GR_GameOverArchotech".Translate(stringBuilder.ToString()); GameVictoryUtility.ShowCredits(victoryText); womb.StopHibernatingWomb(); }
private void DoEndGameHandling(int interval) { if (!IsActive && !IsActivatingPossible) { return; } if (IsActive) { int remainingTicks = GetActiveRemainingTicks; if (remainingTicks <= 1200) { Find.ActiveLesson.Deactivate(); if (remainingTicks <= 1200) { // last 20s: every second a sound if (remainingTicks % 60 == 0) { SoundDefOf.Click.PlayOneShotOnCamera(null); } } if (remainingTicks == 300) { ScreenFader.StartFade(Color.white, 5f); } } if (remainingTicks <= 0) { // Endgame finished IsActive = false; Find.TickManager.CurTimeSpeed = TimeSpeed.Paused; TaleRecorder.RecordTale(DefDatabase <TaleDef> .GetNamedSilentFail("LaunchedShip")); StringBuilder stringBuilder = new StringBuilder(); string victoryText = "EndGame_Victory".Translate(GameVictoryUtility.PawnsLeftBehind()); GameVictoryUtility.ShowCredits(victoryText); //GenGameEnd.EndGameDialogMessage(victoryText, true); // Last: Destroy this building --> disabled //parent.Destroy(DestroyMode.Vanish); return; } if (ticksUntilNextIncident < 0) { Try2InitiateRaid(); ticksUntilNextIncident = GetNewTicksUntilNextIncident; return; } ticksUntilNextIncident -= interval; return; } }
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); }
public static bool CountdownEnded() { Log.Message("CountdownEnded"); bool hard_fail = false; List <String> errors = new List <string>(); if (pht_root != null) { Building shipRoot = (Building)pht_root.GetValue(null); List <Building> list = null; try { list = ShipUtility.ShipBuildingsAttachedTo(shipRoot).ToList <Building>(); if (list.Count == 0) { throw new Exception("LIST_EMPTY"); } } catch (Exception e) { Log.Error(e.Message); errors.Add(e.Message); output_errors(errors, true); GameVictoryUtility.ShowCredits("ERROR"); return(false); } Log.Message("creating ending message"); StringBuilder stringBuilder = new StringBuilder(); foreach (Building building in list) { try { Building_CryptosleepCasket building_CryptosleepCasket = building as Building_CryptosleepCasket; if (building_CryptosleepCasket != null && building_CryptosleepCasket.HasAnyContents) { stringBuilder.AppendLine(" " + building_CryptosleepCasket.ContainedThing.LabelCap); Find.StoryWatcher.statsRecord.colonistsLaunched++; TaleRecorder.RecordTale(TaleDefOf.LaunchedShip, new object[] { building_CryptosleepCasket.ContainedThing }); } } catch (Exception e) { Log.Error("error for a building in the list"); Log.Error(e.Message); errors.Add("error for a building in the list"); errors.Add(e.Message); } } Log.Message("ShowCreditsb"); GameVictoryUtility.ShowCredits(GameVictoryUtility.MakeEndCredits("GameOverShipLaunchedIntro".Translate(), "GameOverShipLaunchedEnding".Translate(), stringBuilder.ToString())); Log.Message("ShowCreditsa"); try { List <Building> listcopy = new List <Building>(list); errors = saveShip(listcopy, errors); } catch (Exception e) { hard_fail = true; Log.Message("error while saving"); errors.Add("error while saving"); errors.Add(e.Message); Log.Error(e.Message); } foreach (Building building in list) { building.Destroy(DestroyMode.Vanish); } output_errors(errors, hard_fail); return(false); } else { Log.Error("pht_root null"); errors.Add("pht_root null"); output_errors(errors, true); GameVictoryUtility.ShowCredits("ERROR"); } GameVictoryUtility.ShowCredits(GameVictoryUtility.MakeEndCredits("GameOverShipLaunchedIntro".Translate(), "GameOverShipLaunchedEnding".Translate(), null, "GameOverColonistsEscaped", null), null, false, 5f); return(false); }