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 committed by Jordan Irwin
parent ea3ab21024
commit c905656ec8
3 changed files with 13 additions and 14 deletions

@ -1,9 +1,14 @@
-- Functions for sneeker mod
local log_mods = minetest.settings:get_bool("log_mods", false)
-- 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,12 +5,7 @@ sneeker = {}
sneeker.modname = minetest.get_current_modname()
sneeker.modpath = minetest.get_modpath(sneeker.modname)
local log_mods = minetest.setting_getbool("log_mods")
sneeker.mob_name = sneeker.modname .. ":" .. sneeker.modname
sneeker.spawnegg_name = sneeker.modname .. ":spawnegg"
if log_mods then
if minetest.settings:get_bool("log_mods", false) then
minetest.log("action", "Loading mod \"" .. sneeker.modname .. "\" ...")
end
@ -19,9 +14,10 @@ dofile(sneeker.modpath .. "/functions.lua")
sneeker.log_debug("Debugging is on")
if log_mods then
sneeker.log("Spawn cap: " .. tostring(sneeker.spawn_cap))
end
sneeker.mob_name = sneeker.modname .. ":" .. sneeker.modname
sneeker.spawnegg_name = sneeker.modname .. ":spawnegg"
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 = tonumber(minetest.settings:get("sneeker.spawn_chance")) or 18000
local spawn_interval = tonumber(minetest.settings:get("sneeker.spawn_interval")) or time_min * 40 -- Default interval is 40 minutes
if minetest.settings:get_bool("log_mods", false) 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"},