From 2ae8a32aa368b0962d90ec3a509c5d80df7e6f39 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 14 Aug 2015 11:50:34 -0400 Subject: [PATCH] Use default nodes wherever possible for pines, jungle trees/leaves, acacias --- default_settings.txt | 10 +-- init.lua | 3 +- leafdecay.lua | 6 +- locale/de.txt | 1 - locale/template.txt | 1 - node_defs.lua | 178 +++++++++++++++++-------------------------- saplings.lua | 2 +- tree_models.lua | 10 +-- 8 files changed, 85 insertions(+), 126 deletions(-) diff --git a/default_settings.txt b/default_settings.txt index 63dfa39..16fca9d 100644 --- a/default_settings.txt +++ b/default_settings.txt @@ -17,8 +17,8 @@ moretrees.enable_fir = true moretrees.enable_beech = false -- set this to true to make moretrees spawn saplings at mapgen time instead --- of fully-grown trees, which will grow into full trees very quickly. With --- older versions of biome_lib, doing this will reduce mapgen lag. +-- of fully-grown trees, which will grow into full trees after a very short +-- delay. This reduces mapgen lag in some situations. moretrees.spawn_saplings = false @@ -43,16 +43,12 @@ moretrees.enable_leafdecay = true moretrees.enable_redefine_apple = true --- various settings to configure default and default-jungle leaf decay. +-- various settings to configure leaf decay. moretrees.leafdecay_delay = 2 moretrees.leafdecay_chance = 100 moretrees.leafdecay_radius = 5 -moretrees.default_jungle_leafdecay_delay = 2 -moretrees.default_jungle_leafdecay_chance = 100 -moretrees.default_jungle_leafdecay_radius = 5 - moretrees.palm_leafdecay_radius = 15 moretrees.default_leafdecay_delay = 3 diff --git a/init.lua b/init.lua index 6bbf133..0fe676f 100644 --- a/init.lua +++ b/init.lua @@ -13,8 +13,7 @@ -- by RealBadAngel. -- -- License: WTFPL for all parts (code and textures, including those copied --- from the jungletree and conifers mods) except the default jungle tree trunk --- texture, which is CC-By-SA. +-- from the the old jungletree and conifers mods). moretrees = {} diff --git a/leafdecay.lua b/leafdecay.lua index 26851a1..272192c 100644 --- a/leafdecay.lua +++ b/leafdecay.lua @@ -19,7 +19,7 @@ end if moretrees.enable_leafdecay then for i in ipairs(moretrees.treelist) do local treename = moretrees.treelist[i][1] - if treename ~= "jungletree" and treename ~= "pine" and treename ~= acacia and treename ~= "fir" and treename ~= "palm" then + if treename ~= "jungletree" and treename ~= "pine" and treename ~= "acacia" and treename ~= "fir" and treename ~= "palm" then minetest.register_abm({ nodenames = "moretrees:"..treename.."_leaves", interval = moretrees.leafdecay_delay, @@ -35,11 +35,11 @@ if moretrees.enable_leafdecay then end minetest.register_abm({ - nodenames = {"moretrees:jungletree_leaves_red","moretrees:jungletree_leaves_green","moretrees:jungletree_leaves_yellow"}, + nodenames = {"default:jungleleaves", "moretrees:jungletree_leaves_red", "moretrees:jungletree_leaves_yellow"}, interval = moretrees.leafdecay_delay, chance = moretrees.leafdecay_chance, action = function(pos, node, active_object_count, active_object_count_wider) - if minetest.find_node_near(pos, moretrees.leafdecay_radius, {"ignore", "default:jungletree", "moretrees:jungletree_trunk"}) then return end + if minetest.find_node_near(pos, moretrees.leafdecay_radius, {"ignore", "default:jungletree"}) then return end process_drops(pos, node.name) minetest.remove_node(pos) nodeupdate(pos) diff --git a/locale/de.txt b/locale/de.txt index b01b1db..cab8d6f 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -65,7 +65,6 @@ Spruce Cone = Fichtenzapfen Pine Cone = Kiefernzapfen Fir Cone = Tannenzapfen Jungle Sapling = Tropenbaumsetzling -Jungle Tree Leaves (Green) = Tropenbaumlaub (gruen) Jungle Tree Leaves (Yellow) = Tropenbaumlaub (gelb) Jungle Tree Leaves (Red) = Tropenbaumlaub (rot) Douglas Fir Leaves (Bright) = Douglasiennadeln (breit) diff --git a/locale/template.txt b/locale/template.txt index 5f4bc32..8c167f5 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -65,7 +65,6 @@ Spruce Cone = Pine Cone = Fir Cone = Jungle Sapling = -Jungle Tree Leaves (Green) = Jungle Tree Leaves (Yellow) = Jungle Tree Leaves (Red) = Douglas Fir Leaves (Bright) = diff --git a/node_defs.lua b/node_defs.lua index c49cf7c..35fb1d4 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -5,17 +5,18 @@ moretrees.avoidnodes = {} moretrees.treelist = { {"beech", "Beech Tree"}, {"apple_tree", "Apple Tree"}, - {"oak", "Oak Tree", "acorn", "Acorn", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, + {"oak", "Oak Tree", "acorn", "Acorn", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, {"sequoia", "Giant Sequoia"}, {"birch", "Birch Tree"}, - {"palm", "Palm Tree", "coconut", "Coconut", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 1.0 }, - {"spruce", "Spruce Tree", "spruce_cone", "Spruce Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, - {"pine", "Pine Tree", "pine_cone", "Pine Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, + {"palm", "Palm Tree", "coconut", "Coconut", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 1.0 }, + {"spruce", "Spruce Tree", "spruce_cone", "Spruce Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, {"willow", "Willow Tree"}, - {"acacia", "Acacia Tree"}, {"rubber_tree", "Rubber Tree"}, - {"jungletree", "Jungle Tree"}, - {"fir", "Douglas Fir", "fir_cone", "Fir Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, + {"fir", "Douglas Fir", "fir_cone", "Fir Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, + + {"jungletree", "Jungle Tree", nil, nil, nil, nil, "default_junglesapling.png" }, + {"pine", "Pine Tree", "pine_cone", "Pine Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8, "default_pine_sapling.png" }, + {"acacia", "Acacia Tree", nil, nil, nil, nil, "default_acacia_sapling.png" }, } local dirs1 = { 21, 20, 23, 22, 21 } @@ -75,6 +76,7 @@ for i in ipairs(moretrees.treelist) do local fruitdesc = moretrees.treelist[i][4] local selbox = moretrees.treelist[i][5] local vscale = moretrees.treelist[i][6] + local saptext = moretrees.treelist[i][7] or "moretrees_"..treename.."_sapling.png" if treename ~= "jungletree" -- the default game provides jungle tree, acacia, and pine trunk/planks nodes. and treename ~= "acacia" @@ -105,8 +107,8 @@ for i in ipairs(moretrees.treelist) do minetest.register_node("moretrees:"..treename.."_sapling", { description = S(treedesc.." Sapling"), drawtype = "plantlike", - tiles = {"moretrees_"..treename.."_sapling.png"}, - inventory_image = "moretrees_"..treename.."_sapling.png", + tiles = {saptex}, + inventory_image = saptex, paramtype = "light", paramtype2 = "waving", walkable = false, @@ -118,28 +120,10 @@ for i in ipairs(moretrees.treelist) do sounds = default.node_sound_defaults(), }) - minetest.register_node("moretrees:"..treename.."_sapling_ongen", { - description = S(treedesc.." Sapling"), - drawtype = "plantlike", - tiles = {"moretrees_"..treename.."_sapling.png"}, - inventory_image = "moretrees_"..treename.."_sapling.png", - paramtype = "light", - paramtype2 = "waving", - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} - }, - groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,not_in_creative_inventory=1,sapling=1}, - sounds = default.node_sound_defaults(), - drop = "moretrees:"..treename.."_sapling" - }) - -- player will get a sapling with 1/100 chance -- player will get leaves only if he/she gets no saplings, -- this is because max_items is 1 - local droprarity = 100 if treename == "palm" then @@ -235,6 +219,23 @@ for i in ipairs(moretrees.treelist) do end end + minetest.register_node("moretrees:"..treename.."_sapling_ongen", { + description = S(treedesc.." Sapling"), + drawtype = "plantlike", + tiles = {saptext}, + inventory_image = saptext, + paramtype = "light", + paramtype2 = "waving", + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + }, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,not_in_creative_inventory=1,sapling=1}, + sounds = default.node_sound_defaults(), + drop = "moretrees:"..treename.."_sapling" + }) + if fruit then minetest.register_node("moretrees:"..fruit, { description = S(fruitdesc), @@ -276,46 +277,9 @@ end -- Extra nodes for jungle trees: -minetest.register_node("moretrees:jungletree_sapling", { - description = S("Jungle Sapling"), - drawtype = "plantlike", - visual_scale = 1.0, - tiles = {"default_junglesapling.png"}, - inventory_image = "default_junglesapling.png", - wield_image = "default_junglesapling.png", - paramtype = "light", - paramtype2 = "waving", - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} - }, - groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}, - sounds = default.node_sound_leaves_defaults(), -}) - -minetest.register_node("moretrees:jungletree_sapling_ongen", { - description = S("Jungle Sapling"), - drawtype = "plantlike", - visual_scale = 1.0, - tiles = {"default_junglesapling.png"}, - inventory_image = "default_junglesapling.png", - wield_image = "default_junglesapling.png", - paramtype = "light", - paramtype2 = "waving", - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} - }, - groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,not_in_creative_inventory=1,sapling=1}, - sounds = default.node_sound_leaves_defaults(), - drop = "moretrees:jungletree_sapling" -}) - -local jungleleaves = {"green","yellow","red"} -local jungleleavesnames = {"Green", "Yellow", "Red"} -for color = 1, 3 do +local jungleleaves = {"yellow","red"} +local jungleleavesnames = {"Yellow", "Red"} +for color = 1, #jungleleaves do local leave_name = "moretrees:jungletree_leaves_"..jungleleaves[color] local moretrees_leaves_inventory_image = nil @@ -338,7 +302,7 @@ for color = 1, 3 do drop = { max_items = 1, items = { - {items = {'moretrees:jungletree_sapling'}, rarity = 100 }, + {items = {"default:junglesapling"}, rarity = 100 }, {items = {"moretrees:jungletree_leaves_"..jungleleaves[color]} } } }, @@ -380,15 +344,16 @@ if moretrees.enable_redefine_apple then end table.insert(moretrees.avoidnodes, "default:jungletree") -table.insert(moretrees.avoidnodes, "moretrees:jungletree_trunk") +table.insert(moretrees.avoidnodes, "default:pine_tree") +table.insert(moretrees.avoidnodes, "default:acacia_tree") table.insert(moretrees.avoidnodes, "moretrees:fir_trunk") table.insert(moretrees.avoidnodes, "default:tree") if moretrees.spawn_saplings then table.insert(moretrees.avoidnodes, "snow:sapling_pine") table.insert(moretrees.avoidnodes, "default:junglesapling") - table.insert(moretrees.avoidnodes, "moretrees:jungle_tree_sapling") - table.insert(moretrees.avoidnodes, "moretrees:jungle_tree_sapling_ongen") + table.insert(moretrees.avoidnodes, "default:pine_sapling") + table.insert(moretrees.avoidnodes, "default:acacia_sapling") end -- "empty" (tapped) rubber tree nodes @@ -418,47 +383,48 @@ minetest.register_abm({ end, }) --- For compatibility with old nodes and recently-changed nodes. +-- For compatibility with old nodes, recently-changed nodes, and default nodes -minetest.register_alias("technic:rubber_tree_full", "moretrees:rubber_tree_trunk") -minetest.register_alias("farming_plus:rubber_tree_full", "moretrees:rubber_tree_trunk") -minetest.register_alias("farming:rubber_tree_full", "moretrees:rubber_tree_trunk") +minetest.register_alias("technic:rubber_tree_full", "moretrees:rubber_tree_trunk") +minetest.register_alias("farming_plus:rubber_tree_full", "moretrees:rubber_tree_trunk") +minetest.register_alias("farming:rubber_tree_full", "moretrees:rubber_tree_trunk") -minetest.register_alias("technic:rubber_leaves", "moretrees:rubber_tree_leaves") -minetest.register_alias("farming_plus:rubber_leaves", "moretrees:rubber_tree_leaves") -minetest.register_alias("farming:rubber_leaves", "moretrees:rubber_tree_leaves") +minetest.register_alias("technic:rubber_leaves", "moretrees:rubber_tree_leaves") +minetest.register_alias("farming_plus:rubber_leaves", "moretrees:rubber_tree_leaves") +minetest.register_alias("farming:rubber_leaves", "moretrees:rubber_tree_leaves") -minetest.register_alias("technic:rubber_tree_sapling", "moretrees:rubber_tree_sapling") -minetest.register_alias("farming_plus:rubber_sapling", "moretrees:rubber_tree_sapling") -minetest.register_alias("farming:rubber_sapling", "moretrees:rubber_tree_sapling") +minetest.register_alias("technic:rubber_tree_sapling", "moretrees:rubber_tree_sapling") +minetest.register_alias("farming_plus:rubber_sapling", "moretrees:rubber_tree_sapling") +minetest.register_alias("farming:rubber_sapling", "moretrees:rubber_tree_sapling") -minetest.register_alias("default:junglesapling","moretrees:jungletree_sapling") -minetest.register_alias("moretrees:jungletree_trunk_sideways", "moreblocks:horizontal_jungle_tree") -minetest.register_alias("moretrees:jungletree_trunk", "default:jungletree") -minetest.register_alias("moretrees:jungletree_planks", "default:junglewood") +minetest.register_alias("moretrees:conifer_trunk", "moretrees:fir_trunk") +minetest.register_alias("moretrees:conifer_trunk_sideways", "moretrees:fir_trunk_sideways") +minetest.register_alias("moretrees:conifer_leaves", "moretrees:fir_leaves") +minetest.register_alias("moretrees:conifer_leaves_bright", "moretrees:fir_leaves_bright") +minetest.register_alias("moretrees:conifer_sapling", "moretrees:fir_sapling") -minetest.register_alias("jungletree:leaves_green", "moretrees:jungletree_leaves_green") -minetest.register_alias("jungletree:leaves_red", "moretrees:jungletree_leaves_red") -minetest.register_alias("jungletree:leaves_yellow", "moretrees:jungletree_leaves_yellow") +minetest.register_alias("conifers:trunk", "moretrees:fir_trunk") +minetest.register_alias("conifers:trunk_reversed", "moretrees:fir_trunk_sideways") +minetest.register_alias("conifers:leaves", "moretrees:fir_leaves") +minetest.register_alias("conifers:leaves_special", "moretrees:fir_leaves_bright") +minetest.register_alias("conifers:sapling", "moretrees:fir_sapling") -minetest.register_alias("moretrees:conifer_trunk", "moretrees:fir_trunk") -minetest.register_alias("moretrees:conifer_trunk_sideways", "moretrees:fir_trunk_sideways") -minetest.register_alias("moretrees:conifer_leaves", "moretrees:fir_leaves") -minetest.register_alias("moretrees:conifer_leaves_bright", "moretrees:fir_leaves_bright") -minetest.register_alias("moretrees:conifer_sapling", "moretrees:fir_sapling") +minetest.register_alias("moretrees:jungletree_sapling", "default:junglesapling") +minetest.register_alias("moretrees:jungletree_trunk_sideways", "moreblocks:horizontal_jungle_tree") +minetest.register_alias("moretrees:jungletree_trunk", "default:jungletree") +minetest.register_alias("moretrees:jungletree_planks", "default:junglewood") +minetest.register_alias("moretrees:jungletree_leaves_green", "default:jungletree_leaves") -minetest.register_alias("conifers:trunk", "moretrees:fir_trunk") -minetest.register_alias("conifers:trunk_reversed", "moretrees:fir_trunk_sideways") -minetest.register_alias("conifers:leaves", "moretrees:fir_leaves") -minetest.register_alias("conifers:leaves_special", "moretrees:fir_leaves_bright") -minetest.register_alias("conifers:sapling", "moretrees:fir_sapling") +minetest.register_alias("jungletree:leaves_green", "default:jungleleaves") +minetest.register_alias("jungletree:leaves_red", "moretrees:jungletree_leaves_red") +minetest.register_alias("jungletree:leaves_yellow", "moretrees:jungletree_leaves_yellow") -minetest.register_alias("moretrees:acacia_trunk", "default:acacia_tree") -minetest.register_alias("moretrees:acacia_planks", "default:acacia_wood") -minetest.register_alias("moretrees:acacia_sapling", "default:acacia_sapling") -minetest.register_alias("moretrees:acacia_leaves", "default:acacia_leaves") +minetest.register_alias("moretrees:acacia_trunk", "default:acacia_tree") +minetest.register_alias("moretrees:acacia_planks", "default:acacia_wood") +minetest.register_alias("moretrees:acacia_sapling", "default:acacia_sapling") +minetest.register_alias("moretrees:acacia_leaves", "default:acacia_leaves") -minetest.register_alias("moretrees:pine_trunk", "default:pinetree") -minetest.register_alias("moretrees:pine_planks", "default:pinewood") -minetest.register_alias("moretrees:pine_sapling", "default:pine_sapling") -minetest.register_alias("moretrees:pine_leaves", "default:pine_needles") +minetest.register_alias("moretrees:pine_trunk", "default:pinetree") +minetest.register_alias("moretrees:pine_planks", "default:pinewood") +minetest.register_alias("moretrees:pine_sapling", "default:pine_sapling") +minetest.register_alias("moretrees:pine_leaves", "default:pine_needles") diff --git a/saplings.lua b/saplings.lua index b34db92..2b40b75 100644 --- a/saplings.lua +++ b/saplings.lua @@ -78,7 +78,7 @@ biome_lib:grow_plants({ biome_lib:grow_plants({ grow_delay = moretrees.sapling_interval, grow_chance = moretrees.sapling_chance, - grow_plant = "moretrees:jungletree_sapling", + grow_plant = "default:junglesapling", grow_nodes = moretrees.jungletree_biome.surface, grow_function = "moretrees:grow_jungletree" }) diff --git a/tree_models.lua b/tree_models.lua index f1cf5a5..f29594a 100644 --- a/tree_models.lua +++ b/tree_models.lua @@ -144,8 +144,8 @@ moretrees.pine_model={ rules_b="[&&&TTT[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]", rules_c="/", rules_d="F", - trunk="moretrees:pine_trunk", - leaves="moretrees:pine_leaves", + trunk="default:pine_tree", + leaves="default:pine_needles", angle=30, iterations=2, random_level=0, @@ -191,8 +191,8 @@ moretrees.acacia_model={ .."GGfffff--G--" .."ffffGGG", rules_c = "/", - trunk="moretrees:acacia_trunk", - leaves="moretrees:acacia_leaves", + trunk="default:acacia_tree", + leaves="default:acacia_leaves", angle=45, iterations=3, random_level=0, @@ -218,7 +218,7 @@ moretrees.jungletree_model={ rules_a=nil, rules_b=nil, trunk="default:jungletree", - leaves="moretrees:jungletree_leaves_green", + leaves="default:jungleleaves", leaves2=nil, leaves2_chance=nil, angle=45,