public static void MakeTriangularRoom(Map map, ResolveParams rp) { if (rp.wallStuff == null) { Faction faction = Find.FactionManager.RandomNonHostileFaction(false, false, true, TechLevel.Spacer); rp.wallStuff = BaseGenUtility.RandomCheapWallStuff(faction, false); } if (rp.floorDef == null) { rp.floorDef = BaseGenUtility.CorrespondingTerrainDef(rp.wallStuff, true); } if (rp.floorDef == null) { rp.floorDef = BaseGenUtility.RandomBasicFloorDef(Faction.OfMechanoids, false); } ResolveParams resolveParams = rp; resolveParams.rect = new CellRect(rp.rect.minX, rp.rect.minZ, 1, rp.rect.Height); BaseGen.symbolStack.Push("edgeWalls", resolveParams, null); for (int i = 0; i <= rp.rect.Width; i++) { int num = rp.rect.minX + i; int num2 = (int)Math.Floor((double)(0.5f * (float)i)); int num3 = (int)Math.Ceiling((double)(0.5f * (float)i)); for (int j = rp.rect.minZ + num2; j < rp.rect.minZ + rp.rect.Width - num2; j++) { foreach (Thing thing in map.thingGrid.ThingsAt(new IntVec3(num, 1, j))) { thing.TakeDamage(new DamageInfo(DamageDefOf.Blunt, 10000, -1f, -1f, null, null, null, 0)); } MapGenUtility.TryToSetFloorTile(new IntVec3(num, 1, j), map, rp.floorDef); if (j == rp.rect.minZ + num2 || j == rp.rect.minZ + num3 || j == rp.rect.minZ + rp.rect.Width - (num2 + 1) || j == rp.rect.minZ + rp.rect.Width - (num3 + 1)) { ResolveParams resolveParams2 = rp; resolveParams2.rect = new CellRect(num, j, 1, 1); BaseGen.symbolStack.Push("edgeWalls", resolveParams2, null); } } } map.MapUpdate(); RoofGrid roofGrid = BaseGen.globalSettings.map.roofGrid; RoofDef def = rp.roofDef ?? RoofDefOf.RoofConstructed; for (int k = 0; k <= rp.rect.Width; k++) { int newX = rp.rect.minX + k; int num4 = (int)Math.Floor((double)(0.5f * (float)k)); for (int l = rp.rect.minZ + num4; l < rp.rect.minZ + rp.rect.Width - num4; l++) { IntVec3 c = new IntVec3(newX, 1, l); if (!roofGrid.Roofed(c)) { roofGrid.SetRoof(c, def); } } } }
public static void TileArea(Map map, CellRect rect, TerrainDef floorMaterial = null, float floorIntegrity = 1f) { if (floorMaterial == null) { floorMaterial = BaseGenUtility.RandomBasicFloorDef(Faction.OfMechanoids, false); } for (int i = rect.minX; i <= rect.maxX; i++) { for (int j = rect.minZ; j <= rect.maxZ; j++) { IntVec3 c = new IntVec3(i, 1, j); if (Rand.Value <= floorIntegrity) { MapGenUtility.TryToSetFloorTile(c, map, floorMaterial); //rect.GetIterator().MoveNext(); //c = rect.GetIterator().Current; } } } }