From 7efe89ff584b2c0338dcede4c1e08504d0158780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Sun, 26 Jun 2011 13:47:21 +0200 Subject: [PATCH] backported cactus, papyrus and clay --- data/heart.png | Bin 308 -> 258 bytes heart.png | Bin 258 -> 0 bytes src/mapgen.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 10 deletions(-) delete mode 100644 heart.png diff --git a/data/heart.png b/data/heart.png index 6bc183e04f21cba17b52009e89bb52072d5a0afd..bea1aefd6b22e3268f88db0eb26188b1cb362f81 100644 GIT binary patch delta 210 zcmV;@04@Kt0)hgNBnkm@Qb$4nuFf3kkuey52XskIMF-mj8W%GHKxNM^0001#NklVQ zc5uf$mMgo6z)RnOHGYBE@E2eNX~Qny4B~~m3Xq?rh593L2{H=50gdG}LP=Bz2nYy#2xN$nE*O8-Nkl9#BDbI(Ls&# z%GzuoAEjllO;+D+Z%Dd*{$^t^CUp&JEU@e=UJ*}~yJ%xg%!>0@nGqj71`Tns%ixlj zSHyE-v`gGF%B`+*G+V^gXS^f57lH>&dmg0sA52LHMA{<$AAAB8R%;g2&!{W_0000< KMNUMnLSTZvP;Kl0 diff --git a/heart.png b/heart.png deleted file mode 100644 index bea1aefd6b22e3268f88db0eb26188b1cb362f81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 258 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0XB zj({-ZRBb+KpdfpRr>`sfZB{99Vn~*1 zOf;RLoV~^PV*i6<0qnDigqRBVv2zGCh{k7MuAcWI;r8w|tei*K7JX!>6zOP5Hd=1= zq0!~|;tH-6T(g|4=G}RrVR)@*+b<8*$>M6JyaEj$jvIcNwydn+xXm=}-5m$K?>Cy( zHQx9jp1_iMSnmPPqt@MA6Xq{%{iR&UX~eakvG=Lg;u1%PV4(XLJYD@<);T3K0RY|` BTmb+8 diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 801dd72b..71696a34 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -151,6 +151,34 @@ static 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); + + have_clay = have_sand && (claynoise > 1.25); + // Use fast index incrementing s16 start_y = node_max.Y+2; v3s16 em = vmanip.m_area.getExtent(); @@ -1778,7 +1815,10 @@ void make_block(BlockMakeData *data) { if(have_sand) { - vmanip.m_data[i] = MapNode(CONTENT_SAND); + if (have_clay) + vmanip.m_data[i] = MapNode(CONTENT_CLAY); + else + vmanip.m_data[i] = MapNode(CONTENT_SAND); } #if 1 else if(current_depth==0 && !water_detected @@ -1823,7 +1863,7 @@ void make_block(BlockMakeData *data) //s16 y = find_ground_level(data->vmanip, v2s16(x,z)); s16 y = find_ground_level_from_noise(data->seed, v2s16(x,z), 4); // Don't make a tree under water level - if(y < WATER_LEVEL) + if(y < WATER_LEVEL - 1) continue; // Make sure tree fits (only trees whose starting point is // at this block are added) @@ -1847,19 +1887,36 @@ void make_block(BlockMakeData *data) // If not found, handle next one if(found == false) continue; - /* - Trees grow only on mud and grass - */ + { u32 i = data->vmanip->m_area.index(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(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(vmanip, p); + } + // Cactii grow only on sand + else if(n->d == CONTENT_SAND) + { + p.Y++; + make_cactus(vmanip, p); + } } - // Tree will be placed one higher - p.Y++; - // Make a tree - make_tree(vmanip, p); } #if 0