2017-05-28 04:54:26 +02:00
|
|
|
-- Functions for sneeker mod
|
2017-05-28 04:30:56 +02:00
|
|
|
|
|
|
|
|
2017-05-29 10:23:15 +02:00
|
|
|
local log_mods = minetest.settings:get_bool("log_mods", false)
|
|
|
|
|
|
|
|
|
2017-05-28 04:30:56 +02:00
|
|
|
-- Displays a message in log output
|
2017-05-28 04:54:26 +02:00
|
|
|
function sneeker.log(message)
|
2017-05-29 10:23:15 +02:00
|
|
|
if log_mods then
|
|
|
|
minetest.log('action', '[' .. sneeker.modname .. '] ' .. message)
|
|
|
|
end
|
2017-05-28 04:30:56 +02:00
|
|
|
end
|
|
|
|
|
2017-05-28 04:54:26 +02:00
|
|
|
-- Displays a message in log output only if 'sneeker.debug' is set to 'true'
|
|
|
|
function sneeker.log_debug(message)
|
|
|
|
if sneeker.debug then
|
2017-05-29 10:16:02 +02:00
|
|
|
sneeker.log('DEBUG: ' .. message)
|
2017-05-28 04:30:56 +02:00
|
|
|
end
|
|
|
|
end
|
2017-05-29 09:58:55 +02:00
|
|
|
|
2017-05-29 10:29:08 +02:00
|
|
|
-- Spawns a sneeker entity
|
2017-05-29 09:58:55 +02:00
|
|
|
function sneeker.spawn(pos)
|
|
|
|
minetest.add_entity(pos, sneeker.mob_name)
|
|
|
|
sneeker.log_debug('Spawned entity "' .. sneeker.mob_name .. '" at ' .. tostring(pos.x) .. ',' .. tostring(pos.y))
|
|
|
|
end
|