init
parent
77f43bc62b
commit
05c8fa6bbe
19
README.md
19
README.md
|
@ -1,2 +1,21 @@
|
||||||
# digiline_nodes
|
# digiline_nodes
|
||||||
API to add digiline nodes
|
API to add digiline nodes
|
||||||
|
## Code License
|
||||||
|
Copyright (C) 2021 Cato Yiu and other contributers
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
P.S: for a full list of contributer list, see:
|
||||||
|
* https://gitlab.com/yw05/digistuff/-/commits/master/
|
||||||
|
* https://github.com/C-C-Minetest-Server/digiline_nodes/commits/main
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
--[[
|
||||||
|
This file is a part of digiline_nodes.
|
||||||
|
|
||||||
|
Copyright (C) 2021 Cato Yiu and other contributers
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
local MN = minetest.get_current_modname()
|
||||||
|
local MP = minetest.get_modpath(MN)
|
||||||
|
local S = minetest.get_translator(MN)
|
||||||
|
digiline_nodes = {}
|
||||||
|
local _dn = digiline_nodes
|
||||||
|
function _dn.register_digiline_node(mod,node)
|
||||||
|
local nodename = mod .. ":" .. node
|
||||||
|
local digi_nodename = MN .. ":" .. mod .. "__" .. node
|
||||||
|
local ndef = minetest.registered_nodes[nodename]
|
||||||
|
if not(ndef) then
|
||||||
|
minetest.log("warning","Not registering `" .. nodename ..
|
||||||
|
"`'s digiline node since it does not exist")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local digi_ndef = table.copy(ndef)
|
||||||
|
digi_ndef.description = S("Digiline Condused @1",ndef.description or nodename)
|
||||||
|
if ndef.long_description then
|
||||||
|
digi_ndef.long_description = S("Digiline condused version of @1",ndef.long_description)
|
||||||
|
end
|
||||||
|
digi_ndef.digiline = {
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 1, y = 0, z = 0},
|
||||||
|
{x =-1, y = 0, z = 0},
|
||||||
|
{x = 0, y = 1, z = 0},
|
||||||
|
{x = 0, y =-1, z = 0},
|
||||||
|
{x = 0, y = 0, z = 1},
|
||||||
|
{x = 0, y = 0, z =-1}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
digi_ndef.is_ground_content = false
|
||||||
|
if not digi_ndef.group then digi_ndef.group = {} end
|
||||||
|
digi_ndef.group.digiline_node = 1
|
||||||
|
minetest.register_node(digi_nodename,digi_ndef)
|
||||||
|
end
|
||||||
|
|
||||||
|
local domod = function(mn)
|
||||||
|
dofile(MP .. "/mods/" .. mn .. ".lua")
|
||||||
|
end
|
||||||
|
if minetest.get_modpath("default") then
|
||||||
|
domod("default")
|
||||||
|
end
|
||||||
|
if minetest.get_modpath("ethereal") then
|
||||||
|
domod("ethereal")
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
name = digiline_nodes
|
||||||
|
destription = API to add digiline nodes
|
||||||
|
depends = digilines
|
||||||
|
optional_depends = default, ethereal
|
|
@ -0,0 +1,30 @@
|
||||||
|
--[[
|
||||||
|
This file is a part of digiline_nodes.
|
||||||
|
|
||||||
|
Copyright (C) 2021 Cato Yiu and other contributers
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
local function reg(node)
|
||||||
|
digiline_nodes.register_digiline_node("default",node)
|
||||||
|
end
|
||||||
|
|
||||||
|
reg("stone")
|
||||||
|
reg("cobbe")
|
||||||
|
reg("stonebrick")
|
||||||
|
reg("stone_block")
|
||||||
|
reg("sandstone")
|
||||||
|
reg("desert_sandstone")
|
||||||
|
reg("silver_sandstone")
|
||||||
|
reg("meselamp")
|
|
@ -0,0 +1,23 @@
|
||||||
|
--[[
|
||||||
|
This file is a part of digiline_nodes.
|
||||||
|
|
||||||
|
Copyright (C) 2021 Cato Yiu and other contributers
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
local function reg(node)
|
||||||
|
digiline_nodes.register_digiline_node("ethereal",node)
|
||||||
|
end
|
||||||
|
|
||||||
|
reg("crystal_block")
|
|
@ -0,0 +1,18 @@
|
||||||
|
--[[
|
||||||
|
This file is a part of digiline_nodes.
|
||||||
|
|
||||||
|
Copyright (C) 2021 Cato Yiu and other contributers
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
]]
|
Loading…
Reference in New Issue