mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2025-01-09 17:30:24 +01:00
Check for NaN values in settings
This commit is contained in:
parent
d6e50086c1
commit
676baa4b0b
@ -2,6 +2,8 @@ local function initialize_data(meta)
|
|||||||
local NEAREST_MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_commandblock.nearest_max_distance")) or 8
|
local NEAREST_MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_commandblock.nearest_max_distance")) or 8
|
||||||
if NEAREST_MAX_DISTANCE <= 0 then
|
if NEAREST_MAX_DISTANCE <= 0 then
|
||||||
NEAREST_MAX_DISTANCE = 1
|
NEAREST_MAX_DISTANCE = 1
|
||||||
|
elseif NEAREST_MAX_DISTANCE ~= NEAREST_MAX_DISTANCE then -- NaN
|
||||||
|
NEAREST_MAX_DISTANCE = 8
|
||||||
end
|
end
|
||||||
|
|
||||||
local commands = meta:get_string("commands")
|
local commands = meta:get_string("commands")
|
||||||
|
@ -19,6 +19,8 @@ local function is_jammed(pos)
|
|||||||
local JAMMER_MAX_DISTANCE = tonumber(minetest.setting_get(moresecons_jammer.max_distance)) or 10
|
local JAMMER_MAX_DISTANCE = tonumber(minetest.setting_get(moresecons_jammer.max_distance)) or 10
|
||||||
if JAMMER_MAX_DISTANCE <= 0 then
|
if JAMMER_MAX_DISTANCE <= 0 then
|
||||||
JAMMER_MAX_DISTANCE = 1
|
JAMMER_MAX_DISTANCE = 1
|
||||||
|
elseif JAMMER_MAX_DISTANCE ~= JAMMER_MAX_DISTANCE then -- NaN
|
||||||
|
JAMMER_MAX_DISTANCE = 10
|
||||||
end
|
end
|
||||||
|
|
||||||
local pz,py,px = vector.unpack(pos)
|
local pz,py,px = vector.unpack(pos)
|
||||||
|
@ -2,6 +2,8 @@ local kill_nearest_player = function(pos)
|
|||||||
local MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_playerkiller.max_distance")) or 8 -- Use this number to set maximal distance to kill
|
local MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_playerkiller.max_distance")) or 8 -- Use this number to set maximal distance to kill
|
||||||
if MAX_DISTANCE <= 0 then
|
if MAX_DISTANCE <= 0 then
|
||||||
MAX_DISTANCE = 8
|
MAX_DISTANCE = 8
|
||||||
|
elseif MAX_DISTANCE ~= MAX_DISTANCE then -- NaN
|
||||||
|
MAX_DISTANCE = 8
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Search the nearest player
|
-- Search the nearest player
|
||||||
|
@ -44,9 +44,11 @@ if use_speech_dispatcher then
|
|||||||
end
|
end
|
||||||
|
|
||||||
function sayer_activate(pos)
|
function sayer_activate(pos)
|
||||||
local MAX_DISTANCE = minetest.setting_get("moremesecons_sayer.max_distance") or 8
|
local MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_sayer.max_distance")) or 8
|
||||||
if MAX_DISTANCE <= 0 then
|
if MAX_DISTANCE <= 0 then
|
||||||
MAX_DISTANCE = 1
|
MAX_DISTANCE = 1
|
||||||
|
elseif MAX_DISTANCE ~= MAX_DISTANCE then -- NaN
|
||||||
|
MAX_DISTANCE = 8
|
||||||
end
|
end
|
||||||
MAX_DISTANCE = MAX_DISTANCE^2
|
MAX_DISTANCE = MAX_DISTANCE^2
|
||||||
|
|
||||||
@ -83,9 +85,11 @@ if use_speech_dispatcher then
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
function sayer_activate(pos)
|
function sayer_activate(pos)
|
||||||
local MAX_DISTANCE = minetest.setting_get("moremesecons_sayer.max_distance") or 8
|
local MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_sayer.max_distance")) or 8
|
||||||
if MAX_DISTANCE <= 0 then
|
if MAX_DISTANCE <= 0 then
|
||||||
MAX_DISTANCE = 1
|
MAX_DISTANCE = 1
|
||||||
|
elseif MAX_DISTANCE ~= MAX_DISTANCE then -- NaN
|
||||||
|
MAX_DISTANCE = 8
|
||||||
end
|
end
|
||||||
|
|
||||||
local tab = {
|
local tab = {
|
||||||
|
@ -13,10 +13,14 @@ local teleport_nearest = function(pos)
|
|||||||
local MAX_TELEPORTATION_DISTANCE = tonumber(minetest.setting_get("moremesecons_teleporter.max_t2t_distance")) or 50
|
local MAX_TELEPORTATION_DISTANCE = tonumber(minetest.setting_get("moremesecons_teleporter.max_t2t_distance")) or 50
|
||||||
if MAX_TELEPORTATION_DISTANCE <= 0 then
|
if MAX_TELEPORTATION_DISTANCE <= 0 then
|
||||||
MAX_TELEPORTATION_DISTANCE = 1
|
MAX_TELEPORTATION_DISTANCE = 1
|
||||||
|
elseif MAX_TELEPORTATION_DISTANCE ~= MAX_TELEPORTATION_DISTANCE then -- NaN
|
||||||
|
MAX_TELEPORTATION_DISTANCE = 50
|
||||||
end
|
end
|
||||||
local MAX_PLAYER_DISTANCE = tonumber(minetest.setting_get("moremesecons_teleporter.max_p2t_distance")) or 25
|
local MAX_PLAYER_DISTANCE = tonumber(minetest.setting_get("moremesecons_teleporter.max_p2t_distance")) or 25
|
||||||
if MAX_PLAYER_DISTANCE <= 0 then
|
if MAX_PLAYER_DISTANCE <= 0 then
|
||||||
MAX_PLAYER_DISTANCE = 1
|
MAX_PLAYER_DISTANCE = 1
|
||||||
|
elseif MAX_PLAYER_DISTANCE ~= MAX_PLAYER_DISTANCE then -- NaN
|
||||||
|
MAX_PLAYER_DISTANCE = 25
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Search the nearest player
|
-- Search the nearest player
|
||||||
|
@ -117,6 +117,8 @@ function is_jammed(pos)
|
|||||||
local JAMMER_MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_wireless.jammer_max_distance")) or 15
|
local JAMMER_MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_wireless.jammer_max_distance")) or 15
|
||||||
if JAMMER_MAX_DISTANCE <= 0 then
|
if JAMMER_MAX_DISTANCE <= 0 then
|
||||||
JAMMER_MAX_DISTANCE = 1
|
JAMMER_MAX_DISTANCE = 1
|
||||||
|
elseif JAMMER_MAX_DISTANCE ~= JAMMER_MAX_DISTANCE then -- NaN
|
||||||
|
JAMMER_MAX_DISTANCE = 15
|
||||||
end
|
end
|
||||||
|
|
||||||
local pz,py,px = vector.unpack(pos)
|
local pz,py,px = vector.unpack(pos)
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
moremesecons_commandblock.authorized_commands (Authorized commands) string tell
|
moremesecons_commandblock.authorized_commands (Authorized commands) string tell
|
||||||
|
|
||||||
# Maximum distance of the @nearest player
|
# Maximum distance of the @nearest player
|
||||||
# Any value less than or equal to 0 will be set to 1
|
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
||||||
moremesecons_commandblock.nearest_max_distance (Nearest player maximum distance) float 8
|
moremesecons_commandblock.nearest_max_distance (Nearest player maximum distance) float 8
|
||||||
|
|
||||||
[Signal Jammer]
|
[Signal Jammer]
|
||||||
|
|
||||||
# Jammer action range
|
# Jammer action range
|
||||||
# Any value less than or equal to 0 will be set to 1
|
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
||||||
moremesecons_jammer.max_distance (Jammer action range) float 10
|
moremesecons_jammer.max_distance (Jammer action range) float 10
|
||||||
|
|
||||||
[Player Killer]
|
[Player Killer]
|
||||||
|
|
||||||
# Player Killer action range
|
# Player Killer action range
|
||||||
# Any value less than or equal to 0 will be set to 1
|
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
||||||
moremesecons_playerkiller.max_distance (Player Killer action range) float 8
|
moremesecons_playerkiller.max_distance (Player Killer action range) float 8
|
||||||
|
|
||||||
[Sayer]
|
[Sayer]
|
||||||
@ -31,13 +31,13 @@ moremesecons_playerkiller.max_distance (Player Killer action range) float 8
|
|||||||
moremesecons_sayer.use_speech_dispatcher (Use the Speech Dispatcher) bool true
|
moremesecons_sayer.use_speech_dispatcher (Use the Speech Dispatcher) bool true
|
||||||
|
|
||||||
# Sayer range
|
# Sayer range
|
||||||
# Any value less than or equal to 0 will be set to 1
|
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
||||||
moremesecons_sayer.max_distance (Range) float 8
|
moremesecons_sayer.max_distance (Range) float 8
|
||||||
|
|
||||||
[Teleporter]
|
[Teleporter]
|
||||||
|
|
||||||
# Maximum Teleporter To Teleporter distance
|
# Maximum Teleporter To Teleporter distance
|
||||||
# Any value less than or equal to 0 will be set to 1
|
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
||||||
moremesecons_teleporter.max_t2t_distance (Maximum Teleporter To Teleporter distance) float 50
|
moremesecons_teleporter.max_t2t_distance (Maximum Teleporter To Teleporter distance) float 50
|
||||||
|
|
||||||
# Maximum Player To Teleporter distance
|
# Maximum Player To Teleporter distance
|
||||||
@ -47,5 +47,5 @@ moremesecons_teleporter.max_p2t_distance (Maximum Player To Teleporter distance)
|
|||||||
[Wireless]
|
[Wireless]
|
||||||
|
|
||||||
# Wireless Jammer action range
|
# Wireless Jammer action range
|
||||||
# Any value less than or equal to 0 will be set to 1
|
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
|
||||||
moremesecons_wireless.jammer_max_distance (Wireless Jammer action range) float 15
|
moremesecons_wireless.jammer_max_distance (Wireless Jammer action range) float 15
|
||||||
|
Loading…
Reference in New Issue
Block a user