diff --git a/init.lua b/init.lua index d09930c..84f2ef1 100644 --- a/init.lua +++ b/init.lua @@ -117,6 +117,7 @@ dofile(MP.."/power/powerswitch.lua") dofile(MP.."/power/protection.lua") dofile(MP.."/power/power_line.lua") dofile(MP.."/power/ta4_cable.lua") +dofile(MP.."/power/ta4_cable_wall_entry.lua") dofile(MP.."/power/laser.lua") -- Iron Age diff --git a/power/ta4_cable.lua b/power/ta4_cable.lua index 0abef4e..cbd2760 100644 --- a/power/ta4_cable.lua +++ b/power/ta4_cable.lua @@ -27,10 +27,16 @@ local Cable = tubelib2.Tube:new({ max_tube_length = ELE2_MAX_CABLE_LENGHT, show_infotext = false, tube_type = "ele2", - primary_node_names = {"techage:ta4_power_cableS", "techage:ta4_power_cableA"}, + primary_node_names = {"techage:ta4_power_cableS", "techage:ta4_power_cableA", + "techage:ta4_cable_wall_entry"}, secondary_node_names = {}, after_place_tube = function(pos, param2, tube_type, num_tubes) - minetest.swap_node(pos, {name = "techage:ta4_power_cable"..tube_type, param2 = param2}) + local name = minetest.get_node(pos).name + if name == "techage:ta4_cable_wall_entry" then + minetest.swap_node(pos, {name = "techage:ta4_cable_wall_entry", param2 = param2}) + else + minetest.swap_node(pos, {name = "techage:ta4_power_cable"..tube_type, param2 = param2}) + end end, }) @@ -143,7 +149,7 @@ minetest.register_node("techage:ta4_power_box", { }, connects_to = {"techage:ta4_power_cableA", "techage:ta4_power_cableS", "techage:ta4_solar_inverter", "techage:ta4_solar_carrier", - "techage:ta4_solar_carrierB"}, + "techage:ta4_solar_carrierB", "techage:ta4_cable_wall_entry"}, after_place_node = function(pos, placer, itemstack, pointed_thing) Cable:after_place_node(pos) diff --git a/power/ta4_cable_wall_entry.lua b/power/ta4_cable_wall_entry.lua new file mode 100644 index 0000000..d83d3b7 --- /dev/null +++ b/power/ta4_cable_wall_entry.lua @@ -0,0 +1,57 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2020 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA4 cable wall entry + +]]-- + +local S = techage.S + +local TA4_Cable = techage.TA4_Cable + +minetest.register_node("techage:ta4_cable_wall_entry", { + description = S("TA4 Cable Wall Entry"), + tiles = { + -- up, down, right, left, back, front + "basic_materials_concrete_block.png", + "basic_materials_concrete_block.png", + "basic_materials_concrete_block.png", + "basic_materials_concrete_block.png", + "basic_materials_concrete_block.png^techage_ta4_cable_hole.png", + "basic_materials_concrete_block.png^techage_ta4_cable_hole.png", + }, + + after_place_node = function(pos, placer, itemstack, pointed_thing) + if not TA4_Cable:after_place_tube(pos, placer, pointed_thing) then + minetest.remove_node(pos) + return true + end + return false + end, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + TA4_Cable:after_dig_tube(pos, oldnode) + end, + + paramtype2 = "facedir", -- important! + on_rotate = screwdriver.disallow, -- important! + groups = {crumbly = 2, cracky = 2, snappy = 2}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craft({ + output = "techage:ta4_cable_wall_entry", + recipe = { + {"", "techage:ta4_power_cableS", ""}, + {"", "basic_materials:concrete_block", ""}, + {"", "",""}, + }, +}) diff --git a/textures/techage_ta4_cable_hole.png b/textures/techage_ta4_cable_hole.png new file mode 100644 index 0000000..f936c9c Binary files /dev/null and b/textures/techage_ta4_cable_hole.png differ diff --git a/textures/techage_tube_junction.png b/textures/techage_tube_junction.png index b94402a..8d44956 100644 Binary files a/textures/techage_tube_junction.png and b/textures/techage_tube_junction.png differ