diff options
author | Paramat <paramat@users.noreply.github.com> | 2018-04-15 21:56:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-15 21:56:05 +0100 |
commit | 28813702d67f5d56a7e29cb9473278dcc2ea750e (patch) | |
tree | a6262ba0d04a2e2ef2693fa287df654347904d9a /src/camera.cpp | |
parent | 326eeca306f7bfb53ae3685eef18978dd81e587e (diff) | |
download | hax-minetest-server-28813702d67f5d56a7e29cb9473278dcc2ea750e.tar.gz hax-minetest-server-28813702d67f5d56a7e29cb9473278dcc2ea750e.zip |
FOV: Raise lower limit to avoid zoom-loading of distant world (#7234)
In the client, raise lower limit from 30 to 45 degrees, to avoid server
seeing this as a zoom and loading world beyond the server-set limit.
Add minimum in settingtypes.txt and enforce lower limit when set using
minetest.conf.
In the server, distrust the client-sent FOV if below the heuristic zoom
threshold and use the player object property 'zoom_fov' to check it, to
protect against hacked clients.
Diffstat (limited to '')
-rw-r--r-- | src/camera.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/camera.cpp b/src/camera.cpp index ebb154137..1bbdb56ea 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -71,7 +71,9 @@ Camera::Camera(MapDrawControl &draw_control, Client *client): */ m_cache_fall_bobbing_amount = g_settings->getFloat("fall_bobbing_amount"); m_cache_view_bobbing_amount = g_settings->getFloat("view_bobbing_amount"); - m_cache_fov = g_settings->getFloat("fov"); + // 45 degrees is the lowest FOV that doesn't cause the server to treat this + // as a zoom FOV and load world beyond the set server limits. + m_cache_fov = std::fmax(g_settings->getFloat("fov"), 45.0f); m_arm_inertia = g_settings->getBool("arm_inertia"); m_nametags.clear(); } |