From 58d9d44c357594b24f46f56bd838f9f88cf87122 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Sat, 27 May 2017 19:15:23 -0700 Subject: [PATCH] Add logging messages --- init.lua | 5 +++++ spawn.lua | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/init.lua b/init.lua index bf2b368..0bf2c23 100644 --- a/init.lua +++ b/init.lua @@ -11,6 +11,11 @@ end sneaker.spawn_cap = tonumber(minetest.settings:get("sneaker_spawn_cap")) or 50 +if minetest.settings:get_bool("log_mods", false) then + minetest.log("action", "Loading mod \"" .. sneaker.modname .. "\" ...") + sneaker.log("Spawn cap: " .. tostring(sneaker.spawn_cap)) +end + local scripts = { "tnt_function", "spawn", diff --git a/spawn.lua b/spawn.lua index c833f15..74bfd03 100644 --- a/spawn.lua +++ b/spawn.lua @@ -8,6 +8,11 @@ local time_day = time_hr * 24 local spawn_chance = tonumber(minetest.settings:get("sneaker_spawn_chance")) or 18000 local spawn_interval = tonumber(minetest.settings:get("sneaker_spawn_interval")) or time_min * 40 -- Default interval is 40 minutes +if minetest.settings:get_bool("log_mods", false) then + sneaker.log("Spawn chance: " .. tostring(spawn_chance) .. " (1/" .. tostring(spawn_chance) .. ")") + sneaker.log("Spawn interval: " .. tostring(spawn_interval) .. " (" .. tostring(spawn_interval/60) .. " minutes)") +end + minetest.register_abm({ nodenames = {"default:dirt_with_grass","default:stone"}, neighbors = {"air"},