diff --git a/.luacheckrc b/.luacheckrc index be8b493d..148443af 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -26,10 +26,11 @@ read_globals = { "mesecon", "moretrees", "unified_inventory", "protector", "unifieddyes", "digiline_remote", - "drawers", "mg", + "drawers", "mg", "mcl_explosions", "craftguide", "i3", "mtt", "vizlib", "mcl_sounds", "mcl_vars", - "mcl_worlds", "exchangeclone", + "mcl_worlds", "mcl_buckets", "mcl_formspec", + "mcl_craftguide","exchangeclone", -- Only used in technic/machines/MV/lighting.lua (disabled) "isprotect", "homedecor_expect_infinite_stacks", diff --git a/technic/crafts.lua b/technic/crafts.lua index d43ab345..e49ec7b4 100644 --- a/technic/crafts.lua +++ b/technic/crafts.lua @@ -1,19 +1,23 @@ -- 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 mat = technic.materials +local has_mcl = minetest.get_modpath("mcl_core") -- Remove some recipes -- Bronze -minetest.clear_craft({ - type = "shapeless", - output = "default:bronze_ingot" -}) --- Restore recipe for bronze block to ingots -minetest.register_craft({ - output = "default:bronze_ingot 9", - recipe = { - {"default:bronzeblock"} - } -}) +if not has_mcl then + minetest.clear_craft({ + type = "shapeless", + output = "default:bronze_ingot" + }) + -- Restore recipe for bronze block to ingots + minetest.register_craft({ + output = "default:bronze_ingot 9", + recipe = { + {"default:bronzeblock"} + } + }) +end -- Accelerator tube if pipeworks.enable_accelerator_tube then @@ -38,9 +42,9 @@ if pipeworks.enable_teleport_tube then minetest.register_craft({ output = 'pipeworks:teleport_tube_1', recipe = { - {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, + {mat.mese_crystal, 'technic:copper_coil', mat.mese_crystal}, {'pipeworks:tube_1', 'technic:control_logic_unit', 'pipeworks:tube_1'}, - {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, + {mat.mese_crystal, 'technic:copper_coil', mat.mese_crystal}, } }) end @@ -62,36 +66,36 @@ minetest.register_craft( { minetest.register_craft({ output = 'technic:diamond_drill_head', recipe = { - {'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'}, - {'default:diamond', '', 'default:diamond'}, - {'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'}, + {'technic:stainless_steel_ingot', mat.diamond, 'technic:stainless_steel_ingot'}, + {mat.diamond, '', mat.diamond}, + {'technic:stainless_steel_ingot', mat.diamond, 'technic:stainless_steel_ingot'}, } }) minetest.register_craft({ output = 'technic:green_energy_crystal', recipe = { - {'default:gold_ingot', 'technic:battery', 'dye:green'}, + {mat.gold_ingot, 'technic:battery', mat.dye_green}, {'technic:battery', 'technic:red_energy_crystal', 'technic:battery'}, - {'dye:green', 'technic:battery', 'default:gold_ingot'}, + {mat.dye_green, 'technic:battery', mat.gold_ingot}, } }) minetest.register_craft({ output = 'technic:blue_energy_crystal', recipe = { - {'moreores:mithril_ingot', 'technic:battery', 'dye:blue'}, + {mat.mithril_ingot, 'technic:battery', mat.dye_blue}, {'technic:battery', 'technic:green_energy_crystal', 'technic:battery'}, - {'dye:blue', 'technic:battery', 'moreores:mithril_ingot'}, + {mat.dye_blue, 'technic:battery', mat.mithril_ingot}, } }) minetest.register_craft({ output = 'technic:red_energy_crystal', recipe = { - {'moreores:silver_ingot', 'technic:battery', 'dye:red'}, + {mat.silver_ingot, 'technic:battery', mat.dye_red}, {'technic:battery', 'basic_materials:energy_crystal_simple', 'technic:battery'}, - {'dye:red', 'technic:battery', 'moreores:silver_ingot'}, + {mat.dye_red, 'technic:battery', mat.silver_ingot}, } }) @@ -110,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.insulation, 'technic:wrought_iron_ingot', mat.insulation}, {'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil'}, {'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'}, } @@ -124,7 +126,7 @@ minetest.register_craft({ minetest.register_craft({ output = 'technic:mv_transformer', recipe = { - {isolation, 'technic:carbon_steel_ingot', isolation}, + {mat.insulation, 'technic:carbon_steel_ingot', mat.insulation}, {'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil'}, {'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'}, } @@ -133,7 +135,7 @@ minetest.register_craft({ minetest.register_craft({ output = 'technic:hv_transformer', recipe = { - {isolation, 'technic:stainless_steel_ingot', isolation}, + {mat.insulation, 'technic:stainless_steel_ingot', mat.insulation}, {'technic:copper_coil', 'technic:stainless_steel_ingot', 'technic:copper_coil'}, {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, } @@ -143,7 +145,7 @@ minetest.register_craft({ output = 'technic:control_logic_unit', recipe = { {'', 'basic_materials:gold_wire', ''}, - {'default:copper_ingot', 'technic:silicon_wafer', 'default:copper_ingot'}, + {mat.bronze_ingot, 'technic:silicon_wafer', mat.bronze_ingot}, {'', 'technic:chromium_ingot', ''}, }, replacements = { {"basic_materials:gold_wire", "basic_materials:empty_spool"}, }, @@ -153,8 +155,8 @@ minetest.register_craft({ output = 'technic:mixed_metal_ingot 9', recipe = { {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, - {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, - {'default:tin_ingot', 'default:tin_ingot', 'default:tin_ingot'}, + {mat.bronze_ingot, mat.bronze_ingot, mat.bronze_ingot}, + {mat.tin_ingot, mat.tin_ingot, mat.tin_ingot}, } }) @@ -176,13 +178,13 @@ minetest.register_craft({ minetest.register_craft({ - output = "default:dirt 2", + output = mat.dirt.." 2", type = "shapeless", - replacements = {{"bucket:bucket_water","bucket:bucket_empty"}}, + replacements = {{mat.bucket_water,mat.bucket_empty}}, recipe = { "technic:stone_dust", "group:leaves", - "bucket:bucket_water", + mat.bucket_water, "group:sand", }, }) diff --git a/technic/init.lua b/technic/init.lua index 598b927a..22d99d4d 100644 --- a/technic/init.lua +++ b/technic/init.lua @@ -4,6 +4,12 @@ technic = rawget(_G, "technic") or {} technic.plus = true technic.version = 1.2 +if minetest.get_modpath("mcl_sounds") then + technic.sounds = mcl_sounds +else + technic.sounds = assert(default, "No suitable mod found for sounds") +end + technic.creative_mode = minetest.settings:get_bool("creative_mode") local modpath = minetest.get_modpath("technic") @@ -12,6 +18,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/items.lua b/technic/items.lua index 3a257034..fa1fb871 100644 --- a/technic/items.lua +++ b/technic/items.lua @@ -1,6 +1,8 @@ local S = technic.getter +local has_mcl = minetest.get_modpath("mcl_core") + minetest.register_craftitem("technic:silicon_wafer", { description = S("Silicon Wafer"), inventory_image = "technic_silicon_wafer.png", @@ -108,12 +110,14 @@ minetest.register_craftitem("technic:carbon_cloth", { minetest.register_node("technic:machine_casing", { description = S("Machine Casing"), - groups = {cracky=2}, + groups = {cracky=2, pickaxey=2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, sunlight_propagates = true, paramtype = "light", drawtype = "allfaces", tiles = {"technic_machine_casing.png"}, - sounds = default.node_sound_stone_defaults(), + sounds = technic.sounds.node_sound_stone_defaults(), }) for p = 0, 35 do @@ -164,8 +168,10 @@ for p = 0, 35 do tiles = {"technic_uranium_block.png"}, is_ground_content = true, groups = {uranium_block=1, not_in_creative_inventory=nici, - cracky=1, level=2, radioactive=radioactivity}, - sounds = default.node_sound_stone_defaults(), + cracky=1, level=has_mcl and 0 or 2, radioactive=radioactivity, pickaxey=4}, + _mcl_blast_resistance = 1, + _mcl_hardness = 1, + sounds = technic.sounds.node_sound_stone_defaults(), }); if not ov then minetest.register_craft({ diff --git a/technic/machines/HV/forcefield.lua b/technic/machines/HV/forcefield.lua index ba9d0289..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 }, } }) @@ -307,7 +309,9 @@ minetest.register_node("technic:forcefield_emitter_off", { "technic_forcefield_emitter_off.png", "technic_forcefield_emitter_off.png" }, - groups = {cracky = 1, technic_machine = 1, technic_hv = 1}, + groups = {cracky = 1, technic_machine = 1, technic_hv = 1, pickaxey = 3}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, on_receive_fields = forcefield_receive_fields, on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -339,7 +343,9 @@ minetest.register_node("technic:forcefield_emitter_on", { "technic_forcefield_emitter_on.png" }, groups = {cracky = 1, technic_machine = 1, technic_hv = 1, - not_in_creative_inventory=1}, + not_in_creative_inventory=1, pickaxey = 3}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, drop = "technic:forcefield_emitter_off", on_receive_fields = forcefield_receive_fields, on_destruct = function(pos) @@ -366,7 +372,7 @@ minetest.register_node("technic:forcefield", { drawtype = "glasslike", groups = {not_in_creative_inventory=1}, paramtype = "light", - light_source = default.LIGHT_MAX, + light_source = minetest.LIGHT_MAX, diggable = false, drop = '', tiles = {{ diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua index 60015f01..b80defdd 100644 --- a/technic/machines/HV/nuclear_reactor.lua +++ b/technic/machines/HV/nuclear_reactor.lua @@ -14,6 +14,8 @@ local power_supply = 100000 -- EUs 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 @@ -24,20 +26,34 @@ 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'}, } }) +local size = minetest.get_modpath("mcl_formspec") and "size[9,9]" or "size[8,9]" local function make_reactor_formspec(meta) - local f = "size[8,9]".. - "label[0,0;"..S("Nuclear Reactor Rod Compartment").."]".. - "list[context;src;2,1;3,2;]".. - "list[current_player;main;0,5;8,4;]".. - "listring[]".. - "button[5.5,1.5;2,1;start;"..S("Start").."]".. - "checkbox[5.5,2.5;autostart;"..S("Automatic Start")..";"..meta:get_string("autostart").."]" + local f = size.. + "label[0,0;"..S("Nuclear Reactor Rod Compartment").."]".. + "list[context;src;2,1;3,2;]".. + "listring[context;src]".. + "button[5.5,1.5;2,1;start;"..S("Start").."]".. + "checkbox[5.5,2.5;autostart;"..S("Automatic Start")..";"..meta:get_string("autostart").."]" + if has_mcl then + f = f.. + mcl_formspec.get_itemslot_bg(2,1,3,2).. + -- player inventory + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1).. + "listring[current_player;main]" + else + f = f.. + "list[current_player;main;0,5;8,4;]".. + "listring[current_player;main]" + end if not has_digilines then return f end @@ -149,8 +165,8 @@ local function reactor_structure_badness(pos) local c_blast_concrete = minetest.get_content_id("technic:blast_resistant_concrete") local c_lead = minetest.get_content_id("technic:lead_block") local c_steel = minetest.get_content_id("technic:stainless_steel_block") - local c_water_source = minetest.get_content_id("default:water_source") - local c_water_flowing = minetest.get_content_id("default:water_flowing") + local c_water_source = minetest.get_content_id(mat.water_source) + local c_water_flowing = minetest.get_content_id(mat.water_flowing) local blast_layer, steel_layer, lead_layer, water_layer = 0, 0, 0, 0 @@ -209,9 +225,21 @@ local function reactor_structure_badness(pos) return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer) end +local mcl_expl_info = { + drop_chance = 1.0, + max_blast_resistance = 10, + sound = true, + particles = true, + fire = true, + griefing = true, + grief_protected = true, +} local function melt_down_reactor(pos) minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos)) + if minetest.get_modpath("mcl_explosions") then + mcl_explosions.explode(pos, 30, mcl_expl_info) + end minetest.set_node(pos, {name = "technic:corium_source"}) end @@ -417,9 +445,11 @@ minetest.register_node("technic:hv_nuclear_reactor_core", { }, drawtype = "mesh", mesh = "technic_reactor.obj", - groups = {cracky = 1, technic_machine = 1, technic_hv = 1}, + groups = {cracky = 1, technic_machine = 1, technic_hv = 1, pickaxey = 3}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), paramtype = "light", paramtype2 = "facedir", stack_max = 1, @@ -460,9 +490,11 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", { drawtype = "mesh", mesh = "technic_reactor.obj", groups = {cracky = 1, technic_machine = 1, technic_hv = 1, radioactive = 4, - not_in_creative_inventory = 1}, + not_in_creative_inventory = 1, pickaxey = 3}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), drop = "technic:hv_nuclear_reactor_core", light_source = 14, paramtype = "light", diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua index 52b6ea6b..e8ff97e1 100644 --- a/technic/machines/HV/quarry.lua +++ b/technic/machines/HV/quarry.lua @@ -5,6 +5,7 @@ local has_digilines = minetest.get_modpath("digilines") local has_mesecons = minetest.get_modpath("mesecons") local has_vizlib = minetest.get_modpath("vizlib") local has_jumpdrive = minetest.get_modpath("jumpdrive") +local has_mcl = minetest.get_modpath("mcl_formspec") local quarry_max_depth = technic.config:get_int("quarry_max_depth") local quarry_dig_particles = technic.config:get_bool("quarry_dig_particles") @@ -81,6 +82,9 @@ local function can_dig_node(pos, dig_pos, node_name, owner, digger) if not def or not def.diggable or (def.can_dig and not def.can_dig(dig_pos, digger)) then return false end + if def._mcl_hardness == -1 then + return false + end return not minetest.is_protected(dig_pos, owner) end @@ -255,11 +259,11 @@ local function reset_quarry(meta) meta:set_int("finished", 0) end -local base_formspec = "size[8,9]".. +local size = minetest.get_modpath("mcl_formspec") and "size[9,10]" or "size[8,9]" +local base_formspec = size.. "label[0,0;"..S("@1 Quarry", S("HV")).."]".. "list[context;cache;0,0.7;4,3;]".. - "list[current_player;main;0,5.2;8,4;]".. - "listring[]".. + "listring[context;cache]".. "button[6,0.6;2,1;restart;"..S("Restart").."]".. "field[4.3,2.1;2,1;size;"..S("Radius")..";${size}]".. "field[6.3,2.1;2,1;max_depth;"..S("Max Depth")..";${max_depth}]".. @@ -272,6 +276,21 @@ if has_digilines then "field[4.3,4.2;4,1;channel;"..S("Digiline Channel")..";${channel}]" end +if has_mcl then + base_formspec = base_formspec.. + mcl_formspec.get_itemslot_bg(0,0.7,4,3).. + -- player inventory + "list[current_player;main;0,5.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,5.5,9,3).. + "list[current_player;main;0,8.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,8.74,9,1).. + "listring[current_player;main]" +else + base_formspec = base_formspec.. + "list[current_player;main;0,5;8,4;]".. + "listring[current_player;main]" +end + local function update_formspec(meta) local fs = base_formspec local status = S("Digging not started") @@ -478,7 +497,9 @@ minetest.register_node("technic:quarry", { "technic_carbon_steel_block.png^technic_cable_connection_overlay.png", "technic_carbon_steel_block.png^technic_cable_connection_overlay.png" }, - groups = {cracky = 2, tubedevice = 1, technic_machine = 1, technic_hv = 1}, + groups = {cracky = 2, tubedevice = 1, technic_machine = 1, technic_hv = 1, pickaxey = 2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"front", "back", "left", "right"}, tube = { connect_sides = {top = 1}, 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..9c040f1a 100644 --- a/technic/machines/LV/compressor.lua +++ b/technic/machines/LV/compressor.lua @@ -1,11 +1,13 @@ + local S = technic.getter +local mat = technic.materials minetest.register_alias("compressor", "technic:lv_compressor") minetest.register_craft({ output = 'technic:lv_compressor', recipe = { - {'default:stone', 'basic_materials:motor', 'default:stone'}, + {mat.stone, 'basic_materials:motor', mat.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..368d1073 100644 --- a/technic/machines/LV/electric_furnace.lua +++ b/technic/machines/LV/electric_furnace.lua @@ -1,14 +1,15 @@ -- LV Electric Furnace -- This is a faster version of the stone furnace which runs on EUs local S = technic.getter +local mat = technic.materials -- FIXME: kpoppel I'd like to introduce an induction heating element here also minetest.register_craft({ - output = 'technic:electric_furnace', + output = 'technic:lv_electric_furnace', recipe = { - {'default:cobble', 'default:cobble', 'default:cobble'}, - {'default:cobble', 'technic:machine_casing', 'default:cobble'}, - {'default:cobble', 'technic:lv_cable', 'default:cobble'}, + {mat.cobble, mat.cobble, mat.cobble}, + {mat.cobble, 'technic:machine_casing', mat.cobble}, + {mat.cobble, 'technic:lv_cable', mat.cobble}, } }) diff --git a/technic/machines/LV/generator.lua b/technic/machines/LV/generator.lua index dc9815f0..f212591b 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'}, + {mat.stone, mat.furnace, mat.stone}, + {mat.stone, 'technic:machine_casing', mat.stone}, + {mat.stone, 'technic:lv_cable', mat.stone}, } }) diff --git a/technic/machines/LV/geothermal.lua b/technic/machines/LV/geothermal.lua index ad891fd5..71c16ab1 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 == mat.water_source or node.name == mat.water_flowing then return 1 end + if node.name == mat.lava_source or node.name == mat.lava_flowing then return 2 end return 0 end @@ -87,10 +88,12 @@ minetest.register_node("technic:geothermal", { tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_lv=1}, + technic_machine=1, technic_lv=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, paramtype2 = "facedir", legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Geothermal @1 Generator", S("LV"))) @@ -105,9 +108,11 @@ minetest.register_node("technic:geothermal_active", { "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, paramtype2 = "facedir", groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, + technic_machine=1, technic_lv=1, not_in_creative_inventory=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), drop = "technic:geothermal", technic_run = run, }) 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 e2aeb324..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")) @@ -123,7 +124,9 @@ minetest.register_node("technic:lv_lamp", { "technic_lv_lamp_side.png", "technic_lv_lamp_side.png" }, - groups = {cracky = 2, technic_machine = 1, technic_lv = 1}, + groups = {cracky = 2, technic_machine = 1, technic_lv = 1, pickaxey = 2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"front", "back", "left", "right", "top"}, can_dig = technic.machine_can_dig, technic_run = lamp_run, @@ -166,7 +169,9 @@ minetest.register_node("technic:lv_lamp_active", { paramtype = "light", light_source = 14, drop = "technic:lv_lamp", - groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1}, + groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1, pickaxey = 2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"front", "back", "left", "right", "top"}, can_dig = technic.machine_can_dig, technic_run = lamp_run, @@ -190,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/led.lua b/technic/machines/LV/led.lua index 678346d4..8566dc49 100644 --- a/technic/machines/LV/led.lua +++ b/technic/machines/LV/led.lua @@ -41,7 +41,9 @@ minetest.register_node("technic:lv_led", { tiles = {"technic_lv_led.png"}, inventory_image = "technic_lv_led_inv.png", sunlight_propagates = true, - groups = {cracky = 2, technic_machine = 1, technic_lv = 1}, + groups = {cracky = 2, technic_machine = 1, technic_lv = 1, pickaxey = 2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"front", "back", "left", "right", "top", "bottom"}, can_dig = technic.machine_can_dig, technic_run = led_run, @@ -73,7 +75,9 @@ minetest.register_node("technic:lv_led_active", { light_source = 9, drop = "technic:lv_led", sunlight_propagates = true, - groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1}, + groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1, pickaxey = 2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"front", "back", "left", "right", "top", "bottom"}, can_dig = technic.machine_can_dig, technic_run = led_run, diff --git a/technic/machines/LV/music_player.lua b/technic/machines/LV/music_player.lua index 4e5f801b..79937dd0 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}, } }) @@ -93,9 +94,11 @@ minetest.register_node("technic:music_player", { tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_lv=1}, + technic_machine=1, technic_lv=1, axey = 2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom"}, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("@1 Music Player", S("LV"))) diff --git a/technic/machines/LV/solar_panel.lua b/technic/machines/LV/solar_panel.lua index e8b9ef13..553b6ccb 100644 --- a/technic/machines/LV/solar_panel.lua +++ b/technic/machines/LV/solar_panel.lua @@ -48,9 +48,11 @@ minetest.register_node("technic:solar_panel", { tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_lv=1}, + technic_machine=1, technic_lv=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom"}, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), description = S("Small Solar @1 Generator", S("LV")), active = false, drawtype = "nodebox", diff --git a/technic/machines/LV/water_mill.lua b/technic/machines/LV/water_mill.lua index 4dad2dee..63f9280e 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'}, } @@ -19,8 +20,7 @@ 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 + if node.name == mat.water_flowing or node.name == mat.river_water_flowing then return node.param2 -- returns approx. water flow, if any end return false @@ -78,9 +78,11 @@ minetest.register_node("technic:water_mill", { }, paramtype2 = "facedir", groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_lv=1}, + technic_machine=1, technic_lv=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Hydro @1 Generator", S("LV"))) @@ -96,9 +98,11 @@ minetest.register_node("technic:water_mill_active", { "technic_water_mill_side.png", "technic_water_mill_side.png"}, paramtype2 = "facedir", groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, + technic_machine=1, technic_lv=1, not_in_creative_inventory=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), drop = "technic:water_mill", technic_run = run, technic_disabled_machine_name = "technic:water_mill", diff --git a/technic/machines/MV/hydro_turbine.lua b/technic/machines/MV/hydro_turbine.lua index 18891217..f0499694 100644 --- a/technic/machines/MV/hydro_turbine.lua +++ b/technic/machines/MV/hydro_turbine.lua @@ -75,9 +75,11 @@ minetest.register_node("technic:hydro_turbine", { }, paramtype2 = "facedir", groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_mv=1}, + technic_machine=1, technic_mv=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Hydro @1 Generator", S("MV"))) @@ -92,10 +94,12 @@ minetest.register_node("technic:hydro_turbine_active", { "technic_hydro_turbine_side.png", "technic_hydro_turbine_side.png", "technic_hydro_turbine_side.png", "technic_hydro_turbine_side.png"}, paramtype2 = "facedir", - groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_mv=1, not_in_creative_inventory=1}, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, axey=2, handy=1, + technic_machine=1, technic_mv=1, not_in_creative_inventory=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), drop = "technic:hydro_turbine", technic_run = run, technic_disabled_machine_name = "technic:hydro_turbine", diff --git a/technic/machines/MV/tool_workshop.lua b/technic/machines/MV/tool_workshop.lua index 46e68292..4c161e3b 100644 --- a/technic/machines/MV/tool_workshop.lua +++ b/technic/machines/MV/tool_workshop.lua @@ -4,28 +4,47 @@ 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}, } }) local workshop_demand = {5000, 3500, 2000} +local size = minetest.get_modpath("mcl_formspec") and "size[9,9;]" or "size[8,9;]" local workshop_formspec = - "size[8,9;]".. + size.. "list[context;src;3,1;1,1;]".. "label[0,0;"..S("@1 Tool Workshop", S("MV")).."]".. "list[context;upgrade1;1,3;1,1;]".. "list[context;upgrade2;2,3;1,1;]".. - "label[1,4;"..S("Upgrade Slots").."]".. - "list[current_player;main;0,5;8,4;]".. + "label[1,4;"..S("Upgrade Slots").."]" + +if minetest.get_modpath("mcl_formspec") then + workshop_formspec = workshop_formspec.. + mcl_formspec.get_itemslot_bg(3,1,1,1).. + mcl_formspec.get_itemslot_bg(1,3,1,1).. + mcl_formspec.get_itemslot_bg(2,3,1,1).. + -- player inventory + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1) +else + workshop_formspec = workshop_formspec.. + "list[current_player;main;0,5;8,4;]" +end + +-- listrings +workshop_formspec = workshop_formspec.. "listring[current_player;main]".. "listring[context;src]".. "listring[current_player;main]".. @@ -94,9 +113,11 @@ minetest.register_node("technic:tool_workshop", { "technic_workshop_side.png" }, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_mv=1, tubedevice=1, tubedevice_receiver=1}, + technic_machine=1, technic_mv=1, tubedevice=1, tubedevice_receiver=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom", "back", "left", "right"}, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("@1 Tool Workshop", S("MV"))) diff --git a/technic/machines/MV/wind_mill.lua b/technic/machines/MV/wind_mill.lua index 823254d7..c422d99a 100644 --- a/technic/machines/MV/wind_mill.lua +++ b/technic/machines/MV/wind_mill.lua @@ -24,8 +24,10 @@ minetest.register_node("technic:wind_mill_frame", { drawtype = "glasslike_framed", tiles = {"technic_carbon_steel_block.png", "default_glass.png"}, sunlight_propagates = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, pickaxey=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, + sounds = technic.sounds.node_sound_stone_defaults(), paramtype = "light", }) @@ -70,9 +72,11 @@ minetest.register_node("technic:wind_mill", { description = S("Wind @1 Generator", S("MV")), tiles = {"technic_carbon_steel_block.png"}, paramtype2 = "facedir", - groups = {cracky=1, technic_machine=1, technic_mv=1}, + groups = {cracky=1, technic_machine=1, technic_mv=1, pickaxey=2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"top", "bottom", "back", "left", "right"}, - sounds = default.node_sound_stone_defaults(), + sounds = technic.sounds.node_sound_stone_defaults(), drawtype = "nodebox", paramtype = "light", node_box = { diff --git a/technic/machines/other/anchor.lua b/technic/machines/other/anchor.lua index d3ea1874..da69b7db 100644 --- a/technic/machines/other/anchor.lua +++ b/technic/machines/other/anchor.lua @@ -70,8 +70,10 @@ minetest.register_node("technic:admin_anchor", { drawtype = "normal", tiles = {"technic_admin_anchor.png"}, is_ground_content = true, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, not_in_creative_inventory=1, pickaxey=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, + sounds = technic.sounds.node_sound_stone_defaults(), after_place_node = function (pos, placer) local meta = minetest.get_meta(pos) if placer and placer:is_player() then diff --git a/technic/machines/other/coal_alloy_furnace.lua b/technic/machines/other/coal_alloy_furnace.lua index b9b894b9..b81d81cb 100644 --- a/technic/machines/other/coal_alloy_furnace.lua +++ b/technic/machines/other/coal_alloy_furnace.lua @@ -2,25 +2,44 @@ -- 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}, } }) local machine_name = S("Fuel-Fired Alloy Furnace") +local size = minetest.get_modpath("mcl_formspec") and "size[9,9]" or "size[8,9]" local formspec = - "size[8,9]".. + size.. "label[0,0;"..machine_name.."]".. "image[2,2;1,1;default_furnace_fire_bg.png]".. "list[context;fuel;2,3;1,1;]".. "list[context;src;2,1;2,1;]".. - "list[context;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. + "list[context;dst;5,1;2,2;]" + +if minetest.get_modpath("mcl_formspec") then + formspec = formspec.. + mcl_formspec.get_itemslot_bg(2,3,1,1).. + mcl_formspec.get_itemslot_bg(2,1,2,1).. + mcl_formspec.get_itemslot_bg(5,1,2,2).. + -- player inventory + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1) +else + formspec = formspec.. + "list[current_player;main;0,5;8,4;]" +end + +-- listrings +formspec = formspec.. "listring[context;dst]".. "listring[current_player;main]".. "listring[context;src]".. @@ -34,9 +53,11 @@ minetest.register_node("technic:coal_alloy_furnace", { "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"}, paramtype2 = "facedir", - groups = {cracky=2}, + groups = {cracky=2, pickaxey=2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), + sounds = technic.sounds.node_sound_stone_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", formspec) @@ -60,9 +81,11 @@ minetest.register_node("technic:coal_alloy_furnace_active", { paramtype2 = "facedir", light_source = 8, drop = "technic:coal_alloy_furnace", - groups = {cracky=2, not_in_creative_inventory=1}, + groups = {cracky=2, not_in_creative_inventory=1, pickaxey=2}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), + sounds = technic.sounds.node_sound_stone_defaults(), can_dig = technic.machine_can_dig, allow_metadata_inventory_put = technic.machine_inventory_put, allow_metadata_inventory_take = technic.machine_inventory_take, @@ -123,14 +146,26 @@ minetest.register_abm({ meta:set_string("infotext", S("@1 Active", machine_name).." ("..percent.."%)") technic.swap_node(pos, "technic:coal_alloy_furnace_active") meta:set_string("formspec", - "size[8,9]".. + size.. "label[0,0;"..machine_name.."]".. "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. (100 - percent)..":default_furnace_fire_fg.png]".. "list[context;fuel;2,3;1,1;]".. "list[context;src;2,1;2,1;]".. "list[context;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. + + (minetest.get_modpath("mcl_formspec") and + mcl_formspec.get_itemslot_bg(2,3,1,1).. + mcl_formspec.get_itemslot_bg(2,1,2,1).. + mcl_formspec.get_itemslot_bg(5,1,2,2).. + -- player inventory + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1) + or "list[current_player;main;0,5;8,4;]").. + + -- listrings "listring[context;dst]".. "listring[current_player;main]".. "listring[context;src]".. diff --git a/technic/machines/other/coal_furnace.lua b/technic/machines/other/coal_furnace.lua index 53a0f8b4..878dfdda 100644 --- a/technic/machines/other/coal_furnace.lua +++ b/technic/machines/other/coal_furnace.lua @@ -1,5 +1,7 @@ local S = technic.getter -if minetest.registered_nodes["default:furnace"].description == "Furnace" then +local default_furnace = minetest.registered_nodes["default:furnace"] + +if default_furnace and default_furnace.description == "Furnace" then minetest.override_item("default:furnace", { description = S("Fuel-Fired Furnace") }) end diff --git a/technic/machines/other/constructor.lua b/technic/machines/other/constructor.lua index bd1f64c2..d24469b1 100644 --- a/technic/machines/other/constructor.lua +++ b/technic/machines/other/constructor.lua @@ -142,21 +142,43 @@ local function make_constructor(mark, length) "technic_constructor_front_off.png"}, paramtype2 = "facedir", groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - mesecon = 2, technic_constructor = 1}, + mesecon = 2, technic_constructor = 1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, mesecons = {effector = {action_on = make_on(mark, length)}}, - sounds = default.node_sound_stone_defaults(), + sounds = technic.sounds.node_sound_stone_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) - local formspec = "size[8,9;]".. - "label[0,0;"..S("Constructor Mk@1", mark).."]".. - "list[current_player;main;0,5;8,4;]".. - "listring[current_player;main]" + local size = minetest.get_modpath("mcl_formspec") and "size[9,9]" or "size[8,9]" + local formspec = size.. + "label[0,0;"..S("Constructor Mk@1", mark).."]" for i = 1, length do formspec = formspec.. "label[5,"..(i - 1)..";"..S("Slot @1", i).."]".. - "list[context;slot"..i..";6,"..(i - 1)..";1,1;]".. - "listring[context;slot"..i.."]" + "list[context;slot"..i..";6,"..(i - 1)..";1,1;]" end + if minetest.get_modpath("mcl_formspec") then + for i = 1, length do + formspec = formspec.. + mcl_formspec.get_itemslot_bg(6,i-1,1,1) + end + formspec = formspec.. + -- player inventory + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1) + else + formspec = formspec.. + "list[current_player;main;0,5;8,4;]" + end + -- listrings + for i = 1, length do + formspec = formspec.. + "listring[current_player;main]".. + "listring[context;slot"..i.."]" + end + meta:set_string("formspec", formspec) meta:set_string("infotext", S("Constructor Mk@1", mark)) local inv = meta:get_inventory() @@ -199,9 +221,11 @@ local function make_constructor(mark, length) paramtype2 = "facedir", drop = "technic:constructor_mk"..mark.."_off", groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - mesecon=2, not_in_creative_inventory=1, technic_constructor=1}, + mesecon=2, not_in_creative_inventory=1, technic_constructor=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, mesecons= {effector = {action_off = make_off(mark)}}, - sounds = default.node_sound_stone_defaults(), + sounds = technic.sounds.node_sound_stone_defaults(), allow_metadata_inventory_put = allow_inventory_put, allow_metadata_inventory_take = technic.machine_inventory_take, allow_metadata_inventory_move = technic.machine_inventory_move, diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua index 0c1e7f40..9381c047 100644 --- a/technic/machines/other/injector.lua +++ b/technic/machines/other/injector.lua @@ -5,17 +5,34 @@ 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}, [4] = {x= 1,y= 0,z= 0}, [5] = {x= 0,y= 1,z= 0} } -local base_formspec = "size[8,9;]".. +local size = minetest.get_modpath("mcl_formspec") and "size[9,10]" or "size[8,9]" +local base_formspec = size.. "label[0,0;"..S("Self-Contained Injector").."]".. "list[context;main;0,2;8,2;]".. + "listring[context;main]" + +if minetest.get_modpath("mcl_formspec") then + base_formspec = base_formspec.. + mcl_formspec.get_itemslot_bg(0,2,8,2).. + -- player inventory + "list[current_player;main;0,5.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,5.5,9,3).. + "list[current_player;main;0,8.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,8.74,9,1).. + "listring[current_player;main]" +else + base_formspec = base_formspec.. "list[current_player;main;0,5;8,4;]".. - "listring[]" + "listring[current_player;main]" +end local function set_injector_formspec(pos) local meta = minetest.get_meta(pos) @@ -53,7 +70,9 @@ minetest.register_node("technic:injector", { "technic_injector_side.png" }, paramtype2 = "facedir", - groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1}, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, tube = { can_insert = function(pos, node, stack, direction) local meta = minetest.get_meta(pos) @@ -67,7 +86,7 @@ minetest.register_node("technic:injector", { end, connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, }, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Self-Contained Injector")) @@ -140,7 +159,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 c5a07dfb..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"} } }) @@ -59,9 +60,11 @@ minetest.register_node("technic:power_monitor",{ "technic_power_monitor_front.png" }, paramtype2 = "facedir", - groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1}, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom", "back"}, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Power Monitor")) diff --git a/technic/machines/register/alloy_recipes.lua b/technic/machines/register/alloy_recipes.lua index 94e44278..1748726c 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,30 @@ 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 }, - {"default:obsidian", "bucket:bucket_empty", "bucket:bucket_lava", 1 }, + {"technic:raw_latex 2", mat.coal_lump, "technic:rubber 2", 2}, + {mat.ice, mat.bucket_empty, mat.bucket_water, 1 }, + {mat.obsidian, mat.bucket_empty, mat.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 305ca018..53449304 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: @@ -22,11 +23,11 @@ minetest.register_craft({ output = "technic:battery", recipe = { {"group:wood", "technic:sulfur_lump", "group:wood"}, - {"technic:lead_ingot", "bucket:bucket_water", "technic:lead_ingot"}, + {"technic:lead_ingot", mat.bucket_water, "technic:lead_ingot"}, {"group:wood", "technic:sulfur_lump", "group:wood"}, }, replacements = { - {"bucket:bucket_water", "bucket:bucket_empty"} + {mat.bucket_water, mat.bucket_empty} } }) -- With oil extract: @@ -44,11 +45,11 @@ minetest.register_craft({ output = "technic:battery", recipe = { {"group:wood", "technic:sulfur_dust", "group:wood"}, - {"technic:lead_ingot", "bucket:bucket_water", "technic:lead_ingot"}, + {"technic:lead_ingot", mat.bucket_water, "technic:lead_ingot"}, {"group:wood", "technic:sulfur_dust", "group:wood"}, }, replacements = { - {"bucket:bucket_water", "bucket:bucket_empty"} + {mat.bucket_water, mat.bucket_empty} } }) -- With oil extract: @@ -113,8 +114,9 @@ function technic.register_battery_box(nodename, data) local tier = def.tier local ltier = string.lower(tier) + local size = minetest.get_modpath("mcl_formspec") and "size[9,9]" or "size[8,9]" local formspec = - "size[8,9]".. + size.. "image[1,1;1,2;technic_power_meter_bg.png]".. "list[context;src;3,1;1,1;]".. "image[4,1;1,1;technic_battery_reload.png]".. @@ -123,20 +125,45 @@ function technic.register_battery_box(nodename, data) "label[3,0;"..S("Charge").."]".. "label[5,0;"..S("Discharge").."]".. "label[1,3;"..S("Power level").."]".. - "list[current_player;main;0,5;8,4;]".. - "listring[context;dst]".. - "listring[current_player;main]".. - "listring[context;src]".. - "listring[current_player;main]".. (def.upgrade and "list[context;upgrade1;3.5,3;1,1;]".. "list[context;upgrade2;4.5,3;1,1;]".. - "label[3.5,4;"..S("Upgrade Slots").."]".. - "listring[context;upgrade1]".. - "listring[current_player;main]".. - "listring[context;upgrade2]".. - "listring[current_player;main]" - or "") + "label[3.5,4;"..S("Upgrade Slots").."]" + or "") + + if minetest.get_modpath("mcl_formspec") then + formspec = formspec.. + mcl_formspec.get_itemslot_bg(3,1,1,1).. + mcl_formspec.get_itemslot_bg(5,1,1,1).. + -- player inventory + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1).. + -- upgrade + (def.upgrade and + mcl_formspec.get_itemslot_bg(3.5,3,1,1).. + mcl_formspec.get_itemslot_bg(4.5,3,1,1) + or "") + else + formspec = formspec.. + "list[current_player;main;0,5;8,4;]" + end + + -- listrings + formspec = formspec.. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[context;src]".. + "listring[current_player;main]".. + (def.upgrade and + "listring[context;upgrade1]".. + "listring[current_player;main]".. + "listring[context;upgrade2]".. + "listring[current_player;main]" + or "") + + -- -- Generate formspec with power meter @@ -306,7 +333,7 @@ function technic.register_battery_box(nodename, data) for i = 0, 8 do local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, ["technic_"..ltier]=1} + technic_machine=1, ["technic_"..ltier]=1, axey=2, handy=1} if i ~= 0 then groups.not_in_creative_inventory = 1 end @@ -336,10 +363,12 @@ function technic.register_battery_box(nodename, data) side_tex, front_tex}, groups = groups, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom"}, tube = def.tube and tube or nil, paramtype2 = "facedir", - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), drop = "technic:"..ltier.."_battery_box0", on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 7e1ce6c6..f0dee0cd 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -51,10 +51,13 @@ local function cable_defaults(nodename, data) snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, + swordy = 1, + axey = 1, + handy = 1, ["technic_"..ltier.."_cable"] = 1 } def.drop = def.drop or nodename - def.sounds = def.sounds or default.node_sound_wood_defaults() + def.sounds = def.sounds or technic.sounds.node_sound_wood_defaults() def.on_construct = def.on_construct or function(pos) place_network_node(pos, {tier}, nodename) end def.on_destruct = def.on_destruct or function(pos) remove_network_node(pos, {tier}, nodename) end def.paramtype = def.paramtype or "light" @@ -123,6 +126,8 @@ function technic.register_cable_plate(nodename, data) end else def.groups.not_in_creative_inventory = 1 + def._mcl_blast_resistance = 1 + def._mcl_hardness = 0.8 end def.on_rotate = function(pos, node, user, mode, new_param2) -- mode 1 is left-click, mode 2 is right-click @@ -142,6 +147,8 @@ function technic.register_cable(nodename, data) def.tiles = def.tiles or {texture_basename..".png"} def.inventory_image = def.inventory_image or def.inventory_image ~= false and texture_basename.."_wield.png" or nil def.wield_image = def.wield_image or def.wield_image ~= false and texture_basename.."_wield.png" or nil + def._mcl_blast_resistance = 1 + def._mcl_hardness = 0.8 minetest.register_node(nodename, def) cable_tier[nodename] = def.tier end 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..153722ca 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,13 +13,13 @@ 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 - technic.register_freezer_recipe({input = {data[1]}, output = data[2]}) + technic.register_freezer_recipe({input = {data[1]}, output = data[2], hidden = true}) end diff --git a/technic/machines/register/generator.lua b/technic/machines/register/generator.lua index 3105ec73..6703d761 100644 --- a/technic/machines/register/generator.lua +++ b/technic/machines/register/generator.lua @@ -20,13 +20,41 @@ local tube = { connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, } +local size = minetest.get_modpath("mcl_formspec") and "size[9,10]" or "size[8,9]" + +local function update_generator_formspec(meta, desc, percent, form_buttons) + local generator_formspec = size.. + "label[0, 0;"..desc.."]".. + "list[context;src;3,1;1,1;]".. + "listring[context;src]".. + "image[4,1;1,1;default_furnace_fire_bg.png^[lowpart:".. + (percent)..":default_furnace_fire_fg.png]".. + form_buttons + + if minetest.get_modpath("mcl_formspec") then + generator_formspec = generator_formspec.. + mcl_formspec.get_itemslot_bg(3,1,1,1).. + -- player inventory + "list[current_player;main;0,5.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,5.5,9,3).. + "list[current_player;main;0,8.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,8.74,9,1).. + "listring[current_player;main]" + else + generator_formspec = generator_formspec.. + "list[current_player;main;0, 5;8, 4;]".. + "listring[current_player;main]" + end + return meta:set_string("formspec", generator_formspec) +end + function technic.register_generator(data) local tier = data.tier local ltier = string.lower(tier) local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, ["technic_"..ltier]=1} + technic_machine=1, ["technic_"..ltier]=1, axey=2, handy=1} if data.tube then groups.tubedevice = 1 groups.tubedevice_receiver = 1 @@ -34,14 +62,6 @@ function technic.register_generator(data) local active_groups = {not_in_creative_inventory = 1} for k, v in pairs(groups) do active_groups[k] = v end - local generator_formspec = - "size[8,9;]".. - "label[0,0;"..S("Fuel-Fired @1 Generator", S(tier)).."]".. - "list[context;src;3,1;1,1;]".. - "image[4,1;1,1;default_furnace_fire_bg.png]".. - "list[current_player;main;0,5;8,4;]".. - "listring[]" - local desc = S("Fuel-Fired @1 Generator", S(tier)) local run = function(pos, node) @@ -96,16 +116,7 @@ function technic.register_generator(data) } )..pipeworks.button_label end - meta:set_string("formspec", - "size[8, 9]".. - "label[0, 0;"..desc.."]".. - "list[context;src;3, 1;1, 1;]".. - "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. - (percent)..":default_furnace_fire_fg.png]".. - "list[current_player;main;0, 5;8, 4;]".. - "listring[]".. - form_buttons - ) + update_generator_formspec(meta, desc, percent, form_buttons) end local tentry = tube_entry @@ -123,9 +134,11 @@ function technic.register_generator(data) }, paramtype2 = "facedir", groups = groups, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom", "back", "left", "right"}, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), tube = data.tube and tube or nil, on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -146,7 +159,7 @@ function technic.register_generator(data) } )..pipeworks.button_label end - meta:set_string("formspec", generator_formspec..form_buttons) + update_generator_formspec(meta, desc, 0, form_buttons) local inv = meta:get_inventory() inv:set_size("src", 1) end, @@ -174,7 +187,10 @@ function technic.register_generator(data) } )..pipeworks.button_label end - meta:set_string("formspec", generator_formspec..form_buttons) + local burn_totaltime = meta:get_int("burn_totaltime") or 0 + local burn_time = meta:get_int("burn_time") + local percent = math.floor(burn_time / burn_totaltime * 100) + update_generator_formspec(meta, desc, percent, form_buttons) end, }) @@ -190,9 +206,11 @@ function technic.register_generator(data) }, paramtype2 = "facedir", groups = active_groups, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom"}, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), tube = data.tube and tube or nil, drop = "technic:"..ltier.."_generator", can_dig = technic.machine_can_dig, @@ -239,16 +257,7 @@ function technic.register_generator(data) } )..pipeworks.button_label end - meta:set_string("formspec", - "size[8, 9]".. - "label[0, 0;"..desc.."]".. - "list[context;src;3, 1;1, 1;]".. - "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. - (percent)..":default_furnace_fire_fg.png]".. - "list[current_player;main;0, 5;8, 4;]".. - "listring[]".. - form_buttons - ) + update_generator_formspec(meta, desc, percent, form_buttons) return true end, on_receive_fields = function(pos, formname, fields, sender) @@ -273,16 +282,7 @@ function technic.register_generator(data) local burn_time = meta:get_int("burn_time") local percent = math.floor(burn_time / burn_totaltime * 100) - meta:set_string("formspec", - "size[8, 9]".. - "label[0, 0;"..desc.."]".. - "list[context;src;3, 1;1, 1;]".. - "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. - (percent)..":default_furnace_fire_fg.png]".. - "list[current_player;main;0, 5;8, 4;]".. - "listring[]".. - form_buttons - ) + update_generator_formspec(meta, desc, percent, form_buttons) end, }) 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/machine_base.lua b/technic/machines/register/machine_base.lua index d90ecdeb..e4841043 100644 --- a/technic/machines/register/machine_base.lua +++ b/technic/machines/register/machine_base.lua @@ -44,7 +44,7 @@ function technic.register_base_machine(nodename, data) local infotext_active = S("@1 Active", def.description) local infotext_unpowered = S("@1 Unpowered", def.description) - local groups = {cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1} + local groups = {cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1, pickaxey=2} if def.tube then groups.tubedevice = 1 groups.tubedevice_receiver = 1 @@ -52,25 +52,50 @@ function technic.register_base_machine(nodename, data) local active_groups = table.copy(groups) active_groups.not_in_creative_inventory = 1 + local size = minetest.get_modpath("mcl_formspec") and "size[9,10]" or "size[8,9]" local formspec = - "size[8,9;]".. + size.. "list[context;src;"..(4-input_size)..",1;"..input_size..",1;]".. "list[context;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;"..def.description.."]".. - "listring[context;dst]".. - "listring[current_player;main]".. - "listring[context;src]".. - "listring[current_player;main]" + "label[0,0;"..def.description.."]" if def.upgrade then formspec = formspec.. "list[context;upgrade1;1,3;1,1;]".. "list[context;upgrade2;2,3;1,1;]".. - "label[1,4;"..S("Upgrade Slots").."]".. - "listring[context;upgrade1]".. - "listring[current_player;main]".. - "listring[context;upgrade2]".. - "listring[current_player;main]" + "label[1,4;"..S("Upgrade Slots").."]" + end + + if minetest.get_modpath("mcl_formspec") then + formspec = formspec.. + mcl_formspec.get_itemslot_bg(4-input_size,1,input_size,1).. + mcl_formspec.get_itemslot_bg(5,1,2,2).. + -- player inventory + "list[current_player;main;0,5.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,5.5,9,3).. + "list[current_player;main;0,8.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,8.74,9,1) + if def.upgrade then + formspec = formspec.. + mcl_formspec.get_itemslot_bg(1,3,1,1).. + mcl_formspec.get_itemslot_bg(2,3,1,1) + end + else + formspec = formspec.. + "list[current_player;main;0,5;8,4;]" + end + + -- listrings + formspec = formspec.. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[context;src]".. + "listring[current_player;main]" + if def.upgrade then + formspec = formspec.. + "listring[context;upgrade1]".. + "listring[current_player;main]".. + "listring[context;upgrade2]".. + "listring[current_player;main]" end local tube = technic.new_default_tube() @@ -172,10 +197,12 @@ function technic.register_base_machine(nodename, data) }, paramtype2 = "facedir", groups = groups, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, tube = def.tube and tube or nil, connect_sides = def.connect_sides or connect_default, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local node = minetest.get_node(pos) local meta = minetest.get_meta(pos) @@ -244,9 +271,11 @@ function technic.register_base_machine(nodename, data) paramtype2 = "facedir", drop = nodename, groups = active_groups, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = def.connect_sides or connect_default, legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), tube = def.tube and tube or nil, can_dig = technic.machine_can_dig, allow_metadata_inventory_put = technic.machine_inventory_put, diff --git a/technic/machines/register/recipes.lua b/technic/machines/register/recipes.lua index 17c83a68..50ab1163 100644 --- a/technic/machines/register/recipes.lua +++ b/technic/machines/register/recipes.lua @@ -1,6 +1,7 @@ local have_ui = minetest.get_modpath("unified_inventory") local have_cg = minetest.get_modpath("craftguide") +local have_mcl_cg = minetest.get_modpath("mcl_craftguide") local have_i3 = minetest.get_modpath("i3") technic.recipes = { cooking = { input_size = 1, output_size = 1 } } @@ -23,6 +24,12 @@ function technic.register_recipe_type(typename, origdata) icon = data.icon, }) end + if have_mcl_cg then + mcl_craftguide.register_craft_type(typename, { + description = data.description, + icon = data.icon, + }) + end if have_i3 then i3.register_craft_type(typename, { description = data.description, @@ -86,6 +93,14 @@ local function register_recipe(typename, data) items = {table.concat(data.input, ", ")}, }) end + if have_mcl_cg then + mcl_craftguide.register_craft({ + type = typename, + output = output, + items = data.input, + width = 0, + }) + end if have_i3 then i3.register_craft({ type = typename, @@ -101,10 +116,14 @@ end local has_exchangeclone = minetest.get_modpath("zzzz_exchangeclone_init") function technic.register_recipe(typename, data) - if has_exchangeclone then + if has_exchangeclone then exchangeclone.register_technic_recipe(typename, data) end - minetest.after(0.01, register_recipe, typename, data) -- Handle aliases + if have_mcl_cg then + register_recipe(typename, data) + else + minetest.after(0.01, register_recipe, typename, data) -- Handle aliases + end end function technic.get_recipe(typename, items) diff --git a/technic/machines/register/solar_array.lua b/technic/machines/register/solar_array.lua index a3eb429b..41f9b7b0 100644 --- a/technic/machines/register/solar_array.lua +++ b/technic/machines/register/solar_array.lua @@ -46,11 +46,12 @@ function technic.register_solar_array(nodename, data) modname.."_"..name.."_side.png", modname.."_"..name.."_side.png" } - def.groups = def.groups or { - snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, ["technic_"..ltier]=1 - } + def.groups = def.groups or {snappy=2, choppy=2, oddly_breakable_by_hand=2, + technic_machine=1, ["technic_"..ltier]=1, axey=2, handy=1} + def._mcl_blast_resistance = 1 + def._mcl_hardness = 0.8 def.connect_sides = def.connect_sides or {"bottom"} - def.sounds = def.sounds or default.node_sound_wood_defaults() + def.sounds = def.sounds or technic.sounds.node_sound_wood_defaults() def.description = def.description or S("Arrayed Solar @1 Generator", S(tier)) def.active = def.active or false def.drawtype = def.drawtype or "nodebox" diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua index 3109c7d3..75f344e4 100644 --- a/technic/machines/supply_converter.lua +++ b/technic/machines/supply_converter.lua @@ -181,9 +181,11 @@ minetest.register_node("technic:supply_converter", { "technic_supply_converter_side.png" }, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, - technic_machine=1, technic_all_tiers=1}, + technic_machine=1, technic_all_tiers=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"top", "bottom"}, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_receive_fields = supply_converter_receive_fields, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index 9377c71f..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"} } }) @@ -46,9 +47,11 @@ minetest.register_node("technic:switching_station",{ "technic_water_mill_top_active.png", "technic_water_mill_top_active.png", "technic_water_mill_top_active.png"}, - groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1}, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1, axey=2, handy=1}, + _mcl_blast_resistance = 1, + _mcl_hardness = 0.8, connect_sides = {"bottom"}, - sounds = default.node_sound_wood_defaults(), + sounds = technic.sounds.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Switching Station")) diff --git a/technic/materials.lua b/technic/materials.lua new file mode 100644 index 00000000..9ce9be84 --- /dev/null +++ b/technic/materials.lua @@ -0,0 +1,79 @@ + +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 = { + stone = has_mcl and "mcl_core:stone" or "default:stone", + cobble = has_mcl and "mcl_core:cobble" or "default:cobble", + mossycobble = has_mcl and "mcl_core:mossycobble" or "default:mossycobble", + 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:steel_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 = has_mcl and "mesecons_torch:redstoneblock" or "default:mese", + 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", + dye_orange = has_mcl and "mcl_dye:orange" or "dye:orange", + dye_grey = has_mcl and "mcl_dye:grey" or "dye:grey", + insulation = mesecons_materials and "mesecons_materials:fiber" or "technic:rubber", + obsidian = has_mcl and "mcl_core:obsidian" or "default:obsidian", + 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", + 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", + 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_stone = has_mcl and "mcl_core:redsandstone" or "default:desert_stone", + 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", + 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/mod.conf b/technic/mod.conf index 90a9da9c..9759e34a 100644 --- a/technic/mod.conf +++ b/technic/mod.conf @@ -1,3 +1,3 @@ name = technic -depends = default, pipeworks, technic_worldgen, basic_materials, moreores -optional_depends = bucket, mesecons, mesecons_mvps, digilines, digiline_remote, unified_inventory, dye, craftguide, i3, mtt, vizlib, zzzz_exchangeclone_init +depends = pipeworks, technic_worldgen, basic_materials +optional_depends = mcl_core, mcl_sounds, default, bucket, mesecons, mesecons_mvps, digilines, digiline_remote, unified_inventory, dye, craftguide, i3, mtt, vizlib, moreores, mcl_buckets, mcl_explosions, mcl_craftguide, zzzz_exchangeclone_init diff --git a/technic/radiation.lua b/technic/radiation.lua index e2dc425b..8067df9e 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -32,6 +32,7 @@ local MP = minetest.get_modpath("technic") local throttle = dofile(MP .. "/util/throttle.lua") local S = technic.getter +local has_mcl = minetest.get_modpath("mcl_core") local rad_resistance_node = { ["default:brick"] = 13, @@ -489,12 +490,28 @@ if rawget(_G, "bucket") and bucket.register_liquid then ) end +if minetest.get_modpath("mcl_buckets") then + mcl_buckets.register_liquid({ + bucketname = "technic:bucket_corium", + source_place = "technic:corium_source", + source_take = {"technic:corium_source"}, + inventory_image = "technic_bucket_corium.png", + name = S("Corium Bucket"), + longdesc = S("This bucket is filled with radioactive corium."), + usagehelp = S("Place it to empty the bucket and create a radioactive liquid source."), + tt_help = S("Danger Hight Radiation"), + groups = { radioactive = 5 }, + }) +end + minetest.register_node("technic:chernobylite_block", { description = S("Chernobylite Block"), tiles = {"technic_chernobylite_block.png"}, is_ground_content = true, - groups = {cracky=1, radioactive=4, level=2}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=1, radioactive=4, level= has_mcl and 0 or 2, pickaxey=5}, + _mcl_blast_resistance = 30, + _mcl_hardness = 40, + sounds = technic.sounds.node_sound_stone_defaults(), light_source = 2, }) @@ -545,7 +562,11 @@ if griefing then vector.new(0,-1,0), }) do if math.random(8) == 1 then - minetest.dig_node(vector.add(pos, offset)) + local vpos = vector.add(pos, offset) + local def = minetest.registered_nodes[minetest.get_node(vpos).name] + if def and (not def._mcl_hardness or def._mcl_hardness > 0) then + minetest.dig_node(vpos) + end end end end, diff --git a/technic/spec/fixtures/network.lua b/technic/spec/fixtures/network.lua index 1a507c4f..e7a18313 100644 --- a/technic/spec/fixtures/network.lua +++ b/technic/spec/fixtures/network.lua @@ -29,8 +29,12 @@ _G.technic.digilines = { {x = 0, y = -1, z = 0}, -- along y below } } +_G.technic.sounds = setmetatable({}, { + __index = function(...) return function(...) return "" end end, +}) sourcefile("config") +sourcefile("materials") sourcefile("register") technic.register_tier("LV", "Busted LV") technic.register_tier("MV", "Busted MV") 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..bc7e0e83 100644 --- a/technic/tools/chainsaw.lua +++ b/technic/tools/chainsaw.lua @@ -195,7 +195,9 @@ 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 faabc37f..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", ""} } @@ -96,7 +97,10 @@ minetest.register_globalstep(function(dtime) end end) -minetest.register_node("technic:light", { +if minetest.get_modpath("mcl_core") then + minetest.register_alias("technic:light", "mcl_core:light_14") +else + minetest.register_node("technic:light", { drawtype = "glasslike", tiles = {"technic_light.png"}, paramtype = "light", @@ -107,4 +111,5 @@ minetest.register_node("technic:light", { sunlight_propagates = true, light_source = minetest.LIGHT_MAX, pointable = false, -}) + }) +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"} } }) diff --git a/technic/tools/tree_tap.lua b/technic/tools/tree_tap.lua index eb9f36a2..a37401f4 100644 --- a/technic/tools/tree_tap.lua +++ b/technic/tools/tree_tap.lua @@ -1,7 +1,16 @@ local S = technic.getter +local mat = technic.materials local mesecons_materials = minetest.get_modpath("mesecons_materials") +local function drop_raw_latex(pointed_thing, user) + if minetest.get_modpath("mcl_core") then + minetest.add_item(user:get_pos(), "technic:raw_latex") + else + minetest.handle_node_drops(pointed_thing.above, {"technic:raw_latex"}, user) + end +end + minetest.register_tool("technic:treetap", { description = S("Tree Tap"), inventory_image = "technic_tree_tap.png", @@ -21,7 +30,7 @@ minetest.register_tool("technic:treetap", { end node.name = "moretrees:rubber_tree_trunk_empty" minetest.swap_node(pos, node) - minetest.handle_node_drops(pointed_thing.above, {"technic:raw_latex"}, user) + drop_raw_latex(pointed_thing, user) if not technic.creative_mode then local item_wear = tonumber(itemstack:get_wear()) item_wear = item_wear + 819 @@ -38,8 +47,8 @@ minetest.register_tool("technic:treetap", { minetest.register_craft({ output = "technic:treetap", recipe = { - {"pipeworks:tube_1", "group:wood", "default:stick"}, - {"", "default:stick", "default:stick"} + {"pipeworks:tube_1", "group:wood", mat.stick}, + {"", mat.stick, mat.stick} }, }) diff --git a/technic_worldgen/crafts.lua b/technic_worldgen/crafts.lua index 3453111b..0966276a 100644 --- a/technic_worldgen/crafts.lua +++ b/technic_worldgen/crafts.lua @@ -1,6 +1,8 @@ local S = minetest.get_translator("technic_worldgen") +local has_mcl = minetest.get_modpath("mcl_core") + minetest.register_craftitem(":technic:uranium_lump", { description = S("Uranium Lump"), inventory_image = "technic_uranium_lump.png", @@ -118,7 +120,7 @@ minetest.register_craft({ minetest.register_craft({ type = "cooking", - recipe = "default:steel_ingot", + recipe = has_mcl and "mcl_core:iron_ingot" or "default:steel_ingot", output = "technic:cast_iron_ingot", }) diff --git a/technic_worldgen/init.lua b/technic_worldgen/init.lua index f611d89b..4f06f84c 100644 --- a/technic_worldgen/init.lua +++ b/technic_worldgen/init.lua @@ -33,9 +33,20 @@ if minetest.get_modpath("mg") then dofile(modpath.."/mg.lua") end -minetest.register_alias("technic:wrought_iron_ingot", "default:steel_ingot") minetest.register_alias("technic:uranium", "technic:uranium_lump") -minetest.register_alias("technic:wrought_iron_block", "default:steelblock") -minetest.register_alias("technic:diamond_block", "default:diamondblock") -minetest.register_alias("technic:diamond", "default:diamond") -minetest.register_alias("technic:mineral_diamond", "default:stone_with_diamond") + +if minetest.get_modpath("default") then + minetest.register_alias("technic:wrought_iron_ingot", "default:steel_ingot") + minetest.register_alias("technic:wrought_iron_block", "default:steelblock") + minetest.register_alias("technic:diamond_block", "default:diamondblock") + minetest.register_alias("technic:diamond", "default:diamond") + minetest.register_alias("technic:mineral_diamond", "default:stone_with_diamond") +end + +if minetest.get_modpath("mcl_core") then + minetest.register_alias("technic:wrought_iron_ingot", "mcl_core:iron_ingot") + minetest.register_alias("technic:wrought_iron_block", "mcl_core:ironblock") + minetest.register_alias("technic:diamond_block", "mcl_core:diamondblock") + minetest.register_alias("technic:diamond", "mcl_core:diamond") + minetest.register_alias("technic:mineral_diamond", "mcl_core:stone_with_diamond") +end