From ad9e084e94f94a445cff37cae54c408567e008f3 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 28 Feb 2011 02:48:31 +0200 Subject: [PATCH] added trees (very glitchy) and changed grass texture --- data/grass.png | Bin 876 -> 876 bytes src/map.cpp | 42 +++++++++++++++++++++++++++++++++++++----- src/server.cpp | 4 +++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/data/grass.png b/data/grass.png index 43befb70a0e9bb0856f4544f94387d3ee6609f09..47d7b11fe953ceb517ac7886d9fe1dba91317eac 100644 GIT binary patch delta 19 acmaFE_J(aj0*4HPs?hn2m?axCSeOAuJ_d&X delta 19 acmaFE_J(aj0*AD?rPSgomiCPqEX)8zyap-& diff --git a/src/map.cpp b/src/map.cpp index 7b16834e..bca56a6f 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1875,6 +1875,8 @@ void make_tree(VoxelManipulator &vmanip, v3s16 p0) MapNode treenode(CONTENT_TREE); MapNode leavesnode(CONTENT_LEAVES); + vmanip.emerge(VoxelArea(p0-v3s16(2,0,2),p0+v3s16(2,6,2))); + s16 trunk_h = myrand_range(3, 6); v3s16 p1 = p0; for(s16 ii=0; iisetNode(v3s16(x0,y0,z0), n); } } +#endif /* This is used for guessing whether or not the block should @@ -4815,7 +4819,7 @@ continue_generating: } /* - Add block to sector. + Add block to sector */ sector->insertBlock(block); @@ -4830,6 +4834,34 @@ continue_generating: { block->setLightingExpired(false); } + + /* + Add trees + */ + if(some_part_underground && !completely_underground) + { + MapVoxelManipulator vm(this); + + double a = tree_amount_2d(m_seed, v2s16(p_nodes.X+8, p_nodes.Z+8)); + u16 tree_count = (u16)(a*MAP_BLOCKSIZE*MAP_BLOCKSIZE); + for(u16 i=0; i