diff --git a/.luacheckrc b/.luacheckrc index 43446b6..ac94689 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -12,6 +12,9 @@ read_globals = { -- Minetest "minetest", "vector", "ItemStack", - "dump" + "dump", + + -- optional deps + "technic" } diff --git a/app/js/util/compute_abm_nodes.js b/app/js/util/compute_abm_nodes.js index c28e68a..30f9ce6 100644 --- a/app/js/util/compute_abm_nodes.js +++ b/app/js/util/compute_abm_nodes.js @@ -17,7 +17,7 @@ function register_abm_label(abm, index){ } else { // try another index - register_abm_label(abm, index || 1); + register_abm_label(abm, (index || 0) + 1); } } diff --git a/init.lua b/init.lua index 4a2ef0c..1ff68a9 100644 --- a/init.lua +++ b/init.lua @@ -15,7 +15,8 @@ dofile(MP .. "/textures.lua") minetest.register_on_mods_loaded(function() -- workaround for empty translations, defer a globalstep until everything is initialized - minetest.after(0, function() + -- deferred by 1 second until technic.recipes is populated + minetest.after(1, function() local start = minetest.get_us_time() -- copy static assets diff --git a/mod.conf b/mod.conf index eaab5de..1961257 100644 --- a/mod.conf +++ b/mod.conf @@ -1 +1,2 @@ name = mtinfo +optional_depends = technic diff --git a/recipes.lua b/recipes.lua index c27d8fa..d0e00b2 100644 --- a/recipes.lua +++ b/recipes.lua @@ -30,6 +30,29 @@ function mtinfo.export_recipes() end end end + + for recipe_type, entry in pairs(technic.recipes) do + if entry.recipes then + for name, recipe in pairs(entry.recipes) do + local existing_recipes = data[name] + if not existing_recipes then + existing_recipes = {} + end + + table.insert(existing_recipes, { + type = recipe_type, + method = recipe_type, + items = recipe.input, + output = recipe.output, + time = recipe.time + }) + + data[name] = existing_recipes + end + end + end + + mtinfo.export_json(mtinfo.basepath.."/data/recipes.js", data, "mtinfo.recipes") end