ShadowNinja
2016-03-20 83c6494166fcebefc0cd6f6868032fb814c35ff5
Use connected nodeboxes for cables
42 files modified
487 ■■■■■ changed files
technic/legacy.lua 9 ●●●●● patch | view | raw | blame | history
technic/machines/HV/battery_box.lua 2 ●●● patch | view | raw | blame | history
technic/machines/HV/cables.lua 4 ●●●● patch | view | raw | blame | history
technic/machines/HV/forcefield.lua 7 ●●●●● patch | view | raw | blame | history
technic/machines/HV/generator.lua 2 ●●● patch | view | raw | blame | history
technic/machines/HV/nuclear_reactor.lua 7 ●●●●● patch | view | raw | blame | history
technic/machines/HV/quarry.lua 5 ●●●●● patch | view | raw | blame | history
technic/machines/HV/solar_array.lua 2 ●●● patch | view | raw | blame | history
technic/machines/LV/alloy_furnace.lua 6 ●●●● patch | view | raw | blame | history
technic/machines/LV/battery_box.lua 6 ●●●● patch | view | raw | blame | history
technic/machines/LV/cables.lua 4 ●●●● patch | view | raw | blame | history
technic/machines/LV/cnc.lua 37 ●●●●● patch | view | raw | blame | history
technic/machines/LV/compressor.lua 6 ●●●● patch | view | raw | blame | history
technic/machines/LV/electric_furnace.lua 2 ●●● patch | view | raw | blame | history
technic/machines/LV/extractor.lua 2 ●●● patch | view | raw | blame | history
technic/machines/LV/generator.lua 2 ●●● patch | view | raw | blame | history
technic/machines/LV/geothermal.lua 10 ●●●●● patch | view | raw | blame | history
technic/machines/LV/grinder.lua 2 ●●● patch | view | raw | blame | history
technic/machines/LV/music_player.lua 6 ●●●●● patch | view | raw | blame | history
technic/machines/LV/solar_array.lua 2 ●●● patch | view | raw | blame | history
technic/machines/LV/solar_panel.lua 24 ●●●●● patch | view | raw | blame | history
technic/machines/LV/water_mill.lua 8 ●●●●● patch | view | raw | blame | history
technic/machines/MV/alloy_furnace.lua 2 ●●● patch | view | raw | blame | history
technic/machines/MV/battery_box.lua 2 ●●● patch | view | raw | blame | history
technic/machines/MV/cables.lua 10 ●●●● patch | view | raw | blame | history
technic/machines/MV/centrifuge.lua 6 ●●●● patch | view | raw | blame | history
technic/machines/MV/compressor.lua 2 ●●● patch | view | raw | blame | history
technic/machines/MV/electric_furnace.lua 4 ●●●● patch | view | raw | blame | history
technic/machines/MV/extractor.lua 2 ●●● patch | view | raw | blame | history
technic/machines/MV/generator.lua 2 ●●● patch | view | raw | blame | history
technic/machines/MV/grinder.lua 4 ●●●● patch | view | raw | blame | history
technic/machines/MV/power_radiator.lua 19 ●●●● patch | view | raw | blame | history
technic/machines/MV/solar_array.lua 2 ●●● patch | view | raw | blame | history
technic/machines/MV/tool_workshop.lua 6 ●●●●● patch | view | raw | blame | history
technic/machines/MV/wind_mill.lua 5 ●●●●● patch | view | raw | blame | history
technic/machines/register/battery_box.lua 4 ●●● patch | view | raw | blame | history
technic/machines/register/cables.lua 206 ●●●● patch | view | raw | blame | history
technic/machines/register/generator.lua 10 ●●●●● patch | view | raw | blame | history
technic/machines/register/machine_base.lua 12 ●●●●● patch | view | raw | blame | history
technic/machines/register/solar_array.lua 3 ●●●● patch | view | raw | blame | history
technic/machines/supply_converter.lua 16 ●●●●● patch | view | raw | blame | history
technic/machines/switching_station.lua 15 ●●●●● patch | view | raw | blame | history
technic/legacy.lua
@@ -22,9 +22,6 @@
    ["technic:compressor"]        = "technic:lv_compressor",
    ["technic:compressor_active"] = "technic:lv_compressor_active",
    ["technic:hv_battery_box"] = "technic:hv_battery_box0",
    ["technic:hv_cable"] = "technic:hv_cable0",
    ["technic:lv_cable"] = "technic:lv_cable0",
    ["technic:mv_cable"] = "technic:mv_cable0",
    ["technic:mv_battery_box"] = "technic:mv_battery_box0",
    ["technic:generator"]        = "technic:lv_generator",
    ["technic:generator_active"] = "technic:lv_generator_active",
@@ -36,3 +33,9 @@
    minetest.register_alias(old, new)
end
for i = 0, 63 do
    minetest.register_alias("technic:hv_cable"..i, "technic:hv_cable")
    minetest.register_alias("technic:mv_cable"..i, "technic:mv_cable")
    minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
