public static Map SetupCaravanAttackMap(Caravan caravan, List<Pawn> enemies) { int num = CaravanIncidentUtility.CalculateIncidentMapSize(caravan.PawnsListForReading, enemies); Map map = CaravanIncidentUtility.GetOrGenerateMapForIncident(caravan, new IntVec3(num, 1, num), WorldObjectDefOf.Ambush); IntVec3 playerStartingSpot; IntVec3 root; MultipleCaravansCellFinder.FindStartingCellsFor2Groups(map, out playerStartingSpot, out root); CaravanEnterMapUtility.Enter(caravan, map, (Pawn x) => CellFinder.RandomSpawnCellForPawnNear(playerStartingSpot, map, 4), CaravanDropInventoryMode.DoNotDrop, true); for (int i = 0; i < enemies.Count; i++) { IntVec3 loc = CellFinder.RandomSpawnCellForPawnNear(root, map, 4); GenSpawn.Spawn(enemies[i], loc, map, Rot4.Random, false); } return map; }
public static Map SetupCaravanAttackMap(Caravan caravan, List <Pawn> enemies, bool sendLetterIfRelatedPawns) { int num = CaravanIncidentUtility.CalculateIncidentMapSize(caravan.PawnsListForReading, enemies); Map map = CaravanIncidentUtility.GetOrGenerateMapForIncident(caravan, new IntVec3(num, 1, num), WorldObjectDefOf.Ambush); IntVec3 playerStartingSpot; IntVec3 root; MultipleCaravansCellFinder.FindStartingCellsFor2Groups(map, out playerStartingSpot, out root); CaravanEnterMapUtility.Enter(caravan, map, (Pawn x) => CellFinder.RandomSpawnCellForPawnNear(playerStartingSpot, map, 4), CaravanDropInventoryMode.DoNotDrop, true); for (int i = 0; i < enemies.Count; i++) { IntVec3 loc = CellFinder.RandomSpawnCellForPawnNear(root, map, 4); GenSpawn.Spawn(enemies[i], loc, map, Rot4.Random, WipeMode.Vanish, false); } if (sendLetterIfRelatedPawns) { PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(enemies, "LetterRelatedPawnsGroupGeneric".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, true, true); } return(map); }