X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fmap.cpp;h=fc674d263642bf05e2627cd6f5e13e2cedbf5e9e;hb=ccc0420c52d341ea20ff879aac7520179ca24bdf;hp=a49de3c4600b3dc4c39d6d7096fde1aa6ffd8917;hpb=ab02f0aa1b852391db89a1384f5c7271271196a5;p=minetest.git diff --git a/src/map.cpp b/src/map.cpp index a49de3c46..fc674d263 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2045,6 +2045,34 @@ void make_tree(VoxelManipulator &vmanip, v3s16 p0) } } +void make_papyrus(VoxelManipulator &vmanip, v3s16 p0) +{ + MapNode papyrusnode(CONTENT_PAPYRUS); + + s16 trunk_h = myrand_range(2, 3); + v3s16 p1 = p0; + for(s16 ii=0; iiseed+4321, 6, 0.95); + + bool have_clay = have_sand && (claynoise > 1.25); + // Find ground level s16 surface_y = find_ground_level_clever(data->vmanip, p2d); @@ -3143,7 +3178,10 @@ void makeChunk(ChunkMakeData *data) MapNode *n = &data->vmanip.m_data[i]; if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) { - n->d = CONTENT_SAND; + if(have_clay && (surface_y == WATER_LEVEL)) + n->d = CONTENT_CLAY; + else + n->d = CONTENT_SAND; } else { @@ -3201,24 +3239,39 @@ void makeChunk(ChunkMakeData *data) s16 z = myrand_range(p2d_min.Y, p2d_max.Y); s16 y = find_ground_level(data->vmanip, v2s16(x,z)); // Don't make a tree under water level - if(y < WATER_LEVEL) + if(y < WATER_LEVEL - 1) continue; // Don't make a tree so high that it doesn't fit if(y > y_nodes_max - 6) continue; v3s16 p(x,y,z); - /* - Trees grow only on mud and grass - */ { u32 i = data->vmanip.m_area.index(v3s16(p)); MapNode *n = &data->vmanip.m_data[i]; - if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS) + if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS && n->d != CONTENT_SAND) + continue; + // Papyrus grows only on mud and in water + if(n->d == CONTENT_MUD && y == WATER_LEVEL - 1) + { + p.Y++; + make_papyrus(data->vmanip, p); + } + // Don't make a tree under water level + if(y < WATER_LEVEL) continue; + // Trees grow only on mud and grass + if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) + { + p.Y++; + make_tree(data->vmanip, p); + } + // Cactii grow only on sand + else if(n->d == CONTENT_SAND) + { + p.Y++; + make_cactus(data->vmanip, p); + } } - p.Y++; - // Make a tree - make_tree(data->vmanip, p); } } /*u32 tree_max = relative_area / 60;