an assortment of bugfixes

This commit is contained in:
darkrose 2013-10-27 12:39:33 +10:00
parent 16b86e472d
commit a813944dc0
4 changed files with 32 additions and 15 deletions

View File

@ -1369,7 +1369,6 @@ void content_mapnode_init()
f->description = std::string("Sponge"); f->description = std::string("Sponge");
f->setAllTextures("sponge.png"); f->setAllTextures("sponge.png");
f->setInventoryTextureCube("sponge.png", "sponge.png", "sponge.png"); f->setInventoryTextureCube("sponge.png", "sponge.png", "sponge.png");
f->param_type = CPT_MINERAL;
f->draw_type = CDT_CUBELIKE; f->draw_type = CDT_CUBELIKE;
f->is_ground_content = true; f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
@ -1381,7 +1380,6 @@ void content_mapnode_init()
f->description = std::string("Waterlogged Sponge"); f->description = std::string("Waterlogged Sponge");
f->setAllTextures("sponge_full.png"); f->setAllTextures("sponge_full.png");
f->setInventoryTextureCube("sponge_full.png", "sponge_full.png", "sponge_full.png"); f->setInventoryTextureCube("sponge_full.png", "sponge_full.png", "sponge_full.png");
f->param_type = CPT_MINERAL;
f->draw_type = CDT_CUBELIKE; f->draw_type = CDT_CUBELIKE;
f->is_ground_content = true; f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";

View File

@ -255,6 +255,7 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_SILVER 0x8C3 #define CONTENT_SILVER 0x8C3
#define CONTENT_GOLD 0x8C4 #define CONTENT_GOLD 0x8C4
#define CONTENT_QUARTZ 0x8C5 #define CONTENT_QUARTZ 0x8C5
// fire and tnt
#define CONTENT_FIRE 0x8C6 #define CONTENT_FIRE 0x8C6
#define CONTENT_FIRE_SHORTTERM 0x8C7 #define CONTENT_FIRE_SHORTTERM 0x8C7
#define CONTENT_TNT 0x8C8 #define CONTENT_TNT 0x8C8

View File

