Пример #1
0
        public override void Generate(Map map, GenStepParams parms)
        {
            if (!MapGenerator.TryGetVar("RectOfInterest", out CellRect var))
            {
                var = CellRect.SingleCell(map.Center);
            }
            Faction       faction       = (map.ParentFaction != null && map.ParentFaction != Faction.OfPlayer) ? map.ParentFaction : Find.FactionManager.RandomEnemyFaction();
            ResolveParams resolveParams = default(ResolveParams);

            resolveParams.rect                    = GetOutpostRect(var, map);
            resolveParams.faction                 = faction;
            resolveParams.edgeDefenseWidth        = 2;
            resolveParams.edgeDefenseTurretsCount = Rand.RangeInclusive(0, 1);
            resolveParams.edgeDefenseMortarsCount = 0;
            if (parms.siteCoreOrPart != null)
            {
                resolveParams.settlementPawnGroupPoints = parms.siteCoreOrPart.parms.threatPoints;
                resolveParams.settlementPawnGroupSeed   = OutpostSitePartUtility.GetPawnGroupMakerSeed(parms.siteCoreOrPart.parms);
            }
            else
            {
                resolveParams.settlementPawnGroupPoints = defaultPawnGroupPointsRange.RandomInRange;
            }
            RimWorld.BaseGen.BaseGen.globalSettings.map          = map;
            RimWorld.BaseGen.BaseGen.globalSettings.minBuildings = 1;
            RimWorld.BaseGen.BaseGen.globalSettings.minBarracks  = 1;
            RimWorld.BaseGen.BaseGen.symbolStack.Push("settlement", resolveParams);
            RimWorld.BaseGen.BaseGen.Generate();
        }
Пример #2
0
        private int GetEnemiesCount(Site site, SiteCoreOrPartParams parms)
        {
            PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms();

            pawnGroupMakerParms.tile        = site.Tile;
            pawnGroupMakerParms.faction     = site.Faction;
            pawnGroupMakerParms.groupKind   = PawnGroupKindDefOf.Settlement;
            pawnGroupMakerParms.points      = parms.threatPoints;
            pawnGroupMakerParms.inhabitants = true;
            pawnGroupMakerParms.seed        = OutpostSitePartUtility.GetPawnGroupMakerSeed(parms);
            return(PawnGroupMakerUtility.GeneratePawnKindsExample(pawnGroupMakerParms).Count());
        }
 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?(OutpostSitePartUtility.GetPawnGroupMakerSeed(parms))
     }).Count <PawnKindDef>());
 }
Пример #4
0
        public override void Generate(Map map, GenStepParams parms)
        {
            if (!MapGenerator.TryGetVar <CellRect>("RectOfInterest", out var var))
            {
                var = CellRect.SingleCell(map.Center);
            }
            if (!MapGenerator.TryGetVar <List <CellRect> >("UsedRects", out var var2))
            {
                var2 = new List <CellRect>();
                MapGenerator.SetVar("UsedRects", var2);
            }
            Faction       faction       = ((map.ParentFaction != null && map.ParentFaction != Faction.OfPlayer) ? map.ParentFaction : Find.FactionManager.RandomEnemyFaction());
            ResolveParams resolveParams = default(ResolveParams);

            resolveParams.rect                    = GetOutpostRect(var, var2, map);
            resolveParams.faction                 = faction;
            resolveParams.edgeDefenseWidth        = 2;
            resolveParams.edgeDefenseTurretsCount = Rand.RangeInclusive(0, 1);
            resolveParams.edgeDefenseMortarsCount = 0;
            if (parms.sitePart != null)
            {
                resolveParams.settlementPawnGroupPoints = parms.sitePart.parms.threatPoints;
                resolveParams.settlementPawnGroupSeed   = OutpostSitePartUtility.GetPawnGroupMakerSeed(parms.sitePart.parms);
            }
            else
            {
                resolveParams.settlementPawnGroupPoints = defaultPawnGroupPointsRange.RandomInRange;
            }
            RimWorld.BaseGen.BaseGen.globalSettings.map          = map;
            RimWorld.BaseGen.BaseGen.globalSettings.minBuildings = 1;
            RimWorld.BaseGen.BaseGen.globalSettings.minBarracks  = 1;
            RimWorld.BaseGen.BaseGen.symbolStack.Push("settlement", resolveParams);
            if (faction != null && faction == Faction.Empire)
            {
                RimWorld.BaseGen.BaseGen.globalSettings.minThroneRooms = 1;
                RimWorld.BaseGen.BaseGen.globalSettings.minLandingPads = 1;
            }
            RimWorld.BaseGen.BaseGen.Generate();
            if (faction != null && faction == Faction.Empire && RimWorld.BaseGen.BaseGen.globalSettings.landingPadsGenerated == 0)
            {
                GenStep_Settlement.GenerateLandingPadNearby(resolveParams.rect, map, faction, out var usedRect);
                var2.Add(usedRect);
            }
            var2.Add(resolveParams.rect);
        }
Пример #5
0
        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?(OutpostSitePartUtility.GetPawnGroupMakerSeed(parms.siteCoreOrPart.parms));
            }
            else
            {
                resolveParams.settlementPawnGroupPoints = new float?(this.defaultPawnGroupPointsRange.RandomInRange);
            }
            BaseGen.globalSettings.map          = map;
            BaseGen.globalSettings.minBuildings = 1;
            BaseGen.globalSettings.minBarracks  = 1;
            BaseGen.symbolStack.Push("settlement", resolveParams);
            BaseGen.Generate();
        }