modified: src/content_craft.cpp

modified:   src/content_inventory.cpp
	modified:   src/content_mapblock.cpp
	modified:   src/content_mapnode.cpp
	modified:   src/content_mapnode.h
	modified:   src/mapgen.cpp
	modified:   src/mineral.cpp
	modified:   src/tile.cpp
	data/brightglass.png
	data/glowdust.png
	data/glowstone.png
This commit is contained in:
Brendan 2011-08-13 21:30:25 -07:00
parent 9e35fe8c37
commit 93b59ed08a
8 changed files with 155 additions and 4 deletions

View File

@ -458,6 +458,13 @@ void craft_set_creative_inventory(Player *player)
assert(r == NULL);
}
{
InventoryItem *item = new CraftItem("glowdust", 1);
void* r = player->inventory.addItem("main", item);
assert(r == NULL);
}
/*
Give materials
*/
@ -486,6 +493,8 @@ void craft_set_creative_inventory(Player *player)
CONTENT_CHEST,
CONTENT_FURNACE,
CONTENT_SIGN_WALL,
CONTENT_BRIGHTGLASS,
CONTENT_GLOWSTONE,
CONTENT_IGNORE
};

View File

@ -71,6 +71,8 @@ std::string item_craft_get_image_name(const std::string &subname)
return "scorched_stuff.png";
else if(subname == "firefly")
return "firefly.png";
else if(subname == "glowdust")
return "glowdust.png";
else
return "cloud.png"; // just something
}
@ -102,7 +104,7 @@ s16 item_craft_get_drop_count(const std::string &subname)
bool item_craft_is_cookable(const std::string &subname)
{
if(subname == "lump_of_iron" || subname == "lump_of_clay" || subname == "rat" || subname == "cooked_rat")
if(subname == "lump_of_iron" || subname == "lump_of_clay" || subname == "rat" || subname == "cooked_rat" || subname == "glowdust")
return true;
return false;
@ -118,6 +120,8 @@ InventoryItem* item_craft_create_cook_result(const std::string &subname)
return new CraftItem("cooked_rat", 1);
else if(subname == "cooked_rat")
return new CraftItem("scorched_stuff", 1);
else if(subname == "glowdust")
return new MaterialItem(CONTENT_BRIGHTGLASS, 1);
return NULL;
}

View File

@ -171,6 +171,17 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
g_texturesource->getTextureId("glass.png"));
material_glass.setTexture(0, pa_glass.atlas);
// BrightGlass material
video::SMaterial material_brightglass;
material_glass.setFlag(video::EMF_LIGHTING, false);
material_glass.setFlag(video::EMF_BILINEAR_FILTER, false);
material_glass.setFlag(video::EMF_FOG_ENABLE, true);
material_glass.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
AtlasPointer pa_brightglass = g_texturesource->getTexture(
g_texturesource->getTextureId("brightglass.png"));
material_brightglass.setTexture(0, pa_brightglass.atlas);
// Wood material
video::SMaterial material_wood;
material_wood.setFlag(video::EMF_LIGHTING, false);
@ -778,6 +789,72 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
collector.append(material_glass, vertices, 4, indices, 6);
}
}
/*
Add brightglass
*/
else if(n.getContent() == CONTENT_BRIGHTGLASS)
{
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
video::SColor c = MapBlock_LightColor(255, l);
for(u32 j=0; j<6; j++)
{
video::S3DVertex vertices[4] =
{
video::S3DVertex(-BS/2,-BS/2,BS/2, 0,0,0, c,
pa_brightglass.x0(), pa_brightglass.y1()),
video::S3DVertex(BS/2,-BS/2,BS/2, 0,0,0, c,
pa_brightglass.x1(), pa_brightglass.y1()),
video::S3DVertex(BS/2,BS/2,BS/2, 0,0,0, c,
pa_brightglass.x1(), pa_brightglass.y0()),
video::S3DVertex(-BS/2,BS/2,BS/2, 0,0,0, c,
pa_brightglass.x0(), pa_brightglass.y0()),
};
if(j == 0)
{
for(u16 i=0; i<4; i++)
vertices[i].Pos.rotateXZBy(0);
}
else if(j == 1)
{
for(u16 i=0; i<4; i++)
vertices[i].Pos.rotateXZBy(180);
}
else if(j == 2)
{
for(u16 i=0; i<4; i++)
vertices[i].Pos.rotateXZBy(-90);
}
else if(j == 3)
{
for(u16 i=0; i<4; i++)
vertices[i].Pos.rotateXZBy(90);
}
else if(j == 4)
{
for(u16 i=0; i<4; i++)
vertices[i].Pos.rotateYZBy(-90);
}
else if(j == 5)
{
for(u16 i=0; i<4; i++)
vertices[i].Pos.rotateYZBy(90);
}
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_glass, vertices, 4, indices, 6);
}
}
/*
Add fence
*/

