2018-11-02 21:20:51 -04:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2018-11-03 11:26:15 -04:00
|
|
|
local ipairs, minetest, nodecore, type
|
2019-01-04 20:36:46 -05:00
|
|
|
= ipairs, minetest, nodecore, type
|
2018-11-02 21:20:51 -04:00
|
|
|
-- 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"
|
2019-01-04 20:36:46 -05:00
|
|
|
},
|
|
|
|
groups = {
|
|
|
|
choppy = 2
|
2018-11-03 19:18:28 -04:00
|
|
|
}
|
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 },
|
2018-11-02 18:47:44 -04:00
|
|
|
alternate_loose = {
|
|
|
|
tiles = { modname .. "_leaves_dry.png" },
|
|
|
|
walkable = false,
|
|
|
|
groups = {
|
|
|
|
snappy = 3,
|
|
|
|
falling_repose = 1
|
|
|
|
}
|
2018-11-02 22:55:14 -04:00
|
|
|
},
|
|
|
|
alternate_solid = {
|
|
|
|
after_dig_node = function(pos, node)
|
2018-11-03 11:26:15 -04:00
|
|
|
node = node or minetest.get_node(pos)
|
|
|
|
local t = {}
|
|
|
|
for i, v in ipairs(nodecore.registered_leaf_drops) do
|
|
|
|
t = v(pos, node, t) or t
|
2018-11-02 22:55:14 -04:00
|
|
|
end
|
2018-11-03 11:26:15 -04:00
|
|
|
local p = nodecore.pickrand(t, function(x) return x.prob end)
|
|
|
|
if not p then return end
|
|
|
|
minetest.place_node(pos, p)
|
2018-11-02 22:55:14 -04:00
|
|
|
end
|
|
|
|
}
|
|
|
|
})
|
2018-11-03 11:26:15 -04:00
|
|
|
nodecore.register_leaf_drops(function(pos, node, list)
|
|
|
|
list[#list + 1] = {name = modname .. ":leaves_loose"}
|
|
|
|
end)
|
2018-11-02 22:55:14 -04:00
|
|
|
|
|
|
|
local function fixed(t) return {type = "fixed", fixed = t} end
|
2018-11-02 23:54:43 -04:00
|
|
|
|