Compare commits
2 commits
ccb9a27827
...
2be4ed8f8a
Author | SHA1 | Date | |
---|---|---|---|
|
2be4ed8f8a | ||
|
388a447331 |
5 changed files with 48 additions and 25 deletions
|
@ -8,7 +8,7 @@ This mod causes fruits on trees from other mods to regrow like apples in the 5.0
|
||||||
|
|
||||||
Cool_trees modpack, ethereal, farming_plus and moretrees are supported, but maybe there are other mods with this problem that I don't know about. Please tell me in the Minetest Forum topic!
|
Cool_trees modpack, ethereal, farming_plus and moretrees are supported, but maybe there are other mods with this problem that I don't know about. Please tell me in the Minetest Forum topic!
|
||||||
|
|
||||||
There is also the possibility to enable regrowing apples in Minetest Settings. Notice that this is only necessary for older versions than MT 5.0.
|
Apples in older versions than Minetest 5.0 will also regrow.
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
----
|
----
|
||||||
|
|
13
depends.txt
13
depends.txt
|
@ -1,13 +0,0 @@
|
||||||
default
|
|
||||||
ethereal?
|
|
||||||
cherrytree?
|
|
||||||
chestnuttree?
|
|
||||||
clementinetree?
|
|
||||||
ebony?
|
|
||||||
lemontree?
|
|
||||||
oak?
|
|
||||||
palm?
|
|
||||||
plumtree?
|
|
||||||
pomegranate?
|
|
||||||
moretrees?
|
|
||||||
farming_plus?
|
|
55
init.lua
55
init.lua
|
@ -1,5 +1,3 @@
|
||||||
local regrowing_apples = minetest.settings:get_bool("regrowing_apples", true)
|
|
||||||
|
|
||||||
local add_fruit_regrowable = function(fruit, node, leaves)
|
local add_fruit_regrowable = function(fruit, node, leaves)
|
||||||
|
|
||||||
-- check if node exists
|
-- check if node exists
|
||||||
|
@ -7,6 +5,42 @@ local add_fruit_regrowable = function(fruit, node, leaves)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- make sure cacao pod from cool_trees isn't placed by player
|
||||||
|
if node == "cacaotree:pod" then
|
||||||
|
minetest.register_node("regrowing_fruits:cacao", {
|
||||||
|
description = "Cacao Pod",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"cacaotree_bean_top.png",
|
||||||
|
"cacaotree_bean_top.png^[transformFY",
|
||||||
|
"cacaotree_bean_right.png",
|
||||||
|
"cacaotree_bean_right.png^[transformFX",
|
||||||
|
"cacaotree_bean_front.png",
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.25, -0.5, 0, 0.25, 0.0625, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
use_texture_alpha = "clip",
|
||||||
|
drop = "cacaotree:cacao_beans 10",
|
||||||
|
groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
|
||||||
|
leafdecay = 3, leafdecay_drop = 1, not_in_creative_inventory = 1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
walkable = false,
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||||
|
if placer:is_player() and newnode.name == "cacaotree:pod" then
|
||||||
|
minetest.set_node(pos, {name = "regrowing_fruits:cacao", param2 = newnode.param2})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
local groups = node.groups
|
local groups = node.groups
|
||||||
if minetest.get_item_group(node, "attached_node") == 1 then
|
if minetest.get_item_group(node, "attached_node") == 1 then
|
||||||
groups = {fleshy=3, dig_immediate=3, flammable=2, leafdecay = 1, leafdecay_drop = 1}
|
groups = {fleshy=3, dig_immediate=3, flammable=2, leafdecay = 1, leafdecay_drop = 1}
|
||||||
|
@ -24,8 +58,10 @@ local add_fruit_regrowable = function(fruit, node, leaves)
|
||||||
end,
|
end,
|
||||||
on_dig = minetest.node_dig, -- override on_dig functions causing regrowth not to work
|
on_dig = minetest.node_dig, -- override on_dig functions causing regrowth not to work
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
if oldnode.param2 == 0 and oldnode.name ~= "plumtree:plum" or oldnode.name == "plumtree:plum" and oldnode.param2 == 1 then
|
if oldnode.param2 == 0 and oldnode.name ~= "plumtree:plum"
|
||||||
minetest.set_node(pos, {name = "regrowing_fruits:"..fruit.."_mark"})
|
or oldnode.name == "plumtree:plum" and oldnode.param2 == 1
|
||||||
|
or oldnode.name == "cacaotree:pod" then
|
||||||
|
minetest.set_node(pos, {name = "regrowing_fruits:"..fruit.."_mark", param2 = oldnode.param2})
|
||||||
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -48,8 +84,8 @@ local add_fruit_regrowable = function(fruit, node, leaves)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
elseif minetest.get_node_light(pos) < 13 then
|
elseif minetest.get_node_light(pos) < 13 then
|
||||||
minetest.get_node_timer(pos):start(200)
|
minetest.get_node_timer(pos):start(200)
|
||||||
elseif node == "plumtree:plum" then
|
elseif node == "cacaotree:pod" or node == "plumtree:plum" then
|
||||||
minetest.set_node(pos, {name = node, param2 = 1})
|
minetest.set_node(pos, {name = node, param2 = minetest.get_node(pos).param2})
|
||||||
else
|
else
|
||||||
minetest.set_node(pos, {name = node})
|
minetest.set_node(pos, {name = node})
|
||||||
end
|
end
|
||||||
|
@ -58,9 +94,7 @@ local add_fruit_regrowable = function(fruit, node, leaves)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- apples
|
-- apples
|
||||||
if regrowing_apples then
|
add_fruit_regrowable("apple", "default:apple", "default:leaves")
|
||||||
add_fruit_regrowable("apple", "default:apple", "default:leaves")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ethereal
|
-- ethereal
|
||||||
add_fruit_regrowable("banana","ethereal:banana", "ethereal:bananaleaves")
|
add_fruit_regrowable("banana","ethereal:banana", "ethereal:bananaleaves")
|
||||||
|
@ -70,7 +104,8 @@ add_fruit_regrowable("lemon", "ethereal:lemon", "ethereal:lemon_leaves")
|
||||||
add_fruit_regrowable("olive", "ethereal:olive", "ethereal:olive_leaves")
|
add_fruit_regrowable("olive", "ethereal:olive", "ethereal:olive_leaves")
|
||||||
add_fruit_regrowable("orange", "ethereal:orange", "ethereal:orange_leaves")
|
add_fruit_regrowable("orange", "ethereal:orange", "ethereal:orange_leaves")
|
||||||
|
|
||||||
-- cool_trees TODO: add cacao
|
-- cool_trees
|
||||||
|
add_fruit_regrowable("cacao", "cacaotree:pod", "cacaotree:trunk") -- use trunk instead of leaves
|
||||||
add_fruit_regrowable("cherry", "cherrytree:cherries", "cherrytree:blossom_leaves")
|
add_fruit_regrowable("cherry", "cherrytree:cherries", "cherrytree:blossom_leaves")
|
||||||
add_fruit_regrowable("chestnut", "chestnuttree:bur", "chestnuttree:leaves")
|
add_fruit_regrowable("chestnut", "chestnuttree:bur", "chestnuttree:leaves")
|
||||||
add_fruit_regrowable("clementine", "clementinetree:clementine", "clementinetree:leaves")
|
add_fruit_regrowable("clementine", "clementinetree:clementine", "clementinetree:leaves")
|
||||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,4 +1,6 @@
|
||||||
name = regrowing_fruits
|
name = regrowing_fruits
|
||||||
author = philipmi
|
author = philipmi
|
||||||
|
depends =
|
||||||
|
optional_depends = default, ethereal, cacaotree, cherrytree, chestnuttree, clementinetree, ebony, lemontree, oak, palm, plumtree, pomegranate, moretrees, farming_plus
|
||||||
description = Fruits on trees from other mods will regrow.
|
description = Fruits on trees from other mods will regrow.
|
||||||
title = Regrowing Fruits
|
title = Regrowing Fruits
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
regrowing_apples (Regrowing apples: unnecessary for MT 5.x) bool false
|
|
Loading…
Reference in a new issue