diff --git a/technic/crafts.lua b/technic/crafts.lua index 47230143..d0ba83bc 100644 --- a/technic/crafts.lua +++ b/technic/crafts.lua @@ -1,29 +1,7 @@ -- check if we have the necessary dependencies to allow actually using these materials in the crafts -local mesecons_materials = minetest.get_modpath("mesecons_materials") -local has_mcl = minetest.get_modpath("mcl_core") -local has_mcl_dye = minetest.get_modpath("mcl_dye") -local has_moreores = minetest.get_modpath("moreores") - -local mat = {} - -if has_moreores then - mat.mithril_ingot = "moreores:mithril_ingot" - mat.silver_ingot = "moreores:silver_ingot" -elseif has_mcl then - mat.mithril_ingot = "mcl_core:lapis" - mat.silver_ingot = "mcl_core:gold_ingot" -end -mat.gold_ingot = has_mcl and "mcl_core:gold_ingot" or "default:gold_ingot" -mat.iron_ingot = has_mcl and "mcl_core:iron_ingot" or "default:iron_ingot" -mat.diamond = has_mcl and "mcl_core:diamond" or "default:diamond" -mat.dirt = has_mcl and "mcl_core:dirt" or "default:dirt" -mat.tin_ingot = has_mcl and "mcl_core:iron_ingot" or "default:tin_ingot" -mat.bronze_ingot = has_mcl and "mcl_copper:copper_ingot" or "default:bronze_ingot" -mat.mese_crystal = has_mcl and "mesecons:redstone" or "default:mese_crystal" -mat.dye_green = has_mcl_dye and "mcl_dye:green" or "dye:green" -mat.dye_red = has_mcl_dye and "mcl_dye:red" or "dye:red" -mat.dye_blue = has_mcl_dye and "mcl_dye:blue" or "dye:blue" +local mat = technic.materials +local has_mcl = minetest.get_modpath("mcl_core") -- Remove some recipes -- Bronze @@ -136,12 +114,10 @@ minetest.register_craft({ }, }) -local isolation = mesecons_materials and "mesecons_materials:fiber" or "technic:rubber" - minetest.register_craft({ output = 'technic:lv_transformer', recipe = { - {isolation, 'technic:wrought_iron_ingot', isolation}, + {mat.isolation, 'technic:wrought_iron_ingot', mat.isolation}, {'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil'}, {'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'}, } @@ -150,7 +126,7 @@ minetest.register_craft({ minetest.register_craft({ output = 'technic:mv_transformer', recipe = { - {isolation, 'technic:carbon_steel_ingot', isolation}, + {mat.isolation, 'technic:carbon_steel_ingot', mat.isolation}, {'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil'}, {'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'}, } @@ -159,7 +135,7 @@ minetest.register_craft({ minetest.register_craft({ output = 'technic:hv_transformer', recipe = { - {isolation, 'technic:stainless_steel_ingot', isolation}, + {mat.isolation, 'technic:stainless_steel_ingot', mat.isolation}, {'technic:copper_coil', 'technic:stainless_steel_ingot', 'technic:copper_coil'}, {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, } diff --git a/technic/init.lua b/technic/init.lua index 16eae9c5..dbb83139 100644 --- a/technic/init.lua +++ b/technic/init.lua @@ -20,6 +20,9 @@ technic.modpath = modpath local S = minetest.get_translator("technic") technic.getter = S +-- Read materials file +dofile(modpath.."/materials.lua") + -- Read configuration file dofile(modpath.."/config.lua") diff --git a/technic/machines/HV/forcefield.lua b/technic/machines/HV/forcefield.lua index 46eaf1d0..3d964561 100644 --- a/technic/machines/HV/forcefield.lua +++ b/technic/machines/HV/forcefield.lua @@ -14,12 +14,14 @@ local S = technic.getter local cable_entry = "^technic_cable_connection_overlay.png" +local mat = technic.materials + minetest.register_craft({ output = "technic:forcefield_emitter_off", recipe = { - {"default:mese", "basic_materials:motor", "default:mese" }, + {mat.mese, "basic_materials:motor", mat.mese }, {"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"}, - {"default:mese", "technic:hv_cable", "default:mese" }, + {mat.mese, "technic:hv_cable", mat.mese }, } }) diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua index 275ce6c4..c47d36ad 100644 --- a/technic/machines/HV/nuclear_reactor.lua +++ b/technic/machines/HV/nuclear_reactor.lua @@ -15,6 +15,7 @@ local fuel_type = "technic:uranium_fuel" -- The reactor burns this local digiline_meltdown = technic.config:get_bool("enable_nuclear_reactor_digiline_selfdestruct") local has_digilines = minetest.get_modpath("digilines") local has_mcl = minetest.get_modpath("mcl_core") +local mat = technic.materials local S = technic.getter @@ -25,7 +26,7 @@ local cable_entry = "^technic_cable_connection_overlay.png" minetest.register_craft({ output = 'technic:hv_nuclear_reactor_core', recipe = { - {'technic:carbon_plate', 'default:obsidian_glass', 'technic:carbon_plate'}, + {'technic:carbon_plate', mat.obsidian_glass, 'technic:carbon_plate'}, {'technic:composite_plate', 'technic:machine_casing', 'technic:composite_plate'}, {'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'}, } diff --git a/technic/machines/LV/alloy_furnace.lua b/technic/machines/LV/alloy_furnace.lua index 67af177e..a7e07ef7 100644 --- a/technic/machines/LV/alloy_furnace.lua +++ b/technic/machines/LV/alloy_furnace.lua @@ -1,13 +1,14 @@ -- LV Alloy furnace local S = technic.getter +local mat = technic.materials -- FIXME: kpoppel: I'd like to introduce an induction heating element here... minetest.register_craft({ output = 'technic:lv_alloy_furnace', recipe = { - {'default:brick', 'default:brick', 'default:brick'}, - {'default:brick', 'technic:machine_casing', 'default:brick'}, - {'default:brick', 'technic:lv_cable', 'default:brick'}, + {mat.brick, mat.brick, mat.brick}, + {mat.brick, 'technic:machine_casing', mat.brick}, + {mat.brick, 'technic:lv_cable', mat.brick}, } }) diff --git a/technic/machines/LV/cables.lua b/technic/machines/LV/cables.lua index af9d5cb3..f6c2e6e2 100644 --- a/technic/machines/LV/cables.lua +++ b/technic/machines/LV/cables.lua @@ -1,13 +1,14 @@ local S = technic.getter +local mat = technic.materials minetest.register_alias("lv_cable", "technic:lv_cable") minetest.register_craft({ output = 'technic:lv_cable 6', recipe = { - {'default:paper', 'default:paper', 'default:paper'}, - {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, - {'default:paper', 'default:paper', 'default:paper'}, + {mat.paper, mat.paper, mat.paper}, + {mat.copper_ingot, mat.copper_ingot, mat.copper_ingot}, + {mat.paper, mat.paper, mat.paper}, } }) diff --git a/technic/machines/LV/compressor.lua b/technic/machines/LV/compressor.lua index 9d38e834..08aef94f 100644 --- a/technic/machines/LV/compressor.lua +++ b/technic/machines/LV/compressor.lua @@ -5,7 +5,7 @@ minetest.register_alias("compressor", "technic:lv_compressor") minetest.register_craft({ output = 'technic:lv_compressor', recipe = { - {'default:stone', 'basic_materials:motor', 'default:stone'}, + {'group:stone', 'basic_materials:motor', 'group:stone'}, {'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'}, {'basic_materials:silver_wire', 'technic:lv_cable', 'basic_materials:silver_wire'}, }, diff --git a/technic/machines/LV/electric_furnace.lua b/technic/machines/LV/electric_furnace.lua index 977c2689..bd6ce927 100644 --- a/technic/machines/LV/electric_furnace.lua +++ b/technic/machines/LV/electric_furnace.lua @@ -6,9 +6,9 @@ local S = technic.getter minetest.register_craft({ output = 'technic:electric_furnace', recipe = { - {'default:cobble', 'default:cobble', 'default:cobble'}, - {'default:cobble', 'technic:machine_casing', 'default:cobble'}, - {'default:cobble', 'technic:lv_cable', 'default:cobble'}, + {'group:cobble', 'group:cobble', 'group:cobble'}, + {'group:cobble', 'technic:machine_casing', 'group:cobble'}, + {'group:cobble', 'technic:lv_cable', 'group:cobble'}, } }) diff --git a/technic/machines/LV/generator.lua b/technic/machines/LV/generator.lua index dc9815f0..1b084cb9 100644 --- a/technic/machines/LV/generator.lua +++ b/technic/machines/LV/generator.lua @@ -3,14 +3,16 @@ -- Inefficient and expensive in fuel (200EU per tick) -- Also only allows for LV machinery to run. +local mat = technic.materials + minetest.register_alias("lv_generator", "technic:lv_generator") minetest.register_craft({ output = 'technic:lv_generator', recipe = { - {'default:stone', 'default:furnace', 'default:stone'}, - {'default:stone', 'technic:machine_casing', 'default:stone'}, - {'default:stone', 'technic:lv_cable', 'default:stone'}, + {'group:stone', mat.furnace, 'group:stone'}, + {'group:stone', 'technic:machine_casing', 'group:stone'}, + {'group:stone', 'technic:lv_cable', 'group:stone'}, } }) diff --git a/technic/machines/LV/geothermal.lua b/technic/machines/LV/geothermal.lua index 8d08adf3..70269e65 100644 --- a/technic/machines/LV/geothermal.lua +++ b/technic/machines/LV/geothermal.lua @@ -6,11 +6,12 @@ minetest.register_alias("geothermal", "technic:geothermal") local S = technic.getter +local mat = technic.materials minetest.register_craft({ output = 'technic:geothermal', recipe = { - {'technic:granite', 'default:diamond', 'technic:granite'}, + {'technic:granite', mat.diamond, 'technic:granite'}, {'basic_materials:copper_wire', 'technic:machine_casing', 'basic_materials:copper_wire'}, {'technic:granite', 'technic:lv_cable', 'technic:granite'}, }, @@ -26,8 +27,8 @@ minetest.register_craftitem("technic:geothermal", { local check_node_around = function(pos) local node = minetest.get_node(pos) - if node.name == "default:water_source" or node.name == "default:water_flowing" then return 1 end - if node.name == "default:lava_source" or node.name == "default:lava_flowing" then return 2 end + if node.name == "default:water_source" or node.name == "default:water_flowing" or node.name == "mcl_core:water_source" or node.name == "mcl_core:water_flowing" then return 1 end + if node.name == "default:lava_source" or node.name == "default:lava_flowing" or node.name == "mcl_core:lava_source" or node.name == "mcl_core:lava_flowing" then return 2 end return 0 end diff --git a/technic/machines/LV/grinder.lua b/technic/machines/LV/grinder.lua index 10a04360..678c7570 100644 --- a/technic/machines/LV/grinder.lua +++ b/technic/machines/LV/grinder.lua @@ -1,12 +1,13 @@ local S = technic.getter +local mat = technic.materials minetest.register_alias("grinder", "technic:lv_grinder") minetest.register_craft({ output = 'technic:lv_grinder', recipe = { - {'default:desert_stone', 'default:diamond', 'default:desert_stone'}, - {'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'}, - {'technic:granite', 'technic:lv_cable', 'technic:granite'}, + {mat.desert_stone, mat.diamond, mat.desert_stone}, + {mat.desert_stone, 'technic:machine_casing', mat.desert_stone}, + {'technic:granite', 'technic:lv_cable', 'technic:granite'}, } }) diff --git a/technic/machines/LV/lamp.lua b/technic/machines/LV/lamp.lua index 5e7f9b2b..4c69e15d 100644 --- a/technic/machines/LV/lamp.lua +++ b/technic/machines/LV/lamp.lua @@ -3,6 +3,7 @@ -- Illuminates a 7x7x3(H) volume below itself with light bright as the sun. local S = technic.getter +local mat = technic.materials local demand = 50 local desc = S("@1 Lamp", S("LV")) @@ -194,7 +195,7 @@ technic.register_machine("LV", "technic:lv_lamp_active", technic.receiver) minetest.register_craft({ output = "technic:lv_lamp", recipe = { - {"default:glass", "default:glass", "default:glass"}, + {mat.glass, mat.glass, mat.glass}, {"technic:lv_led", "technic:lv_led", "technic:lv_led"}, {"mesecons_materials:glue", "technic:lv_cable", "mesecons_materials:glue"}, } diff --git a/technic/machines/LV/music_player.lua b/technic/machines/LV/music_player.lua index b563eeaf..de571569 100644 --- a/technic/machines/LV/music_player.lua +++ b/technic/machines/LV/music_player.lua @@ -2,14 +2,15 @@ -- The player can play music. But it is high ampage! local S = technic.getter +local mat = technic.materials minetest.register_alias("music_player", "technic:music_player") minetest.register_craft({ output = 'technic:music_player', recipe = { - {'technic:chromium_ingot', 'default:diamond', 'technic:chromium_ingot'}, - {'default:diamond', 'technic:machine_casing', 'default:diamond'}, - {'default:mossycobble', 'technic:lv_cable', 'default:mossycobble'}, + {'technic:chromium_ingot', mat.diamond, 'technic:chromium_ingot'}, + {mat.diamond, 'technic:machine_casing', mat.diamond}, + {mat.mossycobble, 'technic:lv_cable', mat.mossycobble}, } }) diff --git a/technic/machines/LV/water_mill.lua b/technic/machines/LV/water_mill.lua index d03d684f..f41c81c1 100644 --- a/technic/machines/LV/water_mill.lua +++ b/technic/machines/LV/water_mill.lua @@ -3,6 +3,7 @@ -- It is a little over half as good as the thermal generator. local S = technic.getter +local mat = technic.materials local cable_entry = "^technic_cable_connection_overlay.png" @@ -11,7 +12,7 @@ minetest.register_alias("water_mill", "technic:water_mill") minetest.register_craft({ output = 'technic:water_mill', recipe = { - {'technic:marble', 'default:diamond', 'technic:marble'}, + {'technic:marble', mat.diamond, 'technic:marble'}, {'group:wood', 'technic:machine_casing', 'group:wood'}, {'technic:marble', 'technic:lv_cable', 'technic:marble'}, } @@ -20,7 +21,9 @@ minetest.register_craft({ local function check_node_around_mill(pos) local node = minetest.get_node(pos) if node.name == "default:water_flowing" - or node.name == "default:river_water_flowing" then + or node.name == "default:river_water_flowing" + or node.name == "mcl_core:water_flowing" + or node.name == "mclx_core:river_water_flowing" then return node.param2 -- returns approx. water flow, if any end return false diff --git a/technic/machines/MV/freezer.lua b/technic/machines/MV/freezer.lua index 039dbe62..3bcf2f11 100644 --- a/technic/machines/MV/freezer.lua +++ b/technic/machines/MV/freezer.lua @@ -5,7 +5,7 @@ minetest.register_craft({ output = 'technic:mv_freezer', recipe = { {'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'}, - {'pipeworks:pipe_1_empty', 'technic:mv_transformer', 'pipeworks:pipe_1_empty'}, + {'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, {'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, } }) diff --git a/technic/machines/MV/tool_workshop.lua b/technic/machines/MV/tool_workshop.lua index e3f85666..9e14f0b6 100644 --- a/technic/machines/MV/tool_workshop.lua +++ b/technic/machines/MV/tool_workshop.lua @@ -4,15 +4,16 @@ minetest.register_alias("tool_workshop", "technic:tool_workshop") local S = technic.getter +local mat = technic.materials local tube_entry = "^pipeworks_tube_connection_wooden.png" minetest.register_craft({ output = 'technic:tool_workshop', recipe = { - {'group:wood', 'default:diamond', 'group:wood'}, + {'group:wood', mat.diamond, 'group:wood'}, {'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth'}, - {'default:obsidian', 'technic:mv_cable', 'default:obsidian'}, + {mat.obsidian, 'technic:mv_cable', mat.obsidian}, } }) diff --git a/technic/machines/other/coal_alloy_furnace.lua b/technic/machines/other/coal_alloy_furnace.lua index b4ebce86..3b40bde1 100644 --- a/technic/machines/other/coal_alloy_furnace.lua +++ b/technic/machines/other/coal_alloy_furnace.lua @@ -2,13 +2,14 @@ -- Fuel driven alloy furnace. This uses no EUs: local S = technic.getter +local mat = technic.materials minetest.register_craft({ output = 'technic:coal_alloy_furnace', recipe = { - {'default:brick', 'default:brick', 'default:brick'}, - {'default:brick', '', 'default:brick'}, - {'default:brick', 'default:brick', 'default:brick'}, + {mat.brick, mat.brick, mat.brick}, + {mat.brick, '', mat.brick}, + {mat.brick, mat.brick, mat.brick}, } }) diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua index 2ac23c68..087fdaa0 100644 --- a/technic/machines/other/injector.lua +++ b/technic/machines/other/injector.lua @@ -5,6 +5,8 @@ local fs_helpers = pipeworks.fs_helpers local tube_entry = "^pipeworks_tube_connection_metallic.png" +local mat = technic.materials + local param2_to_under = { [0] = {x= 0,y=-1,z= 0}, [1] = {x= 0,y= 0,z=-1}, [2] = {x= 0,y= 0,z= 1}, [3] = {x=-1,y= 0,z= 0}, @@ -142,7 +144,7 @@ minetest.register_craft({ output = "technic:injector 1", recipe = { {"", "technic:control_logic_unit",""}, - {"", "default:chest",""}, + {"", mat.chest,""}, {"", "pipeworks:tube_1",""}, } }) diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua index 1c275026..91bc9543 100644 --- a/technic/machines/power_monitor.lua +++ b/technic/machines/power_monitor.lua @@ -3,6 +3,7 @@ -- similarly to the old "slave" switching stations. local S = technic.getter +local mat = technic.materials local cable_entry = "^technic_cable_connection_overlay.png" @@ -43,7 +44,7 @@ minetest.register_craft({ output = "technic:power_monitor", recipe = { {"", "", ""}, - {"", "technic:machine_casing", "default:copper_ingot"}, + {"", "technic:machine_casing", mat.copper_ingot}, {"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"} } }) diff --git a/technic/machines/register/alloy_recipes.lua b/technic/machines/register/alloy_recipes.lua index 94e44278..4c0af1cb 100644 --- a/technic/machines/register/alloy_recipes.lua +++ b/technic/machines/register/alloy_recipes.lua @@ -1,5 +1,6 @@ local S = technic.getter +local mat = technic.materials technic.register_recipe_type("alloy", { description = S("Alloying"), @@ -13,29 +14,29 @@ function technic.register_alloy_recipe(data) end local recipes = { - {"technic:copper_dust 7", "technic:tin_dust", "default:bronze_ingot 8", 12}, - {"default:copper_ingot 7", "default:tin_ingot", "default:bronze_ingot 8", 12}, + {"technic:copper_dust 7", "technic:tin_dust", mat.bronze_ingot.." 8", 12}, + {mat.copper_ingot.." 7", mat.tin_ingot, mat.bronze_ingot.." 8", 12}, {"technic:wrought_iron_dust 2", "technic:coal_dust", "technic:carbon_steel_ingot 2", 6}, {"technic:wrought_iron_ingot 2", "technic:coal_dust", "technic:carbon_steel_ingot 2", 6}, {"technic:carbon_steel_dust 4", "technic:chromium_dust", "technic:stainless_steel_ingot 5", 7.5}, {"technic:carbon_steel_ingot 4", "technic:chromium_ingot", "technic:stainless_steel_ingot 5", 7.5}, {"technic:copper_dust 2", "technic:zinc_dust", "basic_materials:brass_ingot 3"}, - {"default:copper_ingot 2", "technic:zinc_ingot", "basic_materials:brass_ingot 3"}, - {"default:sand 2", "technic:coal_dust 2", "technic:silicon_wafer"}, + {mat.copper_ingot.." 2", "technic:zinc_ingot", "basic_materials:brass_ingot 3"}, + {mat.sand.." 2", "technic:coal_dust 2", "technic:silicon_wafer"}, {"technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer"}, -- from https://en.wikipedia.org/wiki/Carbon_black -- The highest volume use of carbon black is as a reinforcing filler in rubber products, especially tires. -- "[Compounding a] pure gum vulcanizate … with 50% of its weight of carbon black -- improves its tensile strength and wear resistance …" {"technic:raw_latex 4", "technic:coal_dust 2", "technic:rubber 6", 2}, - {"default:ice", "bucket:bucket_empty", "bucket:bucket_water", 1 }, + {mat.ice, "bucket:bucket_empty", "bucket:bucket_water", 1 }, {"default:obsidian", "bucket:bucket_empty", "bucket:bucket_lava", 1 }, } if minetest.get_modpath("ethereal") then - table.insert(recipes, {"default:clay", "dye:red", "bakedclay:red"}) - table.insert(recipes, {"default:clay", "dye:orange", "bakedclay:orange"}) - table.insert(recipes, {"default:clay", "dye:grey", "bakedclay:grey"}) + table.insert(recipes, {mat.clay, mat.dye_red, "bakedclay:red"}) + table.insert(recipes, {mat.clay, mat.dye_orange, "bakedclay:orange"}) + table.insert(recipes, {mat.clay, mat.dye_grey, "bakedclay:grey"}) end if minetest.get_modpath("digilines") then diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index cc73037d..ef3204ac 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -4,15 +4,16 @@ local digilines_path = minetest.get_modpath("digilines") local S = technic.getter local tube_entry = "^pipeworks_tube_connection_metallic.png" local cable_entry = "^technic_cable_connection_overlay.png" +local mat = technic.materials -- Battery recipes: -- Tin-copper recipe: minetest.register_craft({ output = "technic:battery", recipe = { - {"group:wood", "default:copper_ingot", "group:wood"}, - {"group:wood", "default:tin_ingot", "group:wood"}, - {"group:wood", "default:copper_ingot", "group:wood"}, + {"group:wood", mat.copper_ingot, "group:wood"}, + {"group:wood", mat.tin_ingot, "group:wood"}, + {"group:wood", mat.copper_ingot, "group:wood"}, } }) -- Sulfur-lead-water recipes: diff --git a/technic/machines/register/centrifuge_recipes.lua b/technic/machines/register/centrifuge_recipes.lua index d52c0946..5c76ff8a 100644 --- a/technic/machines/register/centrifuge_recipes.lua +++ b/technic/machines/register/centrifuge_recipes.lua @@ -1,4 +1,5 @@ local S = technic.getter +local mat = technic.materials technic.register_recipe_type("separating", { description = S("Separating"), @@ -15,8 +16,8 @@ local recipes = { { "technic:bronze_dust 8", "technic:copper_dust 7", "technic:tin_dust" }, { "technic:stainless_steel_dust 5", "technic:wrought_iron_dust 4", "technic:chromium_dust" }, { "technic:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" }, - { "technic:chernobylite_dust", "default:sand", "technic:uranium3_dust" }, - { "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 4" }, + { "technic:chernobylite_dust", mat.sand, "technic:uranium3_dust" }, + { mat.dirt.." 4", mat.sand, mat.gravel, mat.clay_lump.." 4" }, } local function uranium_dust(p) @@ -28,19 +29,19 @@ end if minetest.get_modpath("bushes_classic") then for _, berry in ipairs({ "blackberry", "blueberry", "gooseberry", "raspberry", "strawberry" }) do - table.insert(recipes, { "bushes:"..berry.."_bush", "default:stick 20", "bushes:"..berry.." 4" }) + table.insert(recipes, { "bushes:"..berry.."_bush", mat.stick.." 20", "bushes:"..berry.." 4" }) end end -if minetest.get_modpath("farming") then +if minetest.get_modpath("farming") or minetest.get_modpath("mcl_farming") then if minetest.get_modpath("cottages") then -- work as a mechanized threshing floor table.insert(recipes, { "farming:wheat", "farming:seed_wheat", "cottages:straw_mat" }) table.insert(recipes, { "farming:barley", "farming:seed_barley", "cottages:straw_mat" }) else -- work in a less fancy and less efficient manner - table.insert(recipes, { "farming:wheat 4", "farming:seed_wheat 3", "default:dry_shrub 1" }) - table.insert(recipes, { "farming:barley 4", "farming:seed_barley 3", "default:dry_shrub 1" }) + table.insert(recipes, { mat.wheat.." 4", mat.seed_wheat.." 3", mat.dry_shrub }) + table.insert(recipes, { "farming:barley 4", "farming:seed_barley 3", mat.dry_shrub }) end end diff --git a/technic/machines/register/common.lua b/technic/machines/register/common.lua index 42d00d14..19fbd2df 100644 --- a/technic/machines/register/common.lua +++ b/technic/machines/register/common.lua @@ -1,5 +1,6 @@ local S = technic.getter +local mat = technic.materials -- handles the machine upgrades every tick function technic.handle_machine_upgrades(meta) @@ -35,7 +36,7 @@ end -- handles the machine upgrades when set or removed local function on_machine_upgrade(meta, stack) local stack_name = stack:get_name() - if stack_name == "default:chest" then + if stack_name == mat.chest then meta:set_int("public", 1) return 1 elseif stack_name ~= "technic:control_logic_unit" @@ -47,7 +48,7 @@ end -- something is about to be removed local function on_machine_downgrade(meta, stack, list) - if stack:get_name() == "default:chest" then + if stack:get_name() == mat.chest then local inv = meta:get_inventory() local upg1, upg2 = inv:get_stack("upgrade1", 1), inv:get_stack("upgrade2", 1) diff --git a/technic/machines/register/compressor_recipes.lua b/technic/machines/register/compressor_recipes.lua index 49f19a92..2e6bfd0e 100644 --- a/technic/machines/register/compressor_recipes.lua +++ b/technic/machines/register/compressor_recipes.lua @@ -1,5 +1,7 @@ local S = technic.getter +local mat = technic.materials +local has_mcl = minetest.get_modpath("mcl_core") technic.register_recipe_type("compressing", { description = S("Compressing"), @@ -12,44 +14,46 @@ function technic.register_compressor_recipe(data) end local recipes = { - {"default:snowblock", "default:ice"}, - {"default:sand 2", "default:sandstone"}, - {"default:desert_sand 2", "default:desert_sandstone"}, - {"default:silver_sand 2", "default:silver_sandstone"}, - {"default:desert_sandstone", "default:desert_stone"}, + {mat.snowblock, mat.ice}, + {mat.sand.." 2", mat.sandstone}, + {mat.desert_sand.." 2", mat.desert_sandstone}, + {mat.silver_sand.." 2", mat.silver_sandstone}, + {mat.desert_sandstone, mat.desert_stone}, {"technic:mixed_metal_ingot", "technic:composite_plate"}, - {"default:copper_ingot 5", "technic:copper_plate"}, + {mat.copper_ingot.." 5", "technic:copper_plate"}, {"technic:coal_dust 4", "technic:graphite"}, {"technic:carbon_cloth", "technic:carbon_plate"}, {"technic:uranium35_ingot 5", "technic:uranium_fuel"}, - {"technic:graphite 25", "default:diamond"} + {"technic:graphite 25", mat.diamond} } if minetest.get_modpath("ethereal") then -- the density of charcoal is ~1/10 of coal, otherwise it's pure carbon - table.insert(recipes, {"ethereal:charcoal_lump 10", "default:coal_lump 1"}) + table.insert(recipes, {"ethereal:charcoal_lump 10", mat.coal_lump.." 1"}) end -- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner -minetest.clear_craft({ - recipe = { - {"default:sand", "default:sand"}, - {"default:sand", "default:sand"}, - }, -}) -minetest.clear_craft({ - recipe = { - {"default:desert_sand", "default:desert_sand"}, - {"default:desert_sand", "default:desert_sand"}, - }, -}) -minetest.clear_craft({ - recipe = { - {"default:silver_sand", "default:silver_sand"}, - {"default:silver_sand", "default:silver_sand"}, - }, -}) +if not has_mcl then + minetest.clear_craft({ + recipe = { + {"default:sand", "default:sand"}, + {"default:sand", "default:sand"}, + }, + }) + minetest.clear_craft({ + recipe = { + {"default:desert_sand", "default:desert_sand"}, + {"default:desert_sand", "default:desert_sand"}, + }, + }) + minetest.clear_craft({ + recipe = { + {"default:silver_sand", "default:silver_sand"}, + {"default:silver_sand", "default:silver_sand"}, + }, + }) +end for _, data in pairs(recipes) do technic.register_compressor_recipe({input = {data[1]}, output = data[2]}) diff --git a/technic/machines/register/freezer_recipes.lua b/technic/machines/register/freezer_recipes.lua index edf16c64..fa921022 100644 --- a/technic/machines/register/freezer_recipes.lua +++ b/technic/machines/register/freezer_recipes.lua @@ -1,5 +1,6 @@ local S = technic.getter +local mat = technic.materials technic.register_recipe_type("freezing", { description = S("Freezing"), @@ -12,10 +13,10 @@ function technic.register_freezer_recipe(data) end local recipes = { - {"bucket:bucket_water", { "default:ice", "bucket:bucket_empty" } }, - {"bucket:bucket_river_water", { "default:ice", "bucket:bucket_empty" } }, - {"default:dirt", "default:dirt_with_snow" }, - {"bucket:bucket_lava", { "default:obsidian", "bucket:bucket_empty" } } + {mat.bucket_water, { mat.ice, mat.bucket_empty } }, + {mat.bucket_river_water, { mat.ice, mat.bucket_empty } }, + {mat.dirt, mat.dirt_with_snow }, + {mat.bucket_lava, { mat.obsidian, mat.bucket_empty } } } for _, data in pairs(recipes) do diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index 24be524b..df38d81e 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -1,5 +1,6 @@ local S = technic.getter +local mat = technic.materials technic.register_recipe_type("grinding", { description = S("Grinding"), @@ -13,30 +14,30 @@ end local recipes = { -- Dusts - {"default:coal_lump", "technic:coal_dust 2"}, - {"default:copper_lump", "technic:copper_dust 2"}, - {"default:desert_stone", "default:desert_sand"}, - {"default:gold_lump", "technic:gold_dust 2"}, - {"default:iron_lump", "technic:wrought_iron_dust 2"}, - {"default:tin_lump", "technic:tin_dust 2"}, + {mat.coal_lump, "technic:coal_dust 2"}, + {mat.copper_lump, "technic:copper_dust 2"}, + {mat.desert_stone, mat.desert_sand}, + {mat.gold_lump, "technic:gold_dust 2"}, + {mat.iron_lump, "technic:wrought_iron_dust 2"}, + {mat.tin_lump, "technic:tin_dust 2"}, {"technic:chromium_lump", "technic:chromium_dust 2"}, {"technic:uranium_lump", "technic:uranium_dust 2"}, {"technic:zinc_lump", "technic:zinc_dust 2"}, {"technic:lead_lump", "technic:lead_dust 2"}, {"technic:sulfur_lump", "technic:sulfur_dust 2"}, - {"default:stone", "technic:stone_dust"}, - {"default:sand", "technic:stone_dust"}, - {"default:desert_sand", "technic:stone_dust"}, - {"default:silver_sand", "technic:stone_dust"}, + {mat.stone, "technic:stone_dust"}, + {mat.sand, "technic:stone_dust"}, + {mat.desert_sand, "technic:stone_dust"}, + {mat.silver_sand, "technic:stone_dust"}, -- Other - {"default:cobble", "default:gravel"}, - {"default:gravel", "default:sand"}, - {"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor - {"default:desert_sandstone", "default:desert_sand 2"}, -- reverse recipe can be found in the compressor - {"default:silver_sandstone", "default:silver_sand 2"}, -- reverse recipe can be found in the compressor + {mat.cobble, mat.gravel}, + {mat.gravel, mat.sand}, + {mat.sandstone, mat.sand.." 2"}, -- reverse recipe can be found in the compressor + {mat.desert_sandstone, mat.desert_sand.." 2"}, -- reverse recipe can be found in the compressor + {mat.silver_sandstone, mat.silver_sand.." 2"}, -- reverse recipe can be found in the compressor - {"default:ice", "default:snowblock"}, + {mat.ice, mat.snowblock}, } if minetest.get_modpath("ethereal") then @@ -47,22 +48,22 @@ end -- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe) minetest.clear_craft({ recipe = { - {"default:sandstone"} + {mat.sandstone} }, }) minetest.clear_craft({ recipe = { - {"default:desert_sandstone"} + {mat.desert_sandstone} }, }) minetest.clear_craft({ recipe = { - {"default:silver_sandstone"} + {mat.silver_sandstone} }, }) if minetest.get_modpath("farming") then - table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"}) + table.insert(recipes, {mat.seed_wheat, "farming:flour 1"}) end if minetest.get_modpath("moreores") then @@ -106,21 +107,21 @@ end -- Sorted alphibeticaly register_dust("Brass", "basic_materials:brass_ingot") -register_dust("Bronze", "default:bronze_ingot") +register_dust("Bronze", mat.bronze_ingot) register_dust("Carbon Steel", "technic:carbon_steel_ingot") register_dust("Cast Iron", "technic:cast_iron_ingot") register_dust("Chernobylite", "technic:chernobylite_block") register_dust("Chromium", "technic:chromium_ingot") register_dust("Coal", nil) -register_dust("Copper", "default:copper_ingot") +register_dust("Copper", mat.copper_ingot) register_dust("Lead", "technic:lead_ingot") -register_dust("Gold", "default:gold_ingot") -register_dust("Mithril", "moreores:mithril_ingot") -register_dust("Silver", "moreores:silver_ingot") +register_dust("Gold", mat.gold_ingot) +register_dust("Mithril", mat.mithril_ingot) +register_dust("Silver", mat.silver_ingot) register_dust("Stainless Steel", "technic:stainless_steel_ingot") -register_dust("Stone", "default:stone") +register_dust("Stone", mat.stone) register_dust("Sulfur", nil) -register_dust("Tin", "default:tin_ingot") +register_dust("Tin", mat.tin_ingot) register_dust("Wrought Iron", "technic:wrought_iron_ingot") register_dust("Zinc", "technic:zinc_ingot") if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then diff --git a/technic/machines/register/grindings.lua b/technic/machines/register/grindings.lua index 23200e20..18c62131 100644 --- a/technic/machines/register/grindings.lua +++ b/technic/machines/register/grindings.lua @@ -1,6 +1,7 @@ local S = technic.getter local moretrees = minetest.get_modpath("moretrees") local dye = minetest.get_modpath("dye") +local mat = technic.materials -- sawdust, the finest wood/tree grinding local sawdust = "technic:sawdust" @@ -9,7 +10,7 @@ minetest.register_craftitem(sawdust, { inventory_image = "technic_sawdust.png", }) minetest.register_craft({ type = "fuel", recipe = sawdust, burntime = 6 }) -technic.register_compressor_recipe({ input = {sawdust .. " 4"}, output = "default:wood" }) +technic.register_compressor_recipe({ input = {sawdust .. " 4"}, output = mat.wood }) -- tree/wood grindings local function register_tree_grinding(name, tree, wood, extract, grinding_color) @@ -54,11 +55,11 @@ local acacia_extract = dye and "dye:brown 8" -- technic recipes don't support groups yet :/ --register_tree_grinding("Common Tree", "group:tree", "group:wood", default_extract) -register_tree_grinding("Acacia", "default:acacia_tree", "default:acacia_wood", acacia_extract) -register_tree_grinding("Common Tree", "default:tree", "default:wood", default_extract) -register_tree_grinding("Common Tree", "default:aspen_tree", "default:aspen_wood", default_extract) -register_tree_grinding("Common Tree", "default:jungletree", "default:junglewood", default_extract) -register_tree_grinding("Common Tree", "default:pine_tree", "default:pine_wood", default_extract) +register_tree_grinding("Acacia", mat.acacia_tree, mat.acacia_wood, acacia_extract) +register_tree_grinding("Common Tree", mat.tree, mat.wood, default_extract) +register_tree_grinding("Common Tree", mat.aspen_tree, mat.aspen_wood, default_extract) +register_tree_grinding("Common Tree", mat.jungletree, mat.junglewood, default_extract) +register_tree_grinding("Common Tree", mat.pine_tree, mat.pine_wood, default_extract) register_tree_grinding("Rubber Tree", "moretrees:rubber_tree_trunk", rubber_tree_planks, "technic:raw_latex") register_tree_grinding("Rubber Tree", "moretrees:rubber_tree_trunk_empty", nil, "technic:raw_latex") diff --git a/technic/machines/register/recipes.lua b/technic/machines/register/recipes.lua index af79f449..d3b29367 100644 --- a/technic/machines/register/recipes.lua +++ b/technic/machines/register/recipes.lua @@ -133,6 +133,7 @@ function technic.get_recipe(typename, items) if recipe then local new_input = {} for i, stack in ipairs(items) do + if not stack:get_count() or not recipe.input[stack:get_name()] then return end if stack:get_count() < recipe.input[stack:get_name()] then return else diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index 7951bd32..cb7205b5 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -4,6 +4,7 @@ local mesecons_path = minetest.get_modpath("mesecons") local digilines_path = minetest.get_modpath("digilines") local S = technic.getter +local mat = technic.materials local cable_entry = "^technic_cable_connection_overlay.png" @@ -11,7 +12,7 @@ minetest.register_craft({ output = "technic:switching_station", recipe = { {"", "technic:lv_transformer", ""}, - {"default:copper_ingot", "technic:machine_casing", "default:copper_ingot"}, + {mat.copper_ingot, "technic:machine_casing", mat.copper_ingot}, {"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"} } }) diff --git a/technic/materials.lua b/technic/materials.lua new file mode 100644 index 00000000..ccff7ef1 --- /dev/null +++ b/technic/materials.lua @@ -0,0 +1,78 @@ + +local mesecons_materials = minetest.get_modpath("mesecons_materials") +local has_mcl = minetest.get_modpath("mcl_core") +local has_mcl_dye = minetest.get_modpath("mcl_dye") +local has_moreores = minetest.get_modpath("moreores") + +technic.materials = { + gold_ingot = has_mcl and "mcl_core:gold_ingot" or "default:gold_ingot", + gold_lump = has_mcl and "mcl_core:gold_nugget" or "default:gold_lump", + steel_ingot = has_mcl and "mcl_core:iron_ingot" or "default:iron_ingot", + iron_lump = has_mcl and "mcl_core:iron_nugget" or "default:iron_lump", + diamond = has_mcl and "mcl_core:diamond" or "default:diamond", + dirt = has_mcl and "mcl_core:dirt" or "default:dirt", + tin_ingot = has_mcl and "mcl_core:iron_ingot" or "default:tin_ingot", + tin_lump = has_mcl and "mcl_raw_ores:raw_iron" or "default:tin_lump", + bronze_ingot = has_mcl and "mcl_copper:copper_ingot" or "default:bronze_ingot", + copper_ingot = has_mcl and "mcl_copper:copper_ingot" or "default:copper_ingot", + copper_lump = has_mcl and "mcl_copper:raw_copper" or "default:copper_lump", + mese_crystal = has_mcl and "mesecons:redstone" or "default:mese_crystal", + dye_green = has_mcl_dye and "mcl_dye:green" or "dye:green", + dye_red = has_mcl_dye and "mcl_dye:red" or "dye:red", + dye_blue = has_mcl_dye and "mcl_dye:blue" or "dye:blue", + isolation = mesecons_materials and "mesecons_materials:fiber" or "technic:rubber", + mese = has_mcl and "mesecons:redstone" or "default:mese", + obsidian_glass = has_mcl and "mcl_core:glass" or "default:obsidian_glass", + brick = has_mcl and "mcl_core:brick" or "default:brick", + paper = has_mcl and "mcl_core:paper" or "default:paper", + furnace = has_mcl and "mcl_furnaces:furnace" or "default:furnace", + desert_stone = has_mcl and "mcl_core:redsandstone" or "default:desert_stone", + mossycobble = has_mcl and "mcl_core:mossycobble" or "default:mossycobble", + obsidian = has_mcl and "mcl_core:obsidian" or "default:obsidian", + chest = has_mcl and "mcl_chests:chest" or "default:chest", + sand = has_mcl and "mcl_core:sand" or "default:sand", + ice = has_mcl and "mcl_core:ice" or "default:ice", + clay = has_mcl and "mcl_core:clay" or "default:clay", + clay_lump = has_mcl and "mcl_core:clay_lump" or "default:clay_lump", + dye_red = has_mcl and "mcl_dye:red" or "dye:red", + dye_orange = has_mcl and "mcl_dye:orange" or "dye:orange", + stick = has_mcl and "mcl_core:stick" or "default:stick", + dry_shrub = has_mcl and "mcl_core:deadbush" or "default:dry_shrub", + wheat = has_mcl and "mcl_farming:wheat_item" or "farming:wheat", + seed_wheat = has_mcl and "mcl_farming:wheat_seeds" or "farming:seed_wheat", + snowblock = has_mcl and "mcl_core:snowblock" or "default:snowblock", + sandstone = has_mcl and "mcl_core:sandstone" or "default:sandstone", + desert_sand = has_mcl and "mcl_core:redsand" or "default:desert_sand", + desert_sandstone = has_mcl and "mcl_core:redsandstone" or "default:desert_sandstone", + silver_sand = has_mcl and "mcl_core:sand" or "default:silver_sand", + silver_sandstone = has_mcl and "mcl_core:sandstone" or "default:silver_sandstone", + glass = has_mcl and "mcl_core:glass" or "default:glass", + coal_lump = has_mcl and "mcl_core:coal_lump" or "default:coal_lump", + bucket_empty = has_mcl and "mcl_buckets:bucket_empty" or "bucket:bucket_empty", + bucket_water = has_mcl and "mcl_buckets:bucket_water" or "bucket:bucket_water", + bucket_river_water = has_mcl and "mcl_buckets:bucket_river_water" or "bucket:bucket_river_water", + bucket_lava = has_mcl and "mcl_buckets:bucket_lava" or "bucket:bucket_lava", + dirt_with_snow = has_mcl and "mcl_core:snowblock" or "default:dirt_with_snow", + gravel = has_mcl and "mcl_core:gravel" or "default:gravel", + cobble = has_mcl and "mcl_core:cobble" or "default:cobble", + tree = has_mcl and "mcl_core:tree" or "default:tree", + wood = has_mcl and "mcl_core:wood" or "default:wood", + acacia_tree = has_mcl and "mcl_core:acaciatree" or "default:acacia_tree", + acacia_wood = has_mcl and "mcl_core:acaciawood" or "default:acacia_wood", + aspen_tree = has_mcl and "mcl_core:birchtree" or "default:aspen_tree", + aspen_wood = has_mcl and "mcl_core:birchwood" or "default:aspen_wood", + jungletree = has_mcl and "mcl_core:jungletree" or "default:jungletree", + junglewood = has_mcl and "mcl_core:junglewood" or "default:junglewood", + pine_tree = has_mcl and "mcl_core:sprucetree" or "default:pine_tree", + pine_wood = has_mcl and "mcl_core:sprucewood" or "default:pine_wood", + water_source = has_mcl and "mcl_core:water_source" or "default:water_source", + water_flowing = has_mcl and "mcl_core:water_flowing" or "default:water_flowing", + river_water_source = has_mcl and "mclx_core:river_water_source" or "default:river_water_source", + river_water_flowing = has_mcl and "mclx_core:river_water_flowing" or "default:river_water_flowing", + lava_source = has_mcl and "mcl_core:lava_source" or "default:lava_source", + lava_flowing = has_mcl and "mcl_core:lava_flowing" or "default:lava_flowing", + mithril_ingot = has_moreores and "moreores:mithril_ingot" or has_mcl and "mcl_core:lapis" or "default:steel_ingot", + silver_ingot = has_moreores and "moreores:silver_ingot" or has_mcl and "mcl_core:gold_ingot" or "default:gold_ingot", + pick_silver = has_moreores and "moreores:pick_silver" or has_mcl and "mcl_tools:pick_gold" or "default:gold_pickaxe", + mithril_block = has_moreores and "moreores:mithril_block" or has_mcl and "mcl_core:lapisblock" or "default:goldblock", +} diff --git a/technic/tools/cans.lua b/technic/tools/cans.lua index e6bc93c4..843077a6 100644 --- a/technic/tools/cans.lua +++ b/technic/tools/cans.lua @@ -1,4 +1,5 @@ local S = technic.getter +local mat = technic.materials local function set_can_wear(itemstack, level, max_level) local temp @@ -87,8 +88,8 @@ technic.register_can({ can_description = S("Water Can"), can_inventory_image = "technic_water_can.png", can_capacity = 16, - liquid_source_name = "default:water_source", - liquid_flowing_name = "default:water_flowing", + liquid_source_name = mat.water_source, + liquid_flowing_name = mat.water_flowing, }) minetest.register_craft({ @@ -105,8 +106,8 @@ technic.register_can({ can_description = S("Lava Can"), can_inventory_image = "technic_lava_can.png", can_capacity = 8, - liquid_source_name = "default:lava_source", - liquid_flowing_name = "default:lava_flowing", + liquid_source_name = mat.lava_source, + liquid_flowing_name = mat.lava_flowing, }) minetest.register_craft({ @@ -123,15 +124,15 @@ technic.register_can({ can_description = S("River Water Can"), can_inventory_image = "technic_river_water_can.png", can_capacity = 16, - liquid_source_name = "default:river_water_source", - liquid_flowing_name = "default:river_water_flowing", + liquid_source_name = mat.river_water_source, + liquid_flowing_name = mat.river_water_flowing, }) minetest.register_craft({ output = 'technic:river_water_can 1', recipe = { {'technic:zinc_ingot', 'technic:rubber', 'technic:zinc_ingot'}, - {'default:steel_ingot', '', 'default:steel_ingot'}, - {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'}, + {mat.steel_ingot, '', mat.steel_ingot}, + {'technic:zinc_ingot', mat.steel_ingot, 'technic:zinc_ingot'}, } }) diff --git a/technic/tools/chainsaw.lua b/technic/tools/chainsaw.lua index f964503a..ada206e6 100644 --- a/technic/tools/chainsaw.lua +++ b/technic/tools/chainsaw.lua @@ -195,7 +195,8 @@ technic.register_power_tool("technic:chainsaw", { }) local mesecons_button = minetest.get_modpath("mesecons_button") -local trigger = mesecons_button and "mesecons_button:button_off" or "default:mese_crystal_fragment" +local has_mcl = minetest.get_modpath("mcl_core") +local trigger = has_mcl and mesecons_button and "mesecons_button:button_wood_off" or mesecons_button and "mesecons_button:button_off" or "default:mese_crystal_fragment" minetest.register_craft({ output = "technic:chainsaw", diff --git a/technic/tools/flashlight.lua b/technic/tools/flashlight.lua index 74478d2a..23d0f137 100644 --- a/technic/tools/flashlight.lua +++ b/technic/tools/flashlight.lua @@ -4,6 +4,7 @@ local flashlight_max_charge = 30000 local S = technic.getter +local mat = technic.materials minetest.register_alias("technic:light_off", "air") @@ -16,7 +17,7 @@ technic.register_power_tool("technic:flashlight", { minetest.register_craft({ output = "technic:flashlight", recipe = { - {"technic:rubber", "default:glass", "technic:rubber"}, + {"technic:rubber", mat.glass, "technic:rubber"}, {"technic:stainless_steel_ingot", "technic:battery", "technic:stainless_steel_ingot"}, {"", "technic:battery", ""} } diff --git a/technic/tools/init.lua b/technic/tools/init.lua index 25d5e98b..2fbcaddd 100644 --- a/technic/tools/init.lua +++ b/technic/tools/init.lua @@ -1,4 +1,6 @@ local path = technic.modpath.."/tools" +local mesecons_materials = minetest.get_modpath("mesecons_materials") +local has_mcl = minetest.get_modpath("mcl_core") local function enabled(name) return technic.config:get_bool("enable_" .. name) @@ -10,7 +12,7 @@ if enabled("flashlight") then dofile(path.."/flashlight.lua") end if enabled("cans") then dofile(path.."/cans.lua") end if enabled("chainsaw") then dofile(path.."/chainsaw.lua") end if enabled("tree_tap") then dofile(path.."/tree_tap.lua") end -if enabled("sonic_screwdriver") then dofile(path.."/sonic_screwdriver.lua") end +if enabled("sonic_screwdriver") and mesecons_materials and not has_mcl then dofile(path.."/sonic_screwdriver.lua") end if enabled("prospector") then dofile(path.."/prospector.lua") end if enabled("vacuum") then dofile(path.."/vacuum.lua") end if enabled("multimeter") then dofile(path.."/multimeter.lua") end diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua index 0dc383ff..f0d78f85 100644 --- a/technic/tools/mining_drill.lua +++ b/technic/tools/mining_drill.lua @@ -2,13 +2,14 @@ local max_charge = {50000, 200000, 300000} local power_usage_per_node = {200, 500, 600} local S = technic.getter +local mat = technic.materials minetest.register_craft({ output = 'technic:mining_drill', recipe = { - {'default:tin_ingot', 'technic:diamond_drill_head', 'default:tin_ingot'}, + {mat.tin_ingot, 'technic:diamond_drill_head', mat.tin_ingot}, {'technic:stainless_steel_ingot', 'basic_materials:motor', 'technic:stainless_steel_ingot'}, - {'', 'technic:red_energy_crystal', 'default:copper_ingot'}, + {'', 'technic:red_energy_crystal', mat.copper_ingot}, } }) minetest.register_craft({ @@ -58,10 +59,10 @@ local function drill_dig_it0 (pos,player) end local node = minetest.get_node(pos) if node.name == "air" or node.name == "ignore" then return end - if node.name == "default:lava_source" then return end - if node.name == "default:lava_flowing" then return end - if node.name == "default:water_source" then minetest.remove_node(pos) return end - if node.name == "default:water_flowing" then minetest.remove_node(pos) return end + if node.name == mat.lava_source then return end + if node.name == mat.lava_flowing then return end + if node.name == mat.water_source then minetest.remove_node(pos) return end + if node.name == mat.water_flowing then minetest.remove_node(pos) return end local def = minetest.registered_nodes[node.name] if not def then return end def.on_dig(pos, node, player) diff --git a/technic/tools/mining_lasers.lua b/technic/tools/mining_lasers.lua index bc8f2a6b..f9998ed2 100644 --- a/technic/tools/mining_lasers.lua +++ b/technic/tools/mining_lasers.lua @@ -1,3 +1,6 @@ + +local mat = technic.materials + local mining_lasers_list = { -- {, , , }, {"1", 7, 50000, 1000}, @@ -11,25 +14,25 @@ local S = technic.getter minetest.register_craft({ output = "technic:laser_mk1", recipe = { - {"default:diamond", "basic_materials:brass_ingot", "default:obsidian_glass"}, + {mat.diamond, "basic_materials:brass_ingot", mat.obsidian_glass}, {"", "basic_materials:brass_ingot", "technic:red_energy_crystal"}, - {"", "", "default:copper_ingot"}, + {"", "", mat.copper_ingot}, } }) minetest.register_craft({ output = "technic:laser_mk2", recipe = { - {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk1"}, + {mat.diamond, "technic:carbon_steel_ingot", "technic:laser_mk1"}, {"", "technic:carbon_steel_ingot", "technic:green_energy_crystal"}, - {"", "", "default:copper_ingot"}, + {"", "", mat.copper_ingot}, } }) minetest.register_craft({ output = "technic:laser_mk3", recipe = { - {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk2"}, + {mat.diamond, "technic:carbon_steel_ingot", "technic:laser_mk2"}, {"", "technic:carbon_steel_ingot", "technic:blue_energy_crystal"}, - {"", "", "default:copper_ingot"}, + {"", "", mat.copper_ingot}, } }) diff --git a/technic/tools/prospector.lua b/technic/tools/prospector.lua index 09782c5a..0d96de07 100644 --- a/technic/tools/prospector.lua +++ b/technic/tools/prospector.lua @@ -1,4 +1,5 @@ local S = technic.getter +local mat = technic.materials local function migrate_meta(meta) local data = meta:get("") @@ -139,7 +140,7 @@ end) minetest.register_craft({ output = "technic:prospector", recipe = { - {"moreores:pick_silver", "moreores:mithril_block", "pipeworks:teleport_tube_1"}, + {mat.pick_silver, mat.mithril_block, "pipeworks:teleport_tube_1"}, {"basic_materials:brass_ingot", "technic:control_logic_unit", "basic_materials:brass_ingot"}, {"", "technic:blue_energy_crystal", ""}, } diff --git a/technic/tools/sonic_screwdriver.lua b/technic/tools/sonic_screwdriver.lua index 1bd5a26e..f7a81dae 100644 --- a/technic/tools/sonic_screwdriver.lua +++ b/technic/tools/sonic_screwdriver.lua @@ -1,6 +1,7 @@ local sonic_screwdriver_max_charge = 15000 local S = technic.getter +local mat = technic.materials -- screwdriver handler code reused from minetest/minetest_game screwdriver @a9ac480 local ROTATE_FACE = 1 @@ -78,8 +79,8 @@ technic.register_power_tool("technic:sonic_screwdriver", { minetest.register_craft({ output = "technic:sonic_screwdriver", recipe = { - {"", "default:diamond", ""}, + {"", mat.diamond, ""}, {"mesecons_materials:fiber", "technic:battery", "mesecons_materials:fiber"}, - {"mesecons_materials:fiber", "moreores:mithril_ingot", "mesecons_materials:fiber"} + {"mesecons_materials:fiber", mat.mithril_ingot, "mesecons_materials:fiber"} } })