mirror of
https://github.com/mt-mods/basic_materials.git
synced 2024-11-05 01:50:28 +01:00
add first class support for repixture (#19)
This commit is contained in:
parent
55fae27d05
commit
a9002d6dad
|
@ -1,5 +1,5 @@
|
|||
globals = {
|
||||
"minetest", "basic_materials",
|
||||
"minetest", "basic_materials", "crafting",
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
|
|
139
crafts.lua
139
crafts.lua
|
@ -69,6 +69,25 @@ elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
|
|||
silver_ingot = "fl_ores:iron_ingot",
|
||||
silicon = "mesecons_materials:silicon",
|
||||
}
|
||||
elseif minetest.get_modpath("rp_default") then
|
||||
materials = {
|
||||
dirt = "rp_default:dirt",
|
||||
sand = "rp_default:sand",
|
||||
gravel = "rp_default:gravel",
|
||||
steel_ingot = "rp_default:ingot_steel",
|
||||
gold_ingot = "rp_default:ingot_gold",
|
||||
mese_crystal_fragment = "rp_default:ingot_steel",
|
||||
torch = "rp_default:torch",
|
||||
diamond = "rp_default:pearl",
|
||||
clay_lump = "rp_default:ingot_steel",
|
||||
water_bucket = "rp_default:swamp_dirt",
|
||||
empty_bucket = "rp_default:dirt",
|
||||
dye_dark_grey = "rp_default:ingot_steel",
|
||||
copper_ingot = "rp_default:ingot_copper",
|
||||
tin_ingot = "rp_default:ingot_tin",
|
||||
silver_ingot = "rp_default:ingot_steel",
|
||||
silicon = "rp_default:ingot_steel",
|
||||
}
|
||||
elseif minetest.get_modpath("hades_core") then
|
||||
materials = {
|
||||
dirt = "hades_core:dirt",
|
||||
|
@ -111,8 +130,44 @@ end
|
|||
|
||||
local have_hades_materials = minetest.get_modpath("hades_materials")
|
||||
|
||||
local function compress_craft(input)
|
||||
local buffer = {}
|
||||
for _, item in pairs(input) do
|
||||
if type(item)=="table" then
|
||||
for _, inneritem in pairs(item) do
|
||||
buffer[inneritem] = (buffer[inneritem] or 0) + 1
|
||||
end
|
||||
elseif item ~= "" then
|
||||
buffer[item] = (buffer[item] or 0) + 1
|
||||
end
|
||||
end
|
||||
|
||||
local output = {}
|
||||
for item, count in pairs(buffer) do
|
||||
output[#output + 1] = item .. " " .. count
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
local function register_craft(input)
|
||||
if minetest.get_modpath("rp_crafting") then
|
||||
local rp_craft = compress_craft(input.recipe)
|
||||
if #rp_craft > crafting.MAX_INPUTS then
|
||||
minetest.log("error", "[basic_materials] unable to register craft for " .. input.output)
|
||||
return
|
||||
end
|
||||
|
||||
crafting.register_craft({
|
||||
output = input.output,
|
||||
items = rp_craft
|
||||
})
|
||||
else
|
||||
minetest.register_craft(input)
|
||||
end
|
||||
end
|
||||
|
||||
-- Craft recipes
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
output = "basic_materials:chainlink_brass 12",
|
||||
recipe = {
|
||||
{"", "basic_materials:brass_ingot", "basic_materials:brass_ingot"},
|
||||
|
@ -121,7 +176,7 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
output = "basic_materials:chain_steel 2",
|
||||
recipe = {
|
||||
{"basic_materials:chainlink_steel"},
|
||||
|
@ -130,7 +185,7 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
output = "basic_materials:chain_brass 2",
|
||||
recipe = {
|
||||
{"basic_materials:chainlink_brass"},
|
||||
|
@ -139,13 +194,13 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
type = "shapeless",
|
||||
output = "basic_materials:brass_ingot 9",
|
||||
recipe = {"basic_materials:brass_block"},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:brass_block",
|
||||
recipe = {
|
||||
{"basic_materials:brass_ingot", "basic_materials:brass_ingot", "basic_materials:brass_ingot"},
|
||||
|
@ -154,14 +209,14 @@ minetest.register_craft( {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:plastic_strip 9",
|
||||
recipe = {
|
||||
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:empty_spool 3",
|
||||
recipe = {
|
||||
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"},
|
||||
|
@ -172,12 +227,12 @@ minetest.register_craft( {
|
|||
|
||||
if have_hades_materials then
|
||||
minetest.clear_craft({
|
||||
type = "shapeless",
|
||||
recipe = {"group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves"}
|
||||
type = "shapeless",
|
||||
recipe = {"group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves"}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
type = "shapeless",
|
||||
output = "basic_materials:oil_extract 2",
|
||||
recipe = {"group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves", "group:leaves"}
|
||||
|
@ -186,9 +241,9 @@ minetest.register_craft({
|
|||
-- Cooking recipes
|
||||
if not have_hades_materials then
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "basic_materials:plastic_sheet",
|
||||
recipe = "basic_materials:paraffin",
|
||||
type = "cooking",
|
||||
output = "basic_materials:plastic_sheet",
|
||||
recipe = "basic_materials:paraffin",
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -224,7 +279,7 @@ minetest.register_craft({
|
|||
burntime = 30,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
output = "basic_materials:concrete_block 6",
|
||||
recipe = {
|
||||
{"group:sand", "basic_materials:wet_cement", materials.gravel},
|
||||
|
@ -233,7 +288,7 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:motor 2",
|
||||
recipe = {
|
||||
{materials.mese_crystal_fragment, "basic_materials:copper_wire", "basic_materials:plastic_sheet"},
|
||||
|
@ -246,14 +301,14 @@ minetest.register_craft( {
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:heating_element 2",
|
||||
recipe = {
|
||||
{materials.copper_ingot, materials.mese_crystal_fragment, materials.copper_ingot}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
--type = "shapeless",
|
||||
output = "basic_materials:energy_crystal_simple 2",
|
||||
recipe = {
|
||||
|
@ -262,7 +317,7 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:copper_wire 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
|
@ -272,7 +327,7 @@ minetest.register_craft( {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:gold_wire 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
|
@ -282,7 +337,7 @@ minetest.register_craft( {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:steel_wire 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
|
@ -293,7 +348,7 @@ minetest.register_craft( {
|
|||
})
|
||||
|
||||
if materials.stainless_steel_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:stainless_steel_wire 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
|
@ -305,7 +360,7 @@ if materials.stainless_steel_ingot then
|
|||
end
|
||||
|
||||
if materials.aluminum_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:aluminum_wire 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
|
@ -316,7 +371,7 @@ if materials.aluminum_ingot then
|
|||
})
|
||||
end
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:steel_strip 12",
|
||||
recipe = {
|
||||
{"", materials.steel_ingot, ""},
|
||||
|
@ -324,7 +379,7 @@ minetest.register_craft( {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:copper_strip 12",
|
||||
recipe = {
|
||||
{"", materials.copper_ingot, ""},
|
||||
|
@ -332,7 +387,7 @@ minetest.register_craft( {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:gold_strip 12",
|
||||
recipe = {
|
||||
{"", materials.gold_ingot, ""},
|
||||
|
@ -341,7 +396,7 @@ minetest.register_craft( {
|
|||
})
|
||||
|
||||
if materials.lead_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:lead_strip 12",
|
||||
recipe = {
|
||||
{"", materials.lead_ingot, ""},
|
||||
|
@ -351,7 +406,7 @@ if materials.lead_ingot then
|
|||
end
|
||||
|
||||
if materials.stainless_steel_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:stainless_steel_strip 12",
|
||||
recipe = {
|
||||
{"", materials.stainless_steel_ingot, ""},
|
||||
|
@ -361,7 +416,7 @@ if materials.stainless_steel_ingot then
|
|||
end
|
||||
|
||||
if materials.aluminum_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:aluminum_strip 12",
|
||||
recipe = {
|
||||
{"", materials.aluminum_ingot, ""},
|
||||
|
@ -370,7 +425,7 @@ if materials.aluminum_ingot then
|
|||
})
|
||||
end
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:steel_bar 6",
|
||||
recipe = {
|
||||
{"", "", materials.steel_ingot},
|
||||
|
@ -380,7 +435,7 @@ minetest.register_craft( {
|
|||
})
|
||||
|
||||
if materials.carbon_steel_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:carbon_steel_bar 6",
|
||||
recipe = {
|
||||
{"", "", materials.carbon_steel_ingot},
|
||||
|
@ -391,7 +446,7 @@ if materials.carbon_steel_ingot then
|
|||
end
|
||||
|
||||
if materials.stainless_steel_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:stainless_steel_bar 6",
|
||||
recipe = {
|
||||
{"", "", materials.stainless_steel_ingot},
|
||||
|
@ -402,7 +457,7 @@ if materials.stainless_steel_ingot then
|
|||
end
|
||||
|
||||
if materials.aluminum_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:aluminum_bar 6",
|
||||
recipe = {
|
||||
{"", "", materials.aluminum_ingot},
|
||||
|
@ -412,7 +467,7 @@ if materials.aluminum_ingot then
|
|||
})
|
||||
end
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:padlock 2",
|
||||
recipe = {
|
||||
{"basic_materials:steel_bar"},
|
||||
|
@ -421,7 +476,7 @@ minetest.register_craft( {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
output = "basic_materials:chainlink_steel 12",
|
||||
recipe = {
|
||||
{"", materials.steel_ingot, materials.steel_ingot},
|
||||
|
@ -430,7 +485,7 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:gear_steel 6",
|
||||
recipe = {
|
||||
{"", materials.steel_ingot, ""},
|
||||
|
@ -439,7 +494,7 @@ minetest.register_craft( {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
type = "shapeless",
|
||||
output = "basic_materials:terracotta_base 8",
|
||||
recipe = {
|
||||
|
@ -450,7 +505,7 @@ minetest.register_craft( {
|
|||
replacements = {{materials.water_bucket, materials.empty_bucket}},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
register_craft({
|
||||
type = "shapeless",
|
||||
output = "basic_materials:wet_cement 3",
|
||||
recipe = {
|
||||
|
@ -464,7 +519,7 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
if not have_hades_materials then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = materials.silicon.." 4",
|
||||
recipe = {
|
||||
{materials.sand, materials.sand},
|
||||
|
@ -473,7 +528,7 @@ if not have_hades_materials then
|
|||
})
|
||||
end
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:ic 4",
|
||||
recipe = {
|
||||
{materials.silicon, materials.silicon},
|
||||
|
@ -482,7 +537,7 @@ minetest.register_craft( {
|
|||
})
|
||||
|
||||
-- Without moreores, there still should be a way to create brass.
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:brass_ingot 9",
|
||||
recipe = {
|
||||
{materials.copper_ingot, materials.tin_ingot, materials.copper_ingot},
|
||||
|
@ -492,7 +547,7 @@ minetest.register_craft( {
|
|||
})
|
||||
|
||||
if materials.silver_ingot then
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
output = "basic_materials:silver_wire 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
|
@ -502,7 +557,7 @@ if materials.silver_ingot then
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
register_craft( {
|
||||
type = "shapeless",
|
||||
output = "basic_materials:brass_ingot 3",
|
||||
recipe = {
|
||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,3 +1,3 @@
|
|||
name = basic_materials
|
||||
optional_depends = moreores, default, mesecons_materials, dye, bucket, fl_stone, fl_trees, mcl_sounds, hades_core, hades_sounds, hades_materials, hades_dye, hades_bucket, hades_extraores, hades_mesecons_materials, aloz
|
||||
optional_depends = moreores, default, mesecons_materials, dye, bucket, fl_stone, fl_trees, mcl_sounds, hades_core, hades_sounds, hades_materials, hades_dye, hades_bucket, hades_extraores, hades_mesecons_materials, aloz, rp_crafting
|
||||
min_minetest_version = 5.2.0
|
||||
|
|
Loading…
Reference in New Issue
Block a user