Changes to 'sneeker.log' method:
Only log message if minetest setting 'log_mods' is 'true'.
This commit is contained in:
parent
b165e45d92
commit
a2ce6cfea8
@ -1,10 +1,15 @@
|
|||||||
-- Functions for sneeker mod
|
-- Functions for sneeker mod
|
||||||
|
|
||||||
|
|
||||||
|
local log_mods = minetest.setting_getbool('log_mods')
|
||||||
|
|
||||||
|
|
||||||
-- Displays a message in log output
|
-- Displays a message in log output
|
||||||
function sneeker.log(message)
|
function sneeker.log(message)
|
||||||
|
if log_mods then
|
||||||
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
|
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Displays a message in log output only if 'sneeker.debug' is set to 'true'
|
-- Displays a message in log output only if 'sneeker.debug' is set to 'true'
|
||||||
function sneeker.log_debug(message)
|
function sneeker.log_debug(message)
|
||||||
|
6
init.lua
6
init.lua
@ -5,9 +5,7 @@ sneeker = {}
|
|||||||
sneeker.modname = minetest.get_current_modname()
|
sneeker.modname = minetest.get_current_modname()
|
||||||
sneeker.modpath = minetest.get_modpath(sneeker.modname)
|
sneeker.modpath = minetest.get_modpath(sneeker.modname)
|
||||||
|
|
||||||
local log_mods = minetest.setting_getbool('log_mods')
|
if minetest.setting_getbool('log_mods') then
|
||||||
|
|
||||||
if log_mods then
|
|
||||||
minetest.log('action', 'Loading mod "' .. sneeker.modname .. '" ...')
|
minetest.log('action', 'Loading mod "' .. sneeker.modname .. '" ...')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -19,9 +17,7 @@ sneeker.log_debug('Debugging is on')
|
|||||||
sneeker.mob_name = sneeker.modname .. ':' .. sneeker.modname
|
sneeker.mob_name = sneeker.modname .. ':' .. sneeker.modname
|
||||||
sneeker.spawnegg_name = sneeker.modname .. ':spawnegg'
|
sneeker.spawnegg_name = sneeker.modname .. ':spawnegg'
|
||||||
|
|
||||||
if log_mods then
|
|
||||||
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
|
sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap))
|
||||||
end
|
|
||||||
|
|
||||||
local scripts = {
|
local scripts = {
|
||||||
'tnt_function',
|
'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_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
|
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 chance: ' .. tostring(spawn_chance) .. ' (1/' .. tostring(spawn_chance) .. ')')
|
||||||
sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minutes)')
|
sneeker.log('Spawn interval: ' .. tostring(spawn_interval) .. ' (' .. tostring(spawn_interval/60) .. ' minutes)')
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {'default:dirt_with_grass', 'default:stone'},
|
nodenames = {'default:dirt_with_grass', 'default:stone'},
|
||||||
|
Loading…
Reference in New Issue
Block a user