public static void MakeTriangularRoom(Map map, ResolveParams rp) { if (rp.wallStuff == null) { rp.wallStuff = BaseGenUtility.RandomCheapWallStuff(Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer), 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); 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 current in map.thingGrid.ThingsAt(new IntVec3(num, 1, j))) { current.TakeDamage(new DamageInfo(DamageDefOf.Blunt, 10000, -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); } } } map.MapUpdate(); RoofGrid roofGrid = BaseGen.globalSettings.map.roofGrid; RoofDef roofDef = rp.roofDef ?? RoofDefOf.RoofConstructed; for (int k = 0; k <= rp.rect.Width; k++) { int num4 = rp.rect.minX + k; int num5 = (int)Math.Floor((double)(0.5f * (float)k)); for (int l = rp.rect.minZ + num5; l < rp.rect.minZ + rp.rect.Width - num5; l++) { IntVec3 intVec = new IntVec3(num4, 1, l); if (!roofGrid.Roofed(intVec)) { roofGrid.SetRoof(intVec, roofDef); } } } }
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 current = new IntVec3(i, 1, j); if (Rand.Value <= floorIntegrity) { MapGenUtility.TryToSetFloorTile(current, map, floorMaterial); rect.GetIterator().MoveNext(); current = rect.GetIterator().Current; } } } }