This commit is contained in:
Nils Dagsson Moskopp 2011-05-30 14:42:08 +02:00
parent 5f063ce97c
commit 289e31ed98
8 changed files with 42 additions and 7 deletions

BIN
data/cactus_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

BIN
data/cactus_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

View File

@ -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<trunk_h; ii++)
{
if(vmanip.m_area.contains(p1))
vmanip.m_data[vmanip.m_area.index(p1)] = cactusnode;
p1.Y++;
}
}
/*
Noise functions. Make sure seed is mangled differently in each one.
*/
@ -3207,18 +3221,24 @@ void makeChunk(ChunkMakeData *data)
if(y > 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;

View File

@ -215,6 +215,16 @@ void init_mapnode()
}
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
i = CONTENT_CACTUS;
f = &g_content_features[i];
f->setAllTextures("cactus_side.png");
f->setTexture(0, "cactus_top.png");
f->setTexture(1, "cactus_top.png");
f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
f->param_type = CPT_MINERAL;
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
i = CONTENT_GLASS;
f = &g_content_features[i];
f->light_propagates = true;

View File

@ -102,6 +102,7 @@ void init_content_inventory_texture_paths();
#define CONTENT_GLASS 20
#define CONTENT_FENCE 21
#define CONTENT_SANDSTONE 22
#define CONTENT_CACTUS 23
/*
Content feature list

View File

@ -73,6 +73,7 @@ void initializeMaterialProperties()
setWoodLikeDiggingProperties(CONTENT_TREE, 1.0);
setWoodLikeDiggingProperties(CONTENT_LEAVES, 0.15);
setWoodLikeDiggingProperties(CONTENT_CACTUS, 0.75);
setWoodLikeDiggingProperties(CONTENT_GLASS, 0.15);
setWoodLikeDiggingProperties(CONTENT_FENCE, 0.75);
setWoodLikeDiggingProperties(CONTENT_WOOD, 0.75);

View File

@ -4078,6 +4078,7 @@ void setCreativeInventory(Player *player)
CONTENT_SANDSTONE,
CONTENT_TREE,
CONTENT_LEAVES,
CONTENT_CACTUS,
CONTENT_GLASS,
CONTENT_FENCE,
CONTENT_MESE,

View File

@ -513,6 +513,8 @@ void TextureSource::buildMainAtlas()
sourcelist.push_back("tree_top.png");
sourcelist.push_back("water.png");
sourcelist.push_back("leaves.png");
sourcelist.push_back("cactus_side.png");
sourcelist.push_back("cactus_top.png");
sourcelist.push_back("glass.png");
sourcelist.push_back("mud.png^grass_side.png");
sourcelist.push_back("cobble.png");