private int GetEnemiesCount(Site site, SiteCoreOrPartParams parms) { return(PawnGroupMakerUtility.GeneratePawnKindsExample(new PawnGroupMakerParms { tile = site.Tile, faction = site.Faction, groupKind = PawnGroupKindDefOf.Settlement, points = parms.threatPoints, inhabitants = true, seed = new int?(SitePartWorker_Outpost.GetPawnGroupMakerSeed(parms)) }).Count <PawnKindDef>()); }
public override void Generate(Map map, GenStepParams parms) { CellRect rectToDefend; if (!MapGenerator.TryGetVar <CellRect>("RectOfInterest", out rectToDefend)) { rectToDefend = CellRect.SingleCell(map.Center); } Faction faction; if (map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer) { faction = Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined); } else { faction = map.ParentFaction; } ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = this.GetOutpostRect(rectToDefend, map); resolveParams.faction = faction; resolveParams.edgeDefenseWidth = new int?(2); resolveParams.edgeDefenseTurretsCount = new int?(Rand.RangeInclusive(0, 1)); resolveParams.edgeDefenseMortarsCount = new int?(0); if (parms.siteCoreOrPart != null) { resolveParams.settlementPawnGroupPoints = new float?(parms.siteCoreOrPart.parms.threatPoints); resolveParams.settlementPawnGroupSeed = new int?(SitePartWorker_Outpost.GetPawnGroupMakerSeed(parms.siteCoreOrPart.parms)); } BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("settlement", resolveParams); BaseGen.Generate(); }