Made it possible via moretrees config to force all moretrees, default, and
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Thu, 14 Nov 2013 23:05:37 +0000 (18:05 -0500)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Thu, 14 Nov 2013 23:05:37 +0000 (18:05 -0500)
default jungle tree leaves to be plantlike drawtype.

The default setting is now plantlike.  Change moretres_settings.txt in
your world folder if you don't like it.

Rearranged a bit of code to accommodate this.

21 files changed:
default_settings.txt
init.lua
leafdecay.lua
node_defs.lua
textures/default_jungleleaves_plantlike.png [new file with mode: 0644]
textures/default_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_apple_tree_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_beech_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_birch_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_fir_leaves_bright_plantlike.png [new file with mode: 0644]
textures/moretrees_fir_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_jungletree_leaves_green_plantlike.png [new file with mode: 0644]
textures/moretrees_jungletree_leaves_red_plantlike.png [new file with mode: 0644]
textures/moretrees_jungletree_leaves_yellow_plantlike.png [new file with mode: 0644]
textures/moretrees_oak_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_palm_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_pine_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_rubber_tree_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_sequoia_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_spruce_leaves_plantlike.png [new file with mode: 0644]
textures/moretrees_willow_leaves_plantlike.png [new file with mode: 0644]

index 6b0a1c8c710c62dcc788069f525c681af4b567eb..5b82a4e81fe1a26222df9d8aabf7b0840ba0bec1 100644 (file)
@@ -26,6 +26,12 @@ moretrees.spawn_saplings             = true
 
 moretrees.enable_stairsplus            = true
 
+-- Set this to false if you don't like the plantlike drawtype for leaves
+-- (this is done to improve peoples' framerates without resorting to making 
+-- leaf nodes opaque).  Affects default leaves and default jungle leaves also.
+
+moretrees.plantlike_leaves             = true
+
 -- Set this to true to enable leaf decay of all trees except the default ones.
 
 moretrees.enable_leafdecay             = true
index dc7d73397d61b3f7c517c74609ba14771efe0c4e..d9a5f6b4c161d5b6a7d21320531131ffc50b0307 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -39,7 +39,7 @@ if io.open(worldpath.."/moretrees_settings.txt","r") == nil then
                end
                io.write(block)
        end
-
+       io.close()
 else
        dofile(worldpath.."/moretrees_settings.txt")
 end
