diff --git a/src/content_sao.cpp b/src/content_sao.cpp index e9d7e86..a96d8d9 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -148,7 +148,7 @@ void ItemSAO::step(float dtime, bool send_recommended) // Apply gravity m_speed_f += v3f(0, -dtime*9.81*BS, 0); // Maximum movement without glitches - f32 pos_max_d = BS*0.3; + f32 pos_max_d = BS*0.5; // Limit speed if (m_speed_f.getLength()*dtime > pos_max_d) m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime); @@ -172,19 +172,43 @@ void ItemSAO::step(float dtime, bool send_recommended) item && item->getCount() == 1 && ( + m_content == CONTENT_LEAVES + || m_content == CONTENT_JUNGLELEAVES + || m_content == CONTENT_APPLE_LEAVES + || m_content == CONTENT_CONIFER_LEAVES + ) + ) { // leaves falling on grass become either saplings or wild grass + if ( un.getContent() == CONTENT_MUD || un.getContent() == CONTENT_GRASS || un.getContent() == CONTENT_GRASS_FOOTSTEPS - ) && ( - m_content == CONTENT_SAPLING - || m_content == CONTENT_JUNGLESAPLING - || m_content == CONTENT_APPLE_SAPLING - || m_content == CONTENT_CONIFER_SAPLING - ) - ) { + ) { + content_t c = CONTENT_SAPLING; + std::vector search; + search.push_back(CONTENT_SAPLING); + search.push_back(CONTENT_JUNGLESAPLING); + search.push_back(CONTENT_APPLE_SAPLING); + search.push_back(CONTENT_CONIFER_SAPLING); + if (m_env->searchNear(pos_i,v3s16(3,3,3),search,NULL)) { + c = CONTENT_WILDGRASS_SHORT; + }else{ + switch (m_content) { + case CONTENT_JUNGLELEAVES: + c = CONTENT_JUNGLESAPLING; + break; + case CONTENT_APPLE_LEAVES: + c = CONTENT_APPLE_SAPLING; + break; + case CONTENT_CONIFER_LEAVES: + c = CONTENT_CONIFER_SAPLING; + break; + default:; + } + } + n.setContent(c); + m_env->getMap().addNodeWithEvent(pos_i,n); + } delete item; - n.setContent(m_content); - m_env->getMap().addNodeWithEvent(pos_i,n); m_removed = true; return; }else if (content_craftitem_features(m_content).edible == 0) { diff --git a/src/environment.cpp b/src/environment.cpp index e7b344e..28d2b4d 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1749,7 +1749,7 @@ void ServerEnvironment::step(float dtime) case CONTENT_JUNGLELEAVES: case CONTENT_CONIFER_LEAVES: { - if (myrand()%8 == 0) { + if (myrand()%4 == 0) { v3s16 leaf_p = p; std::vector search; search.push_back(CONTENT_TREE); @@ -1763,22 +1763,10 @@ void ServerEnvironment::step(float dtime) search.push_back(CONTENT_IGNORE); if (!searchNear(p,v3s16(3,3,3),search,NULL)) { m_map->removeNodeWithEvent(leaf_p); - if (myrand()%20 == 0) { + if (myrand()%10 == 0) { 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); - content_t c = CONTENT_SAPLING; - switch(n.getContent()) { - case CONTENT_JUNGLELEAVES: - c = CONTENT_JUNGLESAPLING; - break; - case CONTENT_CONIFER_LEAVES: - c = CONTENT_CONIFER_SAPLING; - break; - case CONTENT_APPLE_LEAVES: - c = CONTENT_APPLE_SAPLING; - break; - } - ServerActiveObject *obj = new ItemSAO(this, 0, sapling_pos, "MaterialItem2 " + itos(c) + " 1"); + ServerActiveObject *obj = new ItemSAO(this, 0, sapling_pos, "MaterialItem2 " + itos(n.getContent()) + " 1"); addActiveObject(obj); } }