forked from Mirrorlandia_minetest/mod-sneeker
Move settings variables & functions:
- Settings to 'settings.lua' - Functions to 'functions.lua'
This commit is contained in:
parent
604eb77dc7
commit
f50c7f37ca
14
functions.lua
Normal file
14
functions.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
-- Functions for sneaker mod
|
||||||
|
|
||||||
|
|
||||||
|
-- Displays a message in log output
|
||||||
|
function sneaker.log(message)
|
||||||
|
minetest.log('action', '[' .. sneaker.modname .. '] ' .. message)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Displays a message in log output only if 'sneaker.debug' is set to 'true'
|
||||||
|
function sneaker.log_debug(message)
|
||||||
|
if sneaker.debug then
|
||||||
|
sneaker.log('[DEBUG] ' .. message)
|
||||||
|
end
|
||||||
|
end
|
21
init.lua
21
init.lua
@ -5,21 +5,16 @@ sneaker = {}
|
|||||||
sneaker.modname = minetest.get_current_modname()
|
sneaker.modname = minetest.get_current_modname()
|
||||||
sneaker.modpath = minetest.get_modpath(sneaker.modname)
|
sneaker.modpath = minetest.get_modpath(sneaker.modname)
|
||||||
|
|
||||||
sneaker.debug = minetest.setting_get('sneaker_debug') or false
|
local log_mods = minetest.setting_getbool('log_mods')
|
||||||
sneaker.spawn_cap = minetest.setting_get('sneaker_spawn_cap') or 50
|
|
||||||
|
|
||||||
function sneaker.log(message)
|
if log_mods then
|
||||||
minetest.log('action', '[' .. sneaker.modname .. '] ' .. message)
|
|
||||||
end
|
|
||||||
|
|
||||||
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 .. '" ...')
|
minetest.log('action', 'Loading mod "' .. sneaker.modname .. '" ...')
|
||||||
|
end
|
||||||
|
|
||||||
|
dofile(sneaker.modpath .. '/settings.lua')
|
||||||
|
dofile(sneaker.modpath .. '/functions.lua')
|
||||||
|
|
||||||
|
if log_mods then
|
||||||
sneaker.log('Spawn cap: ' .. tostring(sneaker.spawn_cap))
|
sneaker.log('Spawn cap: ' .. tostring(sneaker.spawn_cap))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
5
settings.lua
Normal file
5
settings.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-- Settings for sneaker mod
|
||||||
|
|
||||||
|
|
||||||
|
sneaker.debug = minetest.setting_get('sneaker_debug') or false
|
||||||
|
sneaker.spawn_cap = minetest.setting_get('sneaker_spawn_cap') or 50
|
Loading…
Reference in New Issue
Block a user