From 25c9340e5ac140b81dc7019e7f48912bb23b6704 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Thu, 13 May 2021 18:19:28 +0200 Subject: [PATCH] Add techage:ta4_cable_wall_entry item --- init.lua | 1 + power/ta4_cable.lua | 12 ++++-- power/ta4_cable_wall_entry.lua | 57 ++++++++++++++++++++++++++++ textures/techage_ta4_cable_hole.png | Bin 0 -> 115 bytes textures/techage_tube_junction.png | Bin 413 -> 396 bytes 5 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 power/ta4_cable_wall_entry.lua create mode 100644 textures/techage_ta4_cable_hole.png 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 0000000000000000000000000000000000000000..f936c9c7e5605d604dadd8fe55464c6920dcb7f8 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnH3?%tPCZz)@&H$efSN8&+84TJds*F=FHVFU) z8B2ovf*Bm1-ADs+Bs^UlLnJOICrD%*kYY&P;OmfnU@03P0|Un{#_O^C0n>qM7(8A5 KT-G@yGywo*=^O3< literal 0 HcmV?d00001 diff --git a/textures/techage_tube_junction.png b/textures/techage_tube_junction.png index b94402aa80652c61ef66af8bba8fe7fcf9504b57..8d449563f5e006385191f7d61da85e899ba01815 100644 GIT binary patch delta 369 zcmV-%0gnEi1B?TZB!3=IOjJcja7?>(KBlUr#ezoDlvKC6w%eXtkd%+CV>E1SYY)Op z4*&oF0d!JMQvg8b*k%9#0USw0K~yNuO_57#!$1s%=L*6ObS)5C4|1VfUf& zsDbe+Y7)aF5)o!#jyMDw$B`GnE(6-VI!scS>>i+UFql*ixgo?fUfglxpeZE+a6l&4 zEYP^aq=vglrD_KH%ggGhEDKnh4%*^UZF~ScgAa~y^5(3yrQ2oD*8W6Gw>0VhD!B5H zC+{O%-q=UzX;WKt0}Mr)w(!AGB(<rM!1QxN<#^l#i@qG;D2a zyq@cZ00001bW%=J06^y0W&i*IDoI2^R4C6)k-uuhFbu~13Thz7jWwuEZwn61d?efh z2n1Tw!TVjHrfVQ@>vbt!`=phV=8r?n$B$3=lVpq@iv!>7V1LbWPL>&&epg^$`|=RK zHwT5@K@7BlG4`c`adX7pm0{=LN8c#mt>i0#!(3tu5@8Y2Ur@80GyoE(50NyBeFoqh zs_G03@MH}E04iwDfGXLH06F^!s3R{7wQVaikR%Q3y*N~o8TBrFmq4KsQ%S=