Changes to 'sneeker.log' method:
Only log message if minetest setting 'log_mods' is 'true'.
This commit is contained in:
parent
ea3ab21024
commit
c905656ec8
@ -1,10 +1,15 @@
|
|||||||
-- Functions for sneeker mod
|
-- Functions for sneeker mod
|
||||||
|
|
||||||
|
|
||||||
|
local log_mods = minetest.settings:get_bool("log_mods", false)
|
||||||
|
|
||||||
|
|
||||||
-- 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)
|
||||||
|
12
init.lua
12
init.lua
@ -5,12 +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.settings:get_bool("log_mods", false) then
|
||||||
|
|
||||||
sneeker.mob_name = sneeker.modname .. ":" .. sneeker.modname
|
|
||||||
sneeker.spawnegg_name = sneeker.modname .. ":spawnegg"
|
|
||||||
|
|
||||||
if log_mods then
|
|
||||||
minetest.log("action", "Loading mod \"" .. sneeker.modname .. "\" ...")
|
minetest.log("action", "Loading mod \"" .. sneeker.modname .. "\" ...")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -19,9 +14,10 @@ dofile(sneeker.modpath .. "/functions.lua")
|
|||||||
|
|
||||||
sneeker.log_debug("Debugging is on")
|
sneeker.log_debug("Debugging is on")
|
||||||
|
|
||||||
if log_mods then
|
sneeker.mob_name = sneeker.modname .. ":" .. sneeker.modname
|
||||||
|
sneeker.spawnegg_name = sneeker.modname .. ":spawnegg"
|
||||||
|
|
||||||
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 = tonumber(minetest.settings:get("sneeker.spawn_chance")) or 18000
|
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
|
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 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