-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathrecipe_checker.lua
39 lines (35 loc) · 993 Bytes
/
recipe_checker.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--
-- Script to check recipe overlaps
--
local Recipes = {}
local function recipe_key(items)
local tbl = {}
for idx = 1,9 do
tbl[#tbl + 1] = items[idx] or "#"
end
return table.concat(tbl, "-")
end
minetest.after(1, function()
for name,_ in pairs(minetest.registered_items) do
local mod = string.split(name, ":")[1]
if mod == "techage" or mod == "signs_bot" or mod == "vm16" or mod == "beduino" then
local recipes = minetest.get_all_craft_recipes(name)
if recipes then
for _,recipe in ipairs(recipes) do
if recipe and recipe.items then
--print(dump(recipe.items))
local key = recipe_key(recipe.items)
if Recipes[key] then
if not string.find(name, "slab") and not string.find(name, "stair") then
local text = Recipes[key].." and "..name.." have the same incredients"
minetest.log("error", text)
end
end
Recipes[key] = name
end
end
end
end
end
end)
print ("[techage] Recipe checker loaded")