| 1137 | } |
| 1138 | |
| 1139 | bool WorldServer::placeDungeon(String const& dungeonName, Vec2I const& position, Maybe<DungeonId> dungeonId, bool forcePlacement) { |
| 1140 | m_generatingDungeon = true; |
| 1141 | m_tileProtectionEnabled = false; |
| 1142 | |
| 1143 | auto seed = worldTemplate()->seedFor(position[0], position[1]); |
| 1144 | auto facade = make_shared<DungeonGeneratorWorld>(this, true); |
| 1145 | bool placed = false; |
| 1146 | DungeonGenerator dungeonGenerator(dungeonName, seed, m_worldTemplate->threatLevel(), dungeonId); |
| 1147 | if (auto generateResult = dungeonGenerator.generate(facade, position, false, forcePlacement)) { |
| 1148 | auto worldGenerator = make_shared<WorldGenerator>(this); |
| 1149 | for (auto position : generateResult->second) { |
| 1150 | if (ServerTile* tile = modifyServerTile(position)) |
| 1151 | worldGenerator->replaceBiomeBlocks(tile); |
| 1152 | } |
| 1153 | placed = true; |
| 1154 | } |
| 1155 | |
| 1156 | m_tileProtectionEnabled = true; |
| 1157 | m_generatingDungeon = false; |
| 1158 | |
| 1159 | return placed; |
| 1160 | } |
| 1161 | |
| 1162 | void WorldServer::addBiomeRegion(Vec2I const& position, String const& biomeName, String const& subBlockSelector, int width) { |
| 1163 | width = std::min(width, (int)m_worldTemplate->size()[0]); |
no test coverage detected