*/
if(lighting_invalidated_blocks.size() > 0)
- dstream<<"lighting "<<lighting_invalidated_blocks.size()
- <<" blocks"<<std::endl;
-
- // 50-100ms for single block generation
- //TimeTaker timer("** EmergeThread updateLighting");
-
- // Update lighting without locking the environment mutex,
- // add modified blocks to changed blocks
- map.updateLighting(lighting_invalidated_blocks, modified_blocks);
+ {
+ /*dstream<<"lighting "<<lighting_invalidated_blocks.size()
+ <<" blocks"<<std::endl;*/
+ // 50-100ms for single block generation
+ //TimeTaker timer("** EmergeThread updateLighting");
+
+ // Update lighting without locking the environment mutex,
+ // add modified blocks to changed blocks
+ map.updateLighting(lighting_invalidated_blocks, modified_blocks);
+ }
+
// Add all from changed_blocks to modified_blocks
for(core::map<v3s16, MapBlock*>::Iterator i = changed_blocks.getIterator();
i.atEnd() == false; i++)
block_is_invalid = true;
}
+ /*if(block->isFullyGenerated() == false)
+ {
+ block_is_invalid = true;
+ }*/
+
v2s16 p2d(p.X, p.Z);
ServerMap *map = (ServerMap*)(&server->m_env.getMap());
v2s16 chunkpos = map->sector_to_chunk(p2d);
writeU16(&reply[0], TOCLIENT_INIT);
writeU8(&reply[2], deployed);
writeV3S16(&reply[2+1], floatToInt(player->getPosition()+v3f(0,BS/2,0), BS));
- writeU64(&reply[2+1+6], m_env.getServerMap().getSeed());
+ //writeU64(&reply[2+1+6], m_env.getServerMap().getSeed());
+
// Send as reliable
m_con.Send(peer_id, 0, reply, true);
/*
Give materials
*/
+
+ // CONTENT_IGNORE-terminated list
+ u8 material_items[] = {
+ CONTENT_TORCH,
+ CONTENT_MUD,
+ CONTENT_STONE,
+ CONTENT_SAND,
+ CONTENT_TREE,
+ CONTENT_LEAVES,
+ CONTENT_MESE,
+ CONTENT_WATERSOURCE,
+ CONTENT_CLOUD,
+ CONTENT_FURNACE,
+ CONTENT_SIGN_WALL,
+ CONTENT_IGNORE
+ };
+
+ u8 *mip = material_items;
+ for(u16 i=0; i<PLAYER_INVENTORY_SIZE; i++)
+ {
+ if(*mip == CONTENT_IGNORE)
+ break;
+
+ InventoryItem *item = new MaterialItem(*mip, 1);
+ player->inventory.addItem("main", item);
+
+ mip++;
+ }
+
+#if 0
assert(USEFUL_CONTENT_COUNT <= PLAYER_INVENTORY_SIZE);
// add torch first
InventoryItem *item = new MaterialItem(i, 1);
player->inventory.addItem("main", item);
}
+#endif
+
// Sign
{
InventoryItem *item = new MapBlockObjectItem("Sign Example text");
s16 groundheight = 0;
#if 1
// Try to find a good place a few times
- for(s32 i=0; i<500; i++)
+ for(s32 i=0; i<1000; i++)
{
s32 range = 1 + i;
// We're going to try to throw the player to this position
nodepos = v2s16(-range + (myrand()%(range*2)),
-range + (myrand()%(range*2)));
v2s16 sectorpos = getNodeSectorPos(nodepos);
- /*
- Ignore position if it is near a chunk edge.
- Otherwise it would cause excessive loading time at
- initial generation
- */
- {
- if(m_env.getServerMap().sector_to_chunk(sectorpos+v2s16(1,1))
- != m_env.getServerMap().sector_to_chunk(sectorpos+v2s16(-1,-1)))
- continue;
- }
- // Get sector
- m_env.getMap().emergeSector(sectorpos);
- // Get ground height at point
+ // Get sector (NOTE: Don't get because it's slow)
+ //m_env.getMap().emergeSector(sectorpos);
+ // Get ground height at point (fallbacks to heightmap function)
groundheight = m_env.getServerMap().findGroundLevel(nodepos);
// Don't go underwater
if(groundheight < WATER_LEVEL)
//dstream<<"-> Underwater"<<std::endl;
continue;
}
-#if 0 // Doesn't work, generating blocks is a bit too complicated for doing here
+ // Don't go to high places
+ if(groundheight > WATER_LEVEL + 4)
+ {
+ //dstream<<"-> Underwater"<<std::endl;
+ continue;
+ }
+
+#if 0
+// Doesn't work, generating blocks is a bit too complicated for doing here
// Get block at point
v3s16 nodepos3d;
nodepos3d = v3s16(nodepos.X, groundheight+1, nodepos.Y);
continue;
}
#endif
+
// Found a good place
dstream<<"Searched through "<<i<<" places."<<std::endl;
break;
player->setPosition(intToFloat(v3s16(
nodepos.X,
- groundheight + 1,
+ groundheight + 5, // Accomodate mud
nodepos.Y
), BS));
#endif