end
technic/machines/HV/battery_box.lua
@@ -4,7 +4,7 @@
    recipe = {
        {'technic:mv_battery_box0', 'technic:mv_battery_box0', 'technic:mv_battery_box0'},
        {'technic:mv_battery_box0', 'technic:hv_transformer',  'technic:mv_battery_box0'},
        {'',                        'technic:hv_cable0',       ''},
        {'',                        'technic:hv_cable',        ''},
    }
})
technic/machines/HV/cables.lua
@@ -1,9 +1,9 @@
minetest.register_craft({
    output = 'technic:hv_cable0 3',
    output = 'technic:hv_cable 3',
    recipe = {
        {'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'},
        {'technic:mv_cable0',          'technic:mv_cable0',          'technic:mv_cable0'},
        {'technic:mv_cable',           'technic:mv_cable',           'technic:mv_cable'},
        {'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'},
    }
}) 
technic/machines/HV/forcefield.lua
@@ -15,7 +15,7 @@
    recipe = {
            {"default:mese",         "technic:motor",          "default:mese"        },
            {"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
            {"default:mese",         "technic:hv_cable0",      "default:mese"        },
            {"default:mese",         "technic:hv_cable",       "default:mese"        },
    }
})
@@ -195,7 +195,7 @@
minetest.register_node("technic:forcefield_emitter_off", {
    description = S("%s Forcefield Emitter"):format("HV"),
    tiles = {"technic_forcefield_emitter_off.png"},
    groups = {cracky = 1, technic_machine = 1},
    groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
    on_receive_fields = forcefield_receive_fields,
    on_construct = function(pos)
        local meta = minetest.get_meta(pos)
@@ -215,7 +215,8 @@
minetest.register_node("technic:forcefield_emitter_on", {
    description = S("%s Forcefield Emitter"):format("HV"),
    tiles = {"technic_forcefield_emitter_on.png"},
    groups = {cracky = 1, technic_machine = 1, not_in_creative_inventory=1},
    groups = {cracky = 1, technic_machine = 1, technic_hv = 1,
            not_in_creative_inventory=1},
    drop = "technic:forcefield_emitter_off",
    on_receive_fields = forcefield_receive_fields,
    on_destruct = function(pos)
technic/machines/HV/generator.lua
@@ -5,7 +5,7 @@
    recipe = {
        {'technic:carbon_plate',          'technic:mv_generator',   'technic:composite_plate'},
        {'pipeworks:tube_1',              'technic:hv_transformer', 'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:hv_cable0',      'technic:stainless_steel_ingot'},
        {'technic:stainless_steel_ingot', 'technic:hv_cable',       'technic:stainless_steel_ingot'},
    }
})
technic/machines/HV/nuclear_reactor.lua
@@ -24,7 +24,7 @@
    recipe = {
        {'technic:carbon_plate',          'default:obsidian_glass', 'technic:carbon_plate'},
        {'technic:composite_plate',       'technic:machine_casing', 'technic:composite_plate'},
        {'technic:stainless_steel_ingot',      'technic:hv_cable0', 'technic:stainless_steel_ingot'},
        {'technic:stainless_steel_ingot', 'technic:hv_cable',       'technic:stainless_steel_ingot'},
    }
})
@@ -260,7 +260,7 @@
    tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
             "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
             "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
    groups = {cracky=1, technic_machine=1},
    groups = {cracky=1, technic_machine=1, technic_hv=1},
    legacy_facedir_simple = true,
    sounds = default.node_sound_wood_defaults(),
    drawtype="nodebox",
@@ -294,7 +294,8 @@
    tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
             "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
         "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
    groups = {cracky=1, technic_machine=1, radioactive=11000, not_in_creative_inventory=1},
    groups = {cracky=1, technic_machine=1, technic_hv=1,
        radioactive=11000, not_in_creative_inventory=1},
    legacy_facedir_simple = true,
    sounds = default.node_sound_wood_defaults(),
    drop="technic:hv_nuclear_reactor_core",
technic/machines/HV/quarry.lua
@@ -5,7 +5,7 @@
    recipe = {
        {"technic:carbon_plate",       "pipeworks:filter",       "technic:composite_plate"},
        {"technic:motor",              "technic:machine_casing", "technic:diamond_drill_head"},
        {"technic:carbon_steel_block", "technic:hv_cable0",      "technic:carbon_steel_block"}},
        {"technic:carbon_steel_block", "technic:hv_cable",       "technic:carbon_steel_block"}},
    output = "technic:quarry",
})
@@ -213,7 +213,8 @@
             "technic_carbon_steel_block.png^default_tool_mesepick.png",
             "technic_carbon_steel_block.png"),
    paramtype2 = "facedir",
    groups = {cracky=2, tubedevice=1, technic_machine = 1},
    groups = {cracky=2, tubedevice=1, technic_machine=1, technic_hv=1},
    connect_sides = {"bottom", "front", "left", "right"},
    tube = {
        connect_sides = {top = 1},
    },
