-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.lua
63 lines (61 loc) · 1.93 KB
/
functions.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
-- see LICENSE.txt
--
-- generic functions
-- generate nodes within using an array
-- array format:
-- 1: node description,
-- 2: node name,
-- 3: node side texture,
-- 4: node up and down texture or "" (in this case side texture is used)
-- 5: if 1, register node with stairsplus
function add_simple_nodes(simple_nodes)
for _, row in ipairs(simple_nodes) do
local desc = row[1]
local name = row[2]
local texture_side = row[3]
local texture_updown = row[4]
if texture_updown == "" then
texture_updown = texture_side
end
local register_stairsplus = row[5]
-- node structure
local node = {
description = desc,
tiles = {
texture_updown..".png",
texture_updown..".png",
texture_side..".png",
texture_side..".png",
texture_side..".png",
texture_side..".png",
},
groups = {cracky=1},
paramtype = "light",
paramtype2 = "facedir"
}
-- node name
local nodename = modname..":"..name
-- register in minetest
minetest.register_node(nodename, node)
--[[
minetest.register_node(modname..":"..name, {
description = desc,
tiles = {
texture_updown..".png",
texture_updown..".png",
texture_side..".png",
texture_side..".png",
texture_side..".png",
texture_side..".png",
},
groups = {cracky=1},
paramtype = "light",
})
--]]
-- if moreblocks module is enabled register
if minetest.get_modpath("moreblocks") and register_stairsplus == 1 then
node.sunlight_propagates = true
stairsplus:register_all(modname, name, nodename, node)
end
end
end