Check for NaN values in settings

This commit is contained in:
upsilon
2017-02-11 15:44:53 +01:00
parent d6e50086c1
commit 676baa4b0b
7 changed files with 24 additions and 8 deletions

View File

@ -13,10 +13,14 @@ local teleport_nearest = function(pos)
local MAX_TELEPORTATION_DISTANCE = tonumber(minetest.setting_get("moremesecons_teleporter.max_t2t_distance")) or 50
if MAX_TELEPORTATION_DISTANCE <= 0 then
MAX_TELEPORTATION_DISTANCE = 1
elseif MAX_TELEPORTATION_DISTANCE ~= MAX_TELEPORTATION_DISTANCE then -- NaN
MAX_TELEPORTATION_DISTANCE = 50
end
local MAX_PLAYER_DISTANCE = tonumber(minetest.setting_get("moremesecons_teleporter.max_p2t_distance")) or 25
if MAX_PLAYER_DISTANCE <= 0 then
MAX_PLAYER_DISTANCE = 1
elseif MAX_PLAYER_DISTANCE ~= MAX_PLAYER_DISTANCE then -- NaN
MAX_PLAYER_DISTANCE = 25
end
-- Search the nearest player