master
Emojigit 2021-08-13 07:38:48 +08:00
parent 77f43bc62b
commit 05c8fa6bbe
No known key found for this signature in database
GPG Key ID: 2443E5F619026B90
6 changed files with 158 additions and 0 deletions

View File

@ -1,2 +1,21 @@
# 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

64
init.lua Normal file
View File

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

4
mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = digiline_nodes
destription = API to add digiline nodes
depends = digilines
optional_depends = default, ethereal

30
mods/default.lua Normal file
View File

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

23
mods/ethereal.lua Normal file
View File

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

18
test.lua Normal file
View File

@ -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/>.
]]