Skip to content

Commit ef8b7e2

Browse files
committedOct 17, 2015
Default/trees: Add requirement of light level 13 for sapling growth
1 parent c15bd9d commit ef8b7e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

Diff for: ‎mods/default/trees.lua

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ local function can_grow(pos)
1616
if is_soil == 0 then
1717
return false
1818
end
19+
local ll = minetest.get_node_light(pos)
20+
if not ll or ll < 13 then -- Minimum light level for growth
21+
return false -- matches grass, wheat and cotton
22+
end
1923
return true
2024
end
2125

4 commit comments

Comments
 (4)

kilbith commented on Oct 17, 2015

@kilbith
Contributor

Try to choose a clearer variable name like light_level for not requiring a comment aside.

ShadowNinja commented on Oct 18, 2015

@ShadowNinja
Contributor

I'm guessing you tried to align these comments with a tab width of four. Don't do that -- it breaks with every other tab width. Instead put it before. It doesn't even make sense this way because "matches grass ..." isn't a comment about "return false".

paramat commented on Oct 27, 2015

@paramat
ContributorAuthor

Yes, 'll' was only used to match the farming mod.
I agree the comments are sloppy.
I may have to clean this up.

0-afflatus commented on Oct 28, 2015

@0-afflatus

👍 for readable variable names. I'm not keen on inline comments either.

Please sign in to comment.