mirror of
https://github.com/minetest/minetest.git
synced 2024-08-19 04:54:18 +02:00
end-of-day.
This commit is contained in:
parent
6834b39c96
commit
3d6e71a7d0
55
src/map.cpp
55
src/map.cpp
@ -1914,7 +1914,8 @@ ServerMap::ServerMap(std::string savedir, HMParams hmp, MapParams mp):
|
||||
|
||||
// Add only one entry
|
||||
list_baseheight->addPoint(v3s16(0,0,0), Attribute(0));
|
||||
list_randmax->addPoint(v3s16(0,0,0), Attribute(30));
|
||||
list_randmax->addPoint(v3s16(0,0,0), Attribute(22));
|
||||
//list_randmax->addPoint(v3s16(0,0,0), Attribute(0));
|
||||
list_randfactor->addPoint(v3s16(0,0,0), Attribute(0.45));
|
||||
|
||||
// Easy spawn point
|
||||
@ -2304,6 +2305,22 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
||||
|
||||
}//timer1
|
||||
|
||||
/*
|
||||
Randomize some parameters
|
||||
*/
|
||||
|
||||
// 0-100
|
||||
// Usually little, sometimes huge
|
||||
//u32 stone_obstacle_amount = myrand_range(0, myrand_range(0, 100));
|
||||
u32 stone_obstacle_amount = myrand_range(0, 100);
|
||||
|
||||
/*
|
||||
Loop this part, it will make stuff look older and newer nicely
|
||||
*/
|
||||
|
||||
for(u32 i_age=0; i_age<2; i_age++)
|
||||
{ // Aging loop
|
||||
|
||||
// This is set during the next operation.
|
||||
// Maximum height of the stone surface and obstacles.
|
||||
// This is used to disable dungeon generation from going too high.
|
||||
@ -2316,11 +2333,14 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
||||
/*
|
||||
Add some random stone obstacles
|
||||
*/
|
||||
|
||||
for(u32 ri=0; ri<15; ri++)
|
||||
|
||||
for(u32 ri=0; ri<stone_obstacle_amount/3; ri++)
|
||||
//for(u32 ri=0; ri<7; ri++)
|
||||
//if(0)
|
||||
{
|
||||
// Randomize max height so usually stuff will be quite low
|
||||
s16 maxheight_randomized = myrand_range(0, 30);
|
||||
//s16 maxheight_randomized = myrand_range(0, 25);
|
||||
s16 maxheight_randomized = myrand_range(0, stone_obstacle_amount/3);
|
||||
|
||||
// The size of these could actually be m_chunksize*MAP_BLOCKSIZE*2
|
||||
v3s16 ob_size(
|
||||
@ -2430,7 +2450,11 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
||||
s16 max_tunnel_diameter = 5;
|
||||
u16 tunnel_routepoints = 15;
|
||||
|
||||
bool bruise_surface = (jj < dungeons_count / 3);
|
||||
u32 bruise_surface_maxindex =
|
||||
dungeons_count / 10 * stone_surface_max_y / 10;
|
||||
bruise_surface_maxindex =
|
||||
rangelim(bruise_surface_maxindex, 0, dungeons_count/2);
|
||||
bool bruise_surface = (jj < bruise_surface_maxindex);
|
||||
|
||||
if(bruise_surface)
|
||||
{
|
||||
@ -2718,6 +2742,18 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
||||
// Find ground level
|
||||
s16 surface_y = find_ground_level(vmanip, p2d);
|
||||
|
||||
/*
|
||||
If topmost node is grass, change it to mud.
|
||||
It might be if it was flown to there from a neighboring
|
||||
chunk and then converted.
|
||||
*/
|
||||
{
|
||||
u32 i = vmanip.m_area.index(v3s16(p2d.X, surface_y, p2d.Y));
|
||||
MapNode *n = &vmanip.m_data[i];
|
||||
if(n->d == CONTENT_GRASS)
|
||||
n->d = CONTENT_MUD;
|
||||
}
|
||||
|
||||
/*
|
||||
Add mud on ground
|
||||
*/
|
||||
@ -2779,9 +2815,12 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
||||
|
||||
// If not mud, do nothing to it
|
||||
MapNode *n = &vmanip.m_data[i];
|
||||
if(n->d != CONTENT_MUD)
|
||||
if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS)
|
||||
continue;
|
||||
|
||||
// Make it exactly mud
|
||||
n->d = CONTENT_MUD;
|
||||
|
||||
v3s16 dirs4[4] = {
|
||||
v3s16(0,0,1), // back
|
||||
v3s16(1,0,0), // right
|
||||
@ -2923,6 +2962,9 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
||||
}
|
||||
|
||||
}//timer1
|
||||
|
||||
} // Aging loop
|
||||
|
||||
{
|
||||
// 1ms @cs=8
|
||||
//TimeTaker timer1("plant trees");
|
||||
@ -2951,6 +2993,7 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
||||
}
|
||||
|
||||
}//timer1
|
||||
|
||||
{
|
||||
// 19ms @cs=8
|
||||
//TimeTaker timer1("grow grass");
|
||||
|
@ -568,6 +568,11 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
|
||||
continue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
NOTE: We can't know the ground level this way with the
|
||||
new generator.
|
||||
*/
|
||||
if(haxmode)
|
||||
{
|
||||
/*
|
||||
@ -586,6 +591,7 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Check if map has this block
|
||||
@ -2093,7 +2099,18 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
||||
// Don't add a node if this is not a free space
|
||||
MapNode n2 = m_env.getMap().getNode(p_over);
|
||||
if(content_buildable_to(n2.d) == false)
|
||||
{
|
||||
// Client probably has wrong data.
|
||||
// Set block not sent, so that client will get
|
||||
// a valid one.
|
||||
dstream<<"Client "<<peer_id<<" tried to place"
|
||||
<<" node in invalid position; setting"
|
||||
<<" MapBlock not sent."<<std::endl;
|
||||
RemoteClient *client = getClient(peer_id);
|
||||
v3s16 blockpos = getNodeBlockPos(p_over);
|
||||
client->SetBlockNotSent(blockpos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch(InvalidPositionException &e)
|
||||
{
|
||||
@ -3189,7 +3206,7 @@ Player *Server::emergePlayer(const char *name, const char *password,
|
||||
*/
|
||||
player->setPosition(intToFloat(v3s16(
|
||||
0,
|
||||
50,
|
||||
64,
|
||||
0
|
||||
)));
|
||||
|
||||
@ -3227,7 +3244,7 @@ Player *Server::emergePlayer(const char *name, const char *password,
|
||||
#if 1
|
||||
player->setPosition(intToFloat(v3s16(
|
||||
0,
|
||||
50,
|
||||
64,
|
||||
0
|
||||
)));
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user