Changes to 'sneeker.log' method:

Only log message if minetest setting 'log_mods' is 'true'.
This commit is contained in:
AntumDeluge 2017-05-29 01:23:15 -07:00
parent b165e45d92
commit a2ce6cfea8
3 changed files with 10 additions and 11 deletions

@ -1,9 +1,14 @@
-- Functions for sneeker mod
local log_mods = minetest.setting_getbool('log_mods')
-- Displays a message in log output
function sneeker.log(message)
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
if log_mods then
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
end
end
-- Displays a message in log output only if 'sneeker.debug' is set to 'true'

@ -5,9 +5,7 @@ sneeker = {}
sneeker.modname = minetest.get_current_modname()
sneeker.modpath = minetest.get_modpath(sneeker.modname)
local log_mods = minetest.setting_getbool('log_mods')
if log_mods then
if minetest.setting_getbool('log_mods') then
minetest.log('action', 'Loading mod "' .. sneeker.modname .. '" ...')
end
@ -19,9 +17,7 @@ sneeker.log_debug('Debugging is on')
sneeker.mob_name = sneeker.modname .. ':' .. sneeker.modname
sneeker.spawnegg_name = sneeker.modname .. ':spawnegg'
if log_mods then
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
end
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
local scripts = {
'tnt_function',

@ -8,10 +8,8 @@ local time_day = time_hr * 24
local spawn_chance = minetest.setting_get('sneeker.spawn_chance') or 18000
local spawn_interval = minetest.setting_get('sneeker.spawn_interval') or time_min * 40 -- Default interval is 40 minutes
if minetest.setting_getbool('log_mods') then
sneeker.log('Spawn chance: ' .. tostring(spawn_chance) .. ' (1/' .. tostring(spawn_chance) .. ')')
sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minutes)')
end
sneeker.log('Spawn chance: ' .. tostring(spawn_chance) .. ' (1/' .. tostring(spawn_chance) .. ')')
sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minutes)')
minetest.register_abm({
nodenames = {'default:dirt_with_grass', 'default:stone'},