Growing watermelons.
parent
de461d80ac
commit
46a4a109bf
Binary file not shown.
After Width: | Height: | Size: 821 B |
|
@ -449,6 +449,17 @@ InventoryItem *craft_get_result(InventoryItem **items)
|
|||
}
|
||||
}
|
||||
|
||||
// Watermelon sprout
|
||||
{
|
||||
ItemSpec specs[9];
|
||||
specs[0] = ItemSpec(ITEM_CRAFT, "watermelon_seed");
|
||||
specs[3] = ItemSpec(ITEM_MATERIAL, CONTENT_MUD);
|
||||
if(checkItemCombination(items, specs))
|
||||
{
|
||||
return new MaterialItem(CONTENT_WATERMELON_SPROUT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1011,7 +1011,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
collector.append(material_papyrus, vertices, 4, indices, 6);
|
||||
}
|
||||
}
|
||||
else if(n.getContent() == CONTENT_WATERMELON_VINE)
|
||||
else if(n.getContent() == CONTENT_WATERMELON_VINE || n.getContent() == CONTENT_WATERMELON_GROWING_VINE)
|
||||
{
|
||||
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
|
||||
video::SColor c = MapBlock_LightColor(255, l);
|
||||
|
|
|
@ -36,7 +36,7 @@ void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
|
|||
void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
|
||||
void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
|
||||
|
||||
content_t trans_table_19[23][2] = {
|
||||
content_t trans_table_19[25][2] = {
|
||||
{CONTENT_GRASS, 1},
|
||||
{CONTENT_TREE, 4},
|
||||
{CONTENT_LEAVES, 5},
|
||||
|
@ -60,6 +60,8 @@ content_t trans_table_19[23][2] = {
|
|||
{CONTENT_BOOKSHELF, 29},
|
||||
{CONTENT_WATERMELON, 31},
|
||||
{CONTENT_WATERMELON_VINE, 32},
|
||||
{CONTENT_WATERMELON_SPROUT, 33},
|
||||
{CONTENT_WATERMELON_GROWING_VINE, 34},
|
||||
};
|
||||
|
||||
MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
|
||||
|
@ -275,6 +277,27 @@ void content_mapnode_init()
|
|||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
setWoodLikeDiggingProperties(f->digging_properties, 0.10);
|
||||
|
||||
i = CONTENT_WATERMELON_GROWING_VINE;
|
||||
f = &content_features(i);
|
||||
f->setInventoryTexture("watermelon_growing_vine.png");
|
||||
f->light_propagates = true;
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->is_ground_content = true;
|
||||
f->solidness = 0;
|
||||
f->walkable = false;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WATERMELON_VINE)+" 1";
|
||||
setWoodLikeDiggingProperties(f->digging_properties, 0.10);
|
||||
|
||||
i = CONTENT_WATERMELON_SPROUT;
|
||||
f = &content_features(i);
|
||||
f->setAllTextures("mud.png");
|
||||
f->setTexture(0, "watermelon_sprout.png");
|
||||
f->setInventoryTextureCube("watermelon_sprout.png", "mud.png", "mud.png");
|
||||
f->param_type = CPT_MINERAL;
|
||||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
setDirtLikeDiggingProperties(f->digging_properties, 1.0);
|
||||
|
||||
i = CONTENT_PAPYRUS;
|
||||
f = &content_features(i);
|
||||
f->setInventoryTexture("papyrus.png");
|
||||
|
|
|
@ -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[23][2];
|
||||
extern content_t trans_table_19[25][2];
|
||||
|
||||
MapNode mapnode_translate_from_internal(MapNode n_from, u8 version);
|
||||
MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
||||
|
@ -85,6 +85,8 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
|||
#define CONTENT_NC_RB 0x818
|
||||
#define CONTENT_WATERMELON 0x819 // 31
|
||||
#define CONTENT_WATERMELON_VINE 0x81a // 32
|
||||
#define CONTENT_WATERMELON_SPROUT 0x81b // 34
|
||||
#define CONTENT_WATERMELON_GROWING_VINE 0x81c // 33
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -903,6 +903,72 @@ void ServerEnvironment::step(float dtime)
|
|||
}
|
||||
}
|
||||
/*
|
||||
* Sprouts decay after growing
|
||||
*/
|
||||
if(n.getContent() == CONTENT_WATERMELON_SPROUT)
|
||||
{
|
||||
MapNode n_top = block->getNodeNoEx(p0+v3s16(0,1,0));
|
||||
if(n_top.getContent() == CONTENT_WATERMELON_VINE
|
||||
|| n_top.getContent() == CONTENT_WATERMELON_GROWING_VINE)
|
||||
{
|
||||
n.setContent(CONTENT_MUD);
|
||||
m_map->addNodeWithEvent(p, n);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* All watermelons growing stuff (yes, the grow from air)
|
||||
*/
|
||||
if(n.getContent() == CONTENT_AIR)
|
||||
{
|
||||
MapNode n_bottom = block->getNodeNoEx(p0+v3s16(0, -1, 0));
|
||||
MapNode n_top = block->getNodeNoEx(p0+v3s16(0, 1, 0));
|
||||
if(n_bottom.getContent() == CONTENT_WATERMELON_SPROUT
|
||||
&& n_top.getLightBlend(getDayNightRatio()) >= 12)
|
||||
{
|
||||
n.setContent(CONTENT_WATERMELON_GROWING_VINE);
|
||||
m_map->addNodeWithEvent(p, n);
|
||||
}
|
||||
else if(myrand_range(0, 1)) // will grow vine
|
||||
{
|
||||
s16 xdir = myrand_range(-1, 1);
|
||||
s16 zdir = myrand_range(-1, 1);
|
||||
MapNode n_side = block->getNodeNoEx(p0+v3s16(xdir,0,zdir));
|
||||
if(n_side.getContent() == CONTENT_WATERMELON_GROWING_VINE && (
|
||||
n_bottom.getContent() == CONTENT_MUD ||
|
||||
n_bottom.getContent() == CONTENT_GRASS ||
|
||||
n_bottom.getContent() == CONTENT_GRASS_FOOTSTEPS ||
|
||||
n_bottom.getContent() == CONTENT_SAND))
|
||||
{
|
||||
n.setContent(CONTENT_WATERMELON_GROWING_VINE);
|
||||
m_map->addNodeWithEvent(p, n);
|
||||
}
|
||||
}
|
||||
else if(myrand_range(0, 1)) // will berry
|
||||
{
|
||||
s16 xdir = myrand_range(-1, 1);
|
||||
s16 zdir = myrand_range(-1, 1);
|
||||
MapNode n_side = block->getNodeNoEx(p0+v3s16(xdir,0,zdir));
|
||||
if(n_side.getContent() == CONTENT_WATERMELON_GROWING_VINE && (
|
||||
n_bottom.getContent() == CONTENT_MUD ||
|
||||
n_bottom.getContent() == CONTENT_GRASS ||
|
||||
n_bottom.getContent() == CONTENT_GRASS_FOOTSTEPS ||
|
||||
n_bottom.getContent() == CONTENT_SAND))
|
||||
{
|
||||
n.setContent(CONTENT_WATERMELON);
|
||||
m_map->addNodeWithEvent(p, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Growing vines periodicaly stops to grow
|
||||
if(n.getContent() == CONTENT_WATERMELON_GROWING_VINE)
|
||||
{
|
||||
if(!myrand_range(0,2))
|
||||
{
|
||||
n.setContent(CONTENT_WATERMELON_VINE);
|
||||
m_map->addNodeWithEvent(p, n);
|
||||
}
|
||||
}
|
||||
/*
|
||||
Rats spawn around regular trees
|
||||
*/
|
||||
if(n.getContent() == CONTENT_TREE ||
|
||||
|
|
Loading…
Reference in New Issue