forked from Mirrorlandia_minetest/minetest
Revert "Improve (re)spawn, add cache_block_before_spawn and max_spawn_height settings"
The commit didn't work because the blocks weren't loaded yet. This reverts commit 22dbbf0a6fc9547f0dbdb7f6076337b8c6acd48b. Conflicts: minetest.conf.example
This commit is contained in:
parent
c46574f30f
commit
0fd5c61c00
@ -281,10 +281,6 @@
|
|||||||
#disable_anticheat = false
|
#disable_anticheat = false
|
||||||
# If true, actions are recorded for rollback
|
# If true, actions are recorded for rollback
|
||||||
#enable_rollback_recording = false
|
#enable_rollback_recording = false
|
||||||
# If true, blocks are cached (and generated if not before) before a player is spawned.
|
|
||||||
#cache_block_before_spawn = true
|
|
||||||
# Defines the maximum height a player can spawn in a map, above water level
|
|
||||||
#max_spawn_height = 50
|
|
||||||
|
|
||||||
# Profiler data print interval. #0 = disable.
|
# Profiler data print interval. #0 = disable.
|
||||||
#profiler_print_interval = 0
|
#profiler_print_interval = 0
|
||||||
|
@ -189,8 +189,6 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("disallow_empty_password", "false");
|
settings->setDefault("disallow_empty_password", "false");
|
||||||
settings->setDefault("disable_anticheat", "false");
|
settings->setDefault("disable_anticheat", "false");
|
||||||
settings->setDefault("enable_rollback_recording", "false");
|
settings->setDefault("enable_rollback_recording", "false");
|
||||||
settings->setDefault("cache_block_before_spawn", "true");
|
|
||||||
settings->setDefault("max_spawn_height", "50");
|
|
||||||
|
|
||||||
settings->setDefault("profiler_print_interval", "0");
|
settings->setDefault("profiler_print_interval", "0");
|
||||||
settings->setDefault("enable_mapgen_debug_info", "false");
|
settings->setDefault("enable_mapgen_debug_info", "false");
|
||||||
|
76
src/map.cpp
76
src/map.cpp
@ -3185,56 +3185,48 @@ void ServerMap::prepareBlock(MapBlock *block) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
s16 ServerMap::findGroundLevel(v2s16 p2d)
|
||||||
* Get the ground level by searching for a non CONTENT_AIR node in a column from top to bottom
|
|
||||||
*/
|
|
||||||
s16 ServerMap::findGroundLevel(v2s16 p2d, bool cacheBlocks)
|
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
s16 level;
|
/*
|
||||||
|
Uh, just do something random...
|
||||||
// The reference height is the original mapgen height
|
*/
|
||||||
s16 referenceHeight = m_emerge->getGroundLevelAtPoint(p2d);
|
// Find existing map from top to down
|
||||||
s16 maxSearchHeight = 63 + referenceHeight;
|
s16 max=63;
|
||||||
s16 minSearchHeight = -63 + referenceHeight;
|
s16 min=-64;
|
||||||
v3s16 probePosition(p2d.X, maxSearchHeight, p2d.Y);
|
v3s16 p(p2d.X, max, p2d.Y);
|
||||||
v3s16 blockPosition = getNodeBlockPos(probePosition);
|
for(; p.Y>min; p.Y--)
|
||||||
v3s16 prevBlockPosition = blockPosition;
|
|
||||||
|
|
||||||
// Cache the block to be inspected.
|
|
||||||
if(cacheBlocks) {
|
|
||||||
emergeBlock(blockPosition, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Probes the nodes in the given column
|
|
||||||
for(; probePosition.Y > minSearchHeight; probePosition.Y--)
|
|
||||||
{
|
{
|
||||||
if(cacheBlocks) {
|
MapNode n = getNodeNoEx(p);
|
||||||
// Calculate the block position of the given node
|
if(n.getContent() != CONTENT_IGNORE)
|
||||||
blockPosition = getNodeBlockPos(probePosition);
|
|
||||||
|
|
||||||
// If the node is in an different block, cache it
|
|
||||||
if(blockPosition != prevBlockPosition) {
|
|
||||||
emergeBlock(blockPosition, true);
|
|
||||||
prevBlockPosition = blockPosition;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MapNode node = getNodeNoEx(probePosition);
|
|
||||||
if (node.getContent() != CONTENT_IGNORE &&
|
|
||||||
node.getContent() != CONTENT_AIR) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(p.Y == min)
|
||||||
|
goto plan_b;
|
||||||
|
// If this node is not air, go to plan b
|
||||||
|
if(getNodeNoEx(p).getContent() != CONTENT_AIR)
|
||||||
|
goto plan_b;
|
||||||
|
// Search existing walkable and return it
|
||||||
|
for(; p.Y>min; p.Y--)
|
||||||
|
{
|
||||||
|
MapNode n = getNodeNoEx(p);
|
||||||
|
if(content_walkable(n.d) && n.getContent() != CONTENT_IGNORE)
|
||||||
|
return p.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Could not determine the ground. Use map generator noise functions.
|
// Move to plan b
|
||||||
if(probePosition.Y == minSearchHeight) {
|
plan_b:
|
||||||
level = referenceHeight;
|
#endif
|
||||||
} else {
|
|
||||||
level = probePosition.Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Determine from map generator noise functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
s16 level = m_emerge->getGroundLevelAtPoint(p2d);
|
||||||
return level;
|
return level;
|
||||||
|
|
||||||
|
//double level = base_rock_level_2d(m_seed, p2d) + AVERAGE_MUD_AMOUNT;
|
||||||
|
//return (s16)level;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServerMap::loadFromFolders() {
|
bool ServerMap::loadFromFolders() {
|
||||||
|
@ -428,7 +428,7 @@ public:
|
|||||||
void prepareBlock(MapBlock *block);
|
void prepareBlock(MapBlock *block);
|
||||||
|
|
||||||
// Helper for placing objects on ground level
|
// Helper for placing objects on ground level
|
||||||
s16 findGroundLevel(v2s16 p2d, bool cacheBlocks);
|
s16 findGroundLevel(v2s16 p2d);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Misc. helper functions for fiddling with directory and file
|
Misc. helper functions for fiddling with directory and file
|
||||||
|
@ -2302,7 +2302,6 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
/*infostream<<"Server::ProcessData(): Moved player "<<peer_id<<" to "
|
/*infostream<<"Server::ProcessData(): Moved player "<<peer_id<<" to "
|
||||||
<<"("<<position.X<<","<<position.Y<<","<<position.Z<<")"
|
<<"("<<position.X<<","<<position.Y<<","<<position.Z<<")"
|
||||||
<<" pitch="<<pitch<<" yaw="<<yaw<<std::endl;*/
|
<<" pitch="<<pitch<<" yaw="<<yaw<<std::endl;*/
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(command == TOSERVER_GOTBLOCKS)
|
else if(command == TOSERVER_GOTBLOCKS)
|
||||||
{
|
{
|
||||||
@ -5336,10 +5335,10 @@ v3f findSpawnPos(ServerMap &map)
|
|||||||
-range + (myrand() % (range * 2)));
|
-range + (myrand() % (range * 2)));
|
||||||
|
|
||||||
// Get ground height at point
|
// Get ground height at point
|
||||||
s16 groundheight = map.findGroundLevel(nodepos2d, g_settings->getBool("cache_block_before_spawn"));
|
s16 groundheight = map.findGroundLevel(nodepos2d);
|
||||||
if (groundheight <= water_level) // Don't go underwater
|
if (groundheight <= water_level) // Don't go underwater
|
||||||
continue;
|
continue;
|
||||||
if (groundheight > water_level + g_settings->getS16("max_spawn_height")) // Don't go to high places
|
if (groundheight > water_level + 6) // Don't go to high places
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nodepos = v3s16(nodepos2d.X, groundheight, nodepos2d.Y);
|
nodepos = v3s16(nodepos2d.X, groundheight, nodepos2d.Y);
|
||||||
|
Loading…
Reference in New Issue
Block a user