diff --git a/README.md b/README.md new file mode 100644 index 0000000..f934fbe --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Mesecons Stealthnode + +This mod adds some new ghoststones for mesecons in minetest.
+The function to register your own ghoststones are integrated.
+ + +## No Signal +![Screenshot 1](scrshot_1.jpg) +
+ +## With Signal +![Screenshot 2](scrshot_2.jpg) +
+ +## Install + +Move your Download to the Mods-Folder.
+ +## Depends + +default
+mesecons_random
+ +### optional + +## Credits +Code to register the ghoststones is taken from jeija's ghoststones. + +## License + +License: LGPL3.0 + + + diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..0c15b1f --- /dev/null +++ b/depends.txt @@ -0,0 +1,2 @@ +default +mesecons_random diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..dc1dcc7 --- /dev/null +++ b/init.lua @@ -0,0 +1,66 @@ +--[[ + ******************************************** + *** Mesecons Stealthnodes ** + ******************************************** + + A mod for Minetest to register various Ghoststones. + +]]-- + +stealthnode = {} +stealthnode.version = "1" +stealthnode.revision = "0" + +dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/register.lua") + +local snodes = { + {"default", "cobble"}, + {"default", "stone"}, + {"default", "stonebrick"}, + {"default", "stone_block"}, + + {"default", "desert_cobble"}, + {"default", "desert_stone"}, + {"default", "desert_stonebrick"}, + {"default", "desert_stone_block"}, + + {"default", "sandstone"}, + {"default", "sandstonebrick"}, + {"default", "sandstone_block"}, + + {"default", "desert_sandstone"}, + {"default", "desert_sandstone_brick"}, + {"default", "desert_sandstone_block"}, + + {"default", "silver_sandstone"}, + {"default", "silver_sandstone_brick"}, + {"default", "silver_sandstone_block"}, + + {"default", "obsidian"}, + {"default", "obsidianbrick"}, + {"default", "obsidian_block"}, + + {"default", "wood"}, + {"default", "tree"}, + + {"default", "junglewood"}, + {"default", "jungletree"}, + + {"default", "aspen_wood"}, + {"default", "aspen_tree"}, + + {"default", "pine_wood"}, + {"default", "pine_tree"}, + + {"default", "acacia_wood"}, + {"default", "acacia_tree"}, + + } + +for i,value in pairs(snodes) do + stealthnode.register_stealthnode(value[1], value[2]) + +end + +print("[MOD] " .. minetest.get_current_modname() .. " loaded.") +minetest.log("info", "[MOD] " .. minetest.get_current_modname() .. " loaded.") diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..9aa13dc --- /dev/null +++ b/mod.conf @@ -0,0 +1,4 @@ +name = mesecons_stealthnode +description = A mod to register Ghoststones. +depends = default, mesecons_random +optional_depends = diff --git a/register.lua b/register.lua new file mode 100644 index 0000000..e6b66b6 --- /dev/null +++ b/register.lua @@ -0,0 +1,78 @@ +--[[ + ******************************************** + *** Register Stealthnodes ** + ******************************************** + + Registers a new Ghoststone with the tile of the given Node. + + stealthnode.register_stealthnode(Name, Node) + + Modname = String. Name of the Mod without ":", for example "default" + Node = String. Name of the registered Node + +]]-- + +function stealthnode.register_stealthnode(modname, node) + + tile = "" + + if minetest.registered_nodes[modname .. ":" .. node] == nil then + print("[MOD] " .. minetest.get_current_modname() .. ": " .. modname .. ":" .. node .. " not found to register a stealthnode.") + minetest.log("warning", "[MOD] " .. minetest.get_current_modname() .. ": " .. modname .. ":" .. node .. " not found to register a stealthnode.") + return + else + tile = minetest.registered_nodes[modname .. ":" .. node].tiles + + end + + + minetest.register_node("mesecons_stealthnode:" .. modname .. "_" .. node, { + description="Stealthnode " .. minetest.registered_nodes[modname .. ":" .. node].description, + tiles = tile, + is_ground_content = false, + inventory_image = tile, + groups = {cracky=3}, + sounds = minetest.registered_nodes[modname .. ":" .. node].sounds, + mesecons = {conductor = { + state = mesecon.state.off, + rules = mesecon.rules.alldirs, + onstate = "mesecons_stealthnode:" .. modname .. "_" .. node .. "_active" + }}, + on_blast = mesecon.on_blastnode, + }) + + minetest.register_node("mesecons_stealthnode:" .. modname .. "_" .. node .. "_active", { + drawtype = "airlike", + pointable = false, + walkable = false, + diggable = false, + is_ground_content = false, + sunlight_propagates = true, + paramtype = "light", + drop = "mesecons_stealthnode:" .. modname .. "_" .. node, + mesecons = {conductor = { + state = mesecon.state.on, + rules = mesecon.rules.alldirs, + offstate = "mesecons_stealthnode:" .. modname .. "_" .. node + }}, + on_construct = function(pos) + -- remove shadow + shadowpos = vector.add(pos, vector.new(0, 1, 0)) + if (minetest.get_node(shadowpos).name == "air") then + minetest.dig_node(shadowpos) + end + end, + on_blast = mesecon.on_blastnode, + }) + + + minetest.register_craft({ + output = 'mesecons_stealthnode:' .. modname .. "_" .. node .. ' 4', + recipe = { + {"default:steel_ingot", modname .. ":" .. node, "default:steel_ingot"}, + {modname .. ":" .. node, "group:mesecon_conductor_craftable", modname .. ":" .. node}, + {"default:steel_ingot", modname .. ":" .. node, "default:steel_ingot"}, + } + }) + +end -- function stealthnode.register_stealth_node( diff --git a/scrshot_1.jpg b/scrshot_1.jpg new file mode 100644 index 0000000..16a9800 Binary files /dev/null and b/scrshot_1.jpg differ diff --git a/scrshot_2.png b/scrshot_2.png new file mode 100644 index 0000000..383e744 Binary files /dev/null and b/scrshot_2.png differ