View File

@ -31,7 +31,7 @@ void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
content_t trans_table_19[21][2] = {
content_t trans_table_19[23][2] = {
{CONTENT_GRASS, 1},
{CONTENT_TREE, 4},
{CONTENT_LEAVES, 5},
@ -53,6 +53,8 @@ content_t trans_table_19[21][2] = {
{CONTENT_CLAY, 27},
{CONTENT_PAPYRUS, 28},
{CONTENT_BOOKSHELF, 29},
{CONTENT_BRIGHTGLASS, 30},
{CONTENT_GLOWSTONE, 31},
};
MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
@ -488,6 +490,29 @@ void content_mapnode_init()
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
setStoneLikeDiggingProperties(f->digging_properties, 5.0);
i = CONTENT_BRIGHTGLASS;
f = &content_features(i);
f->setAllTextures("brightglass.png");
f->light_propagates = true;
f->sunlight_propagates = true;
f->param_type = CPT_LIGHT;
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->solidness = 0; // drawn separately, makes no faces
f->setInventoryTextureCube("brightglass.png", "brightglass.png", "brightglass.png");
setWoodLikeDiggingProperties(f->digging_properties, 0.15);
f->light_source = LIGHT_MAX-1;
i = CONTENT_GLOWSTONE;
f = &content_features(i);
f->setAllTextures("glowstone.png");
// f->setInventoryTextureCube("glowstone.png", "glowstone.png", "glowstone.png");
f->param_type = CPT_MINERAL;
f->is_ground_content = true;
f->dug_item = std::string("CraftItem glowdust 1");
setStoneLikeDiggingProperties(f->digging_properties, 1.0);
f->light_source = LIGHT_MAX-3;
i = CONTENT_NC;
f = &content_features(i);
f->param_type = CPT_FACEDIR_SIMPLE;

View File

@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
void content_mapnode_init();
extern content_t trans_table_19[21][2];
extern content_t trans_table_19[23][2];
MapNode mapnode_translate_from_internal(MapNode n_from, u8 version);
MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
@ -75,6 +75,8 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_JUNGLEGRASS 0x816
#define CONTENT_NC 0x817
#define CONTENT_NC_RB 0x818
#define CONTENT_BRIGHTGLASS 0x819
#define CONTENT_GLOWSTONE 0x81a
#endif

View File

@ -1760,6 +1760,37 @@ void make_block(BlockMakeData *data)
}
}
}
/*
Add glowstone (gs) (modified from coal)
*/
//for(s16 i=0; i < MYMAX(0, 50 - abs(node_min.Y+8 - (-30))); i++)
//for(s16 i=0; i<50; i++)
u16 gs_amount = 30;
u16 gs_rareness = 60 / gs_amount;
if(gs_rareness == 0)
gs_rareness = 1;
if(mineralrandom.next()%gs_rareness == 0)
{
u16 a = mineralrandom.next() % 16;
u16 amount = gs_amount * a*a*a / 1000;
for(s16 i=0; i<amount; i++)
{
s16 x = mineralrandom.range(node_min.X+1, node_max.X-1);
s16 y = mineralrandom.range(node_min.Y+1, node_max.Y-1);
s16 z = mineralrandom.range(node_min.Z+1, node_max.Z-1);
for(u16 i=0; i<27; i++)
{
v3s16 p = v3s16(x,y,z) + g_27dirs[i];
u32 vi = vmanip.m_area.index(p);
if(vmanip.m_data[vi].getContent() == CONTENT_STONE)
if(mineralrandom.next()%8 == 0)
vmanip.m_data[vi] = MapNode(0x81a); // relies on the data value for glowstone being defined as 0x819 in content_mapnode.h. Poor coding I know, but I couldn't figure out how to do it any other way. I'm pretty sure this is also why the glowstone shows up even when the block is suppsosed to be mud or sand or whatever.
}
}
}
/*
Add iron
*/

View File

@ -24,7 +24,7 @@ const char *mineral_filenames[MINERAL_COUNT] =
{
NULL,
"mineral_coal.png",
"mineral_iron.png"
"mineral_iron.png",
};
std::string mineral_textures[MINERAL_COUNT];

View File

@ -529,6 +529,9 @@ void TextureSource::buildMainAtlas()
sourcelist.push_back("stone.png^mineral_coal.png");
sourcelist.push_back("stone.png^mineral_iron.png");
sourcelist.push_back("glowstone.png");
sourcelist.push_back("brightglass.png");
// Padding to disallow texture bleeding
s32 padding = 16;