From 289e31ed981371fa05bd02488e38e2d0f0f5effe Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 30 May 2011 14:42:08 +0200 Subject: + cactii --- src/map.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index a49de3c46..c48599d47 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2045,6 +2045,20 @@ void make_tree(VoxelManipulator &vmanip, v3s16 p0) } } +void make_cactus(VoxelManipulator &vmanip, v3s16 p0) +{ + MapNode cactusnode(CONTENT_CACTUS); + + s16 trunk_h = 3; + v3s16 p1 = p0; + for(s16 ii=0; ii 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; + // 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 + 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; -- cgit v1.2.3 From ba1460a5822d38dc6617717fa5fec9b033bb0a29 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 04:57:46 +0200 Subject: + clay and associated items --- src/map.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index c48599d47..bf9f38c87 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3141,6 +3141,13 @@ void makeChunk(ChunkMakeData *data) if(have_sand == false) continue; + // Determine whether to have clay in the sand here + double claynoise = noise2d_perlin( + 0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500, + data->seed+4321, 8, 0.95); + + bool have_clay = have_sand && (claynoise > 0.95); + // Find ground level s16 surface_y = find_ground_level_clever(data->vmanip, p2d); @@ -3157,7 +3164,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 { -- cgit v1.2.3 From 5f52a622b6a2602742ea472c1163eba2acf17fb6 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 1 Jun 2011 08:09:28 +0200 Subject: * clay is rarer now --- src/map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index bf9f38c87..ac5bd7d14 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3144,9 +3144,9 @@ void makeChunk(ChunkMakeData *data) // Determine whether to have clay in the sand here double claynoise = noise2d_perlin( 0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500, - data->seed+4321, 8, 0.95); + data->seed+4321, 6, 0.95); - bool have_clay = have_sand && (claynoise > 0.95); + bool have_clay = have_sand && (claynoise > 1.25); // Find ground level s16 surface_y = find_ground_level_clever(data->vmanip, p2d); -- cgit v1.2.3