public void Place(HouseBuilderContext context, StructureMap structures) { this.PlaceEmptyRooms(); foreach (Microsoft.Xna.Framework.Rectangle room in this.Rooms) { structures.AddProtectedStructure(room, 8); } this.PlaceStairs(); this.PlaceDoors(); this.PlacePlatforms(); this.PlaceSupportBeams(); this.FillRooms(); foreach (Microsoft.Xna.Framework.Rectangle room in this.Rooms) { this.AgeRoom(room); } this.PlaceChests(); this.PlaceBiomeSpecificTool(context); }
public void Place(HouseBuilderContext context, StructureMap structures) { PlaceEmptyRooms(); foreach (Rectangle room in Rooms) { structures.AddProtectedStructure(room, 8); } PlaceStairs(); PlaceDoors(); PlacePlatforms(); PlaceSupportBeams(); FillRooms(); foreach (Rectangle room2 in Rooms) { AgeRoom(room2); } PlaceChests(); PlaceBiomeSpecificTool(context); }
private void PlaceBiomeSpecificTool(HouseBuilderContext context) { if (this.Type == HouseType.Jungle && context.SharpenerCount < this._random.Next(2, 5)) { bool flag = false; foreach (Microsoft.Xna.Framework.Rectangle room in this.Rooms) { int j = room.Height - 2 + room.Y; for (int index = 0; index < 10; ++index) { int i = this._random.Next(2, room.Width - 2) + room.X; WorldGen.PlaceTile(i, j, 377, true, true, -1, 0); if (flag = this._tiles[i, j].active() && this._tiles[i, j].type == (ushort)377) { break; } } if (!flag) { int i = room.X + 2; while (i <= room.X + room.Width - 2 && !(flag = WorldGen.PlaceTile(i, j, 377, true, true, -1, 0))) { ++i; } if (flag) { break; } } else { break; } } if (flag) { ++context.SharpenerCount; } } if (this.Type != HouseType.Desert || context.ExtractinatorCount >= this._random.Next(2, 5)) { return; } bool flag1 = false; foreach (Microsoft.Xna.Framework.Rectangle room in this.Rooms) { int j = room.Height - 2 + room.Y; for (int index = 0; index < 10; ++index) { int i = this._random.Next(2, room.Width - 2) + room.X; WorldGen.PlaceTile(i, j, 219, true, true, -1, 0); if (flag1 = this._tiles[i, j].active() && this._tiles[i, j].type == (ushort)219) { break; } } if (!flag1) { int i = room.X + 2; while (i <= room.X + room.Width - 2 && !(flag1 = WorldGen.PlaceTile(i, j, 219, true, true, -1, 0))) { ++i; } if (flag1) { break; } } else { break; } } if (!flag1) { return; } ++context.ExtractinatorCount; }
private void PlaceBiomeSpecificTool(HouseBuilderContext context) { if (Type == HouseType.Jungle && context.SharpenerCount < _random.Next(2, 5)) { bool flag = false; foreach (Rectangle room in Rooms) { int num = room.Height - 2 + room.Y; for (int i = 0; i < 10; i++) { int num2 = _random.Next(2, room.Width - 2) + room.X; WorldGen.PlaceTile(num2, num, 377, mute: true, forced: true); if (flag = (_tiles[num2, num].active() && _tiles[num2, num].type == 377)) { break; } } if (flag) { break; } for (int j = room.X + 2; j <= room.X + room.Width - 2; j++) { if (flag = WorldGen.PlaceTile(j, num, 377, mute: true, forced: true)) { break; } } if (flag) { break; } } if (flag) { context.SharpenerCount++; } } if (Type == HouseType.Desert && context.ExtractinatorCount < _random.Next(2, 5)) { bool flag2 = false; foreach (Rectangle room2 in Rooms) { int num3 = room2.Height - 2 + room2.Y; for (int k = 0; k < 10; k++) { int num4 = _random.Next(2, room2.Width - 2) + room2.X; WorldGen.PlaceTile(num4, num3, 219, mute: true, forced: true); if (flag2 = (_tiles[num4, num3].active() && _tiles[num4, num3].type == 219)) { break; } } if (flag2) { break; } for (int l = room2.X + 2; l <= room2.X + room2.Width - 2; l++) { if (flag2 = WorldGen.PlaceTile(l, num3, 219, mute: true, forced: true)) { break; } } if (flag2) { break; } } if (flag2) { context.ExtractinatorCount++; } } }