80 lines
1.9 KiB
Lua
Raw Normal View History

-- LUALOCALS < ---------------------------------------------------------
local math, minetest, type
= math, minetest, type
local math_random
= math.random
-- LUALOCALS > ---------------------------------------------------------
2018-11-02 00:08:42 -04:00
local modname = minetest.get_current_modname()
minetest.register_node(modname .. ":root", {
description = "Root",
tiles = {
modname .. "_tree_top.png",
"nc_terrain_dirt.png",
"nc_terrain_dirt.png^" .. modname .. "_roots.png"
},
})
minetest.register_node(modname .. ":tree", {
description = "Tree",
tiles = {
modname .. "_tree_top.png",
modname .. "_tree_top.png",
modname .. "_tree_side.png"
},
groups = {
choppy = 3
}
2018-11-02 00:08:42 -04:00
})
2018-11-02 00:50:34 -04:00
minetest.register_node(modname .. ":leaves", {
description = "Leaves",
drawtype = "allfaces_optional",
paramtype = "light",
tiles = { modname .. "_leaves.png" },
groups = { snappy = 2 },
alternate_loose = {
tiles = { modname .. "_leaves_dry.png" },
walkable = false,
groups = {
snappy = 3,
falling_repose = 1
}
},
alternate_solid = {
after_dig_node = function(pos, node)
node = node or minetest.get_node(node)
local l = modname .. ":leaves_loose"
local e = modname .. ":eggcorn"
local b = modname .. ":stick"
local p = {l, l, l, l, l, l, l, l, b, b, e}
for i = 1, node.param2 do
p[#p + 1] = e
p[#p + 1] = e
p[#p + 1] = b
p[#p + 1] = b
end
minetest.place_node(pos,
{name = p[math_random(1, #p)]})
end
}
})
local function fixed(t) return {type = "fixed", fixed = t} end
minetest.register_node(modname .. ":eggcorn", {
description = "EggCorn",
drawtype = "plantlike",
paramtype = "light",
visual_scale = 0.5,
collision_box = fixed({-3/16, -0.5, -3/16, 3/16, 0, 3/16}),
selection_box = fixed({-3/16, -0.5, -3/16, 3/16, 0, 3/16}),
inventory_image = modname .. "_eggcorn.png",
tiles = { modname .. "_eggcorn.png" },
groups = {
snappy = 3,
falling_repose = 1
}
})