PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/src/me/daddychurchill/CityWorld/Plats/Urban/MuseumBuildingLot.java

https://github.com/echurchill/CityWorld
Java | 124 lines | 87 code | 22 blank | 15 comment | 16 complexity | bba7c49ed5142d3e1729f78bd30371d8 MD5 | raw file
  1. package me.daddychurchill.CityWorld.Plats.Urban;
  2. import org.bukkit.Material;
  3. import org.bukkit.block.BlockFace;
  4. import me.daddychurchill.CityWorld.CityWorldGenerator;
  5. import me.daddychurchill.CityWorld.Context.DataContext;
  6. import me.daddychurchill.CityWorld.Plats.FinishedBuildingLot;
  7. import me.daddychurchill.CityWorld.Plats.PlatLot;
  8. import me.daddychurchill.CityWorld.Plugins.RoomProvider;
  9. import me.daddychurchill.CityWorld.Support.Colors;
  10. import me.daddychurchill.CityWorld.Support.PlatMap;
  11. import me.daddychurchill.CityWorld.Support.RealBlocks;
  12. import me.daddychurchill.CityWorld.Support.Surroundings;
  13. public class MuseumBuildingLot extends FinishedBuildingLot {
  14. public MuseumBuildingLot(PlatMap platmap, int chunkX, int chunkZ) {
  15. super(platmap, chunkX, chunkZ);
  16. firstFloorHeight = firstFloorHeight * 5;
  17. height = 1;
  18. depth = 0;
  19. rounded = false;
  20. roofFeature = roofFeature == RoofFeature.ANTENNAS ? RoofFeature.CONDITIONERS : roofFeature;
  21. interiorStyle = InteriorStyle.EMPTY;
  22. }
  23. @Override
  24. public PlatLot newLike(PlatMap platmap, int chunkX, int chunkZ) {
  25. return new MuseumBuildingLot(platmap, chunkX, chunkZ);
  26. }
  27. @Override
  28. public boolean makeConnected(PlatLot relative) {
  29. boolean result = super.makeConnected(relative);
  30. // // other bits
  31. // if (result && relative instanceof WarehouseBuildingLot) {
  32. // MuseumBuildingLot relativebuilding = (MuseumBuildingLot) relative;
  33. //
  34. // // any other bits
  35. // contentStyle = relativebuilding.contentStyle;
  36. // }
  37. return result;
  38. }
  39. @Override
  40. protected void calculateOptions(DataContext context) {
  41. super.calculateOptions(context);
  42. // how do the walls inset?
  43. insetWallWE = 1;
  44. insetWallNS = 1;
  45. // what about the ceiling?
  46. insetCeilingWE = insetWallWE;
  47. insetCeilingNS = insetWallNS;
  48. // nudge in a bit more as we go up
  49. insetInsetMidAt = 1;
  50. insetInsetHighAt = 1;
  51. insetStyle = InsetStyle.STRAIGHT;
  52. }
  53. @Override
  54. protected void drawInteriorParts(CityWorldGenerator generator, RealBlocks chunk, DataContext context,
  55. RoomProvider rooms, int floor, int floorAt, int floorHeight, int insetNS, int insetWE, boolean allowRounded,
  56. Material materialWall, Material materialGlass, StairWell stairLocation, Material materialStair,
  57. Material materialStairWall, Material materialPlatform, boolean drawStairWall, boolean drawStairs,
  58. boolean topFloor, boolean singleFloor, Surroundings heights) {
  59. // outside
  60. drawExteriorDoors(generator, chunk, context, floor, floorAt, floorHeight, insetNS, insetWE, allowRounded,
  61. materialWall, materialGlass, stairLocation, heights);
  62. if (singleFloor && generator.getSettings().includeBones) {
  63. // calculate if we should do it
  64. boolean placeBones = false;
  65. if (allowRounded) {
  66. // do the sides (yea this could be done tighter but it doesn't get called much)
  67. if (heights.toSouth()) {
  68. if (heights.toWest()) {
  69. placeBones = false;
  70. } else if (heights.toEast()) {
  71. placeBones = false;
  72. }
  73. } else if (heights.toNorth()) {
  74. if (heights.toWest()) {
  75. placeBones = false;
  76. } else if (heights.toEast()) {
  77. placeBones = false;
  78. }
  79. }
  80. } else
  81. placeBones = true;
  82. // ok... then do it
  83. if (placeBones) {
  84. int sidewalkLevel = getSidewalkLevel(generator);
  85. Colors colors = new Colors(chunkOdds);
  86. chunk.setBlocks(3, 13, sidewalkLevel, 3, 13, colors.getConcrete());
  87. generator.reportLocation("Museum", chunk);
  88. generator.thingProvider.generateBones(generator, this, chunk, 7, sidewalkLevel + 1, 11, chunkOdds,
  89. true);
  90. // it looked so nice for a moment... but the moment has passed
  91. if (generator.getSettings().includeDecayedBuildings) {
  92. destroyLot(generator, sidewalkLevel, sidewalkLevel + firstFloorHeight);
  93. } else {
  94. chunk.setBlocks(7, sidewalkLevel + 1, sidewalkLevel + 3, 4, Material.STONE);
  95. chunk.setWallSign(7, sidewalkLevel + 2, 3, BlockFace.NORTH,
  96. generator.odonymProvider.generateFossilOdonym(generator, chunkOdds));
  97. chunk.setBlock(7, sidewalkLevel + 1, 5, Material.TORCH, BlockFace.SOUTH);
  98. }
  99. }
  100. }
  101. }
  102. }