summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-07-30 14:53:27 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-07-30 14:53:27 -0400
commitbb1b668f8f1ad71aac4c2a44a70a2b42a89e1a03 (patch)
tree1ee48a3dd6917a7f8fb66f648fa62705ad156543
parent8581d3654eb9fc7162e5824f3d9de3d196b14139 (diff)
phase out the old clone_node call. use minetest.override_item() instead.
-rw-r--r--init.lua11
-rw-r--r--node_defs.lua74
2 files changed, 41 insertions, 44 deletions
diff --git a/init.lua b/init.lua
index 17a2a2c..2cb048b 100644
--- a/init.lua
+++ b/init.lua
@@ -60,17 +60,6 @@ else
moretrees.expect_infinite_stacks = true
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
moretrees.cutting_tools = {
diff --git a/node_defs.lua b/node_defs.lua
index 682e0c3..ba73e91 100644
--- a/node_defs.lua
+++ b/node_defs.lua
@@ -38,37 +38,45 @@ if moretrees.plantlike_leaves then
moretrees_plantlike_leaves_visual_scale = 1.189
end
-local new_default_leaves = moretrees:clone_node("default:leaves")
- if moretrees.enable_default_leafdecay then
- new_default_leaves.groups = {snappy=3, flammable=2, leaves=1}
- end
- if moretrees.plantlike_leaves then
- new_default_leaves.inventory_image = minetest.inventorycube("default_leaves.png")
- new_default_leaves.drawtype = "plantlike"
- new_default_leaves.visual_scale = moretrees_plantlike_leaves_visual_scale
- new_default_leaves.tiles = {"default_leaves_plantlike.png"}
- else
- new_default_leaves.waving = 1
- end
- if moretrees.enable_default_leafdecay or moretrees.plantlike_leaves then
- minetest.register_node(":default:leaves", new_default_leaves)
- end
+-- redefine default leaves to handle plantlike and/or leaf decay options
-local new_default_jungleleaves = moretrees:clone_node("default:jungleleaves")
- if moretrees.enable_default_leafdecay then
- new_default_jungleleaves.groups = {snappy=3, flammable=2, leaves=1}
- end
- if moretrees.plantlike_leaves then
- new_default_jungleleaves.inventory_image = minetest.inventorycube("default_jungleleaves.png")
- new_default_jungleleaves.drawtype = "plantlike"
- new_default_jungleleaves.visual_scale = moretrees_plantlike_leaves_visual_scale
- new_default_jungleleaves.tiles = {"default_jungleleaves_plantlike.png"}
- else
- new_default_jungleleaves.waving = 1
- end
- if moretrees.enable_default_leafdecay or moretrees.plantlike_leaves then
- minetest.register_node(":default:jungleleaves", new_default_jungleleaves)
- end
+if moretrees.enable_default_leafdecay then
+ minetest.override_item("default:leaves", {
+ groups = { snappy = 3, flammable = 2, leaves = 1 }
+ })
+end
+if moretrees.plantlike_leaves then
+ minetest.override_item("default:leaves", {
+ inventory_image = minetest.inventorycube("default_leaves.png"),
+ drawtype = "plantlike",
+ visual_scale = 1.189,
+ tiles = { "default_leaves_plantlike.png" }
+ })
+else
+ minetest.override_item("default:leaves", {
+ waving = 1
+ })
+end
+
+-- redefine default jungle leaves for same
+
+if moretrees.enable_default_leafdecay then
+ minetest.override_item("default:jungleleaves", {
+ groups = { snappy = 3, flammable = 2, leaves = 1 }
+ })
+end
+if moretrees.plantlike_leaves then
+ minetest.override_item("default:jungleleaves", {
+ inventory_image = minetest.inventorycube("default_jungleleaves.png"),
+ drawtype = "plantlike",
+ visual_scale = 1.189,
+ tiles = { "default_jungleleaves_plantlike.png" }
+ })
+else
+ minetest.override_item("default:jungleleaves", {
+ waving = 1
+ })
+end
for i in ipairs(moretrees.treelist) do
local treename = moretrees.treelist[i][1]
@@ -348,9 +356,9 @@ minetest.register_node("moretrees:fir_leaves_bright", {
})
if moretrees.enable_redefine_apple then
- local new_default_apple = moretrees:clone_node("default:apple")
- new_default_apple.groups.attached_node = 1
- minetest.register_node(":default:apple", new_default_apple)
+ minetest.override_item("default:apple",
+ {groups = { fleshy=3, dig_immediate=3, flammable=2, leafdecay=3, leafdecay_drop=1, attached_node = 1}
+ })
end
table.insert(moretrees.avoidnodes, "default:jungletree")