From c0caedc3730085b3261f09e1df23cc1bdd2fce79 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 11 Sep 2011 17:50:44 +0200 Subject: Added Apple Trees --- src/mapgen.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 0018b9919..6ac99aabd 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1,4 +1,4 @@ -/* + /* Minetest-c55 Copyright (C) 2010-2011 celeron55, Perttu Ahola @@ -84,6 +84,11 @@ static void make_tree(VoxelManipulator &vmanip, v3s16 p0) { MapNode treenode(CONTENT_TREE); MapNode leavesnode(CONTENT_LEAVES); + MapNode applenode(CONTENT_APPLE); + + bool is_apple_tree = myrand_range(0,100) < 35?true:false; + s16 apple_count = 0; + s16 trunk_h = myrand_range(4, 5); v3s16 p1 = p0; @@ -138,6 +143,7 @@ static void make_tree(VoxelManipulator &vmanip, v3s16 p0) for(s16 y=leaves_a.MinEdge.Y; y<=leaves_a.MaxEdge.Y; y++) for(s16 x=leaves_a.MinEdge.X; x<=leaves_a.MaxEdge.X; x++) { + bool is_apple = myrand_range(0,100) < 50?true:false; v3s16 p(x,y,z); p += p1; if(vmanip.m_area.contains(p) == false) @@ -147,8 +153,14 @@ static void make_tree(VoxelManipulator &vmanip, v3s16 p0) && vmanip.m_data[vi].getContent() != CONTENT_IGNORE) continue; u32 i = leaves_a.index(x,y,z); - if(leaves_d[i] == 1) - vmanip.m_data[vi] = leavesnode; + if(leaves_d[i] == 1) { + if(is_apple_tree && is_apple && apple_count < 4) { + vmanip.m_data[vi] = applenode; + apple_count++; + } else { + vmanip.m_data[vi] = leavesnode; + } + } } } -- cgit v1.2.3 From 6496b1cf1fe3b172ad2611c51a7a1b9f0f168b13 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 11 Sep 2011 18:16:07 +0200 Subject: Removed Spaces --- src/content_inventory.cpp | 2 +- src/content_mapblock.cpp | 2 +- src/content_mapnode.cpp | 2 +- src/content_mapnode.h | 2 +- src/mapgen.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/content_inventory.cpp b/src/content_inventory.cpp index 2b0dfcb3a..5fbb02d9b 100644 --- a/src/content_inventory.cpp +++ b/src/content_inventory.cpp @@ -1,4 +1,4 @@ - /* +/* Minetest-c55 Copyright (C) 2010-2011 celeron55, Perttu Ahola diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 1ae6886a5..1cc37b969 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -1,4 +1,4 @@ - /* +/* Minetest-c55 Copyright (C) 2010-2011 celeron55, Perttu Ahola diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index 37e79829f..09a84156a 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -1,4 +1,4 @@ - /* +/* Minetest-c55 Copyright (C) 2010-2011 celeron55, Perttu Ahola diff --git a/src/content_mapnode.h b/src/content_mapnode.h index 639f572eb..35dcc20ec 100644 --- a/src/content_mapnode.h +++ b/src/content_mapnode.h @@ -1,4 +1,4 @@ - /* +/* Minetest-c55 Copyright (C) 2010-2011 celeron55, Perttu Ahola diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 6ac99aabd..026248ad4 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1,4 +1,4 @@ - /* +/* Minetest-c55 Copyright (C) 2010-2011 celeron55, Perttu Ahola -- cgit v1.2.3