refactor sapling support checking.
saplings now only check for groups, not specific nodes, when determining whether they are supported. the previously checked nodes are now in the new group that's being checked.
This commit is contained in:
parent
dd796c549e
commit
68e005814f
3 changed files with 7 additions and 3 deletions
|
@ -9,8 +9,10 @@ local leaves_growing = modname .. ":leaves_growing"
|
|||
|
||||
|
||||
local function supports_sapling (name)
|
||||
if name == log_alive or name == root_alive then return true end
|
||||
return minetest.get_item_group(name, "dirty") > 0
|
||||
return blockgame.item_matches(name, {
|
||||
"group:supports_sapling",
|
||||
"group:dirty",
|
||||
})
|
||||
end
|
||||
|
||||
-- this commented-out function will be used when roots start affecting tree growth.
|
||||
|
@ -39,7 +41,7 @@ blockgame.register_increasing_abm({
|
|||
id = modname .. ":grow_sapling",
|
||||
label = "grow sapling",
|
||||
nodenames = {sapling},
|
||||
neighbors = {"group:dirty", log_alive},
|
||||
neighbors = {"group:supports_sapling", "group:dirty"},
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
rate = function (pos, node, data)
|
||||
|
|
|
@ -19,6 +19,7 @@ blockgame.register_node("root_alive", {
|
|||
description = "Growing Root",
|
||||
groups = {
|
||||
woody = 1,
|
||||
supports_sapling = 1,
|
||||
},
|
||||
drop = modname .. ":root",
|
||||
})
|
||||
|
|
|
@ -28,6 +28,7 @@ reg_log("log", {
|
|||
reg_log("log_alive", {
|
||||
groups = {
|
||||
planty = 1,
|
||||
supports_sapling = 1,
|
||||
},
|
||||
texture = "log",
|
||||
drop = modname .. ":log",
|
||||
|
|
Loading…
Reference in a new issue