From 829c69c351f2bf40883ec11bbb24894f991ee67e Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Wed, 30 Jul 2014 12:39:43 -0400 Subject: [PATCH] make nature_classic aware of moretrees If moretrees is not present, nature_classic spawns blossoms and eventually apples on default trees, as it always has. If moretrees IS present, the code will only spawn apple blossoms on moretrees' own apple tree leaves, and will only grow new apples on those trees, not on default trees. In this case, the nature:blossom node is considered deprecated and is aliased to default:leaves to avoid causing undefined nodes in old maps. --- nature_classic/blossom.lua | 21 +++++++++++++++------ nature_classic/depends.txt | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/nature_classic/blossom.lua b/nature_classic/blossom.lua index 4011419..2f1a490 100644 --- a/nature_classic/blossom.lua +++ b/nature_classic/blossom.lua @@ -1,8 +1,18 @@ -- Blossom +local BLOSSOM_NODE = "nature:blossom" +local BLOSSOM_LEAVES = "default:leaves" +local BLOSSOM_TEXTURES = { "default_leaves.png^nature_blossom.png" } + +if minetest.get_modpath("moretrees") then + BLOSSOM_NODE = "moretrees:apple_blossoms" + BLOSSOM_LEAVES = "moretrees:apple_tree_leaves" + BLOSSOM_TEXTURES = { "moretrees_apple_tree_leaves.png^nature_blossom.png" } + minetest.register_alias("nature:blossom", "default:leaves") +end + local BLOSSOM_CHANCE = 15 local BLOSSOM_DELAY = 3600 -local BLOSSOM_NODE = "nature:blossom" local APPLE_CHANCE = 10 local APPLE_SPREAD = 2 @@ -19,13 +29,12 @@ local function spawn_apple_under(pos) end minetest.register_node(":"..BLOSSOM_NODE, { - description = "Blossom", + description = "Apple blossoms", drawtype = "allfaces_optional", - tiles = { "default_leaves.png^nature_blossom.png" }, + tiles = BLOSSOM_TEXTURES, paramtype = "light", groups = { snappy = 3, leafdecay = 3, flammable = 2 }, sounds = default.node_sound_leaves_defaults(), - drop = BLOSSOM_NODE, waving = 1 }) @@ -37,7 +46,7 @@ minetest.register_craft({ -- Blossoming minetest.register_abm({ - nodenames = { "default:leaves" }, + nodenames = { BLOSSOM_LEAVES }, interval = BLOSSOM_DELAY, chance = BLOSSOM_CHANCE, @@ -55,7 +64,7 @@ minetest.register_abm({ chance = BLOSSOM_CHANCE, action = function(pos, node, active_object_count, active_object_count_wider) - nature:grow_node(pos, "default:leaves") + nature:grow_node(pos, BLOSSOM_LEAVES) end }) diff --git a/nature_classic/depends.txt b/nature_classic/depends.txt index 4ad96d5..1246684 100644 --- a/nature_classic/depends.txt +++ b/nature_classic/depends.txt @@ -1 +1,2 @@ default +moretrees?