add desert biome

This commit is contained in:
darkrose 2016-02-02 20:21:00 +10:00
parent 6448b19167
commit 7d59fc857a
4 changed files with 33 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

View File

@ -563,6 +563,25 @@ void content_mapnode_init(bool repeat)
f->is_ground_content = true;
f->pressure_type = CST_DROPABLE;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->extra_dug_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_SALT)+" 1";
f->extra_dug_item_rarity = 30;
f->extra_dug_item_min_level = 3;
f->cook_result = std::string("MaterialItem2 ")+itos(CONTENT_GLASS)+" 1";
f->type = CMT_DIRT;
f->hardness = 1.0;
lists::add("creative",i);
lists::add("cooking",i);
lists::add("decrafting",i);
i = CONTENT_DESERT_SAND;
f = &content_features(i);
f->description = wgettext("Desert Sand");
f->setAllTextures("sand_desert.png");
f->setInventoryTextureCube("sand_desert.png", "sand_desert.png", "sand_desert.png");
f->draw_type = CDT_CUBELIKE;
f->is_ground_content = true;
f->pressure_type = CST_DROPABLE;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->extra_dug_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_SALTPETER)+" 1";
f->extra_dug_item_rarity = 30;
f->extra_dug_item_min_level = 3;

View File

@ -77,7 +77,7 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_STEEL_FENCE 0x01C
#define CONTENT_STEEL_BARS 0x01D
#define CONTENT_RAIL 0x01E
// FREE 0x01F
#define CONTENT_DESERT_SAND 0x01F
#define CONTENT_LAVA 0x020
#define CONTENT_LAVASOURCE 0x021
#define CONTENT_LADDER_WALL 0x022

View File

@ -1974,6 +1974,7 @@ void make_block(BlockMakeData *data)
float surface_humidity = surface_humidity_2d(data->seed, p2d_center);
bool is_jungle = surface_humidity > 0.75;
bool is_desert = surface_humidity < 0.25;
/*
Add grass and mud
*/
@ -2009,10 +2010,12 @@ void make_block(BlockMakeData *data)
air_detected || water_detected
)
) {
if (current_depth == 0 && y <= WATER_LEVEL+2 && possibly_have_sand && !is_jungle)
if (is_desert || (current_depth == 0 && y <= WATER_LEVEL+2 && possibly_have_sand && !is_jungle))
have_sand = true;
if (current_depth < 4) {
if (is_desert) {
vmanip.m_data[i] = MapNode(CONTENT_DESERT_SAND);
}else if (current_depth < 4) {
if (have_sand) {
vmanip.m_data[i] = MapNode(CONTENT_SAND);
}else if (current_depth==0 && !water_detected && y >= WATER_LEVEL && air_detected) {
@ -2133,11 +2136,18 @@ void make_block(BlockMakeData *data)
}
}
// Cactii grow only on sand, on land
}else if (n->getContent() == CONTENT_SAND) {
}else if (n->getContent() == CONTENT_DESERT_SAND) {
if (y > (WATER_LEVEL+2)) {
p.Y++;
make_cactus(vmanip, p);
}
// grass on sand
}else if (n->getContent() == CONTENT_SAND) {
if (y > (WATER_LEVEL+2)) {
p.Y++;
if (vmanip.m_area.contains(p))
vmanip.m_data[vmanip.m_area.index(p)] = MapNode(CONTENT_WILDGRASS_SHORT);
}
}
}
}