Tune caves
[oweals/minetest.git] / src / mapgen.cpp
index fd5851c9816df7e00a952d1fcb8e9467463c76c9..77bd8a8b0a19d989a258d8ea643c4e4ab573ef12 100644 (file)
@@ -1328,9 +1328,7 @@ void make_block(BlockMakeData *data)
        //double gen_area_nodes = MAP_BLOCKSIZE*MAP_BLOCKSIZE * rel_volume;
 
        // Horribly wrong heuristic, but better than nothing
-       bool block_is_underground = (WATER_LEVEL /* local minimum ground level */ > 
-                       MAP_BLOCKSIZE * (data->blockpos_max.X
-                                       - data->blockpos_min.X + 1) / 2);
+       bool block_is_underground = (WATER_LEVEL > node_max.Y);
 
        /*
                Create a block-specific seed
@@ -1418,12 +1416,14 @@ void make_block(BlockMakeData *data)
                        u32 i = vmanip.m_area.index(v3s16(p2d.X, node_min.Y, p2d.Y));
                        for(s16 y=node_min.Y; y<=node_max.Y; y++)
                        {
-                               if(y <= surface_y)
-                                       vmanip.m_data[i] = MapNode(c_stone);
-                               else if(y <= WATER_LEVEL)
+                               if(y <= surface_y){
+                                       if(vmanip.m_data[i].getContent() == CONTENT_IGNORE)
+                                               vmanip.m_data[i] = MapNode(c_stone);
+                               } else if(y <= WATER_LEVEL){
                                        vmanip.m_data[i] = MapNode(c_water_source);
-                               else
+                               } else {
                                        vmanip.m_data[i] = MapNode(c_air);
+                               }
 
                                vmanip.m_area.add_y(em, i, 1);
                        }
@@ -1461,12 +1461,10 @@ void make_block(BlockMakeData *data)
        u32 bruises_count = volume_nodes * stone_surface_max_y / 40000000;
        if(stone_surface_max_y < WATER_LEVEL - 20)
                bruises_count = 0;
-       /*u32 caves_count = 0;
-       u32 bruises_count = 0;*/
        for(u32 jj=0; jj<caves_count+bruises_count; jj++)
        {
                s16 min_tunnel_diameter = 2;
-               s16 max_tunnel_diameter = 5;
+               s16 max_tunnel_diameter = myrand_range(4,5);
                u16 tunnel_routepoints = 20;
                
                v3f main_direction(0,0,0);