forked from oerkki/voxelands
add jungleleaves and jungle saplings
This commit is contained in:
parent
a93083e7b6
commit
e48074e262
|
@ -1067,6 +1067,32 @@ void content_mapnode_init()
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
setLeafLikeDiggingProperties(f->digging_properties, 0.15);
|
setLeafLikeDiggingProperties(f->digging_properties, 0.15);
|
||||||
|
|
||||||
|
i = CONTENT_JUNGLELEAVES;
|
||||||
|
f = &content_features(i);
|
||||||
|
f->description = std::string("Jungle Leaves");
|
||||||
|
f->light_propagates = true;
|
||||||
|
//f->param_type = CPT_MINERAL;
|
||||||
|
f->param_type = CPT_LIGHT;
|
||||||
|
//f->is_ground_content = true;
|
||||||
|
if (new_style_leaves) {
|
||||||
|
f->draw_type = CDT_GLASSLIKE;
|
||||||
|
f->solidness = 0; // drawn separately, makes no faces
|
||||||
|
f->visual_solidness = 1;
|
||||||
|
f->setAllTextures("jungleleaves.png");
|
||||||
|
#ifndef SERVER
|
||||||
|
f->setAllTextureTypes(MATERIAL_ALPHA_SIMPLE);
|
||||||
|
#endif
|
||||||
|
f->setInventoryTextureCube("jungleleaves.png", "jungleleaves.png", "jungleleaves.png");
|
||||||
|
}else{
|
||||||
|
f->draw_type = CDT_CUBELIKE;
|
||||||
|
f->setAllTextures("[noalpha:jungleleaves.png");
|
||||||
|
}
|
||||||
|
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||||
|
f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_JUNGLESAPLING)+" 1";
|
||||||
|
f->extra_dug_item_rarity = 20;
|
||||||
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
|
setLeafLikeDiggingProperties(f->digging_properties, 0.15);
|
||||||
|
|
||||||
i = CONTENT_TRIMMED_LEAVES;
|
i = CONTENT_TRIMMED_LEAVES;
|
||||||
f = &content_features(i);
|
f = &content_features(i);
|
||||||
f->description = std::string("Trimmed Leaves");
|
f->description = std::string("Trimmed Leaves");
|
||||||
|
@ -1614,6 +1640,18 @@ void content_mapnode_init()
|
||||||
f->cook_result = std::string("CraftItem saltpeter 1");
|
f->cook_result = std::string("CraftItem saltpeter 1");
|
||||||
setStoneLikeDiggingProperties(f->digging_properties, 0.5);
|
setStoneLikeDiggingProperties(f->digging_properties, 0.5);
|
||||||
|
|
||||||
|
i = CONTENT_MESE_DIGGING;
|
||||||
|
f = &content_features(i);
|
||||||
|
f->description = std::string("Mese");
|
||||||
|
f->setAllTextures("mese.png");
|
||||||
|
f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
|
||||||
|
f->param_type = CPT_LIGHT;
|
||||||
|
f->draw_type = CDT_CUBELIKE;
|
||||||
|
f->is_ground_content = true;
|
||||||
|
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MESE)+" 1";
|
||||||
|
f->light_source = 10;
|
||||||
|
setStoneLikeDiggingProperties(f->digging_properties, 0.5);
|
||||||
|
|
||||||
i = CONTENT_SPONGE;
|
i = CONTENT_SPONGE;
|
||||||
f = &content_features(i);
|
f = &content_features(i);
|
||||||
f->description = std::string("Sponge");
|
f->description = std::string("Sponge");
|
||||||
|
@ -2414,6 +2452,22 @@ void content_mapnode_init()
|
||||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||||
f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
|
f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
|
||||||
|
|
||||||
|
i = CONTENT_JUNGLESAPLING;
|
||||||
|
f = &content_features(i);
|
||||||
|
f->description = std::string("Jungle Sapling");
|
||||||
|
f->param_type = CPT_LIGHT;
|
||||||
|
f->draw_type = CDT_PLANTLIKE;
|
||||||
|
f->setAllTextures("junglesapling.png");
|
||||||
|
f->setInventoryTexture("junglesapling.png");
|
||||||
|
f->setAllTextureFlags(0);
|
||||||
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
|
f->light_propagates = true;
|
||||||
|
f->air_equivalent = false;
|
||||||
|
f->solidness = 0; // drawn separately, makes no faces
|
||||||
|
f->walkable = false;
|
||||||
|
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||||
|
f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
|
||||||
|
|
||||||
i = CONTENT_APPLE;
|
i = CONTENT_APPLE;
|
||||||
f = &content_features(i);
|
f = &content_features(i);
|
||||||
f->description = std::string("Apple");
|
f->description = std::string("Apple");
|
||||||
|
|
|
@ -276,6 +276,9 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
||||||
#define CONTENT_GLASS_PANE_RED 0x905
|
#define CONTENT_GLASS_PANE_RED 0x905
|
||||||
#define CONTENT_GLASS_PANE_YELLOW 0x906
|
#define CONTENT_GLASS_PANE_YELLOW 0x906
|
||||||
#define CONTENT_GLASS_PANE_BLACK 0x907
|
#define CONTENT_GLASS_PANE_BLACK 0x907
|
||||||
|
// more more
|
||||||
|
#define CONTENT_JUNGLELEAVES 0x910
|
||||||
|
#define CONTENT_JUNGLESAPLING 0x911
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,7 @@ bool FurnaceNodeMetadata::step(float dtime)
|
||||||
fuel_list->decrementMaterials(1);
|
fuel_list->decrementMaterials(1);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_JUNGLETREE).checkItem(fuel_item))
|
else if(ItemSpec(ITEM_MATERIAL, CONTENT_JUNGLEWOOD).checkItem(fuel_item))
|
||||||
{
|
{
|
||||||
m_fuel_totaltime = 30/4;
|
m_fuel_totaltime = 30/4;
|
||||||
m_fuel_time = 0;
|
m_fuel_time = 0;
|
||||||
|
|
|
@ -1548,7 +1548,71 @@ void ServerEnvironment::step(float dtime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n.getContent() == CONTENT_LEAVES) // leaf decay
|
if(n.getContent() == CONTENT_JUNGLESAPLING) {
|
||||||
|
if(myrand()%10 == 0)
|
||||||
|
{
|
||||||
|
s16 max_y = 10;
|
||||||
|
s16 max_o = 2;
|
||||||
|
bool grow = true;
|
||||||
|
content_t below = m_map->getNodeNoEx(p+v3s16(0,-1,0)).getContent();
|
||||||
|
if (below == CONTENT_MUD || below == CONTENT_GRASS) {
|
||||||
|
for (s16 z=-max_o; grow && z < max_o; z++) {
|
||||||
|
for (s16 y=2; grow && y < max_y; y++) {
|
||||||
|
for (s16 x=-max_o; grow && x < max_o; x++) {
|
||||||
|
v3s16 test_p = p + v3s16(x,y,z);
|
||||||
|
if (test_p != p) {
|
||||||
|
content_t tcon = m_map->getNodeNoEx(test_p).getContent();
|
||||||
|
if (
|
||||||
|
tcon != CONTENT_AIR
|
||||||
|
&& tcon != CONTENT_TREE
|
||||||
|
&& tcon != CONTENT_JUNGLETREE
|
||||||
|
&& tcon != CONTENT_LEAVES
|
||||||
|
&& tcon != CONTENT_APPLE
|
||||||
|
&& tcon != CONTENT_IGNORE
|
||||||
|
)
|
||||||
|
grow = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (grow) {
|
||||||
|
actionstream<<"A sapling grows into a jungle tree at "
|
||||||
|
<<PP(p)<<std::endl;
|
||||||
|
|
||||||
|
core::map<v3s16, MapBlock*> modified_blocks;
|
||||||
|
v3s16 tree_p = p;
|
||||||
|
ManualMapVoxelManipulator vmanip(m_map);
|
||||||
|
v3s16 tree_blockp = getNodeBlockPos(tree_p);
|
||||||
|
vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,1,1));
|
||||||
|
mapgen::make_jungletree(vmanip, tree_p);
|
||||||
|
vmanip.blitBackAll(&modified_blocks);
|
||||||
|
|
||||||
|
// update lighting
|
||||||
|
core::map<v3s16, MapBlock*> lighting_modified_blocks;
|
||||||
|
for(core::map<v3s16, MapBlock*>::Iterator
|
||||||
|
i = modified_blocks.getIterator();
|
||||||
|
i.atEnd() == false; i++)
|
||||||
|
{
|
||||||
|
lighting_modified_blocks.insert(i.getNode()->getKey(), i.getNode()->getValue());
|
||||||
|
}
|
||||||
|
m_map->updateLighting(lighting_modified_blocks, modified_blocks);
|
||||||
|
|
||||||
|
// Send a MEET_OTHER event
|
||||||
|
MapEditEvent event;
|
||||||
|
event.type = MEET_OTHER;
|
||||||
|
for(core::map<v3s16, MapBlock*>::Iterator
|
||||||
|
i = modified_blocks.getIterator();
|
||||||
|
i.atEnd() == false; i++)
|
||||||
|
{
|
||||||
|
v3s16 p = i.getNode()->getKey();
|
||||||
|
event.modified_blocks.insert(p, true);
|
||||||
|
}
|
||||||
|
m_map->dispatchEvent(&event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (n.getContent() == CONTENT_LEAVES || n.getContent() == CONTENT_JUNGLELEAVES) // leaf decay
|
||||||
{
|
{
|
||||||
if (myrand()%10 == 0)
|
if (myrand()%10 == 0)
|
||||||
{
|
{
|
||||||
|
@ -1579,7 +1643,10 @@ void ServerEnvironment::step(float dtime)
|
||||||
if (myrand()%20 == 0) {
|
if (myrand()%20 == 0) {
|
||||||
v3f sapling_pos = intToFloat(leaf_p, BS);
|
v3f sapling_pos = intToFloat(leaf_p, BS);
|
||||||
sapling_pos += v3f(myrand_range(-1500,1500)*1.0/1000, 0, myrand_range(-1500,1500)*1.0/1000);
|
sapling_pos += v3f(myrand_range(-1500,1500)*1.0/1000, 0, myrand_range(-1500,1500)*1.0/1000);
|
||||||
ServerActiveObject *obj = new ItemSAO(this, 0, sapling_pos, "MaterialItem2 " + itos(CONTENT_SAPLING) + " 1");
|
content_t c = CONTENT_SAPLING;
|
||||||
|
if (n.getContent() == CONTENT_JUNGLELEAVES)
|
||||||
|
c = CONTENT_JUNGLESAPLING;
|
||||||
|
ServerActiveObject *obj = new ItemSAO(this, 0, sapling_pos, "MaterialItem2 " + itos(c) + " 1");
|
||||||
addActiveObject(obj);
|
addActiveObject(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ void make_largetree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
|
||||||
void make_jungletree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
|
void make_jungletree(ManualMapVoxelManipulator &vmanip, v3s16 p0)
|
||||||
{
|
{
|
||||||
MapNode treenode(CONTENT_JUNGLETREE);
|
MapNode treenode(CONTENT_JUNGLETREE);
|
||||||
MapNode leavesnode(CONTENT_LEAVES);
|
MapNode leavesnode(CONTENT_JUNGLELEAVES);
|
||||||
|
|
||||||
for(s16 x=-1; x<=1; x++)
|
for(s16 x=-1; x<=1; x++)
|
||||||
for(s16 z=-1; z<=1; z++)
|
for(s16 z=-1; z<=1; z++)
|
||||||
|
|
Loading…
Reference in New Issue