minetest-toolranks-extras/init.lua

43 lines
1.3 KiB
Lua
Raw Normal View History

2020-02-12 12:40:48 +01:00
local MP = minetest.get_modpath("toolranks_extras")
2020-02-19 09:30:42 +01:00
toolranks_extras = {}
-- mod information
toolranks_extras.mod = {version = "1.4.1", author = "Louis Royer"}
2020-02-19 09:30:42 +01:00
-- settings
2020-08-11 03:34:24 +02:00
toolranks_extras.settings = {
enable_farming_tools = minetest.settings:get_bool("toolranks_extras.farming", true),
enable_tool_types = minetest.settings:get_bool("toolranks_extras.tool_types", true),
}
2020-02-19 09:30:42 +01:00
2020-08-10 22:06:35 +02:00
-- XXX: when https://github.com/minetest/minetest/pull/7377
-- is merged, we can remove this function
-- and %s/toolranks_extras\.log/minetest\.log/g
toolranks_extras.log = function(level, text)
local prefix = "[toolranks_extra] "
if text then
minetest.log(level, prefix..text)
else
minetest.log(prefix..level)
end
end
2020-02-19 09:30:42 +01:00
-- mods detection
local use_farming = minetest.get_modpath("farming")
2020-02-12 13:07:25 +01:00
-- farming redo (https://notabug.org/tenplus1/farming)
-- already implements toolranks support
2020-02-19 09:30:42 +01:00
local use_farming_redo = use_farming and (farming.mod == "redo") or false
2020-02-12 13:07:25 +01:00
2020-08-10 22:06:35 +02:00
-- toolranks version
if toolranks.add_tool == nil then
toolranks_extras.log("error", "Please a more recent version of"
.." toolranks (at least version 1.2).")
end
2020-08-11 03:34:24 +02:00
dofile(MP.."/tool_types.lua")
2020-02-21 01:37:53 +01:00
if use_farming and (not use_farming_redo)
and toolranks_extras.settings.enable_farming_tools then
dofile(MP.."/hoe.lua")
end