Use connected nodeboxes for cables

This commit is contained in:
ShadowNinja 2016-03-19 21:34:56 -04:00
parent c5127f4b1b
commit 83c6494166
42 changed files with 193 additions and 294 deletions

View File

@ -22,9 +22,6 @@ technic.legacy_nodenames = {
["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 @@ for old, new in pairs(technic.legacy_nodenames) do
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

View File

@ -4,7 +4,7 @@ minetest.register_craft({
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', ''},
}
})

View File

@ -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'},
}
})

View File

@ -15,7 +15,7 @@ minetest.register_craft({
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 @@ end
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_off", {
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)

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -24,7 +24,7 @@ minetest.register_craft({
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 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
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 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
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",

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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 @@ minetest.register_node("technic:quarry", {
"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},
},

View File

@ -6,7 +6,7 @@ minetest.register_craft({
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', ''},
}
})

View File

@ -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'},
}
})

View File

@ -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'},
}
})

View File

@ -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'},

View File

@ -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 @@ minetest.register_node("technic:cnc", {
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 @@ minetest.register_node("technic:cnc_active", {
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,
@ -223,15 +228,3 @@ minetest.register_node("technic:cnc_active", {
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'},
},
})

View File

@ -4,9 +4,9 @@ minetest.register_alias("compressor", "technic:lv_compressor")
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'},
}
})

View File

@ -7,7 +7,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -6,7 +6,7 @@ minetest.register_craft({
recipe = {
{'technic:treetap', 'technic:motor', 'technic:treetap'},
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
{'', 'technic:lv_cable0', ''},
{'', 'technic:lv_cable', ''},
}
})

View File

@ -10,7 +10,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -10,9 +10,9 @@ local S = technic.getter
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 @@ minetest.register_node("technic:geothermal", {
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 @@ minetest.register_node("technic:geothermal_active", {
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",

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -9,7 +9,7 @@ minetest.register_craft({
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 @@ minetest.register_node("technic:music_player", {
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)

View File

@ -10,7 +10,7 @@ minetest.register_craft({
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', ''},
}
})

View File

@ -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 @@ end
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,
@ -54,14 +67,5 @@ minetest.register_node("technic:solar_panel", {
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)

View File

@ -11,7 +11,7 @@ minetest.register_craft({
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 @@ minetest.register_node("technic:water_mill", {
"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 @@ minetest.register_node("technic:water_mill_active", {
"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",

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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', ''},
}
})

View File

@ -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'},
}
})

View File

@ -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" },
}
})

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -9,8 +9,8 @@ minetest.register_craft({
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'},
}
})

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -5,7 +5,7 @@ minetest.register_craft({
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'},
}
})

View File

@ -4,8 +4,8 @@ minetest.register_craft({
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'},
}
})

View File

@ -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
@ -135,15 +145,6 @@ minetest.register_node("technic:power_radiator", {
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({
nodenames = {"technic:power_radiator"},
interval = 1,

View File

@ -4,7 +4,7 @@ minetest.register_craft({
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', ''},
}
})

View File

@ -10,7 +10,7 @@ minetest.register_craft({
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 @@ minetest.register_node("technic:tool_workshop", {
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)

View File

@ -15,7 +15,7 @@ minetest.register_craft({
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 @@ minetest.register_node("technic:wind_mill", {
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",

View File

@ -159,7 +159,8 @@ function technic.register_battery_box(data)
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 @@ function technic.register_battery_box(data)
"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(),

View File

@ -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)

View File

@ -18,14 +18,14 @@ 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}
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 @@ function technic.register_generator(data)
"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 @@ function technic.register_generator(data)
"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,

View File

@ -15,6 +15,8 @@ local tube = {
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 @@ function technic.register_base_machine(data)
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 @@ function technic.register_base_machine(data)
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 @@ function technic.register_base_machine(data)
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,

View File

@ -42,7 +42,8 @@ function technic.register_solar_array(data)
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,

View File

@ -49,14 +49,10 @@ minetest.register_node("technic:supply_converter", {
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_node("technic:supply_converter", {
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'},
}
})

View File

@ -38,9 +38,9 @@ local S = technic.getter
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 @@ minetest.register_node("technic:switching_station",{
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"))