From 5ffbad8afb89413ea298d4c971c3fa1c98b1d9a4 Mon Sep 17 00:00:00 2001 From: "A.C.M" Date: Wed, 7 Jun 2023 18:35:21 +0200 Subject: [PATCH] Conducting Stones added. --- init.lua | 7 +++- locale/mesecons_stealthnodes.de.tr | 7 ++++ locale/template.txt | 7 ++++ nodes.lua | 1 + register.lua | 60 +++++++++++++++++++++++++++++- 5 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 locale/mesecons_stealthnodes.de.tr create mode 100644 locale/template.txt diff --git a/init.lua b/init.lua index ef088c6..93dc924 100644 --- a/init.lua +++ b/init.lua @@ -3,15 +3,18 @@ *** Mesecons Stealthnodes *** ******************************************** - A mod for Minetest to register various Ghoststones. + A mod for Minetest to register various ghoststones and conducting stones. ]]-- stealthnode = {} stealthnode.version = "1" -stealthnode.revision = "5" +stealthnode.revision = "6" local modpath = minetest.get_modpath("mesecons_stealthnodes") +local S = minetest.get_translator(minetest.get_current_modname()) + +stealhnode.S = S dofile(modpath .. "/register.lua") dofile(modpath .. "/nodes.lua") diff --git a/locale/mesecons_stealthnodes.de.tr b/locale/mesecons_stealthnodes.de.tr new file mode 100644 index 0000000..749dfa7 --- /dev/null +++ b/locale/mesecons_stealthnodes.de.tr @@ -0,0 +1,7 @@ +# textdomain: mesecons_stealthnodes + + +### register.lua ### + +Conducting=Leitend +Stealth=Tarn diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..af3283c --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,7 @@ +# textdomain: mesecons_stealthnodes + + +### register.lua ### + +Conducting= +Stealth= diff --git a/nodes.lua b/nodes.lua index 91c8c7f..8e463f4 100644 --- a/nodes.lua +++ b/nodes.lua @@ -75,5 +75,6 @@ local nodes = { for _,value in pairs(nodes) do if minetest.get_modpath(value[1]) then stealthnode.register_stealthnode(value[1], value[2]) + stealthnode.register_conductnode(value[1], value[2]) end end diff --git a/register.lua b/register.lua index d40d6f0..e1a7d07 100644 --- a/register.lua +++ b/register.lua @@ -13,6 +13,8 @@ ]]-- +local S = stealthnode.S + local function copy_table(t) if type(t) ~= "table" then return end local t2 = {} @@ -42,7 +44,7 @@ function stealthnode.register_stealthnode(modname, node) node_groups.mesecons_stealthnode = 1 minetest.register_node(":" .. stealthnode_name, { - description = "Stealthnode " .. nodedef.description, + description = S("Stealth") .. " " .. nodedef.description, drawtype = nodedef.drawtype, tiles = nodedef.tiles, use_texture_alpha = nodedef.use_texture_alpha, @@ -106,4 +108,60 @@ function stealthnode.register_stealthnode(modname, node) {"default:tin_ingot", node_name, "default:tin_ingot"}, } }) + +end + +function stealthnode.register_conductnode(modname, node) + + local node_name = modname .. ":" .. node + + local nodedef = minetest.registered_nodes[node_name] + + if not nodedef then + local message = "[MOD] " .. minetest.get_current_modname() .. ": " + .. node_name .. " not found to register a conductnode." + print(message) + minetest.log("warning", message) + return + end + + local conductnode_name = "mesecons_stealthnode:" .. modname .. "_" .. node + + local node_groups = copy_table(nodedef.groups) or {} + node_groups.mesecons_stealthnode = 1 + + minetest.register_node(":" .. conductnode_name, { + description = S("Conducting") .. " " .. nodedef.description, + drawtype = nodedef.drawtype, + tiles = nodedef.tiles, + use_texture_alpha = nodedef.use_texture_alpha, + paramtype = nodedef.paramtype, + paramtype2 = nodedef.paramtype2, + is_ground_content = false, + sunlight_propagates = nodedef.sunlight_propagates, + node_box = nodedef.node_box, + mesh = nodedef.mesh, + selection_box = nodedef.selection_box, + collision_box = nodedef.collision_box, + sounds = nodedef.sounds, + groups = node_groups, + inventory_image = nodedef.inventory_image, + mesecons = { + conductor = { + state = mesecon.state.off, + rules = mesecon.rules.alldirs, + } + }, + on_blast = mesecon.on_blastnode, + }) + + minetest.register_craft({ + output = conductnode_name .. " 4", + recipe = { + {"default:tin_ingot", node_name, "default:tin_ingot"}, + {node_name, "mesecons:wire_00000000_off", node_name}, + {"default:tin_ingot", node_name, "default:tin_ingot"}, + } + }) + end