aboutsummaryrefslogtreecommitdiff
path: root/src
ModeNameSize
-rw-r--r--CMakeLists.txt15931logplain
-rw-r--r--activeobject.h1555logplain
-rw-r--r--ban.cpp3938logplain
-rw-r--r--ban.h1489logplain
-rw-r--r--base64.cpp3900logplain
-rw-r--r--base64.h250logplain
-rw-r--r--biome.cpp4568logplain
-rw-r--r--biome.h1998logplain
-rw-r--r--camera.cpp18025logplain
-rw-r--r--camera.h4780logplain
-rw-r--r--cavegen.cpp7213logplain
-rw-r--r--cavegen.h1734logplain
d---------cguittfont248logplain
-rw-r--r--chat.cpp17077logplain
-rw-r--r--chat.h7215logplain
-rw-r--r--client.cpp73433logplain
-rw-r--r--client.h12169logplain
-rw-r--r--clientmap.cpp24248logplain
-rw-r--r--clientmap.h3440logplain
-rw-r--r--clientobject.cpp1773logplain
-rw-r--r--clientobject.h3637logplain
-rw-r--r--clientserver.cpp1077logplain
-rw-r--r--clientserver.h13656logplain
-rw-r--r--clientsimpleobject.h1113logplain
-rw-r--r--clouds.cpp9656logplain
-rw-r--r--clouds.h1678logplain
-rw-r--r--cmake_config.h.in698logplain
-rw-r--r--collision.cpp17012logplain
-rw-r--r--collision.h2729logplain
-rw-r--r--config.h979logplain
-rw-r--r--connection.cpp41581logplain
-rw-r--r--connection.h14939logplain
-rw-r--r--constants.h2660logplain
-rw-r--r--content_abm.cpp6329logplain
-rw-r--r--content_abm.h1006logplain
-rw-r--r--content_cao.cpp51701logplain
-rw-r--r--content_cao.h853logplain
-rw-r--r--content_cso.cpp2892logplain
-rw-r--r--content_cso.h1032logplain
-rw-r--r--content_mapblock.cpp42143logplain
-rw-r--r--content_mapblock.h992logplain
-rw-r--r--content_mapnode.cpp8109logplain
-rw-r--r--content_mapnode.h1510logplain
-rw-r--r--content_nodemeta.cpp5465logplain
-rw-r--r--content_nodemeta.h1163logplain
-rw-r--r--content_object.h1263logplain
-rw-r--r--content_sao.cpp38105logplain
-rw-r--r--content_sao.h7525logplain
-rw-r--r--craftdef.cpp27486logplain
-rw-r--r--craftdef.h11691logplain
-rw-r--r--daynightratio.h1841logplain
-rw-r--r--debug.cpp5617logplain
-rw-r--r--debug.h6263logplain
-rw-r--r--defaultsettings.cpp12877logplain
-rw-r--r--defaultsettings.h989logplain
-rw-r--r--dungeongen.cpp16866logplain
-rw-r--r--dungeongen.h3283logplain
-rw-r--r--emerge.cpp13498logplain
-rw-r--r--emerge.h3405logplain
-rw-r--r--environment.cpp64851logplain
-rw-r--r--environment.h12205logplain
-rw-r--r--event.h1912logplain
-rw-r--r--event_manager.h2964logplain
-rw-r--r--exceptions.h3297logplain
-rw-r--r--farmesh.cpp11566logplain
-rw-r--r--farmesh.h1827logplain
-rw-r--r--filecache.cpp3145logplain
-rw-r--r--filecache.h1466logplain
-rw-r--r--filesys.cpp10190logplain
-rw-r--r--filesys.h1967logplain
-rw-r--r--game.cpp84343logplain
-rw-r--r--game.h3147logplain
-rw-r--r--gamedef.h2677logplain
-rw-r--r--genericobject.cpp4381logplain
-rw-r--r--genericobject.h2372logplain
-rw-r--r--gettext.h2090logplain
-rw-r--r--gettime.h1568logplain
-rw-r--r--guiChatConsole.cpp13930logplain
-rw-r--r--guiChatConsole.h3481logplain
-rw-r--r--guiConfigureWorld.cpp21156logplain
-rw-r--r--guiConfigureWorld.h3156logplain
-rw-r--r--guiConfirmMenu.cpp4678logplain
-rw-r--r--guiConfirmMenu.h1522logplain
-rw-r--r--guiCreateWorld.cpp6268logplain
-rw-r--r--guiCreateWorld.h1602logplain
-rw-r--r--guiDeathScreen.cpp4143logplain
-rw-r--r--guiDeathScreen.h1504logplain
-rw-r--r--guiFormSpecMenu.cpp41028logplain
-rw-r--r--guiFormSpecMenu.h5083logplain
-rw-r--r--guiKeyChangeMenu.cpp11860logplain
-rw-r--r--guiKeyChangeMenu.h1946logplain
-rw-r--r--guiMainMenu.cpp42977logplain
-rw-r--r--guiMainMenu.h3414logplain
-rw-r--r--guiMessageMenu.cpp3946logplain
-rw-r--r--guiMessageMenu.h1444logplain
-rw-r--r--guiPasswordChange.cpp6414logplain
-rw-r--r--guiPasswordChange.h1459logplain
-rw-r--r--guiPauseMenu.cpp6536logplain
-rw-r--r--guiPauseMenu.h1572logplain
-rw-r--r--guiTextInputMenu.cpp4652logplain
-rw-r--r--guiTextInputMenu.h1461logplain
-rw-r--r--guiVolumeChange.cpp4653logplain
-rw-r--r--guiVolumeChange.h1497logplain
-rw-r--r--hex.h1357logplain
-rw-r--r--hud.cpp10002logplain
-rw-r--r--hud.h3096logplain
-rw-r--r--intlGUIEditBox.cpp34197logplain
-rw-r--r--intlGUIEditBox.h5777logplain
-rw-r--r--inventory.cpp19074logplain
-rw-r--r--inventory.h7702logplain
-rw-r--r--inventorymanager.cpp21154logplain
-rw-r--r--inventorymanager.h5068logplain
-rw-r--r--irr_aabb3d.h939logplain
-rw-r--r--irr_v2d.h1070logplain
-rw-r--r--irr_v3d.h996logplain
-rw-r--r--irrlichttypes.h1209logplain
-rw-r--r--irrlichttypes_bloated.h1052logplain
-rw-r--r--irrlichttypes_extrabloated.h1292logplain
-rw-r--r--itemdef.cpp18452logplain
-rw-r--r--itemdef.h4652logplain
-rw-r--r--itemgroup.h1183logplain
d---------json151logplain
d---------jthread264logplain
-rw-r--r--keycode.cpp11714logplain
-rw-r--r--keycode.h1724logplain
-rw-r--r--light.cpp3873logplain
-rw-r--r--light.h3228logplain
-rw-r--r--localplayer.cpp15347logplain
-rw-r--r--localplayer.h2016logplain
-rw-r--r--log.cpp3689logplain
-rw-r--r--log.h2490logplain
-rw-r--r--logoutputbuffer.h1351logplain
d---------lua109logplain
-rw-r--r--luaentity_common.h1050logplain
-rw-r--r--main.cpp51753logplain
-rw-r--r--main.h1441logplain
-rw-r--r--mainmenumanager.h2828logplain
-rw-r--r--map.cpp104343logplain
-rw-r--r--map.h13717logplain
-rw-r--r--mapblock.cpp25612logplain
-rw-r--r--mapblock.h13559logplain
-rw-r--r--mapblock_mesh.cpp36133logplain
-rw-r--r--mapblock_mesh.h4812logplain
-rw-r--r--mapchunk.h1831logplain
-rw-r--r--mapgen.cpp13523logplain
-rw-r--r--mapgen.h4632logplain
-rw-r--r--mapgen_indev.cpp17368logplain
-rw-r--r--mapgen_indev.h5466logplain
-rw-r--r--mapgen_singlenode.cpp3103logplain
-rw-r--r--mapgen_singlenode.h1569logplain
-rw-r--r--mapgen_v6.cpp27543logplain
-rw-r--r--mapgen_v6.h4841logplain
-rw-r--r--mapgen_v7.cpp16512logplain
-rw-r--r--mapgen_v7.h3312logplain
-rw-r--r--mapnode.cpp12697logplain
-rw-r--r--mapnode.h5656logplain
-rw-r--r--mapsector.cpp4913logplain
-rw-r--r--mapsector.h2784logplain
-rw-r--r--mesh.cpp14266logplain
-rw-r--r--mesh.h2628logplain
-rw-r--r--modalMenu.h3410logplain
-rw-r--r--modifiedstate.h1171logplain
-rw-r--r--mods.cpp8171logplain
-rw-r--r--mods.h3693logplain
-rw-r--r--nameidmapping.cpp1529logplain
-rw-r--r--nameidmapping.h2137logplain
-rw-r--r--nodedef.cpp26865logplain
-rw-r--r--nodedef.h9000logplain
-rw-r--r--nodemetadata.cpp4058logplain
-rw-r--r--nodemetadata.h2804logplain
-rw-r--r--nodetimer.cpp3656logplain
-rw-r--r--nodetimer.h2230logplain
-rw-r--r--noise.cpp14915logplain
-rw-r--r--noise.h4463logplain
-rw-r--r--object_properties.cpp4059logplain
-rw-r--r--object_properties.h1468logplain
-rw-r--r--particles.cpp10345logplain
-rw-r--r--particles.h3733logplain
-rw-r--r--pathfinder.cpp28672logplain
-rw-r--r--pathfinder.h9852logplain
-rw-r--r--player.cpp6096logplain
-rw-r--r--player.h5137logplain
-rw-r--r--porting.cpp10508logplain
-rw-r--r--porting.h5298logplain
-rw-r--r--profiler.h4954logplain
-rw-r--r--quicktune.cpp2621logplain
-rw-r--r--quicktune.h2837logplain
-rw-r--r--quicktune_shortcutter.h2148logplain
-rw-r--r--rollback.cpp9817logplain
-rw-r--r--rollback.h1855logplain
-rw-r--r--rollback_interface.cpp11741logplain
-rw-r--r--rollback_interface.h3659logplain
-rw-r--r--script.cpp2991logplain
-rw-r--r--script.h1352logplain
-rw-r--r--scriptapi.cpp32394logplain
-rw-r--r--scriptapi.h2500logplain
-rw-r--r--scriptapi_common.cpp8178logplain
-rw-r--r--scriptapi_common.h3641logplain
-rw-r--r--scriptapi_content.cpp9450logplain
-rw-r--r--scriptapi_content.h1299logplain
-rw-r--r--scriptapi_craft.cpp12024logplain
-rw-r--r--scriptapi_craft.h1903logplain
-rw-r--r--scriptapi_entity.cpp8330logplain
-rw-r--r--scriptapi_entity.h2253logplain
-rw-r--r--scriptapi_env.cpp26134logplain
-rw-r--r--scriptapi_env.h4859logplain
-rw-r--r--scriptapi_inventory.cpp18925logplain
-rw-r--r--scriptapi_inventory.h5593logplain
-rw-r--r--scriptapi_item.cpp19047logplain
-rw-r--r--scriptapi_item.h5428logplain
-rw-r--r--scriptapi_node.cpp6309logplain
-rw-r--r--scriptapi_node.h2091logplain
-rw-r--r--scriptapi_nodemeta.cpp15535logplain
-rw-r--r--scriptapi_nodemeta.h3771logplain
-rw-r--r--scriptapi_nodetimer.cpp4297logplain
-rw-r--r--scriptapi_nodetimer.h1767logplain
-rw-r--r--scriptapi_noise.cpp9896logplain
-rw-r--r--scriptapi_noise.h2946logplain
-rw-r--r--scriptapi_object.cpp29935logplain
-rw-r--r--scriptapi_object.h6646logplain
-rw-r--r--scriptapi_particles.cpp4176logplain
-rw-r--r--scriptapi_particles.h1021logplain
-rw-r--r--scriptapi_types.cpp8655logplain
-rw-r--r--scriptapi_types.h4011logplain
-rw-r--r--serialization.cpp6079logplain
-rw-r--r--serialization.h3051logplain
-rw-r--r--server.cpp136138logplain
-rw-r--r--server.h22436logplain
-rw-r--r--serverlist.cpp7911logplain
-rw-r--r--serverlist.h1553logplain
-rw-r--r--serverobject.cpp2476logplain
-rw-r--r--serverobject.h7118logplain
-rw-r--r--settings.h20308logplain
-rw-r--r--sha1.cpp5679logplain
-rw-r--r--sha1.h1623logplain
-rw-r--r--shader.cpp22448logplain
-rw-r--r--shader.h2985logplain
-rw-r--r--sky.cpp17775logplain
-rw-r--r--sky.h2486logplain
-rw-r--r--socket.cpp8655logplain
-rw-r--r--socket.h2510logplain
-rw-r--r--sound.cpp882logplain
-rw-r--r--sound.h3234logplain
-rw-r--r--sound_openal.cpp14385logplain
-rw-r--r--sound_openal.h943logplain
d---------sqlite116logplain
-rw-r--r--staticobject.cpp2224logplain
-rw-r--r--staticobject.h2243logplain
-rw-r--r--strfnd.h5836logplain
-rw-r--r--subgame.cpp7547logplain
-rw-r--r--subgame.h2689logplain
-rw-r--r--test.cpp48589logplain
-rw-r--r--test.h853logplain
-rw-r--r--threads.h1304logplain
-rw-r--r--tile.cpp52772logplain
-rw-r--r--tile.h7451logplain
-rw-r--r--tool.cpp6203logplain
-rw-r--r--tool.h3166logplain
-rw-r--r--treegen.cpp19238logplain
-rw-r--r--treegen.h2703logplain
d---------util643logplain
-rw-r--r--voxel.cpp15892logplain
-rw-r--r--voxel.h13166logplain
-rw-r--r--voxelalgorithms.cpp4681logplain
-rw-r--r--voxelalgorithms.h1678logplain
) stone_surface_max_y = surface_y; BiomeV6Type bt = getBiome(v2s16(x, z)); // Fill ground with stone const v3s16 &em = vm->m_area.getExtent(); u32 i = vm->m_area.index(x, node_min.Y, z); for (s16 y = node_min.Y; y <= node_max.Y; y++) { if (vm->m_data[i].getContent() == CONTENT_IGNORE) { if (y <= surface_y) { vm->m_data[i] = (y >= MGV6_DESERT_STONE_BASE && bt == BT_DESERT) ? n_desert_stone : n_stone; } else if (y <= water_level) { vm->m_data[i] = (y >= MGV6_ICE_BASE && bt == BT_TUNDRA) ? n_ice : n_water_source; } else { vm->m_data[i] = n_air; } } VoxelArea::add_y(em, i, 1); } } return stone_surface_max_y; } void MapgenV6::addMud() { // 15ms @cs=8 //TimeTaker timer1("add mud"); MapNode n_dirt(c_dirt), n_gravel(c_gravel); MapNode n_sand(c_sand), n_desert_sand(c_desert_sand); MapNode addnode; u32 index = 0; for (s16 z = node_min.Z; z <= node_max.Z; z++) for (s16 x = node_min.X; x <= node_max.X; x++, index++) { // Randomize mud amount s16 mud_add_amount = getMudAmount(index) / 2.0 + 0.5; // Find ground level s16 surface_y = find_stone_level(v2s16(x, z)); /////////////////optimize this! // Handle area not found if (surface_y == vm->m_area.MinEdge.Y - 1) continue; BiomeV6Type bt = getBiome(v2s16(x, z)); addnode = (bt == BT_DESERT) ? n_desert_sand : n_dirt; if (bt == BT_DESERT && surface_y + mud_add_amount <= water_level + 1) { addnode = n_sand; } else if (mud_add_amount <= 0) { mud_add_amount = 1 - mud_add_amount; addnode = n_gravel; } else if (bt != BT_DESERT && getHaveBeach(index) && surface_y + mud_add_amount <= water_level + 2) { addnode = n_sand; } if ((bt == BT_DESERT || bt == BT_TUNDRA) && surface_y > 20) mud_add_amount = MYMAX(0, mud_add_amount - (surface_y - 20) / 5); /* If topmost node is grass, change it to mud. It might be if it was // flown to there from a neighboring chunk and then converted. u32 i = vm->m_area.index(x, surface_y, z); if (vm->m_data[i].getContent() == c_dirt_with_grass) vm->m_data[i] = n_dirt;*/ // Add mud on ground s16 mudcount = 0; const v3s16 &em = vm->m_area.getExtent(); s16 y_start = surface_y + 1; u32 i = vm->m_area.index(x, y_start, z); for (s16 y = y_start; y <= node_max.Y; y++) { if (mudcount >= mud_add_amount) break; vm->m_data[i] = addnode; mudcount++; VoxelArea::add_y(em, i, 1); } } } void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos) { const v3s16 &em = vm->m_area.getExtent(); static const v3s16 dirs4[4] = { v3s16(0, 0, 1), // Back v3s16(1, 0, 0), // Right v3s16(0, 0, -1), // Front v3s16(-1, 0, 0), // Left }; // Iterate twice for (s16 k = 0; k < 2; k++) { for (s16 z = mudflow_minpos; z <= mudflow_maxpos; z++) for (s16 x = mudflow_minpos; x <= mudflow_maxpos; x++) { // Node column position v2s16 p2d; // Invert coordinates on second iteration to process columns in // opposite order, to avoid a directional bias. if (k == 1) p2d = v2s16(node_max.X, node_max.Z) - v2s16(x, z); else p2d = v2s16(node_min.X, node_min.Z) + v2s16(x, z); s16 y = node_max.Y; while (y >= node_min.Y) { for (;; y--) { u32 i = vm->m_area.index(p2d.X, y, p2d.Y); MapNode *n = nullptr; // Find next mud node in mapchunk column for (; y >= node_min.Y; y--) { n = &vm->m_data[i]; if (n->getContent() == c_dirt || n->getContent() == c_dirt_with_grass || n->getContent() == c_gravel) break; VoxelArea::add_y(em, i, -1); } if (y < node_min.Y) // No mud found in mapchunk column, process the next column break; if (n->getContent() == c_dirt || n->getContent() == c_dirt_with_grass) { // Convert dirt_with_grass to dirt n->setContent(c_dirt); // Don't flow mud if the stuff under it is not mud, // to leave at least 1 node of mud. u32 i2 = i; VoxelArea::add_y(em, i2, -1); MapNode *n2 = &vm->m_data[i2]; if (n2->getContent() != c_dirt && n2->getContent() != c_dirt_with_grass) // Find next mud node in column continue; } // Check if node above is walkable. If so, cancel // flowing as if node above keeps it in place. u32 i3 = i; VoxelArea::add_y(em, i3, 1); MapNode *n3 = &vm->m_data[i3]; if (ndef->get(*n3).walkable) // Find next mud node in column continue; // Drop mud on one side for (const v3s16 &dirp : dirs4) { u32 i2 = i; // Move to side VoxelArea::add_p(em, i2, dirp); // Check that side is air MapNode *n2 = &vm->m_data[i2]; if (ndef->get(*n2).walkable) continue; // Check that under side is air VoxelArea::add_y(em, i2, -1); n2 = &vm->m_data[i2]; if (ndef->get(*n2).walkable) continue; // Loop further down until not air s16 y2 = y - 1; // y of i2 bool dropped_to_unknown = false; do { y2--; VoxelArea::add_y(em, i2, -1); n2 = &vm->m_data[i2]; // If out of area or in ungenerated world if (y2 < full_node_min.Y || n2->getContent() == CONTENT_IGNORE) { dropped_to_unknown = true; break; } } while (!ndef->get(*n2).walkable); if (!dropped_to_unknown) { // Move up one so that we're in air VoxelArea::add_y(em, i2, 1); // Move mud to new place, and if outside mapchunk remove // any decorations above removed or placed mud. moveMud(i, i2, i3, p2d, em); } // Done, find next mud node in column break; } } } } } } void MapgenV6::moveMud(u32 remove_index, u32 place_index, u32 above_remove_index, v2s16 pos, v3s16 em) { MapNode n_air(CONTENT_AIR); // Copy mud from old place to new place vm->m_data[place_index] = vm->m_data[remove_index]; // Set old place to be air vm->m_data[remove_index] = n_air; // Outside the mapchunk decorations may need to be removed if above removed // mud or if half-buried in placed mud. Placed mud is to the side of pos so // use 'pos.X >= node_max.X' etc. if (pos.X >= node_max.X || pos.X <= node_min.X || pos.Y >= node_max.Z || pos.Y <= node_min.Z) { // 'above remove' node is above removed mud. If it is not air, water or // 'ignore' it is a decoration that needs removing. Also search upwards // to remove a possible stacked decoration. // Check for 'ignore' because stacked decorations can penetrate into // 'ignore' nodes above the mapchunk. while (vm->m_area.contains(above_remove_index) && vm->m_data[above_remove_index].getContent() != CONTENT_AIR && vm->m_data[above_remove_index].getContent() != c_water_source && vm->m_data[above_remove_index].getContent() != CONTENT_IGNORE) { vm->m_data[above_remove_index] = n_air; VoxelArea::add_y(em, above_remove_index, 1); } // Mud placed may have partially-buried a stacked decoration, search // above and remove. VoxelArea::add_y(em, place_index, 1); while (vm->m_area.contains(place_index) && vm->m_data[place_index].getContent() != CONTENT_AIR && vm->m_data[place_index].getContent() != c_water_source && vm->m_data[place_index].getContent() != CONTENT_IGNORE) { vm->m_data[place_index] = n_air; VoxelArea::add_y(em, place_index, 1); } } } void MapgenV6::placeTreesAndJungleGrass() { //TimeTaker t("placeTrees"); if (node_max.Y < water_level) return; PseudoRandom grassrandom(blockseed + 53); content_t c_junglegrass = ndef->getId("mapgen_junglegrass"); // if we don't have junglegrass, don't place cignore... that's bad if (c_junglegrass == CONTENT_IGNORE) c_junglegrass = CONTENT_AIR; MapNode n_junglegrass(c_junglegrass); const v3s16 &em = vm->m_area.getExtent(); // Divide area into parts s16 div = 8; s16 sidelen = central_area_size.X / div; double area = sidelen * sidelen; // N.B. We must add jungle grass first, since tree leaves will // obstruct the ground, giving us a false ground level for (s16 z0 = 0; z0 < div; z0++) for (s16 x0 = 0; x0 < div; x0++) { // Center position of part of division v2s16 p2d_center( node_min.X + sidelen / 2 + sidelen * x0, node_min.Z + sidelen / 2 + sidelen * z0 ); // Minimum edge of part of division v2s16 p2d_min( node_min.X + sidelen * x0, node_min.Z + sidelen * z0 ); // Maximum edge of part of division v2s16 p2d_max( node_min.X + sidelen + sidelen * x0 - 1, node_min.Z + sidelen + sidelen * z0 - 1 ); // Get biome at center position of part of division BiomeV6Type bt = getBiome(p2d_center); // Amount of trees u32 tree_count; if (bt == BT_JUNGLE || bt == BT_TAIGA || bt == BT_NORMAL) { tree_count = area * getTreeAmount(p2d_center); if (bt == BT_JUNGLE) tree_count *= 4; } else { tree_count = 0; } // Add jungle grass if (bt == BT_JUNGLE) { float humidity = getHumidity(p2d_center); u32 grass_count = 5 * humidity * tree_count; for (u32 i = 0; i < grass_count; i++) { s16 x = grassrandom.range(p2d_min.X, p2d_max.X); s16 z = grassrandom.range(p2d_min.Y, p2d_max.Y); int mapindex = central_area_size.X * (z - node_min.Z) + (x - node_min.X); s16 y = heightmap[mapindex]; if (y < water_level) continue; u32 vi = vm->m_area.index(x, y, z); // place on dirt_with_grass, since we know it is exposed to sunlight if (vm->m_data[vi].getContent() == c_dirt_with_grass) { VoxelArea::add_y(em, vi, 1); vm->m_data[vi] = n_junglegrass; } } } // Put trees in random places on part of division for (u32 i = 0; i < tree_count; i++) { s16 x = myrand_range(p2d_min.X, p2d_max.X); s16 z = myrand_range(p2d_min.Y, p2d_max.Y); int mapindex = central_area_size.X * (z - node_min.Z) + (x - node_min.X); s16 y = heightmap[mapindex]; // Don't make a tree under water level // Don't make a tree so high that it doesn't fit if (y < water_level || y > node_max.Y - 6) continue; v3s16 p(x, y, z); // Trees grow only on mud and grass { u32 i = vm->m_area.index(p); content_t c = vm->m_data[i].getContent(); if (c != c_dirt && c != c_dirt_with_grass && c != c_dirt_with_snow) continue; } p.Y++; // Make a tree if (bt == BT_JUNGLE) { treegen::make_jungletree(*vm, p, ndef, myrand()); } else if (bt == BT_TAIGA) { treegen::make_pine_tree(*vm, p - v3s16(0, 1, 0), ndef, myrand()); } else if (bt == BT_NORMAL) { bool is_apple_tree = (myrand_range(0, 3) == 0) && getHaveAppleTree(v2s16(x, z)); treegen::make_tree(*vm, p, is_apple_tree, ndef, myrand()); } } } //printf("placeTreesAndJungleGrass: %dms\n", t.stop()); } void MapgenV6::growGrass() // Add surface nodes { MapNode n_dirt_with_grass(c_dirt_with_grass); MapNode n_dirt_with_snow(c_dirt_with_snow); MapNode n_snowblock(c_snowblock); const v3s16 &em = vm->m_area.getExtent(); u32 index = 0; for (s16 z = full_node_min.Z; z <= full_node_max.Z; z++) for (s16 x = full_node_min.X; x <= full_node_max.X; x++, index++) { // Find the lowest surface to which enough light ends up to make // grass grow. Basically just wait until not air and not leaves. s16 surface_y = 0; { u32 i = vm->m_area.index(x, node_max.Y, z); s16 y; // Go to ground level for (y = node_max.Y; y >= full_node_min.Y; y--) { MapNode &n = vm->m_data[i]; if (ndef->get(n).param_type != CPT_LIGHT || ndef->get(n).liquid_type != LIQUID_NONE || n.getContent() == c_ice) break; VoxelArea::add_y(em, i, -1); } surface_y = (y >= full_node_min.Y) ? y : full_node_min.Y; } BiomeV6Type bt = getBiome(index, v2s16(x, z)); u32 i = vm->m_area.index(x, surface_y, z); content_t c = vm->m_data[i].getContent(); if (surface_y >= water_level - 20) { if (bt == BT_TAIGA && c == c_dirt) { vm->m_data[i] = n_dirt_with_snow; } else if (bt == BT_TUNDRA) { if (c == c_dirt) { vm->m_data[i] = n_snowblock; VoxelArea::add_y(em, i, -1); vm->m_data[i] = n_dirt_with_snow; } else if (c == c_stone && surface_y < node_max.Y) { VoxelArea::add_y(em, i, 1); vm->m_data[i] = n_snowblock; } } else if (c == c_dirt) { vm->m_data[i] = n_dirt_with_grass; } } } } void MapgenV6::generateCaves(int max_stone_y) { float cave_amount = NoisePerlin2D(np_cave, node_min.X, node_min.Y, seed); int volume_nodes = (node_max.X - node_min.X + 1) * (node_max.Y - node_min.Y + 1) * MAP_BLOCKSIZE; cave_amount = MYMAX(0.0, cave_amount); u32 caves_count = cave_amount * volume_nodes / 50000; u32 bruises_count = 1; PseudoRandom ps(blockseed + 21343); PseudoRandom ps2(blockseed + 1032); if (ps.range(1, 6) == 1) bruises_count = ps.range(0, ps.range(0, 2)); if (getBiome(v2s16(node_min.X, node_min.Z)) == BT_DESERT) { caves_count /= 3; bruises_count /= 3; } for (u32 i = 0; i < caves_count + bruises_count; i++) { CavesV6 cave(ndef, &gennotify, water_level, c_water_source, c_lava_source); bool large_cave = (i >= caves_count); cave.makeCave(vm, node_min, node_max, &ps, &ps2, large_cave, max_stone_y, heightmap); } }