forked from Mirrorlandia_minetest/mod-sneeker
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,9 +1,14 @@
|
|||||||
-- 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'
|
||||||
|
8
init.lua
8
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