From 604eb77dc720771de2bc4a6074b635bf21acddc3 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Sat, 27 May 2017 19:20:00 -0700 Subject: [PATCH] Add debugging setting & log method --- init.lua | 9 ++++++++- settingtypes.txt | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 4830877..70aeea6 100644 --- a/init.lua +++ b/init.lua @@ -5,11 +5,18 @@ sneaker = {} sneaker.modname = minetest.get_current_modname() sneaker.modpath = minetest.get_modpath(sneaker.modname) +sneaker.debug = minetest.setting_get('sneaker_debug') or false +sneaker.spawn_cap = minetest.setting_get('sneaker_spawn_cap') or 50 + function sneaker.log(message) minetest.log('action', '[' .. sneaker.modname .. '] ' .. message) end -sneaker.spawn_cap = minetest.setting_get('sneaker_spawn_cap') or 50 +function sneaker.log_debug(message) + if sneaker.debug then + sneaker.log('[DEBUG] ' .. message) + end +end if minetest.setting_getbool('log_mods') then minetest.log('action', 'Loading mod "' .. sneaker.modname .. '" ...') diff --git a/settingtypes.txt b/settingtypes.txt index 864239f..49142d3 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,3 +1,6 @@ +# Logs debug output. +sneaker_debug (Log debug output) bool false + # Sets maximum number of spawns that can exist in world. sneaker_spawn_cap (Maximum spawns) int 50