From 880aa870a0316d8f2f3081bf117e8237af270405 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