technic/machines/HV/solar_array.lua
@@ -6,7 +6,7 @@
    recipe = {
        {'technic:solar_array_mv',     'technic:solar_array_mv', 'technic:solar_array_mv'},
        {'technic:carbon_plate',       'technic:hv_transformer', 'technic:composite_plate'},
        {'',                           'technic:hv_cable0',      ''},
        {'',                           'technic:hv_cable',       ''},
    }
})
technic/machines/LV/alloy_furnace.lua
@@ -4,9 +4,9 @@
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_cable0',      'default:brick'},
        {'default:brick', 'default:brick',          'default:brick'},
        {'default:brick', 'technic:machine_casing', 'default:brick'},
        {'default:brick', 'technic:lv_cable',       'default:brick'},
    }
})
technic/machines/LV/battery_box.lua
@@ -2,9 +2,9 @@
minetest.register_craft({
    output = 'technic:lv_battery_box0',
    recipe = {
        {'group:wood',              'group:wood',              'group:wood'},
        {'technic:battery',         'technic:machine_casing',  'technic:battery'},
        {'technic:battery',         'technic:lv_cable0',       'technic:battery'},
        {'group:wood',      'group:wood',             'group:wood'},
        {'technic:battery', 'technic:machine_casing', 'technic:battery'},
        {'technic:battery', 'technic:lv_cable',       'technic:battery'},
    }
})
technic/machines/LV/cables.lua
@@ -1,8 +1,8 @@
minetest.register_alias("lv_cable", "technic:lv_cable0")
minetest.register_alias("lv_cable", "technic:lv_cable")
minetest.register_craft({
    output = 'technic:lv_cable0 6',
    output = 'technic:lv_cable 6',
    recipe = {
        {'default:paper',        'default:paper',        'default:paper'},
        {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'},
technic/machines/LV/cnc.lua
@@ -9,6 +9,17 @@
local S = technic.getter
minetest.register_craft({
    output = 'technic:cnc',
    recipe = {
        {'default:glass',              'technic:diamond_drill_head', 'default:glass'},
        {'technic:control_logic_unit', 'technic:machine_casing',     'technic:motor'},
        {'technic:carbon_steel_ingot', 'technic:lv_cable',           'technic:carbon_steel_ingot'},
    },
})
local shape = {}
local onesize_products = {
    slope                    = 2,
@@ -174,16 +185,9 @@
    description = S("%s CNC Machine"):format("LV"),
    tiles       = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
                   "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
    drawtype    = "nodebox",
    paramtype   = "light",
    groups = {cracky=2, technic_machine=1, technic_lv=1},
    connect_sides = {"bottom", "back", "left", "right"},
    paramtype2  = "facedir",
    node_box    = {
        type  = "fixed",
        fixed = {
            {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
        },
    },
    groups = {cracky=2, technic_machine=1},
    legacy_facedir_simple = true,
    on_construct = function(pos)
        local meta = minetest.get_meta(pos)
@@ -207,9 +211,10 @@
    description = S("%s CNC Machine"):format("LV"),
    tiles       = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
                   "technic_cnc_side.png",       "technic_cnc_side.png",   "technic_cnc_front_active.png"},
    groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
    connect_sides = {"bottom", "back", "left", "right"},
    paramtype2 = "facedir",
    drop = "technic:cnc",
    groups = {cracky=2, technic_machine=1, not_in_creative_inventory=1},
    legacy_facedir_simple = true,
    can_dig = technic.machine_can_dig,
    allow_metadata_inventory_put = technic.machine_inventory_put,
@@ -222,16 +227,4 @@
technic.register_machine("LV", "technic:cnc",        technic.receiver)
technic.register_machine("LV", "technic:cnc_active", technic.receiver)
-------------------------
-- CNC Machine Recipe
-------------------------
minetest.register_craft({
    output = 'technic:cnc',
    recipe = {
        {'default:glass',              'technic:diamond_drill_head', 'default:glass'},
        {'technic:control_logic_unit', 'technic:machine_casing',     'technic:motor'},
        {'technic:carbon_steel_ingot', 'technic:lv_cable0',          'technic:carbon_steel_ingot'},
    },
})
technic/machines/LV/compressor.lua
@@ -4,9 +4,9 @@
minetest.register_craft({
    output = 'technic:lv_compressor',
    recipe = {
        {'default:stone',        'technic:motor',        'default:stone'},
        {'mesecons:piston',        'technic:machine_casing',    'mesecons:piston'},
        {'technic:fine_silver_wire',    'technic:lv_cable0',        'technic:fine_silver_wire'},
        {'default:stone',            'technic:motor',          'default:stone'},
        {'mesecons:piston',          'technic:machine_casing', 'mesecons:piston'},
        {'technic:fine_silver_wire', 'technic:lv_cable',       'technic:fine_silver_wire'},
    }
})
technic/machines/LV/electric_furnace.lua
@@ -7,7 +7,7 @@
    recipe = {
        {'default:cobble', 'default:cobble',         'default:cobble'},
        {'default:cobble', 'technic:machine_casing', 'default:cobble'},
        {'default:cobble', 'technic:lv_cable0',      'default:cobble'},
        {'default:cobble', 'technic:lv_cable',       'default:cobble'},
    }
})
technic/machines/LV/extractor.lua
@@ -6,7 +6,7 @@
    recipe = {
        {'technic:treetap', 'technic:motor',          'technic:treetap'},
        {'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
        {'',                'technic:lv_cable0',      ''},
        {'',                'technic:lv_cable',       ''},
    }
})
technic/machines/LV/generator.lua
@@ -10,7 +10,7 @@
    recipe = {
        {'default:stone', 'default:furnace',        'default:stone'},
        {'default:stone', 'technic:machine_casing', 'default:stone'},
        {'default:stone', 'technic:lv_cable0',      'default:stone'},
        {'default:stone', 'technic:lv_cable',       'default:stone'},
    }
})
technic/machines/LV/geothermal.lua
@@ -10,9 +10,9 @@
minetest.register_craft({
    output = 'technic:geothermal',
    recipe = {
        {'technic:granite', 'default:diamond', 'technic:granite'},
        {'technic:granite',          'default:diamond',        'technic:granite'},
        {'technic:fine_copper_wire', 'technic:machine_casing', 'technic:fine_copper_wire'},
        {'technic:granite', 'technic:lv_cable0', 'technic:granite'},
        {'technic:granite',          'technic:lv_cable',       'technic:granite'},
    }
})
@@ -82,8 +82,9 @@
    description = S("Geothermal %s Generator"):format("LV"),
    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},
    paramtype2 = "facedir",
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
    legacy_facedir_simple = true,
    sounds = default.node_sound_wood_defaults(),
    on_construct = function(pos)
