mirror of
https://github.com/minetest-mods/technic.git
synced 2024-09-28 23:30:42 +02:00
Refactor default recipe clearing
This commit is contained in:
parent
8ab2a6e047
commit
06ca0371ea
|
@ -38,6 +38,8 @@ local dependent_recipes = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Add dependent recipes to main recipe collection
|
||||||
|
-- if their mods are used.
|
||||||
for dependency, recipes_to_add in pairs(dependent_recipes) do
|
for dependency, recipes_to_add in pairs(dependent_recipes) do
|
||||||
if minetest.get_modpath(dependency) then
|
if minetest.get_modpath(dependency) then
|
||||||
for _, recipe_entry in ipairs(recipes_to_add) do
|
for _, recipe_entry in ipairs(recipes_to_add) do
|
||||||
|
@ -54,8 +56,8 @@ local crafts_to_clear = {
|
||||||
"default:silver_sand",
|
"default:silver_sand",
|
||||||
}
|
}
|
||||||
|
|
||||||
if minetest.get_modpath("everness") then
|
local dependent_crafts_to_clear = {
|
||||||
local everness_crafts_to_clear = {
|
everness = {
|
||||||
"everness:coral_sand",
|
"everness:coral_sand",
|
||||||
"everness:coral_forest_deep_ocean_sand",
|
"everness:coral_forest_deep_ocean_sand",
|
||||||
"everness:coral_white_sand",
|
"everness:coral_white_sand",
|
||||||
|
@ -64,41 +66,43 @@ if minetest.get_modpath("everness") then
|
||||||
"everness:cursed_lands_deep_ocean_sand",
|
"everness:cursed_lands_deep_ocean_sand",
|
||||||
"everness:crystal_forest_deep_ocean_sand",
|
"everness:crystal_forest_deep_ocean_sand",
|
||||||
"everness:mineral_sand",
|
"everness:mineral_sand",
|
||||||
}
|
|
||||||
|
|
||||||
for _, sand_name in ipairs(everness_crafts_to_clear) do
|
|
||||||
table.insert(crafts_to_clear, sand_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, sand_name in ipairs(crafts_to_clear) do
|
|
||||||
minetest.clear_craft({
|
|
||||||
type = "shaped",
|
|
||||||
recipe = {
|
|
||||||
{sand_name, sand_name},
|
|
||||||
{sand_name, sand_name},
|
|
||||||
},
|
},
|
||||||
})
|
nether = {
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("nether") then
|
|
||||||
-- Defuse the default compressed nether brick and nether lump recipes,
|
|
||||||
-- since we have the compressor to take over in a more realistic manner.
|
|
||||||
local nether_crafts_to_clear = {
|
|
||||||
"nether:brick",
|
"nether:brick",
|
||||||
"nether:brick_compressed",
|
"nether:brick_compressed",
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for dependency, crafts in pairs(dependent_crafts_to_clear) do
|
||||||
|
if minetest.get_modpath(dependency) then
|
||||||
|
for _, craft_entry in ipairs(crafts) do
|
||||||
|
table.insert(crafts_to_clear, craft_entry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, craft_name in ipairs(crafts_to_clear) do
|
||||||
|
is_regular = string.sub(craft_name, 1, 7) ~= "nether:"
|
||||||
|
|
||||||
|
if is_regular then
|
||||||
|
-- Regular compression recipes use 2x2 shape.
|
||||||
|
shaped_recipe = {
|
||||||
|
{craft_name, craft_name},
|
||||||
|
{craft_name, craft_name},
|
||||||
|
}
|
||||||
|
else
|
||||||
|
-- Nether's compression recipes use 3x3 shape.
|
||||||
|
shaped_recipe = {
|
||||||
|
{craft_name, craft_name, craft_name},
|
||||||
|
{craft_name, craft_name, craft_name},
|
||||||
|
{craft_name, craft_name, craft_name},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
for _, nether_brick_name in ipairs(nether_crafts_to_clear) do
|
|
||||||
minetest.clear_craft({
|
minetest.clear_craft({
|
||||||
type = "shaped",
|
type = "shaped",
|
||||||
recipe = {
|
recipe = shaped_recipe,
|
||||||
{nether_brick_name, nether_brick_name, nether_brick_name},
|
|
||||||
{nether_brick_name, nether_brick_name, nether_brick_name},
|
|
||||||
{nether_brick_name, nether_brick_name, nether_brick_name},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, data in pairs(recipes) do
|
for _, data in pairs(recipes) do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user