Open Panquesito7 opened 1 year ago
one of the items on my wish-list is a way for mods to register the dimensions of trees in an abstract way. while this request isn't for such a feature, IMO it's a step in the right direction.
I found the correct values for three saplings back when I was working on it. I might re-work this soon using this method unless there's a better way to do so. IIRC, these should be the correct values. There could be some minor issues, though, but here you go. :)
...
-- this code should be on the `on_place` callback of the sapling registration
if treename == "beech" then
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{x = -3, y = 1, z = -4},
{x = 4, y = 9, z = 3},
-- maximum interval of interior volume check
4)
elseif treename == "apple_tree" then
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{x = -9, y = 1, z = -9},
{x = 9, y = 9, z = 9},
-- maximum interval of interior volume check
4)
elseif treename == "oak" then
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{x = -6, y = 1, z = -6},
{x = 8, y = 16, z = 6},
-- maximum interval of interior volume check
4)
while i think this can be useful, it should be behind a setting (maybe off by default?) since checking the whole area probably will be expensive/some people might not care for it
expensive
if we assume areas mod instead of minetest.is_protected
, the check need not be very expensive. https://github.com/minetest-mods/areas/blob/cba647225ce68bb543b8911063b965a1527b3526/api.lua#L58. i know there's other protection mods out there, but areas is common.
Description
A few years back, I remember that I was working on this feature (when the mod was still available on GitLab), but I didn't fully finish it. It appears the issue is still present. Would be great if this could be worked on (I could help a little bit if wanted).
https://github.com/mt-mods/moretrees/blob/393840ba49880e1ce818fcdb4f3a096ec9100eba/node_defs.lua#L445-L450