mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Improve (re)spawn, add cache_block_before_spawn and max_spawn_height settings
This commit is contained in:
parent
000da6b25d
commit
22dbbf0a6f
5 changed files with 55 additions and 40 deletions
|
@ -2285,8 +2285,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
}
|
||||
|
||||
/*infostream<<"Server::ProcessData(): Moved player "<<peer_id<<" to "
|
||||
<<"("<<position.X<<","<<position.Y<<","<<position.Z<<")"
|
||||
<<" pitch="<<pitch<<" yaw="<<yaw<<std::endl;*/
|
||||
<<"("<<position.X<<","<<position.Y<<","<<position.Z<<")"
|
||||
<<" pitch="<<pitch<<" yaw="<<yaw<<std::endl;*/
|
||||
|
||||
}
|
||||
else if(command == TOSERVER_GOTBLOCKS)
|
||||
{
|
||||
|
@ -5318,10 +5319,10 @@ v3f findSpawnPos(ServerMap &map)
|
|||
-range + (myrand() % (range * 2)));
|
||||
|
||||
// Get ground height at point
|
||||
s16 groundheight = map.findGroundLevel(nodepos2d);
|
||||
s16 groundheight = map.findGroundLevel(nodepos2d, g_settings->getBool("cache_block_before_spawn"));
|
||||
if (groundheight <= water_level) // Don't go underwater
|
||||
continue;
|
||||
if (groundheight > water_level + 6) // Don't go to high places
|
||||
if (groundheight > water_level + g_settings->getS16("max_spawn_height")) // Don't go to high places
|
||||
continue;
|
||||
|
||||
nodepos = v3s16(nodepos2d.X, groundheight, nodepos2d.Y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue