Inital Commit

This commit is contained in:
A.C.M 2019-02-15 00:12:16 +01:00
parent 72e432c013
commit ed008d4008
7 changed files with 184 additions and 0 deletions

34
README.md Normal file

@ -0,0 +1,34 @@
# Mesecons Stealthnode
This mod adds some new ghoststones for mesecons in minetest.<br>
The function to register your own ghoststones are integrated.<br>
## No Signal
![Screenshot 1](scrshot_1.jpg)
<br>
## With Signal
![Screenshot 2](scrshot_2.jpg)
<br>
## Install
Move your Download to the Mods-Folder.<br>
## Depends
default<br>
mesecons_random<br>
### optional
## Credits
Code to register the ghoststones is taken from jeija's ghoststones.
## License
License: LGPL3.0

2
depends.txt Normal file

@ -0,0 +1,2 @@
default
mesecons_random

66
init.lua Normal file

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

4
mod.conf Normal file

@ -0,0 +1,4 @@
name = mesecons_stealthnode
description = A mod to register Ghoststones.
depends = default, mesecons_random
optional_depends =

78
register.lua Normal file

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

BIN
scrshot_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
scrshot_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 KiB