}
}
+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.
*/
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;
}
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;
#define CONTENT_GLASS 20
#define CONTENT_FENCE 21
#define CONTENT_SANDSTONE 22
+#define CONTENT_CACTUS 23
/*
Content feature list
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);
CONTENT_SANDSTONE,
CONTENT_TREE,
CONTENT_LEAVES,
+ CONTENT_CACTUS,
CONTENT_GLASS,
CONTENT_FENCE,
CONTENT_MESE,
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");