@@ -99,7 +100,8 @@
    tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
             "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
    paramtype2 = "facedir",
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
    legacy_facedir_simple = true,
    sounds = default.node_sound_wood_defaults(),
    drop = "technic:geothermal",
technic/machines/LV/grinder.lua
@@ -5,7 +5,7 @@
    recipe = {
        {'default:desert_stone', 'default:diamond',        'default:desert_stone'},
        {'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'},
        {'technic:granite',      'technic:lv_cable0',      'technic:granite'},
        {'technic:granite',      'technic:lv_cable',       'technic:granite'},
    }
})
technic/machines/LV/music_player.lua
@@ -9,7 +9,7 @@
    recipe = {
        {'technic:chromium_ingot', 'default:diamond',        'technic:chromium_ingot'},
        {'default:diamond',        'technic:machine_casing', 'default:diamond'},
        {'default:mossycobble',    'technic:lv_cable0',      'default:mossycobble'},
        {'default:mossycobble',    'technic:lv_cable',       'default:mossycobble'},
    }
})
@@ -94,7 +94,9 @@
    description = S("%s Music Player"):format("LV"),
    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},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, technic_lv=1},
    connect_sides = {"bottom"},
    sounds = default.node_sound_wood_defaults(),
    on_construct = function(pos)
        local meta = minetest.get_meta(pos)
technic/machines/LV/solar_array.lua
@@ -10,7 +10,7 @@
    recipe = {
        {'technic:solar_panel',        'technic:solar_panel',    'technic:solar_panel'},
        {'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'},
        {'',                           'technic:lv_cable0',      ''},
        {'',                           'technic:lv_cable',       ''},
    }
})
technic/machines/LV/solar_panel.lua
@@ -4,6 +4,17 @@
local S = technic.getter
minetest.register_craft({
    output = 'technic:solar_panel',
    recipe = {
        {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
        {'technic:fine_silver_wire',    'technic:lv_cable',            'mesecons_materials:glue'},
    }
})
local run = function(pos, node)
    -- The action here is to make the solar panel prodice power
    -- Power is dependent on the light level and the height above ground
@@ -35,7 +46,9 @@
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},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, technic_lv=1},
    connect_sides = {"bottom"},
    sounds = default.node_sound_wood_defaults(),
        description = S("Small Solar %s Generator"):format("LV"),
    active = false,
@@ -52,15 +65,6 @@
        meta:set_string("infotext", S("Small Solar %s Generator"):format("LV"))
    end,
    technic_run = run,
})
minetest.register_craft({
    output = 'technic:solar_panel',
    recipe = {
        {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
        {'technic:fine_silver_wire',    'technic:lv_cable0',           'mesecons_materials:glue'},
    }
})
technic.register_machine("LV", "technic:solar_panel", technic.producer)
technic/machines/LV/water_mill.lua
@@ -11,7 +11,7 @@
    recipe = {
        {'technic:marble', 'default:diamond',        'technic:marble'},
        {'group:wood',     'technic:machine_casing', 'group:wood'},
        {'technic:marble', 'technic:lv_cable0',      'technic:marble'},
        {'technic:marble', 'technic:lv_cable',       'technic:marble'},
    }
})
@@ -72,7 +72,8 @@
             "technic_water_mill_side.png", "technic_water_mill_side.png",
             "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},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, technic_lv=1},
    legacy_facedir_simple = true,
    sounds = default.node_sound_wood_defaults(),
    on_construct = function(pos)
@@ -89,7 +90,8 @@
             "technic_water_mill_side.png",       "technic_water_mill_side.png",
             "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, not_in_creative_inventory=1},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
    legacy_facedir_simple = true,
    sounds = default.node_sound_wood_defaults(),
    drop = "technic:water_mill",
