partial support for technic recipes

This commit is contained in:
BuckarooBanzay 2021-03-03 17:47:02 +01:00
parent 7b2b9fcc71
commit 5f7e60b30d
5 changed files with 31 additions and 3 deletions

View File

@ -12,6 +12,9 @@ read_globals = {
-- Minetest
"minetest",
"vector", "ItemStack",
"dump"
"dump",
-- optional deps
"technic"
}

View File

@ -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);
}
}

View File

@ -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

View File

@ -1 +1,2 @@
name = mtinfo
optional_depends = technic

View File

@ -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