diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defaultsettings.cpp | 1 | ||||
-rw-r--r-- | src/server.cpp | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index ac62b2060..4a420445c 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -245,6 +245,7 @@ void set_default_settings(Settings *settings) settings->setDefault("default_privs", "interact, shout"); settings->setDefault("player_transfer_distance", "0"); settings->setDefault("enable_pvp", "true"); + settings->setDefault("vertical_spawn_range", "16"); settings->setDefault("disallow_empty_password", "false"); settings->setDefault("disable_anticheat", "false"); settings->setDefault("enable_rollback_recording", "false"); diff --git a/src/server.cpp b/src/server.cpp index 1e039631c..09675dae3 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3269,7 +3269,7 @@ v3f Server::findSpawnPos() } s16 water_level = map.getWaterLevel(); - + s16 vertical_spawn_range = g_settings->getS16("vertical_spawn_range"); bool is_good = false; // Try to find a good place a few times @@ -3282,9 +3282,9 @@ v3f Server::findSpawnPos() // Get ground height at point s16 groundheight = map.findGroundLevel(nodepos2d); - if (groundheight <= water_level) // Don't go underwater - continue; - if (groundheight > water_level + 6) // Don't go to high places + // Don't go underwater or to high places + if (groundheight <= water_level || + groundheight > water_level + vertical_spawn_range) continue; v3s16 nodepos(nodepos2d.X, groundheight, nodepos2d.Y); |