technic/machines/MV/alloy_furnace.lua
@@ -5,7 +5,7 @@
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',              'technic:mv_transformer',   'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable0',        'technic:stainless_steel_ingot'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable',         'technic:stainless_steel_ingot'},
    }
})
technic/machines/MV/battery_box.lua
@@ -5,7 +5,7 @@
    recipe = {
        {'technic:lv_battery_box0', 'technic:lv_battery_box0', 'technic:lv_battery_box0'},
        {'technic:lv_battery_box0', 'technic:mv_transformer',  'technic:lv_battery_box0'},
        {'',                        'technic:mv_cable0',       ''},
        {'',                        'technic:mv_cable',        ''},
    }
})
technic/machines/MV/cables.lua
@@ -1,12 +1,12 @@
minetest.register_alias("mv_cable", "technic:mv_cable0")
minetest.register_alias("mv_cable", "technic:mv_cable")
minetest.register_craft({
    output = 'technic:mv_cable0 3',
    output = 'technic:mv_cable 3',
    recipe ={
        {'technic:rubber',    'technic:rubber',    'technic:rubber'},
        {'technic:lv_cable0', 'technic:lv_cable0', 'technic:lv_cable0'},
        {'technic:rubber',    'technic:rubber',    'technic:rubber'},
        {'technic:rubber',   'technic:rubber',   'technic:rubber'},
        {'technic:lv_cable', 'technic:lv_cable', 'technic:lv_cable'},
        {'technic:rubber',   'technic:rubber',   'technic:rubber'},
    }
}) 
technic/machines/MV/centrifuge.lua
@@ -1,9 +1,9 @@
minetest.register_craft({
    output = "technic:mv_centrifuge",
    recipe = {
        { "technic:motor",          "technic:copper_plate",   "technic:diamond_drill_head" },
        { "technic:copper_plate",   "technic:machine_casing", "technic:copper_plate"       },
        { "pipeworks:one_way_tube", "technic:mv_cable0",      "pipeworks:mese_filter"      },
        {"technic:motor",          "technic:copper_plate",   "technic:diamond_drill_head"},
        {"technic:copper_plate",   "technic:machine_casing", "technic:copper_plate"      },
        {"pipeworks:one_way_tube", "technic:mv_cable",       "pipeworks:mese_filter"     },
    }
})
technic/machines/MV/compressor.lua
@@ -5,7 +5,7 @@
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:lv_compressor',  'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',              'technic:mv_transformer', 'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable',       'technic:stainless_steel_ingot'},
    }
})
technic/machines/MV/electric_furnace.lua
@@ -9,8 +9,8 @@
    output = 'technic:mv_electric_furnace',
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',         'technic:mv_transformer',      'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable0',           'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',              'technic:mv_transformer',      'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable',            'technic:stainless_steel_ingot'},
    }
})
technic/machines/MV/extractor.lua
@@ -5,7 +5,7 @@
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:lv_extractor',   'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',              'technic:mv_transformer', 'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable',       'technic:stainless_steel_ingot'},
    }
})
technic/machines/MV/generator.lua
@@ -5,7 +5,7 @@
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:lv_generator',   'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',              'technic:mv_transformer', 'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable',       'technic:stainless_steel_ingot'},
    }
})
technic/machines/MV/grinder.lua
@@ -4,8 +4,8 @@
    output = 'technic:mv_grinder',
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:lv_grinder',     'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',         'technic:mv_transformer', 'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable0',      'technic:stainless_steel_ingot'},
        {'pipeworks:tube_1',              'technic:mv_transformer', 'pipeworks:tube_1'},
        {'technic:stainless_steel_ingot', 'technic:mv_cable',       'technic:stainless_steel_ingot'},
    }
})
technic/machines/MV/power_radiator.lua
@@ -12,6 +12,16 @@
local power_radius = 12
minetest.register_craft({
    output = 'technic:power_radiator 1',
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'},
        {'technic:copper_coil',           'technic:machine_casing', 'technic:copper_coil'},
        {'technic:rubber',                'technic:mv_cable',       'technic:rubber'},
    }
})
------------------------------------------------------------------
-- API for inductive powered nodes:
-- Use the functions below to set the corresponding callbacks
@@ -133,15 +143,6 @@
    on_punch = function(pos, node, puncher)
        toggle_on_off_inductive_appliances(pos, node, puncher)
    end
})
minetest.register_craft({
    output = 'technic:power_radiator 1',
    recipe = {
        {'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'},
        {'technic:copper_coil',           'technic:machine_casing', 'technic:copper_coil'},
        {'technic:rubber',                'technic:mv_cable0',      'technic:rubber'},
    }
})
minetest.register_abm({
technic/machines/MV/solar_array.lua
@@ -4,7 +4,7 @@
    recipe = {
        {'technic:solar_array_lv',     'technic:solar_array_lv', 'technic:solar_array_lv'},
        {'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'},
        {'',                           'technic:mv_cable0',      ''},
        {'',                           'technic:mv_cable',       ''},
    }
})
technic/machines/MV/tool_workshop.lua
@@ -10,7 +10,7 @@
    recipe = {
        {'group:wood',                         'default:diamond',        'group:wood'},
        {'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth'},
        {'default:obsidian',                   'technic:mv_cable0',      'default:obsidian'},
        {'default:obsidian',                   'technic:mv_cable',       'default:obsidian'},
    }
})
@@ -85,7 +85,9 @@
    paramtype2 = "facedir",
    tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
             "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, tubedevice=1, tubedevice_receiver=1},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, technic_mv=1, tubedevice=1, tubedevice_receiver=1},
    connect_sides = {"bottom", "back", "left", "right"},
    sounds = default.node_sound_wood_defaults(),
    on_construct = function(pos)
        local meta = minetest.get_meta(pos)
