1
0
mirror of https://github.com/mt-mods/moretrees.git synced 2024-12-25 02:00:23 +01:00

phase out the old clone_node call. use minetest.override_item() instead.

This commit is contained in:
Vanessa Ezekowitz 2014-07-30 14:53:27 -04:00
parent 8581d3654e
commit bb1b668f8f
2 changed files with 41 additions and 44 deletions

View File

@ -60,17 +60,6 @@ else
moretrees.expect_infinite_stacks = true moretrees.expect_infinite_stacks = true
end end
-- node clone, for redefining stuff
function moretrees:clone_node(name)
node2={}
node=minetest.registered_nodes[name]
for k,v in pairs(node) do
node2[k]=v
end
return node2
end
-- tables, load other files -- tables, load other files
moretrees.cutting_tools = { moretrees.cutting_tools = {

View File

@ -38,36 +38,44 @@ if moretrees.plantlike_leaves then
moretrees_plantlike_leaves_visual_scale = 1.189 moretrees_plantlike_leaves_visual_scale = 1.189
end end
local new_default_leaves = moretrees:clone_node("default:leaves") -- redefine default leaves to handle plantlike and/or leaf decay options
if moretrees.enable_default_leafdecay then if moretrees.enable_default_leafdecay then
new_default_leaves.groups = {snappy=3, flammable=2, leaves=1} minetest.override_item("default:leaves", {
groups = { snappy = 3, flammable = 2, leaves = 1 }
})
end end
if moretrees.plantlike_leaves then if moretrees.plantlike_leaves then
new_default_leaves.inventory_image = minetest.inventorycube("default_leaves.png") minetest.override_item("default:leaves", {
new_default_leaves.drawtype = "plantlike" inventory_image = minetest.inventorycube("default_leaves.png"),
new_default_leaves.visual_scale = moretrees_plantlike_leaves_visual_scale drawtype = "plantlike",
new_default_leaves.tiles = {"default_leaves_plantlike.png"} visual_scale = 1.189,
tiles = { "default_leaves_plantlike.png" }
})
else else
new_default_leaves.waving = 1 minetest.override_item("default:leaves", {
end waving = 1
if moretrees.enable_default_leafdecay or moretrees.plantlike_leaves then })
minetest.register_node(":default:leaves", new_default_leaves)
end end
local new_default_jungleleaves = moretrees:clone_node("default:jungleleaves") -- redefine default jungle leaves for same
if moretrees.enable_default_leafdecay then if moretrees.enable_default_leafdecay then
new_default_jungleleaves.groups = {snappy=3, flammable=2, leaves=1} minetest.override_item("default:jungleleaves", {
groups = { snappy = 3, flammable = 2, leaves = 1 }
})
end end
if moretrees.plantlike_leaves then if moretrees.plantlike_leaves then
new_default_jungleleaves.inventory_image = minetest.inventorycube("default_jungleleaves.png") minetest.override_item("default:jungleleaves", {
new_default_jungleleaves.drawtype = "plantlike" inventory_image = minetest.inventorycube("default_jungleleaves.png"),
new_default_jungleleaves.visual_scale = moretrees_plantlike_leaves_visual_scale drawtype = "plantlike",
new_default_jungleleaves.tiles = {"default_jungleleaves_plantlike.png"} visual_scale = 1.189,
tiles = { "default_jungleleaves_plantlike.png" }
})
else else
new_default_jungleleaves.waving = 1 minetest.override_item("default:jungleleaves", {
end waving = 1
if moretrees.enable_default_leafdecay or moretrees.plantlike_leaves then })
minetest.register_node(":default:jungleleaves", new_default_jungleleaves)
end end
for i in ipairs(moretrees.treelist) do for i in ipairs(moretrees.treelist) do
@ -348,9 +356,9 @@ minetest.register_node("moretrees:fir_leaves_bright", {
}) })
if moretrees.enable_redefine_apple then if moretrees.enable_redefine_apple then
local new_default_apple = moretrees:clone_node("default:apple") minetest.override_item("default:apple",
new_default_apple.groups.attached_node = 1 {groups = { fleshy=3, dig_immediate=3, flammable=2, leafdecay=3, leafdecay_drop=1, attached_node = 1}
minetest.register_node(":default:apple", new_default_apple) })
end end
table.insert(moretrees.avoidnodes, "default:jungletree") table.insert(moretrees.avoidnodes, "default:jungletree")