2015-12-18 06:36:12 -08:00
|
|
|
--local t = os.clock()
|
2018-03-08 15:24:00 -08:00
|
|
|
|
2015-06-09 05:04:57 -07:00
|
|
|
xdecor = {}
|
2015-08-19 02:02:22 -07:00
|
|
|
local modpath = minetest.get_modpath("xdecor")
|
2023-06-11 16:16:22 -07:00
|
|
|
local ar_api = minetest.get_modpath("3d_armor")
|
2015-06-09 05:04:57 -07:00
|
|
|
|
2023-06-06 10:43:00 -07:00
|
|
|
-- Intllib
|
|
|
|
local S
|
|
|
|
if minetest.get_translator ~= nil then
|
2023-06-11 16:16:22 -07:00
|
|
|
S = minetest.get_translator("xdecor") -- 5.x translation function
|
2023-06-06 10:43:00 -07:00
|
|
|
else
|
2023-06-11 16:16:22 -07:00
|
|
|
if minetest.get_modpath("intllib") then
|
|
|
|
dofile(minetest.get_modpath("intllib") .. "/init.lua")
|
|
|
|
if intllib.make_gettext_pair then
|
|
|
|
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
|
|
|
|
else
|
|
|
|
gettext = intllib.Getter() -- old text file method
|
|
|
|
end
|
|
|
|
S = gettext
|
|
|
|
else -- boilerplate function
|
|
|
|
S = function(str, ...)
|
|
|
|
local args = {...}
|
|
|
|
return str:gsub("@%d+", function(match)
|
|
|
|
return args[tonumber(match:sub(2))]
|
|
|
|
end)
|
|
|
|
end
|
2023-06-06 10:43:00 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
xdecor.S = S
|
2023-06-11 16:16:22 -07:00
|
|
|
xdecor.reparaible_tools = {"pick", "axe", "shovel", "hoe"}
|
2023-06-06 10:43:00 -07:00
|
|
|
|
2019-07-23 05:03:20 -07:00
|
|
|
dofile(modpath .. "/handlers/animations.lua")
|
|
|
|
dofile(modpath .. "/handlers/helpers.lua")
|
|
|
|
dofile(modpath .. "/handlers/nodeboxes.lua")
|
|
|
|
dofile(modpath .. "/handlers/registration.lua")
|
2016-02-12 06:00:44 -08:00
|
|
|
|
2023-06-07 12:33:56 -07:00
|
|
|
if ar_api then xdecor.repairable_tools = {"pick", "axe", "shovel", "sword", "hoe", "armor", "shield"}
|
|
|
|
else xdecor.repairable_tools = {"pick", "axe", "shovel", "hoe"} end
|
|
|
|
|
2019-07-23 05:03:20 -07:00
|
|
|
dofile(modpath .. "/src/nodes.lua")
|
|
|
|
dofile(modpath .. "/src/recipes.lua")
|
2017-08-27 22:41:14 -07:00
|
|
|
|
2018-03-08 12:12:21 -08:00
|
|
|
local subpart = {
|
2017-08-27 22:41:14 -07:00
|
|
|
"chess",
|
|
|
|
"cooking",
|
|
|
|
"enchanting",
|
|
|
|
"hive",
|
|
|
|
"itemframe",
|
|
|
|
"mailbox",
|
|
|
|
"mechanisms",
|
|
|
|
"rope",
|
2019-07-23 05:03:20 -07:00
|
|
|
"workbench",
|
2017-08-27 22:41:14 -07:00
|
|
|
}
|
|
|
|
|
2023-08-27 10:26:11 -07:00
|
|
|
if not minetest.get_modpath("rosary") then
|
|
|
|
table.insert(subpart, "rosary")
|
|
|
|
end
|
|
|
|
|
2019-07-23 05:03:20 -07:00
|
|
|
for _, name in ipairs(subpart) do
|
|
|
|
local enable = minetest.settings:get_bool("enable_xdecor_" .. name)
|
2018-03-08 12:12:21 -08:00
|
|
|
if enable or enable == nil then
|
2019-07-23 05:03:20 -07:00
|
|
|
dofile(modpath .. "/src/" .. name .. ".lua")
|
2017-08-27 22:41:14 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-09 03:35:17 -08:00
|
|
|
--print(string.format("[xdecor] loaded in %.2f ms", (os.clock()-t)*1000))
|