technic/machines/MV/wind_mill.lua
@@ -15,7 +15,7 @@
    recipe = {
        {'',                           'technic:motor',              ''},
        {'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'},
        {'',                           'technic:mv_cable0',          ''},
        {'',                           'technic:mv_cable',           ''},
    }
})
@@ -62,7 +62,8 @@
    description = S("Wind %s Generator"):format("MV"),
    tiles = {"technic_carbon_steel_block.png"},
    paramtype2 = "facedir",
    groups = {cracky=1, technic_machine=1},
    groups = {cracky=1, technic_machine=1, technic_mv=1},
    connect_sides = {"top", "bottom", "back", "left", "right"},
    sounds = default.node_sound_stone_defaults(),
    drawtype = "nodebox",
    paramtype = "light",
technic/machines/register/battery_box.lua
@@ -159,7 +159,8 @@
    end
    
    for i = 0, 8 do
        local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1}
        local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
                technic_machine=1, ["technic_"..ltier]=1}
        if i ~= 0 then
            groups.not_in_creative_inventory = 1
        end
@@ -178,6 +179,7 @@
                 "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
                 "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"},
            groups = groups,
            connect_sides = {"bottom"},
            tube = data.tube and tube or nil,
            paramtype2 = "facedir",
            sounds = default.node_sound_wood_defaults(),
technic/machines/register/cables.lua
@@ -1,177 +1,65 @@
local S = technic.getter
local cable_itstr_to_tier = {}
local cable_tier = {}
function technic.is_tier_cable(name, tier)
    return cable_tier[name] == tier
end
function technic.get_cable_tier(name)
    return cable_tier[name]
end
local function clear_networks()
    technic.networks = {}
end
function technic.register_cable(tier, size)
    local ltier = string.lower(tier)
    cable_tier["technic:"..ltier.."_cable"] = tier
    for x1 = 0, 1 do
    for x2 = 0, 1 do
    for y1 = 0, 1 do
    for y2 = 0, 1 do
    for z1 = 0, 1 do
    for z2 = 0, 1 do
        local id = technic.get_cable_id({x1, x2, y1, y2, z1, z2})
    local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
        cable_itstr_to_tier["technic:"..ltier.."_cable"..id] = tier
    local node_box = {
        type = "connected",
        fixed          = {-size, -size, -size, size,  size, size},
        connect_top    = {-size, -size, -size, size,  0.5,  size}, -- y+
        connect_bottom = {-size, -0.5,  -size, size,  size, size}, -- y-
        connect_front  = {-size, -size, -0.5,  size,  size, size}, -- z-
        connect_back   = {-size, -size,  size, size,  size, 0.5 }, -- z+
        connect_left   = {-0.5,  -size, -size, size,  size, size}, -- x-
        connect_right  = {-size, -size, -size, 0.5,   size, size}, -- x+
    }
        local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
        if id ~= 0 then
            groups.not_in_creative_inventory = 1
        end
        minetest.register_node("technic:"..ltier.."_cable"..id, {
            description = S("%s Cable"):format(tier),
            tiles = {"technic_"..ltier.."_cable.png"},
            inventory_image = "technic_"..ltier.."_cable_wield.png",
            wield_image = "technic_"..ltier.."_cable_wield.png",
            groups = groups,
            sounds = default.node_sound_wood_defaults(),
            drop = "technic:"..ltier.."_cable0",
            paramtype = "light",
            sunlight_propagates = true,
            drawtype = "nodebox",
            node_box = {
                type = "fixed",
                fixed = technic.gen_cable_nodebox(x1, y1, z1, x2, y2, z2, size)
            },
            on_construct = function()
                technic.networks = {}
            end,
            on_destruct = function()
                technic.networks = {}
            end,
            after_place_node = function(pos)
                local node = minetest.get_node(pos)
                technic.update_cables(pos, technic.get_cable_tier(node.name))
            end,
            after_dig_node = function(pos, oldnode)
                local tier = technic.get_cable_tier(oldnode.name)
                technic.update_cables(pos, tier, true)
            end
        })
    end
    end
    end
    end
    end
    end
    minetest.register_node("technic:"..ltier.."_cable", {
        description = S("%s Cable"):format(tier),
        tiles = {"technic_"..ltier.."_cable.png"},
        inventory_image = "technic_"..ltier.."_cable_wield.png",
        wield_image = "technic_"..ltier.."_cable_wield.png",
        groups = groups,
        sounds = default.node_sound_wood_defaults(),
        drop = "technic:"..ltier.."_cable",
        paramtype = "light",
        sunlight_propagates = true,
        drawtype = "nodebox",
        node_box = node_box,
        connects_to = {"technic:"..ltier.."_cable",
            "group:technic_"..ltier, "group:technic_all_tiers"},
        on_construct = clear_networks,
        on_destruct = clear_networks,
    })
