public static void MakeColony(params ColonyMakerFlag[] flags) { bool godMode = DebugSettings.godMode; DebugSettings.godMode = true; Thing.allowDestroyNonDestroyable = true; if (FixedColonyAnimalsDebug.usedCells == null) { FixedColonyAnimalsDebug.usedCells = new BoolGrid(FixedColonyAnimalsDebug.Map); } else { FixedColonyAnimalsDebug.usedCells.ClearAndResizeTo(FixedColonyAnimalsDebug.Map); } FixedColonyAnimalsDebug.overRect = new CellRect(FixedColonyAnimalsDebug.Map.Center.x - 50, FixedColonyAnimalsDebug.Map.Center.z - 50, 100, 100); FixedColonyAnimalsDebug.DeleteAllSpawnedPawns(); GenDebug.ClearArea(FixedColonyAnimalsDebug.overRect, Find.CurrentMap); if (flags.Contains(ColonyMakerFlag.Animals)) { foreach (PawnKindDef pawnKindDef in from k in DefDatabase <PawnKindDef> .AllDefs where k.RaceProps.Animal select k) { CellRect cellRect; if (!FixedColonyAnimalsDebug.TryGetFreeRect(6, 3, out cellRect)) { return; } cellRect = cellRect.ContractedBy(1); foreach (IntVec3 c in cellRect) { FixedColonyAnimalsDebug.Map.terrainGrid.SetTerrain(c, TerrainDefOf.Concrete); } GenSpawn.Spawn(PawnGenerator.GeneratePawn(pawnKindDef, null), cellRect.Cells.ElementAt(0), FixedColonyAnimalsDebug.Map, WipeMode.Vanish); IntVec3 intVec = cellRect.Cells.ElementAt(1); Pawn deadpawn = (Pawn)GenSpawn.Spawn(PawnGenerator.GeneratePawn(pawnKindDef, null), intVec, FixedColonyAnimalsDebug.Map, WipeMode.Vanish); deadpawn.Kill(null); CompRottable compRottable = ((Corpse)intVec.GetThingList(Find.CurrentMap).First((Thing t) => t is Corpse)).TryGetComp <CompRottable>(); if (compRottable != null) { compRottable.RotProgress += 1200000f; } if (pawnKindDef.RaceProps.leatherDef != null) { GenSpawn.Spawn(pawnKindDef.RaceProps.leatherDef, cellRect.Cells.ElementAt(2), FixedColonyAnimalsDebug.Map, WipeMode.Vanish); } if (pawnKindDef.RaceProps.meatDef != null) { GenSpawn.Spawn(pawnKindDef.RaceProps.meatDef, cellRect.Cells.ElementAt(3), FixedColonyAnimalsDebug.Map, WipeMode.Vanish); } } } FixedColonyAnimalsDebug.ClearAllHomeArea(); FixedColonyAnimalsDebug.FillWithHomeArea(FixedColonyAnimalsDebug.overRect); DebugSettings.godMode = godMode; Thing.allowDestroyNonDestroyable = false; }
private static void MakeColonyAnimals() { FixedColonyAnimalsDebug.MakeColony(new ColonyMakerFlag[1]); }