@ -1103,8 +1103,8 @@ void ServerEnvironment::step(float dtime)
*/ */
if (n.getContent() == CONTENT_GRASS) if (n.getContent() == CONTENT_GRASS)
{ {
int f = (10000-(p.Y*2))+10; int f = (1000-(p.Y*2))+10;
if (p.Y > 2 && myrand()%f == 0) { if (p.Y > 1 && myrand()%f == 0) {
MapNode n_top = m_map->getNodeNoEx(p+v3s16(0,1,0)); MapNode n_top = m_map->getNodeNoEx(p+v3s16(0,1,0));
if (n_top.getContent() == CONTENT_AIR && n_top.getLightBlend(getDayNightRatio()) >= 13) { if (n_top.getContent() == CONTENT_AIR && n_top.getLightBlend(getDayNightRatio()) >= 13) {
v3f pp; v3f pp;
@ -1112,13 +1112,31 @@ void ServerEnvironment::step(float dtime)
pp.Y = p.Y; pp.Y = p.Y;
pp.Z = p.Z; pp.Z = p.Z;
Player *nearest = getNearestConnectedPlayer(pp); Player *nearest = getNearestConnectedPlayer(pp);
if (nearest == NULL || nearest->getPosition().getDistanceFrom(pp*BS)/BS > 10.0) { if (nearest == NULL || nearest->getPosition().getDistanceFrom(pp*BS)/BS > 20.0) {
bool can_grow = true;
for(s16 x=-1; can_grow && x<=1; x++)
for(s16 y=-1; can_grow && y<=1; y++)
for(s16 z=-1; can_grow && z<=1; z++)
{
MapNode n_test = m_map->getNodeNoEx(p+v3s16(x,y,z));
if (
n_test.getContent() == CONTENT_WILDGRASS_SHORT
|| n_test.getContent() == CONTENT_WILDGRASS_LONG
|| n_test.getContent() == CONTENT_FLOWER_STEM
|| n_test.getContent() == CONTENT_FLOWER_ROSE
|| n_test.getContent() == CONTENT_FLOWER_TULIP
|| n_test.getContent() == CONTENT_FLOWER_DAFFODIL
)
can_grow = false;
}
if (can_grow) {
n_top.setContent(CONTENT_WILDGRASS_SHORT); n_top.setContent(CONTENT_WILDGRASS_SHORT);
m_map->addNodeWithEvent(p+v3s16(0,1,0), n_top); m_map->addNodeWithEvent(p+v3s16(0,1,0), n_top);
} }
} }
} }
} }
}
if (n.getContent() == CONTENT_WILDGRASS_SHORT) if (n.getContent() == CONTENT_WILDGRASS_SHORT)
{ {
MapNode n_btm = m_map->getNodeNoEx(p+v3s16(0,-1,0)); MapNode n_btm = m_map->getNodeNoEx(p+v3s16(0,-1,0));
@ -1153,7 +1171,7 @@ void ServerEnvironment::step(float dtime)
{ {
MapNode n_btm = m_map->getNodeNoEx(p+v3s16(0,-1,0)); MapNode n_btm = m_map->getNodeNoEx(p+v3s16(0,-1,0));
if (n_btm.getContent() == CONTENT_GRASS || n_btm.getContent() == CONTENT_MUD) { if (n_btm.getContent() == CONTENT_GRASS || n_btm.getContent() == CONTENT_MUD) {
if (p.Y > -1 && myrand()%200 == 0) { if (p.Y > -1 && myrand()%100 == 0) {
MapNode n_top = m_map->getNodeNoEx(p+v3s16(0,1,0)); MapNode n_top = m_map->getNodeNoEx(p+v3s16(0,1,0));
if ((n_btm.getContent() == CONTENT_GRASS || n_btm.getContent() == CONTENT_FLOWER_POT) && n_top.getLightBlend(getDayNightRatio()) >= 13) { if ((n_btm.getContent() == CONTENT_GRASS || n_btm.getContent() == CONTENT_FLOWER_POT) && n_top.getLightBlend(getDayNightRatio()) >= 13) {
switch (myrand()%3) { switch (myrand()%3) {
@ -1613,7 +1631,7 @@ void ServerEnvironment::step(float dtime)
p.Y < -30 p.Y < -30
&& n_top1.getContent() == CONTENT_WATERSOURCE && n_top1.getContent() == CONTENT_WATERSOURCE
&& n_top2.getContent() == CONTENT_WATERSOURCE && n_top2.getContent() == CONTENT_WATERSOURCE
//&& myrand()%5000 == 0 && myrand()%50 == 0
) { ) {
n_top1.setContent(CONTENT_SPONGE_FULL); n_top1.setContent(CONTENT_SPONGE_FULL);
m_map->addNodeWithEvent(p+v3s16(0,1,0), n_top1); m_map->addNodeWithEvent(p+v3s16(0,1,0), n_top1);

View File

@ -2409,7 +2409,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
if ((n.getContent()&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK) if ((n.getContent()&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK)
mp.Y = -1; mp.Y = -1;
MapNode m = m_env.getMap().getNode(p_under+mp); MapNode m = m_env.getMap().getNodeNoEx(p_under+mp);
core::list<u16> far_players; core::list<u16> far_players;
if ((n.getContent()&CONTENT_HATCH_MASK) != CONTENT_HATCH_MASK) { if ((n.getContent()&CONTENT_HATCH_MASK) != CONTENT_HATCH_MASK) {
if ((n.getContent()&CONTENT_DOOR_OPEN_MASK) == CONTENT_DOOR_OPEN_MASK) { if ((n.getContent()&CONTENT_DOOR_OPEN_MASK) == CONTENT_DOOR_OPEN_MASK) {
@ -2662,7 +2662,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
} }
if (is_farm_swap) if (is_farm_swap)
{ {
MapNode n = m_env.getMap().getNode(p_under); MapNode n = m_env.getMap().getNodeNoEx(p_under);
n.setContent(CONTENT_FARM_DIRT); n.setContent(CONTENT_FARM_DIRT);
actionstream<<player->getName()<<" ploughs "<<PP(p_under) actionstream<<player->getName()<<" ploughs "<<PP(p_under)
@ -2705,7 +2705,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
<<(int)mineral<<std::endl; <<(int)mineral<<std::endl;
core::list<u16> far_players; core::list<u16> far_players;
MapNode n = m_env.getMap().getNode(p_under); MapNode n = m_env.getMap().getNodeNoEx(p_under);
if ( if (
n.getContent() >= CONTENT_DOOR_MIN n.getContent() >= CONTENT_DOOR_MIN
&& n.getContent() <= CONTENT_DOOR_MAX && n.getContent() <= CONTENT_DOOR_MAX
@ -2727,7 +2727,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
sendRemoveNode(p_under, 0, &far_players, 30); sendRemoveNode(p_under, 0, &far_players, 30);
}else{ }else{
if (n.getContent() == CONTENT_FLOWER_POT) { if (n.getContent() == CONTENT_FLOWER_POT) {
MapNode a = m_env.getMap().getNode(p_under+v3s16(0,1,0)); MapNode a = m_env.getMap().getNodeNoEx(p_under+v3s16(0,1,0));
if ( if (
a.getContent() == CONTENT_FLOWER_ROSE a.getContent() == CONTENT_FLOWER_ROSE
|| a.getContent() == CONTENT_FLOWER_DAFFODIL || a.getContent() == CONTENT_FLOWER_DAFFODIL
@ -2743,7 +2743,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
} }
} }
} }
MapNode a = m_env.getMap().getNode(p_under+v3s16(0,1,0)); MapNode a = m_env.getMap().getNodeNoEx(p_under+v3s16(0,1,0));
if (a.getContent() == CONTENT_FIRE) { if (a.getContent() == CONTENT_FIRE) {
sendRemoveNode(p_under+v3s16(0,1,0), 0, &far_players, 30); sendRemoveNode(p_under+v3s16(0,1,0), 0, &far_players, 30);
{ {
@ -2848,7 +2848,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|| wieldname == std::string("TinBucket") || wieldname == std::string("TinBucket")
) )
) { ) {
MapNode n = m_env.getMap().getNode(p_under); MapNode n = m_env.getMap().getNodeNoEx(p_under);
n.setContent(CONTENT_SPONGE); n.setContent(CONTENT_SPONGE);
core::list<u16> far_players; core::list<u16> far_players;