end
minetest.register_on_placenode(function(pos, node)
local function clear_nets_if_machine(pos, node)
    for tier, machine_list in pairs(technic.machines) do
        if machine_list[node.name] ~= nil then
            technic.update_cables(pos, tier, true)
            technic.networks = {}
            return clear_networks()
        end
    end
end)
minetest.register_on_dignode(function(pos, node)
    for tier, machine_list in pairs(technic.machines) do
        if machine_list[node.name] ~= nil then
            technic.update_cables(pos, tier, true)
            technic.networks = {}
        end
    end
end)
function technic.get_cable_id(links)
    return (links[6] * 1) + (links[5] * 2)
            + (links[4] * 4)  + (links[3] * 8)
            + (links[2] * 16) + (links[1] * 32)
end
function technic.update_cables(pos, tier, no_set, secondrun)
    local link_positions = {
        {x=pos.x+1, y=pos.y,   z=pos.z},
        {x=pos.x-1, y=pos.y,   z=pos.z},
        {x=pos.x,   y=pos.y+1, z=pos.z},
        {x=pos.x,   y=pos.y-1, z=pos.z},
        {x=pos.x,   y=pos.y,   z=pos.z+1},
        {x=pos.x,   y=pos.y,   z=pos.z-1}}
    local links = {0, 0, 0, 0, 0, 0}
    for i, link_pos in pairs(link_positions) do
        local connect_type = technic.cables_should_connect(pos, link_pos, tier)
        if connect_type then
            links[i] = 1
            -- Have cables next to us update theirselves,
            -- but only once. (We don't want to update the entire
            -- network or start an infinite loop of updates)
            if not secondrun and connect_type == "cable" then
                technic.update_cables(link_pos, tier, false, true)
            end
        end
    end
    -- We don't want to set ourselves if we have been removed or we are
    -- updating a machine
    if not no_set then
        minetest.set_node(pos, {name="technic:"..string.lower(tier)
                .."_cable"..technic.get_cable_id(links)})
    end
end
function technic.is_tier_cable(name, tier)
    return cable_itstr_to_tier[name] and cable_itstr_to_tier[name] == tier
end
function technic.get_cable_tier(name)
    return cable_itstr_to_tier[name]
end
function technic.cables_should_connect(pos1, pos2, tier)
    local name = minetest.get_node(pos2).name
    if name == "technic:switching_station" then
        return pos2.y == pos1.y + 1 and "machine" or false
    elseif name == "technic:supply_converter" then
        return math.abs(pos2.y - pos1.y) == 1 and "machine" or false
    elseif technic.is_tier_cable(name, tier) then
        return "cable"
    elseif technic.machines[tier][name] then
        return "machine"
    end
    return false
end
function technic.gen_cable_nodebox(x1, y1, z1, x2, y2, z2, size)
    -- Nodeboxes
    local box_center = {-size, -size, -size, size,  size, size}
    local box_y1 =     {-size, -size, -size, size,  0.5,  size} -- y+
    local box_x1 =     {-size, -size, -size, 0.5,   size, size} -- x+
    local box_z1 =     {-size, -size,  size, size,  size, 0.5}  -- z+
    local box_z2 =     {-size, -size, -0.5,  size,  size, size} -- z-
    local box_y2 =     {-size, -0.5,  -size, size,  size, size} -- y-
    local box_x2 =     {-0.5,  -size, -size, size,  size, size} -- x-
    local box = {box_center}
    if x1 == 1 then
        table.insert(box, box_x1)
    end
    if y1 == 1 then
        table.insert(box, box_y1)
    end
    if z1 == 1 then
        table.insert(box, box_z1)
    end
    if x2 == 1 then
        table.insert(box, box_x2)
    end
    if y2 == 1 then
        table.insert(box, box_y2)
    end
    if z2 == 1 then
        table.insert(box, box_z2)
    end
    return box
end
minetest.register_on_placenode(clear_nets_if_machine)
minetest.register_on_dignode(clear_nets_if_machine)
technic/machines/register/generator.lua
@@ -18,14 +18,14 @@
    local tier = data.tier
    local ltier = string.lower(tier)
    local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1}
    local active_groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, not_in_creative_inventory=1}
    local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, ["technic_"..ltier]=1}
    if data.tube then
        groups.tubedevice = 1
        groups.tubedevice_receiver = 1
        active_groups.tubedevice = 1
        active_groups.tubedevice_receiver = 1
    end
    local active_groups = {not_in_creative_inventory = 1}
    for k, v in pairs(groups) do active_groups[k] = v end
    local generator_formspec =
        "invsize[8,9;]"..