@@ -63,6 +63,17 @@ 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 = {
index f77f8ddc4f40af2029ad1a691e4a50a0bc1b4a45..3bce131524a13fc46186f4a661e57088c218c0aa 100644 (file)
@@ -1,14 +1,5 @@
 -- leaf decay
 
-function clone_node(name)
-       node2={}
-       node=minetest.registered_nodes[name]
-       for k,v in pairs(node) do
-               node2[k]=v
-       end
-       return node2
-end
-
 -- this function is based on the default leafdecay code
 local process_drops = function(pos, name)
        local drops = minetest.get_node_drops(name)
@@ -85,10 +76,6 @@ end
 
 if moretrees.enable_default_leafdecay then
 
-       new_default_leaves = clone_node("default:leaves")
-       new_default_leaves.groups = {snappy=3, flammable=2, leaves=1}
-       minetest.register_node(":default:leaves", new_default_leaves)
-
        minetest.register_abm({
                nodenames = "default:leaves",
                interval = moretrees.default_leafdecay_delay,
@@ -105,10 +92,6 @@ end
 
 if moretrees.enable_default_jungle_leafdecay then
 
-       new_default_jungle_leaves = clone_node("default:jungleleaves")
-       new_default_jungle_leaves.groups = {snappy=3, flammable=2, leaves=1}
-       minetest.register_node(":default:jungleleaves", new_default_jungle_leaves)
-
        minetest.register_abm({
                nodenames = "default:jungleleaves",
                interval = moretrees.default_jungle_leafdecay_delay,
index e0b231cba3b6410681e6a6a32444f203af089056..6d586e07c8d2f255e9c0802bc07c26600c886191 100644 (file)
@@ -19,6 +19,35 @@ local dirs1 = { 21, 20, 23, 22, 21 }
 local dirs2 = { 12, 9, 18, 7, 12 }
 local dirs3 = { 14, 11, 16, 5, 14 }
 
+moretrees_new_leaves_drawtype = "allfaces_optional"
+moretrees_new_leaves_visual_scale = 1.0
+moretrees_new_leaves_extension = ".png"
+
+if moretrees.plantlike_leaves then
+       moretrees_new_leaves_drawtype = "plantlike"
+       moretrees_new_leaves_visual_scale = 1.189
+       moretrees_new_leaves_extension = "_plantlike.png"
+end
+
+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
+       new_default_leaves.drawtype = moretrees_new_leaves_drawtype
+       new_default_leaves.visual_scale = moretrees_new_leaves_visual_scale
+       new_default_leaves.tiles = {"default_leaves"..moretrees_new_leaves_extension}
+       minetest.register_node(":default:leaves", new_default_leaves)
+
+new_default_jungle_leaves = clone_node("default:jungleleaves")
+       if moretrees.enable_default_jungle_leafdecay then
+       new_default_jungle_leaves.groups = {snappy=3, flammable=2, leaves=1}
+       end
+       new_default_jungle_leaves = moretrees:clone_node("default:jungleleaves")
+       new_default_jungle_leaves.drawtype = moretrees_new_leaves_drawtype
+       new_default_jungle_leaves.visual_scale = moretrees_new_leaves_visual_scale
+       new_default_jungle_leaves.tiles = {"default_jungleleaves"..moretrees_new_leaves_extension}
+       minetest.register_node(":default:jungleleaves", new_default_jungle_leaves)
+
 for i in ipairs(moretrees.treelist) do
        local treename = moretrees.treelist[i][1]
        local treedesc = moretrees.treelist[i][2]
@@ -103,8 +132,9 @@ for i in ipairs(moretrees.treelist) do
 
                minetest.register_node("moretrees:"..treename.."_leaves", {
                        description = treedesc.." Leaves",
-                       drawtype = "allfaces_optional",
-                       tiles = { "moretrees_"..treename.."_leaves.png" },
+                       drawtype = moretrees_new_leaves_drawtype,
+                       visual_scale = moretrees_new_leaves_visual_scale,
+                       tiles = { "moretrees_"..treename.."_leaves"..moretrees_new_leaves_extension },
                        paramtype = "light",
                        groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1},
                        sounds = default.node_sound_leaves_defaults(),
@@ -308,8 +338,9 @@ for color = 1, 3 do
        local leave_name = "moretrees:jungletree_leaves_"..jungleleaves[color]
        minetest.register_node(leave_name, {
                description = "Jungle Tree Leaves ("..jungleleavesnames[color]..")",
-               drawtype = "allfaces_optional",
-               tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..".png"},
+               drawtype = moretrees_new_leaves_drawtype,
+               visual_scale = moretrees_new_leaves_visual_scale,
+               tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..moretrees_new_leaves_extension},
                paramtype = "light",
                groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1},
                drop = {
@@ -326,9 +357,10 @@ end
 -- Extra needles for firs
 
 minetest.register_node("moretrees:fir_leaves_bright", {
-       drawtype = "allfaces_optional",
+       drawtype = moretrees_new_leaves_drawtype,
+       visual_scale = moretrees_new_leaves_visual_scale,
        description = "Douglas Fir Leaves (Bright)",
-       tile_images = { "moretrees_fir_leaves_bright.png" },
+       tile_images = { "moretrees_fir_leaves_bright"..moretrees_new_leaves_extension },
        paramtype = "light",
 
        groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1 },
diff --git a/textures/default_jungleleaves_plantlike.png b/textures/default_jungleleaves_plantlike.png
new file mode 100644 (file)
index 0000000..d7cac73
Binary files /dev/null and b/textures/default_jungleleaves_plantlike.png differ
diff --git a/textures/default_leaves_plantlike.png b/textures/default_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..6786a03
Binary files /dev/null and b/textures/default_leaves_plantlike.png differ
diff --git a/textures/moretrees_apple_tree_leaves_plantlike.png b/textures/moretrees_apple_tree_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..f333fd0
Binary files /dev/null and b/textures/moretrees_apple_tree_leaves_plantlike.png differ
diff --git a/textures/moretrees_beech_leaves_plantlike.png b/textures/moretrees_beech_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..6786a03
Binary files /dev/null and b/textures/moretrees_beech_leaves_plantlike.png differ
diff --git a/textures/moretrees_birch_leaves_plantlike.png b/textures/moretrees_birch_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..5c85e3d
Binary files /dev/null and b/textures/moretrees_birch_leaves_plantlike.png differ
diff --git a/textures/moretrees_fir_leaves_bright_plantlike.png b/textures/moretrees_fir_leaves_bright_plantlike.png
new file mode 100644 (file)
index 0000000..96bab2f
Binary files /dev/null and b/textures/moretrees_fir_leaves_bright_plantlike.png differ
diff --git a/textures/moretrees_fir_leaves_plantlike.png b/textures/moretrees_fir_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..05c93ee
Binary files /dev/null and b/textures/moretrees_fir_leaves_plantlike.png differ
diff --git a/textures/moretrees_jungletree_leaves_green_plantlike.png b/textures/moretrees_jungletree_leaves_green_plantlike.png
new file mode 100644 (file)
index 0000000..89da8c6
Binary files /dev/null and b/textures/moretrees_jungletree_leaves_green_plantlike.png differ
diff --git a/textures/moretrees_jungletree_leaves_red_plantlike.png b/textures/moretrees_jungletree_leaves_red_plantlike.png
new file mode 100644 (file)
index 0000000..d13ce69
Binary files /dev/null and b/textures/moretrees_jungletree_leaves_red_plantlike.png differ
diff --git a/textures/moretrees_jungletree_leaves_yellow_plantlike.png b/textures/moretrees_jungletree_leaves_yellow_plantlike.png
new file mode 100644 (file)
index 0000000..06cf566
Binary files /dev/null and b/textures/moretrees_jungletree_leaves_yellow_plantlike.png differ
diff --git a/textures/moretrees_oak_leaves_plantlike.png b/textures/moretrees_oak_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..e860166
Binary files /dev/null and b/textures/moretrees_oak_leaves_plantlike.png differ
diff --git a/textures/moretrees_palm_leaves_plantlike.png b/textures/moretrees_palm_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..dd410d1
Binary files /dev/null and b/textures/moretrees_palm_leaves_plantlike.png differ
diff --git a/textures/moretrees_pine_leaves_plantlike.png b/textures/moretrees_pine_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..c0334fb
Binary files /dev/null and b/textures/moretrees_pine_leaves_plantlike.png differ
diff --git a/textures/moretrees_rubber_tree_leaves_plantlike.png b/textures/moretrees_rubber_tree_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..0ac8a8b
Binary files /dev/null and b/textures/moretrees_rubber_tree_leaves_plantlike.png differ
diff --git a/textures/moretrees_sequoia_leaves_plantlike.png b/textures/moretrees_sequoia_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..88b292c
Binary files /dev/null and b/textures/moretrees_sequoia_leaves_plantlike.png differ
diff --git a/textures/moretrees_spruce_leaves_plantlike.png b/textures/moretrees_spruce_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..05c93ee
Binary files /dev/null and b/textures/moretrees_spruce_leaves_plantlike.png differ
diff --git a/textures/moretrees_willow_leaves_plantlike.png b/textures/moretrees_willow_leaves_plantlike.png
new file mode 100644 (file)
index 0000000..49ad834
Binary files /dev/null and b/textures/moretrees_willow_leaves_plantlike.png differ