protected override void ScatterAt(IntVec3 c, Map map, int stackCount = 1) { ThingDef stuffDef = BaseGenUtility.RandomCheapWallStuff(null, true); if (Rand.Bool) { bool @bool = Rand.Bool; int randomInRange = this.WallLengthRange.RandomInRange; CellRect cellRect = new CellRect(c.x, c.z, (!@bool) ? 1 : randomInRange, (!@bool) ? randomInRange : 1); if (this.CanPlaceAncientBuildingInRange(cellRect.ExpandedBy(1), map)) { this.MakeLongWall(c, map, this.WallLengthRange.RandomInRange, @bool, stuffDef); } } else { CellRect cellRect2 = new CellRect(c.x, c.z, this.ShedSizeRange.RandomInRange, this.ShedSizeRange.RandomInRange); CellRect rect = cellRect2.ClipInsideMap(map); if (this.CanPlaceAncientBuildingInRange(rect, map)) { BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("ancientRuins", rect); BaseGen.Generate(); } } }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); int randomInRange = GenStep_AmbrosiaAnimalsGenLGE.AmbrosiaSproutSizeWidth.RandomInRange; int randomInRange2 = GenStep_AmbrosiaAnimalsGenLGE.AmbrosiaSproutSizeHeight.RandomInRange; CellRect rect = new CellRect(Rand.RangeInclusive(this.adventureRegion.minX + 10, this.adventureRegion.maxX - AmbrosiaSproutSizeWidth.max - 10), Rand.RangeInclusive(this.adventureRegion.minZ + 10, this.adventureRegion.maxZ - AmbrosiaSproutSizeHeight.max - 10), randomInRange, randomInRange2); rect.ClipInsideMap(map); foreach (IntVec3 c2 in rect) { CompTerrainPumpDry.AffectCell(map, c2); for (int i = 0; i < 8; i++) { Vector3 b = Rand.InsideUnitCircleVec3 * 3f; IntVec3 c3 = IntVec3.FromVector3(c2.ToVector3Shifted() + b); if (c3.InBounds(map)) { CompTerrainPumpDry.AffectCell(map, c3); } } } ResolveParams baseResolveParams = default(ResolveParams); baseResolveParams.rect = rect; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("ambrosiaAreaPrepareLGE", baseResolveParams); BaseGen.Generate(); }
protected override void ScatterAt(IntVec3 c, Map map, int stackCount = 1) { RimEconomyWorldManager rimEconomyWorldManager = Find.World.GetComponent <RimEconomyWorldManager>(); List <Speciality> specialities = rimEconomyWorldManager.getSettlementTileSpecialities(map.Tile); int specialityPowerCount = specialities.Count + (specialities.FindAll((Speciality speciality) => speciality.produceSilver()).Count) * RimEconomy.SilverPower; int extraFactionBasePowerPerSpeciality = RimEconomy.SettingInt["extraFactionBasePowerPerSpeciality"].Value; IntRange factionBaseSizeRange = new IntRange(Math.Min(map.Size.x - 50, 34 + (int)(specialityPowerCount * extraFactionBasePowerPerSpeciality)), Math.Min(map.Size.z - 50, 38 + (int)(specialityPowerCount * extraFactionBasePowerPerSpeciality))); int randomInRange = factionBaseSizeRange.RandomInRange; int randomInRange2 = factionBaseSizeRange.RandomInRange; CellRect rect = new CellRect(c.x - randomInRange / 2, c.z - randomInRange2 / 2, randomInRange, randomInRange2); Faction faction; if (map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer) { faction = Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined); } else { faction = map.ParentFaction; } rect.ClipInsideMap(map); ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = rect; resolveParams.faction = faction; BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("factionBase", resolveParams); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); this.baseResolveParams.rect = new CellRect(0, 0, map.Size.x, map.Size.z); BaseGen.symbolStack.Push("exampleBaselineLostCityLGE", this.baseResolveParams); BaseGen.Generate(); }
protected override void ScatterAt(IntVec3 c, Map map, int stackCount = 1) { int randomInRange = GenStep_Settlement.SettlementSizeRange.RandomInRange; int randomInRange2 = GenStep_Settlement.SettlementSizeRange.RandomInRange; CellRect rect = new CellRect(c.x - randomInRange / 2, c.z - randomInRange2 / 2, randomInRange, randomInRange2); Faction faction; if (map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer) { faction = Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined); } else { faction = map.ParentFaction; } rect.ClipInsideMap(map); ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = rect; resolveParams.faction = faction; BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("settlement", resolveParams); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); int prisonCampWidth = GenStep_PrisonCampLGE.PrisonCampSizeWidth.RandomInRange; int prisonCampHeight = GenStep_PrisonCampLGE.PrisonCampSizeHeight.RandomInRange; CellRect rect = new CellRect(this.adventureRegion.minX + (this.adventureRegion.Width / 2) - (prisonCampWidth / 2), this.adventureRegion.minZ + (this.adventureRegion.Height / 2) - (prisonCampHeight / 2), prisonCampWidth, prisonCampHeight); rect.ClipInsideMap(map); foreach (IntVec3 c2 in rect) { CompTerrainPumpDry.AffectCell(map, c2); for (int i = 0; i < 8; i++) { Vector3 b = Rand.InsideUnitCircleVec3 * 3f; IntVec3 c3 = IntVec3.FromVector3(c2.ToVector3Shifted() + b); if (c3.InBounds(map)) { CompTerrainPumpDry.AffectCell(map, c3); } } } ResolveParams baseResolveParams = default(ResolveParams); baseResolveParams.rect = rect; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("prisonCampLGE", baseResolveParams); BaseGen.Generate(); }
public static void DoScatterAt(IntVec3 c, Map map, GenStepParams parms, int stackCount = 1) { int randomInRange = SettlementSizeRange.RandomInRange; int randomInRange2 = SettlementSizeRange.RandomInRange; CellRect rect = new CellRect(c.x - randomInRange / 2, c.z - randomInRange2 / 2, randomInRange, randomInRange2); rect.ClipInsideMap(map); Faction faction = map.ParentFaction; ResolveParams rp = default(ResolveParams); rp.rect = rect; TraverseParms traverseParms = TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false); ResolveParams resolveParams = rp; resolveParams.rect = rp.rect; resolveParams.faction = faction; resolveParams.pawnGroupKindDef = (rp.pawnGroupKindDef ?? PawnGroupKindDefOf.Settlement); resolveParams.singlePawnSpawnCellExtraPredicate = (rp.singlePawnSpawnCellExtraPredicate ?? ((IntVec3 x) => map.reachability.CanReachMapEdge(x, traverseParms))); if (resolveParams.pawnGroupMakerParams == null) { resolveParams.pawnGroupMakerParams = new PawnGroupMakerParms(); resolveParams.pawnGroupMakerParams.tile = map.Tile; resolveParams.pawnGroupMakerParams.faction = faction; resolveParams.pawnGroupMakerParams.points = (rp.settlementPawnGroupPoints ?? SymbolResolver_Settlement.DefaultPawnsPoints.RandomInRange); resolveParams.pawnGroupMakerParams.inhabitants = true; resolveParams.pawnGroupMakerParams.seed = rp.settlementPawnGroupSeed; } BaseGen.symbolStack.Push("pawnGroup", resolveParams, null); BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 0; BaseGen.globalSettings.minBarracks = 0; BaseGen.Generate(); }
protected override void ScatterAt(IntVec3 loc, Map map, int count = 1) { CellRect cellRect = CellRect.CenteredOn(loc, 7, 7).ClipInsideMap(map); ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = cellRect; resolveParams.faction = map.ParentFaction; ItemStashContentsComp component = map.info.parent.GetComponent <ItemStashContentsComp>(); if (component != null && component.contents.Any) { resolveParams.stockpileConcreteContents = component.contents; } else { resolveParams.stockpileMarketValue = new float?(this.totalValueRange.RandomInRange); if (this.itemCollectionGeneratorDefs != null) { resolveParams.itemCollectionGeneratorDef = this.itemCollectionGeneratorDefs.RandomElement <ItemCollectionGeneratorDef>(); } } BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("storage", resolveParams); BaseGen.Generate(); MapGenerator.SetVar <CellRect>("RectOfInterest", cellRect); }
public override void Generate(Map map) { 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); resolveParams.factionBasePawnGroupPointsFactor = new float?(0.4f); BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("factionBase", resolveParams); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams genStepParams) { if (!MapGenerator.TryGetVar <CellRect>(name: "RectOfInterest", var: out CellRect centralPoint)) { centralPoint = CellRect.SingleCell(c: map.Center); } Faction faction = Faction.OfMechanoids; ResolveParams resolveParams = new ResolveParams(); resolveParams.rect = this.getRect(centralPoint: centralPoint, map: map); resolveParams.faction = faction; ThingSetMakerParams thingMakerParams = new ThingSetMakerParams(); thingMakerParams.totalMarketValueRange = new FloatRange(500, 1000); thingMakerParams.filter = new ThingFilter(); thingMakerParams.filter.SetDisallowAll(); thingMakerParams.filter.SetAllow(WTH_DefOf.WTH_MechanoidData, true); resolveParams.thingSetMakerParams = thingMakerParams; float sizeFactor = size / 20f; resolveParams.mechanoidsCount = Math.Max(5, Mathf.RoundToInt((genStepParams.sitePart.parms.threatPoints * sizeFactor) / 100f)); BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push(symbol: "mechanoidTemple", resolveParams: resolveParams); BaseGen.Generate(); }
protected override void ScatterAt(IntVec3 c, Map map, int stackCount = 1) { int randomInRange = FactionBaseSizeRange.RandomInRange; int randomInRange2 = FactionBaseSizeRange.RandomInRange; CellRect rect = new CellRect(c.x - 19, c.z - 19, 39, 39); Faction faction; if (map.info.parent == null || map.info.parent.Faction == null || map.info.parent.Faction == Faction.OfPlayer) { faction = Find.FactionManager.RandomEnemyFaction(false, false); } else { faction = map.info.parent.Faction; } if (FactionBaseSymbolResolverUtility.ShouldUseSandbags(faction)) { // rect = rect.ExpandedBy(4); } rect.ClipInsideMap(map); ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = rect; resolveParams.faction = faction; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("factionBase", resolveParams); //BaseGen.symbolStack.Push("farm", resolveParams); BaseGen.Generate(); }
protected override void ScatterAt(IntVec3 c, Map map, GenStepParams parms, int stackCount = 1) { int randomInRange = SettlementSizeRange.RandomInRange; int randomInRange2 = SettlementSizeRange.RandomInRange; CellRect rect = new CellRect(c.x - randomInRange / 2, c.z - randomInRange2 / 2, randomInRange, randomInRange2); rect.ClipInsideMap(map); var faction = ExtendedFactionUtility.RandomFactionOfTechLevel(TechLevel.Medieval, allowDefeated: true); ResolveParams resolveParams = default; resolveParams.faction = faction; resolveParams.rect = rect; resolveParams.noRoof = true; resolveParams.chanceToSkipWallBlock = 0.22f; resolveParams.SetCustom(VFEResolveParams.Name, new VFEResolveParams()); var vfeParams = resolveParams.GetCustom <VFEResolveParams>(VFEResolveParams.Name); Log.Message(vfeParams.ToStringSafe()); vfeParams.hasDoors = false; vfeParams.outdoorLighting = false; vfeParams.generatePawns = false; BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("VFEM_medievalSettlement", resolveParams); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams genStepParams) { if (!MapGenerator.TryGetVar("RectOfInterest", out CellRect centralPoint)) { centralPoint = CellRect.SingleCell(map.Center); } var faction = map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer ? Find.FactionManager.RandomEnemyFaction() : map.ParentFaction; ResolveParams resolveParams = default; resolveParams.rect = GetHuntersLodgeRect(centralPoint, map); resolveParams.faction = faction; ThingSetMakerParams maxFoodAndStuffForHuntersLodge = default; maxFoodAndStuffForHuntersLodge.totalMarketValueRange = new FloatRange(200, 500); maxFoodAndStuffForHuntersLodge.totalNutritionRange = new FloatRange(20, 50); //maxFoodAndStuffForHuntersLodge.filter.SetAllow(ThingCategoryDefOf.PlantFoodRaw, true); resolveParams.thingSetMakerParams = maxFoodAndStuffForHuntersLodge; BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("huntersLodgeBase", resolveParams); BaseGen.Generate(); }
protected override void ScatterAt(IntVec3 c, Map map, int stackCount = 1) { int randomInRange = GenStep_EscapeShip.EscapeShipSizeWidth.RandomInRange; int randomInRange2 = GenStep_EscapeShip.EscapeShipSizeHeight.RandomInRange; CellRect rect = new CellRect(c.x - randomInRange / 2, c.z - randomInRange2 / 2, randomInRange, randomInRange2); rect.ClipInsideMap(map); foreach (IntVec3 c2 in rect) { if (!map.terrainGrid.TerrainAt(c2).affordances.Contains(TerrainAffordanceDefOf.Heavy)) { CompTerrainPumpDry.AffectCell(map, c2); for (int i = 0; i < 8; i++) { Vector3 b = Rand.InsideUnitCircleVec3 * 3f; IntVec3 c3 = IntVec3.FromVector3(c2.ToVector3Shifted() + b); if (c3.InBounds(map)) { CompTerrainPumpDry.AffectCell(map, c3); } } } } ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = rect; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("ship_core", resolveParams); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { if (!map.TileInfo.WaterCovered) { BaseGen.Generate(); } }
protected override void ScatterAt(IntVec3 c, Map map, int stackCount = 1) { int randomInRange1 = SettlementSizeRange.RandomInRange; int randomInRange2 = SettlementSizeRange.RandomInRange; CellRect cellRect = new CellRect(map.Center.x - (randomInRange1 / 2), map.Center.z - (randomInRange2 / 2), randomInRange1, randomInRange2); cellRect.ClipInsideMap(map); BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("settlement", new ResolveParams { rect = cellRect, faction = map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer ? Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined) : map.ParentFaction }); for (int i = 0; i < 3; i++) { if (!RCellFinder.TryFindRandomCellOutsideColonyNearTheCenterOfTheMap(map.AllCells.Where(x => x.Walkable(map) && !x.Fogged(map)).RandomElement(), map, 25, out IntVec3 v)) { Log.Error("genstep: didnt find random cell " + i + "index"); return; } CellRect var = CellRect.CenteredOn(v, 8, 8).ClipInsideMap(map); Pawn pawn = map.Parent.GetComponent <PrisonerWillingToJoinComp>() == null || !map.Parent.GetComponent <PrisonerWillingToJoinComp>().pawn.Any ? PrisonerWillingToJoinQuestUtility.GeneratePrisoner(map.Tile, map.ParentFaction) : map.Parent.GetComponent <PrisonerWillingToJoinComp>().pawn.Take(map.Parent.GetComponent <PrisonerWillingToJoinComp>().pawn[0]); if (pawn.equipment != null && pawn.equipment.AllEquipmentListForReading.Count > 0) { pawn.equipment.DestroyAllEquipment(); } BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("prisonCell", new ResolveParams { rect = var, faction = map.ParentFaction }); BaseGen.Generate(); pawn.guest.SetGuestStatus(map.ParentFaction, true); BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("pawn", new ResolveParams { rect = new CellRect(var.CenterCell.x, var.CenterCell.z, 1, 1).ClipInsideMap(map), faction = map.ParentFaction, singlePawnToSpawn = pawn, postThingSpawn = x => { MapGenerator.rootsToUnfog.Add(x.Position); ((Pawn)x).mindState.WillJoinColonyIfRescued = true; } }); BaseGen.Generate(); MapGenerator.SetVar("RectOfInterest", var); RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith(x => !x.Roofed(map) && x.IsValid, map, out IntVec3 k); k.ClampInsideMap(map); MapGenerator.rootsToUnfog.Add(k); } }
protected override void ScatterAt(IntVec3 loc, Map map, int stackCount = 1) { int randomInRange = GenStep_ScatterShrines.ShrinesCountX.RandomInRange; int randomInRange2 = GenStep_ScatterShrines.ShrinesCountZ.RandomInRange; int randomInRange3 = GenStep_ScatterShrines.ExtraHeightRange.RandomInRange; IntVec2 standardAncientShrineSize = SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize; int num = 1; int num2 = randomInRange * standardAncientShrineSize.x + (randomInRange - 1) * num; int num3 = randomInRange2 * standardAncientShrineSize.z + (randomInRange2 - 1) * num; int num4 = num2 + 2; int num5 = num3 + 2 + randomInRange3; CellRect rect = new CellRect(loc.x, loc.z, num4, num5); rect.ClipInsideMap(map); if (rect.Width != num4 || rect.Height != num5) { return; } foreach (IntVec3 current in rect.Cells) { List <Thing> list = map.thingGrid.ThingsListAt(current); for (int i = 0; i < list.Count; i++) { if (list[i].def == ThingDefOf.AncientCryptosleepCasket) { return; } } } if (!base.CanPlaceAncientBuildingInRange(rect, map)) { return; } ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = rect; resolveParams.disableSinglePawn = new bool?(true); resolveParams.disableHives = new bool?(true); resolveParams.ancientTempleEntranceHeight = new int?(randomInRange3); BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("ancientTemple", resolveParams); BaseGen.Generate(); int nextSignalTagID = Find.UniqueIDsManager.GetNextSignalTagID(); string signalTag = "ancientTempleApproached-" + nextSignalTagID; SignalAction_Letter signalAction_Letter = (SignalAction_Letter)ThingMaker.MakeThing(ThingDefOf.SignalAction_Letter, null); signalAction_Letter.signalTag = signalTag; signalAction_Letter.letter = LetterMaker.MakeLetter("LetterLabelAncientShrineWarning".Translate(), "AncientShrineWarning".Translate(), LetterDefOf.NeutralEvent, new TargetInfo(rect.CenterCell, map, false)); GenSpawn.Spawn(signalAction_Letter, rect.CenterCell, map); RectTrigger rectTrigger = (RectTrigger)ThingMaker.MakeThing(ThingDefOf.RectTrigger, null); rectTrigger.signalTag = signalTag; rectTrigger.Rect = rect.ExpandedBy(1).ClipInsideMap(map); rectTrigger.destroyIfUnfogged = true; GenSpawn.Spawn(rectTrigger, rect.CenterCell, map); }
public override void Generate(Map map, GenStepParams parms) { Debug.Log(Debug.Scatter, "Medium generate"); Find.TickManager.Pause(); currentOptions = RealRuins_ModSettings.defaultScatterOptions.Copy(); //store as instance variable to keep accessible on subsequent ScatterAt calls currentOptions.minRadius = 24; currentOptions.maxRadius = 50; currentOptions.scavengingMultiplier = 0.1f; currentOptions.deteriorationMultiplier = 0.1f; currentOptions.hostileChance = 0.8f; currentOptions.itemCostLimit = 800; currentOptions.minimumCostRequired = 25000; currentOptions.minimumDensityRequired = 0.01f; currentOptions.minimumAreaRequired = 4000; currentOptions.deleteLowQuality = false; //do not delete since we have much higher requirements for base ruins currentOptions.shouldKeepDefencesAndPower = true; ResolveParams rp = default(ResolveParams); BaseGen.globalSettings.map = map; rp.rect = new CellRect(0, 0, map.Size.x, map.Size.z); rp.SetCustom <ScatterOptions>(Constants.ScatterOptions, currentOptions); rp.faction = Find.FactionManager.OfAncientsHostile; BaseGen.symbolStack.Push("chargeBatteries", rp); BaseGen.symbolStack.Push("refuel", rp); BaseGen.symbolStack.Push("scatterRuins", rp); if (Rand.Chance(0.5f * Find.Storyteller.difficulty.threatScale)) { float pointsCost = Math.Abs(Rand.Gaussian()) * 500 * Find.Storyteller.difficulty.threatScale; rp.faction = Find.FactionManager.RandomEnemyFaction(); rp.singlePawnLord = LordMaker.MakeNewLord(rp.faction, new LordJob_AssaultColony(rp.faction, false, false, true, true), map, null); rp.pawnGroupKindDef = (rp.pawnGroupKindDef ?? PawnGroupKindDefOf.Settlement); if (rp.pawnGroupMakerParams == null) { rp.pawnGroupMakerParams = new PawnGroupMakerParms(); rp.pawnGroupMakerParams.tile = map.Tile; rp.pawnGroupMakerParams.faction = rp.faction; PawnGroupMakerParms pawnGroupMakerParams = rp.pawnGroupMakerParams; pawnGroupMakerParams.points = pointsCost; } BaseGen.symbolStack.Push("pawnGroup", rp); } BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { CellRect cellRect; if (!MapGenerator.TryGetVar <CellRect>("RectOfInterest", out cellRect)) { cellRect = this.FindRandomRectToDefend(map); } Faction faction; if (map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer) { faction = (from x in Find.FactionManager.AllFactions where !x.defeated && x.HostileTo(Faction.OfPlayer) && !x.def.hidden && x.def.techLevel >= TechLevel.Industrial select x).RandomElementWithFallback(Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined)); } else { faction = map.ParentFaction; } int randomInRange = this.widthRange.RandomInRange; CellRect rect = cellRect.ExpandedBy(7 + randomInRange).ClipInsideMap(map); int value; int value2; if (parms.siteCoreOrPart != null) { value = parms.siteCoreOrPart.parms.turretsCount; value2 = parms.siteCoreOrPart.parms.mortarsCount; } else { value = this.defaultTurretsCountRange.RandomInRange; value2 = this.defaultMortarsCountRange.RandomInRange; } ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = rect; resolveParams.faction = faction; resolveParams.edgeDefenseWidth = new int?(randomInRange); resolveParams.edgeDefenseTurretsCount = new int?(value); resolveParams.edgeDefenseMortarsCount = new int?(value2); resolveParams.edgeDefenseGuardsCount = new int?(this.guardsCountRange.RandomInRange); BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("edgeDefense", resolveParams); BaseGen.Generate(); ResolveParams resolveParams2 = default(ResolveParams); resolveParams2.rect = rect; resolveParams2.faction = faction; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("outdoorLighting", resolveParams2); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); int num = map.Size.x / 10; int num2 = 8 * map.Size.x / 10; int num3 = map.Size.z / 10; int num4 = 8 * map.Size.z / 10; this.baseResolveParams.rect = new CellRect(num, num3, num2, num4); BaseGen.symbolStack.Push("scatterInsectHivesLGE", this.baseResolveParams); BaseGen.Generate(); }
private void SetAllStructuresToFaction(Faction f, Map m) { IEnumerable <Thing> enumerable = from thing in m.listerThings.AllThings where thing.def.IsDoor select thing; foreach (Thing thing2 in enumerable) { thing2.SetFaction(f, null); } BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); this.baseResolveParams.rect = new CellRect(0, 0, map.Size.x, map.Size.z); BaseGen.symbolStack.Push("toxicFalloutCityBaseLGE", this.baseResolveParams); BaseGen.Generate(); //after generation spawn permanent toxic fallout GameCondition falloutCondition = GameConditionMaker.MakeCondition(GameConditionDefOf.ToxicFallout); falloutCondition.Permanent = true; map.GameConditionManager.RegisterCondition(falloutCondition); }
protected override void ScatterAt(IntVec3 loc, Map map, int count = 1) { Faction faction; if (map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer) { faction = Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined); } else { faction = map.ParentFaction; } CellRect rect = CellRect.CenteredOn(loc, Size, Size); RemoteHackerComp hackerComp = map.info.parent.GetComponent <RemoteHackerComp> (); Pawn hackerPawn = hackerComp.pawn.Take(hackerComp.pawn [0]); ResolveParams rp = default(ResolveParams); rp.rect = rect; rp.faction = faction; rp.wallStuff = ThingDefOf.Steel; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("problemHacker_hackerRoom", rp); BaseGen.Generate(); ResolveParams rp2 = default(ResolveParams); rp2.rect = rect; rp2.faction = faction; rp2.singlePawnToSpawn = hackerPawn; rp2.singlePawnLord = LordMaker.MakeNewLord(faction, new LordJob_DefendBase(faction, loc), map); BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("pawn", rp2); BaseGen.Generate(); ResolveParams rp3 = default(ResolveParams); rp3.rect = rp.rect.ExpandedBy(2); rp3.edgeDefenseWidth = 2; rp3.edgeDefenseTurretsCount = 8; rp3.edgeDefenseGuardsCount = 2; rp3.faction = faction; rp3.singlePawnLord = rp2.singlePawnLord; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("edgeDefense", rp3); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); CellRect rect = new CellRect(Rand.RangeInclusive(this.adventureRegion.minX, this.adventureRegion.maxX - 60), Rand.RangeInclusive(this.adventureRegion.minZ + 15, this.adventureRegion.maxZ - 15), 20, 20); rect.ClipInsideMap(map); ResolveParams baseResolveParams = this.baseResolveParams; baseResolveParams.rect = rect; BaseGen.symbolStack.Push("crashedShip", baseResolveParams, null); BaseGen.Generate(); MapGenUtility.MakeDoors(new ResolveParams { wallStuff = ThingDefOf.Plasteel }, map); MapGenUtility.ResolveCustomGenSteps(map, parms); }
protected override void ScatterAt(IntVec3 loc, Map map, int count = 1) { Faction faction; if (map.ParentFaction == null || map.ParentFaction == Faction.OfPlayer) { faction = Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined); } else { faction = map.ParentFaction; } CellRect cellRect = CellRect.CenteredOn(loc, 8, 8).ClipInsideMap(map); PrisonerWillingToJoinComp component = map.Parent.GetComponent <PrisonerWillingToJoinComp>(); Pawn singlePawnToSpawn; if (component != null && component.pawn.Any) { singlePawnToSpawn = component.pawn.Take(component.pawn[0]); } else { singlePawnToSpawn = PrisonerWillingToJoinQuestUtility.GeneratePrisoner(map.Tile, faction); } ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = cellRect; resolveParams.faction = faction; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("prisonCell", resolveParams); BaseGen.Generate(); ResolveParams resolveParams2 = default(ResolveParams); resolveParams2.rect = cellRect; resolveParams2.faction = faction; resolveParams2.singlePawnToSpawn = singlePawnToSpawn; resolveParams2.postThingSpawn = delegate(Thing x) { MapGenerator.rootsToUnfog.Add(x.Position); ((Pawn)x).mindState.WillJoinColonyIfRescued = true; }; BaseGen.globalSettings.map = map; BaseGen.symbolStack.Push("pawn", resolveParams2); BaseGen.Generate(); MapGenerator.SetVar <CellRect>("RectOfInterest", cellRect); }
public override void ScatterAt(IntVec3 c, Map map, GenStepParams parms, int stackCount = 1) { if (Settlement == null) { FactionFC settlementFaction = Find.World.GetComponent <FactionFC>(); Settlement = settlementFaction.getSettlement(map.Tile, Find.World.info.name); } int middle = 36 + Settlement.settlementLevel * 2; IntRange range = new IntRange(middle - 2, middle + 2); int randomInRange1 = range.RandomInRange; int randomInRange2 = range.RandomInRange; CellRect cellRect = new CellRect(c.x - randomInRange1 / 2, c.z - randomInRange2 / 2, randomInRange1, randomInRange2); Faction faction = Faction.OfPlayer; cellRect.ClipInsideMap(map); ResolveParams resolveParams = new ResolveParams(); if (Settlement.settlementLevel >= 7) { resolveParams.filthDef = null; } else { resolveParams.filthDensity = new FloatRange(Settlement.settlementLevel / 10f, (Settlement.settlementLevel + 3) / 10f); } resolveParams.chanceToSkipFloor = Math.Min(0, 100 - Settlement.settlementLevel * 10); resolveParams.rect = cellRect; resolveParams.faction = faction; BaseGen.globalSettings.map = map; resolveParams.stockpileMarketValue = (float)Settlement.totalProfit; double defenseBuildings = Settlement.weapons.endProduction; int defenseCount = (int)(CurveFactor * Math.Log(defenseBuildings + 1)); resolveParams.edgeDefenseMortarsCount = (int)Math.Ceiling(defenseCount / 3f); resolveParams.edgeDefenseTurretsCount = defenseCount; BaseGen.globalSettings.minBuildings = Settlement.settlementLevel; BaseGen.globalSettings.minBarracks = Settlement.settlementLevel; BaseGen.symbolStack.Push("colony", resolveParams); BaseGen.Generate(); }
protected override void ScatterAt(IntVec3 loc, Map map, GenStepParams parms, int count = 1) { int randomInRange = SettlementSizeRange.RandomInRange; int randomInRange2 = SettlementSizeRange.RandomInRange; CellRect rect = new CellRect(loc.x - randomInRange / 2, loc.z - randomInRange2 / 2, randomInRange, randomInRange2); Faction faction = Find.FactionManager.FirstFactionOfDef(DefDatabase <FactionDef> .GetNamed("RE_Zombies")); rect.ClipInsideMap(map); ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = rect; resolveParams.faction = faction; BaseGen.globalSettings.map = map; BaseGen.globalSettings.minBuildings = 1; BaseGen.globalSettings.minBarracks = 1; BaseGen.symbolStack.Push("zombiesettlement", resolveParams); BaseGen.Generate(); }
public override void Generate(Map map, GenStepParams parms) { if (!map.TileInfo.WaterCovered) { base.Generate(map, parms); CellRect rect = new CellRect(Rand.RangeInclusive(this.adventureRegion.minX, this.adventureRegion.maxX - 50), Rand.RangeInclusive(this.adventureRegion.minZ, this.adventureRegion.maxZ - 50), 50, 50); rect.ClipInsideMap(map); ResolveParams baseResolveParams = this.baseResolveParams; baseResolveParams.rect = rect; BaseGen.symbolStack.Push("abandonedLab", baseResolveParams, null); BaseGen.Generate(); MapGenUtility.MakeDoors(new ResolveParams { wallStuff = ThingDefOf.Plasteel }, map); MapGenUtility.ResolveCustomGenSteps(map, parms); } }
public override void Generate(Map map, GenStepParams parms) { if (!map.TileInfo.WaterCovered) { base.Generate(map, parms); CellRect rect = new CellRect(Rand.RangeInclusive(this.adventureRegion.minX, this.adventureRegion.maxX - 60), Rand.RangeInclusive(this.adventureRegion.minZ, this.adventureRegion.maxZ - 60), 60, 60); rect.ClipInsideMap(map); ResolveParams baseResolveParams = this.baseResolveParams; baseResolveParams.rect = rect; BaseGen.symbolStack.Push("oldMilitaryBase", baseResolveParams, null); BaseGen.Generate(); MapGenUtility.MakeDoors(new ResolveParams { wallStuff = ThingDefOf.Steel }, map); MapGenUtility.UnfogFromRandomEdge(map); MapGenUtility.ResolveCustomGenSteps(map, parms); int num = Rand.RangeInclusive(1, 2); MapGenUtility.ScatterWeaponsWhere(baseResolveParams.rect, num, map, (ThingDef thing) => thing.IsRangedWeapon && !thing.destroyOnDrop && thing.weaponTags != null && thing.weaponTags.Contains("Gun") && (thing.weaponTags.Contains("GunHeavy") || !thing.weaponTags.Contains("AdvancedGun"))); } }
// Token: 0x06000064 RID: 100 RVA: 0x00004278 File Offset: 0x00002478 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.Industrial); } else { faction = map.ParentFaction; } ResolveParams resolveParams = default(ResolveParams); resolveParams.rect = this.GetOutpostRect(rectToDefend, map); resolveParams.faction = faction; resolveParams.edgeDefenseWidth = new int?(0); resolveParams.edgeDefenseTurretsCount = new int?(Rand.RangeInclusive(0, 0)); 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 = 28; BaseGen.globalSettings.minBarracks = 4; BaseGen.symbolStack.Push("advancedGeneration", resolveParams); BaseGen.Generate(); }