@@ -93,6 +93,7 @@
                 "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"}, 
        paramtype2 = "facedir",
        groups = groups,
        connect_sides = {"bottom", "back", "left", "right"},
        legacy_facedir_simple = true,
        sounds = default.node_sound_wood_defaults(),
        tube = data.tube and tube or nil,
@@ -122,6 +123,7 @@
                 "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"},
        paramtype2 = "facedir",
        groups = active_groups,
        connect_sides = {"bottom"},
        legacy_facedir_simple = true,
        sounds = default.node_sound_wood_defaults(),
        tube = data.tube and tube or nil,
technic/machines/register/machine_base.lua
@@ -15,6 +15,8 @@
    connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1},
}
local connect_default = {"bottom", "back", "left", "right"}
local function round(v)
    return math.floor(v + 0.5)
end
@@ -27,15 +29,13 @@
    local tier = data.tier
    local ltier = string.lower(tier)
    local groups = {cracky = 2, technic_machine = 1}
    local active_groups = {cracky = 2, technic_machine = 1, not_in_creative_inventory = 1}
    local groups = {cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1}
    if data.tube then
        groups.tubedevice = 1
        groups.tubedevice_receiver = 1
        active_groups.tubedevice = 1
        active_groups.tubedevice_receiver = 1
    end
    local active_groups = {not_in_creative_inventory = 1}
    for k, v in pairs(groups) do active_groups[k] = v end
    local formspec =
        "invsize[8,9;]"..
@@ -145,6 +145,7 @@
        paramtype2 = "facedir",
        groups = groups,
        tube = data.tube and tube or nil,
        connect_sides = data.connect_sides or connect_default,
        legacy_facedir_simple = true,
        sounds = default.node_sound_wood_defaults(),
        on_construct = function(pos)
@@ -179,6 +180,7 @@
        paramtype2 = "facedir",
        drop = "technic:"..ltier.."_"..machine_name,
        groups = active_groups,
        connect_sides = data.connect_sides or connect_default,
        legacy_facedir_simple = true,
        sounds = default.node_sound_wood_defaults(),
        tube = data.tube and tube or nil,
technic/machines/register/solar_array.lua
@@ -42,7 +42,8 @@
        tiles = {"technic_"..ltier.."_solar_array_top.png",  "technic_"..ltier.."_solar_array_bottom.png",
             "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png",
             "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"},
        groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
        groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, ["technic_"..ltier]=1},
        connect_sides = {"bottom"},
        sounds = default.node_sound_wood_defaults(),
        description = S("Arrayed Solar %s Generator"):format(tier),
        active = false,
technic/machines/supply_converter.lua
@@ -49,14 +49,10 @@
    tiles  = {"technic_supply_converter_top.png", "technic_supply_converter_bottom.png",
              "technic_supply_converter_side.png", "technic_supply_converter_side.png",
              "technic_supply_converter_side.png", "technic_supply_converter_side.png"},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
        technic_machine=1, technic_all_tiers=1},
    connect_sides = {"top", "bottom"},
    sounds = default.node_sound_wood_defaults(),
    drawtype = "nodebox",
    paramtype = "light",
    node_box = {
        type = "fixed",
        fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
    },
    on_construct = function(pos)
        local meta = minetest.get_meta(pos)
        meta:set_string("infotext", S("Supply Converter"))
@@ -68,9 +64,9 @@
minetest.register_craft({
    output = 'technic:supply_converter 1',
    recipe = {
        {'technic:fine_gold_wire',        'technic:rubber',         'technic:doped_silicon_wafer'},
        {'technic:mv_transformer',        'technic:machine_casing', 'technic:lv_transformer'},
        {'technic:mv_cable0',             'technic:rubber',         'technic:lv_cable0'},
        {'technic:fine_gold_wire', 'technic:rubber',         'technic:doped_silicon_wafer'},
        {'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'},
        {'technic:mv_cable',       'technic:rubber',         'technic:lv_cable'},
    }
})
technic/machines/switching_station.lua
@@ -38,9 +38,9 @@
minetest.register_craft({
    output = "technic:switching_station",
    recipe = {
        {"",                        "technic:lv_transformer", ""},
        {"default:copper_ingot",    "technic:machine_casing", "default:copper_ingot"},
        {"technic:lv_cable0",       "technic:lv_cable0",      "technic:lv_cable0"}
        {"",                     "technic:lv_transformer", ""},
        {"default:copper_ingot", "technic:machine_casing", "default:copper_ingot"},
        {"technic:lv_cable",     "technic:lv_cable",       "technic:lv_cable"}
    }
})
@@ -49,14 +49,9 @@
    tiles  = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
                  "technic_water_mill_top_active.png", "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},
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1},
    connect_sides = {"bottom"},
    sounds = default.node_sound_wood_defaults(),
    drawtype = "nodebox",
    paramtype = "light",
    node_box = {
        type = "fixed",
        fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
    },
    on_construct = function(pos)
        local meta = minetest.get_meta(pos)
        meta:set_string("infotext", S("Switching Station"))