-/*
+ /*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
return "scorched_stuff.png";
else if(subname == "firefly")
return "firefly.png";
+ else if(subname == "apple")
+ return "apple.png";
else
return "cloud.png"; // just something
}
s16 item_craft_get_drop_count(const std::string &subname)
{
- if(subname == "rat" || subname == "firefly")
+ if(subname == "rat" || subname == "firefly" || subname == "apple")
return 1;
return -1;
{
if(subname == "cooked_rat")
return true;
+ else if(subname == "apple")
+ return true;
return false;
}
{
if(subname == "cooked_rat")
return 6; // 3 hearts
+ else if(subname == "apple")
+ return 12; // 6 hearts
return 0;
}
-/*
+ /*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
AtlasPointer pa_papyrus = g_texturesource->getTexture(
g_texturesource->getTextureId("papyrus.png"));
material_papyrus.setTexture(0, pa_papyrus.atlas);
+
+ // Apple material
+ video::SMaterial material_apple;
+ material_apple.setFlag(video::EMF_LIGHTING, false);
+ material_apple.setFlag(video::EMF_BILINEAR_FILTER, false);
+ material_apple.setFlag(video::EMF_FOG_ENABLE, true);
+ material_apple.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+ AtlasPointer pa_apple = g_texturesource->getTexture(
+ g_texturesource->getTextureId("apple.png"));
+ material_apple.setTexture(0, pa_apple.atlas);
// junglegrass material
video::SMaterial material_junglegrass;
// Add to mesh collector
collector.append(material_ladder, vertices, 4, indices, 6);
}
+ else if(n.getContent() == CONTENT_APPLE)
+ {
+ u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
+ video::SColor c = MapBlock_LightColor(255, l);
+
+ for(u32 j=0; j<4; j++)
+ {
+ video::S3DVertex vertices[4] =
+ {
+ video::S3DVertex(-BS/2,-BS/2,0, 0,0,0, c,
+ pa_apple.x0(), pa_apple.y1()),
+ video::S3DVertex(BS/2,-BS/2,0, 0,0,0, c,
+ pa_apple.x1(), pa_apple.y1()),
+ video::S3DVertex(BS/2,BS/2,0, 0,0,0, c,
+ pa_apple.x1(), pa_apple.y0()),
+ video::S3DVertex(-BS/2,BS/2,0, 0,0,0, c,
+ pa_apple.x0(), pa_apple.y0()),
+ };
+
+ if(j == 0)
+ {
+ for(u16 i=0; i<4; i++)
+ vertices[i].Pos.rotateXZBy(45);
+ }
+ else if(j == 1)
+ {
+ for(u16 i=0; i<4; i++)
+ vertices[i].Pos.rotateXZBy(-45);
+ }
+ else if(j == 2)
+ {
+ for(u16 i=0; i<4; i++)
+ vertices[i].Pos.rotateXZBy(135);
+ }
+ else if(j == 3)
+ {
+ for(u16 i=0; i<4; i++)
+ vertices[i].Pos.rotateXZBy(-135);
+ }
+
+ for(u16 i=0; i<4; i++)
+ {
+ vertices[i].Pos += intToFloat(p + blockpos_nodes, BS);
+ }
+
+ u16 indices[] = {0,1,2,2,3,0};
+ // Add to mesh collector
+ collector.append(material_apple, vertices, 4, indices, 6);
+ }
+ }
}
}
#endif
-/*
+ /*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
setStoneLikeDiggingProperties(f->digging_properties, 3.0);
+ i = CONTENT_APPLE;
+ f = &content_features(i);
+ f->setInventoryTexture("apple.png");
+ f->param_type = CPT_LIGHT;
+ f->light_propagates = true;
+ f->sunlight_propagates = true;
+ f->solidness = 0; // drawn separately, makes no faces
+ f->walkable = false;
+ f->air_equivalent = true;
+ f->dug_item = std::string("CraftItem apple 1");
+ f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
+
// NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
-/*
+ /*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
{
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;
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)
&& 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;
+ }
+ }
}
}